| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794 |
- <template>
- <div>
- <layout>
- <layout-header>
- <div class="">
- <!--按钮部分-->
- <el-form ref="elSearchFormRef" inline class="demo-form-inline" @submit.native.prevent>
- <el-form-item>
- <el-input v-model="searchInfo" placeholder="搜索工单编号或产品名称 " clearable style="width: 180px"/>
- <el-button type="primary" icon="search" class="search" @click="handleSearch"/>
- <el-button type="primary"icon="edit"class="bt"@click=" () => { dialogDetail = true; } "><i class="el-icon-edit" />查改</el-button>
- <!--<el-button type="primary" disabled icon="edit" @click="" style="margin-left: 10px">工艺方案复制</el-button>-->
- <el-button type="primary" icon="edit" class="bt" @click=" () => { dialogGdcjstj = true; }">工单超节损统计</el-button>
- <el-button type="primary" icon="edit" class="bt" @click=" () => { dialogKhsz = true}">考核设置</el-button>
- <el-button type="primary" icon="edit" class="bt"@click=" () => { dialogXzgdtl = true; }">修正工单投料</el-button>
- <el-button type="primary" icon="edit" class="bt"@click=" () => { dialogGxclhc = true;}">工序产量核查</el-button>
- <el-button type="primary"icon="edit"class="bt"@click="() => {dialogGdzjfptj = true;}">工单质检废品统计</el-button>
- <el-button type="primary" icon="edit" class="bt"@click="() => {dialogHjfpfb = true;}">核检废品分布</el-button>
- <el-button type="primary" icon="edit" class="bt"@click="handleGddy">工单打印</el-button>
- <el-button type="primary" icon="edit" class="bt" @click="() => { pd_lcdlist = true; pd_lcdProductValue();}">流程单查询</el-button>
- <el-button type="primary" icon="edit" class="bt" @click="exportExcel">导出Excel</el-button>
- <el-button type="primary" icon="edit" class="bt" @click="ygdy">超节损员工打印</el-button>
- </el-form-item>
- </el-form>
- <!-- 弹窗 -->
- <div>
- <!-- 查改 -->
- <Detail v-if="dialogDetail" :is-show="dialogDetail" :gdbh="gdbh"
- :yjno="yjno"
- @destroy="() => {dialogDetail = false;}"/>
- <!-- 工单超节损统计 -->
- <el-dialog v-model="dialogGdcjstj" title="工单超节损统计" destroy-on-close >
- <Gdcjstj :gdbh="gdbh" :yjno ="yjno" />
- </el-dialog>
- <!-- 员工打印 -->
- <el-dialog v-model="dialogygdy" title="员工打印" destroy-on-close style="height: 40%;">
- <el-date-picker
- v-model="ygdy_formData['ygriqi']"
- type="month"
- placeholder="选择年月"
- :default-value="new Date()"
- style="width: 500px"
- />
- <el-button type="primary" icon="edit" class="bt" @click="onclick_ygdy">按员工打印</el-button>
- </el-dialog>
- <!-- 修正工单印件质量考核设置 -->
- <Khsz v-if="dialogKhsz" v-model="dialogKhsz" :gdbh="gdbh" :yjno="yjno" />
- <!-- 修正工单投料 -->
- <Xzgdtl v-if="dialogXzgdtl" v-model="dialogXzgdtl" @update-data = "exitXzgdtl" :gdbh="gdbh" :yjno="yjno"/>
- <!-- 工序产量核查 -->
- <Gxclhc v-if="dialogGxclhc" v-model="dialogGxclhc"
- :gdbh="gdbh" :jjcp_yjno = "jjcp_yjno"
- />
- <!-- 工单质检废品统计 -->
- <Gongdanzhijianfeipintongji
- v-if="dialogGdzjfptj"
- v-model="dialogGdzjfptj"
- :val="gdbh"
- />
- <!-- 核检废品分布 -->
- <Hjfpfb
- v-if="dialogHjfpfb"
- v-model="dialogHjfpfb"
- :val="gdbh"
- :jjcp_yjno="jjcp_yjno"
- />
- <!-- 工单打印 -->
- <PrintPage ref="printPageRef" />
- <!--流程单查询【弹窗】-->
- <el-dialog v-model="pd_lcdlist" title="工单工序生产进程" fullscreen>
- <div style="width: 100%; height: 100%">
- <el-button type="" @click=" () => {pd_lcdlist = false;}">退出</el-button>
- </div>
- <div style=" width: 100%; height: 100%; display: flex; align-items: center;">
- <el-form-item label="工单编号" style="margin-right: 20px; padding: 0">
- <el-input v-model="pd_lcdformData['gdbh']" @keyup.enter="pd_lcdProductValue" placeholder="Enter回车"/>
- </el-form-item>
- <el-form-item label="" style="margin-right: 5px; padding: 0">
- <el-input v-model="pd_lcdformData['code']" disabled/>
- </el-form-item>
- <el-form-item label="" style="margin-right: 5px; padding: 0">
- <el-input v-model="pd_lcdformData['name']" disabled style="width: 500px" />
- </el-form-item>
- </div>
- <div style="width: 100%; height: 70vh; display: flex">
- <layout>
- <layout-sider
- :resize-directions="['right']"
- :width="240"
- style="margin-right: 10px; height: 70vh"
- >
- <div class="JKWTree-tree">
- <el-tree
- :data="pd_lcd_treeData"
- default-expand-all
- @node-click="pd_lcd_handleNodeClick"
- />
- </div>
- </layout-sider>
- <layout-main>
- <!-- 这里放右侧的内容 -->
- <el-space wrap>
- <!-- 右侧内容 -->
- <template v-for="item in processList.total_process">
- <el-button
- disabled
- :type="
- !processList.process.includes(item)
- ? 'danger'
- : 'info'
- "
- plain
- style="width: 50px"
- >{{ item }}</el-button>
- </template>
- </el-space>
- </layout-main>
- </layout>
- </div>
- </el-dialog>
- </div>
- </div>
- </layout-header>
- <layout>
- <!-- 左侧树侧形结构-->
- <layout-sider
- :resize-directions="['right']"
- :width="190"
- style="margin-right: 10px"
- >
- <div class="JKWTree-tree" style="height: 70vh" >
- <h3>工单超节损核算</h3>
- <el-tree :data="treeData" highlight-current @node-click="handleNodeClick"/>
- </div>
- </layout-sider>
- <!-- 右侧内容区域 -->
- <layout-content>
- <!-- 上方列表 -->
- <div class="gva-table-box">
- <el-table
- style="width: 100%; height: 30vh"
- :data="tableData1"
- row-key="ID"
- highlight-current-row
- border
- :row-class-name="rowClassName"
- :cell-class-name="cellClassName"
- :row-style="{ height: '20px' }"
- :cell-style="{ padding: '0px' }"
- :header-row-style="{ height: '20px' }"
- :header-cell-style="{ padding: '0px' }"
- @row-click="showOrderSuperLossGy"
- @current-change="
- (row, oldRow) => {
- currentRow = row;
- }
- "
- >
- <el-table-column
- type="selection"
- width="55"
- />
- <!-- 使用 v-for 循环渲染每一列 -->
- <el-table-column
- v-for="column in tableCols1"
- :key="column.prop"
- :prop="column.prop"
- :label="column.label"
- :width="column.width"
- :align='column.left'
- :fixed='column.fixed'
- :sortable="column.sortable"
- show-overflow-tooltip="true"
- sortable
- />
- </el-table>
- </div>
- <!-- 下方表格 -->
- <el-table
- style="width: 100%; height: 40vh"
- row-key="ID"
- highlight-current-row
- border
- :data="tableData2"
- :row-style="{ height: '20px' }"
- :cell-style="{ padding: '0px' }"
- :header-row-style="{ height: '20px' }"
- :header-cell-style="{ padding: '0px' }"
- >
- <el-table-column
- type="selection"
- width="55"
- />
- <!-- 使用 v-for 循环渲染每一列 -->
- <el-table-column
- v-for="column in tableCols2"
- :key="column.prop"
- :prop="column.prop"
- :label="column.label"
- :width="column.width"
- show-overflow-tooltip="true"
- sortable
- />
- </el-table>
- </layout-content>
- </layout>
- </layout>
- </div>
- </template>
- <script>
- import service from '@/utils/request'
- import { writeXLSX } from 'xlsx'
- // 5.1流程单查询-工单工序生产进程菜单栏
- export const getOrderProcessLeft = (params) => {
- return service({
- url: '/mes_server/work_order_verification/getOrderProcessLeft',
- method: 'get',
- params,
- })
- }
- // 5.2流程单查询-获取工单工序生产进程右侧
- export const getOrderProcessRight = (params) => {
- return service({
- url: '/mes_server/work_order_verification/getOrderProcessRight',
- method: 'get',
- params,
- })
- }
- </script>
- <script setup>
- import {
- Layout,
- LayoutContent,
- LayoutHeader,
- LayoutSider,
- } from '@arco-design/web-vue'
- import { ref, watch } from 'vue'
- import {
- getOrderSuperLossGy,
- getSide,
- EmployeeDataCollect,
- getTable,
- } from '@/api/mes_api_gty/orderAccounting'
- import Khsz from '@/view/performance/12-orderAccounting/componets/khsz.vue'
- import {hiprint} from "vue-plugin-hiprint";
- import Gdcjstj from '@/view/performance/12-orderAccounting/componets/gdcjstj.vue'
- import Xzgdtl from '@/view/performance/12-orderAccounting/componets/xzgdtl.vue'
- import Gxclhc from '@/view/performance/12-orderAccounting/componets/gxclhc.vue'
- import Gongdanzhijianfeipintongji from '@/view/performance/09-workOrderVerification/componets/gongdanzhijianfeipintongji.vue'
- import Detail from '@/view/performance/12-orderAccounting/componets/detail.vue'
- import Hjfpfb from './componets/hjfpfb.vue'
- import PrintPage from '@/view/yunyin/shengchanguanli/components/print.vue'
- import { reactive } from 'vue'
- import { exportExcelFile } from '@/utils/excel'
- import { useUserStore } from '@/pinia/modules/user'
- const userStore = useUserStore()
- const sys_id =
- '[' + userStore.userInfo.userName + '/' + userStore.userInfo.nickName + ']'
- // 弹窗
- const dialogGdcjstj = ref(false)
- const dialogDetail = ref(false)
- const dialogKhsz = ref(false)
- const dialogXzgdtl = ref(false)
- const dialogGxclhc = ref(false)
- const dialogGdzjfptj = ref(false)
- const dialogHjfpfb = ref(false)
- // 侧边栏数据
- const treeData = ref([])
- const getSideData = async() => {
- const res = await getSide()
- if (res.code === 0) {
- const { data } = res
- const transformedData = []
- for (const [key, value] of Object.entries(data)) {
- const [date, total] = key.split('-') // 提取日期和数量
- const transformedItem = {
- label: `${date}(工单数:${total})`,
- date: date,
- children: value.map((item) => ({
- label: `${item['客户编号']}【${item['客户名称']}】(工单数:${item.total})`,
- date: date,
- code: item?.['客户编号'],
- })),
- }
- transformedData.push(transformedItem)
- }
- treeData.value = transformedData
- }
- }
- getSideData()
- // 表格数据
- const tableCols1 = [
- // { label: '超损工单', prop: 'csgd', width: '110' ,sortable:'sortable'},
- { label: '工单编号', prop: 'Gd_gdbh', width: '110',sortable:'sortable',fixed:'fixed',align:'left'},
- { label: '印件号', prop: 'jjcp_yjno', width: '95' ,sortable:'sortable'},
- { label: '联数', prop: 'yj_ls', width: '80' ,sortable:'sortable'},
- { label: '产品代号', prop: '成品编码', width: '120' ,sortable:'sortable'},
- { label: '产品名称', prop: '成品名称', width: '250' ,sortable:'sortable'},
- { label: '实际投料', prop: '实际投料', width: '115' ,sortable:'sortable'},
- { label: '计量单位', prop: '计量单位', width: '115' ,sortable:'sortable'},
- { label: '入仓日期', prop: 'warehousing_date', width: '110' ,sortable:'sortable'},
- { label: '入仓数量', prop: 'warehousing_num', width: '110' ,sortable:'sortable'},
- { label: '目标合格率', prop: 'target_rate', width: '120' ,sortable:'sortable'},
- { label: '实际合格率', prop: 'real_rate', width: '120' ,sortable:'sortable'},
- { label: '奖惩系数', prop: 'reward_rate', width: '110' ,sortable:'sortable'},
- { label: '奖罚金额合计', prop: 'reward_money', width: '140',sortable:'sortable' },
- { label: '废品合计', prop: '废品合计', width: '120' ,sortable:'sortable'},
- { label: '工单无形损', prop: '工单无形损', width: '120',sortable:'sortable' },
- { label: '材料废', prop: '材料废', width: '120' ,sortable:'sortable'},
- { label: '零头处理', prop: '零头处理', width: '120',sortable:'sortable' },
- { label: '处发废', prop: '外发废', width: '120',sortable:'sortable' },
- { label: '外摊废', prop: '分摊废', width: '120' ,sortable:'sortable'},
- { label: '工单计划损耗', prop: '工单计划损耗', width: '140',sortable:'sortable' },
- { label: '工单制程废', prop: 'zcfp', width: '120',sortable:'sortable' },
- { label: '工单检验废', prop: '工单质检废', width: '120',sortable:'sortable' },
- { label: '年月', prop: 'date', width: '120' ,sortable:'sortable'},
- ]
- const tableCols2 = [
- { label: '工单编号', prop: 'Gy0_gdbh', width: '120' },
- { label: '印件及工序', prop: 'Gy0_yjno', width: '120' },
- { label: '工序名称', prop: 'Gy0_gxmc', width: '200' },
- { label: '联数', prop: 'Gy0_ls', width: '80' },
- { label: '基础损耗', prop: 'Gy0_Rate0', width: '120' },
- { label: '损耗率', prop: 'Gy0_Rate1', width: '120' },
- { label: '损耗系数', prop: '损耗系数', width: '120' },
- { label: '计损色数', prop: 'Gy0_ms', width: '120' },
- { label: '计划产量', prop: 'Gy0_计划接货数', width: '120' },
- { label: '计划损耗', prop: 'Gy0_计划损耗', width: '120' },
- { label: '上报产量', prop: 'total_cl', width: '120' },
- { label: '制程废', prop: 'total_fp', width: '120' },
- ]
- const tableData1 = ref([])
- const tableData2 = ref([])
- const currentRow = ref({})
- const gdbh = ref('')
- const jjcp_yjno = ref('')
- const date = ref('')
- const yjno = ref ('')
- const searchInfo = ref('')
- watch(currentRow, (value, oldValue, onCleanup) => {
- gdbh.value = value?.['Gd_gdbh']
- date.value = value?.['date']
- yjno.value = value?.['yj_Yjno']
- jjcp_yjno.value = value?.['jjcp_yjno']
- pd_lcdformData['gdbh'] = value?.['Gd_gdbh']
- })
- const cjsriqi = ref ('')
- // 显示上方表格
- const handleNodeClick = async(node) => {
- // console.log(node.date)
- cjsriqi.value = node.date
- console.log(cjsriqi.value)
- if (!node.children) {
- const { date, code } = node
- const res = await getTable({ date, code, limit: 9999, page: 1 })
- tableData1.value = res.data.data.map((item) => ({
- ...item,
- csgd:
- parseFloat(item['target_rate']) - parseFloat(item['real_rate']) > 0
- ? '√'
- : '',
- date: date,
- }))
- // console.log(tableData1.value )
- } else {
- // console.log(node.date, node.code)
- }
- }
- // 显示下方表格
- const showOrderSuperLossGy = async() => {
- jjcp_yjno.value = currentRow.value['jjcp_yjno']
- const { Gd_gdbh: order } = currentRow.value
- const yjno = jjcp_yjno.value
- console.log(yjno)
- const res = await getOrderSuperLossGy({ order,yjno })
- if (res.code === 0) {
- const { data } = res
- tableData2.value = data.map((item) => ({
- ...item,
- Gy0_yjno: `${item.Gy0_yjno}-${item.Gy0_gxh}`,
- Gy0_gxmc:
- item.Add_gxmc === ''
- ? item.Gy0_gxmc
- : `${item.Gy0_gxmc}〖${item.Add_gxmc}〗`,
- }))
- }
- }
- // 定位
- const handleSearch = async() => {
- console.log(searchInfo.value)
- //调用搜索接口
- const res = await getTable({ search:searchInfo.value,limit:999,page:1})
- console.log(res)
- tableData1.value = res.data.data.map((item) => ({
- ...item,
- csgd:
- parseFloat(item['target_rate']) - parseFloat(item['real_rate']) > 0
- ? '√'
- : '',
- date: date,
- }))
- // if (searchInfo.value) {
- // tableData1.value = tableData1.value.filter((item) => {
- // return item['Gd_gdbh'] === searchInfo.value ?? item
- // })
- // }
- }
- /* const rowClassName = ({ row, rowIndex }) => {
- if (row['csgd'] === '√') {
- return 'yellow-row'
- }
- return ''
- }*/
- function cellClassName({ row, column, rowIndex, columnIndex }) {
- if ([7, 11, 13, 21].includes(columnIndex)) {
- return 'red-cell'
- }
- return ''
- }
- const printPageRef = ref()
- function handleGddy() {
- printPageRef.value.open(gdbh.value)
- }
- const pd_lcdlist = ref(false)
- const processList = ref([])
- const pd_lcdformData = reactive({})
- const pd_lcdProductValue = async() => {
- _getOrderProcessLeft_list()
- }
- const pd_lcd_treeData = ref([])
- const _getOrderProcessLeft_list = async() => {
- const order = pd_lcdformData['gdbh']
- console.log(order)
- try {
- // 5.1流程单查询-工单工序生产进程菜单栏
- const getOrderProcessLeft_list = await getOrderProcessLeft({
- order: order,
- })
- console.log(getOrderProcessLeft_list)
- pd_lcdformData['code'] = getOrderProcessLeft_list.data.Gd_info['code']
- pd_lcdformData['name'] = getOrderProcessLeft_list.data.Gd_info['name']
- pd_lcd_treeData.value = [
- {
- label: order + '-' + getOrderProcessLeft_list.data.Gd_info['name'],
- // label: order + '-' + getOrderProcessLeft_list.data.Gd_info['code'] + '-' + getOrderProcessLeft_list.data.Gd_info['name'],
- value: undefined,
- children: [],
- },
- ]
- const newData = []
- for (const key in getOrderProcessLeft_list.data.Gy_info) {
- const temp = getOrderProcessLeft_list.data.Gy_info[key]
- const concatenatedValue = `${temp.Gy0_yjno}-${temp.Gy0_gxh} ---> ${temp.Gy0_gxmc}`
- newData.push({ label: concatenatedValue, value: temp.Gy0_gxh })
- }
- pd_lcd_treeData.value[0].children = newData
- // 5.2流程单查询-获取工单工序生产进程右侧【进入页面默认显示第一个】
- const getOrderProcessRight_list = await getOrderProcessRight({
- order: order,
- gxNo: newData[0].value,
- })
- processList.value = getOrderProcessRight_list.data
- } catch (error) {
- console.error(error)
- }
- }
- const pd_lcd_handleNodeClick = async(node) => {
- if (node.value === undefined) return
- const order = pd_lcdformData['gdbh']
- // //5.2流程单查询-获取工单工序生产进程右侧
- const getOrderProcessRight_list = await getOrderProcessRight({
- order: order,
- gxNo: node.value,
- })
- console.log(getOrderProcessRight_list)
- processList.value = getOrderProcessRight_list.data
- }
- // 导出excel
- const exportExcel = () => {
- const labels = tableCols1.map((item) => item.label)
- const props = tableCols1.map((item) => item.prop)
- const data = tableData1.value.map((item) => {
- const row = {}
- props.forEach((prop, index) => {
- row[labels[index]] = item?.[prop]
- })
- return row
- })
- if (data[0]?.[labels[0]] === undefined) {
- return
- }
- exportExcelFile(data)
- }
- // 员工打印
- // false是弹窗默认关闭
- const dialogygdy = ref(false)
- const ygdy_formData = reactive({
- ygriqi : '',
- })
- // 点击 超节损员工打印打开弹窗
- const ygdy = () => {
- dialogygdy.value = true
- }
- // json
- const jsondatas = {"panels":[{"index":0,"name":1,"paperType":"A4","height":210,"width":297,"paperHeader":76.5,"paperFooter":837,"printElements":[{"options":{"left":12,"top":9,"height":40,"width":40,"src":"https://shangbiaopic.11467.com/13/85/13855845.jpg","fit":"","coordinateSync":false,"widthHeightSync":false,"right":55,"bottom":45.989585876464844,"vCenter":35,"hCenter":25.989585876464844,"field":"minong"},"printElementType":{"title":"图片","type":"image"}},{"options":{"left":57,"top":15,"height":14,"width":180,"title":"浙江翌星包装科技有限公司","coordinateSync":false,"widthHeightSync":false,"fontSize":13.5,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":319.5,"top":15,"height":30,"width":168,"title":"员工超结损奖罚统计","right":393,"bottom":36,"vCenter":333,"hCenter":31.125,"coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"fontSize":16.5,"fontWeight":"bold","textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":46.5,"top":54,"height":16,"width":90,"title":"文本","field":"riqi","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":203.2474136352539,"bottom":92.23958587646484,"vCenter":154.4974136352539,"hCenter":71.98958587646484,"hideTitle":true},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":510,"top":52.5,"height":16,"width":48,"title":"打印时间","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":556.5,"top":52.5,"height":16,"width":141,"field":"dysj","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":15,"top":54,"height":16,"width":31.5,"title":"日期","right":90.74478149414062,"bottom":93.0000228881836,"vCenter":48.744781494140625,"hCenter":71.2500228881836,"coordinateSync":false,"widthHeightSync":false,"fontSize":12,"qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":19.5,"top":85.5,"height":61.5,"width":735,"field":"table","groupFieldsFormatter":"function(type,options,data){ return [\"name\"] }","qid":"table_1","right":755.2421951293945,"bottom":147.74480438232422,"vCenter":387.74219512939453,"hCenter":116.99480438232422,"coordinateSync":false,"widthHeightSync":false,"maxRows":25,"tableHeaderBorder":"border","columns":[[{"width":107.22811671087534,"title":"所在部门","field":"szbm","checked":true,"columnId":"szbm","fixed":false,"rowspan":1,"colspan":1},{"width":128.67374005305038,"title":"班组","field":"banzu","checked":true,"columnId":"banzu","fixed":false,"rowspan":1,"colspan":1,"align":"left"},{"width":128.67374005305038,"title":"员工编号","field":"ygbh","checked":true,"columnId":"ygbh","fixed":false,"rowspan":1,"colspan":1},{"width":128.67374005305038,"title":"员工姓名","field":"ygxm","checked":true,"columnId":"ygxm","fixed":false,"rowspan":1,"colspan":1},{"width":128.67374005305038,"title":"超节损金额","field":"cjsje","checked":true,"columnId":"cjsje","fixed":false,"rowspan":1,"colspan":1},{"width":113.07692307692307,"title":"备注说明","field":"beizhu","checked":true,"columnId":"beizhu","fixed":false,"rowspan":1,"colspan":1}]]},"printElementType":{"title":"表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}}],"paperNumberLeft":822,"paperNumberTop":501,"paperNumberDisabled":true,"paperNumberContinue":true,"rotate":true,"orient":2,"watermarkOptions":{},"panelLayoutOptions":{}}]}
- const onclick_ygdy = async () => {
- // 获取用户选择的日期
- const selectedDate = new Date(ygdy_formData['ygriqi']);
- // 手动增加一个月
- selectedDate.setMonth(selectedDate.getMonth() + 1);
- // 格式化为 YYYY-MM
- const formattedDate = selectedDate.toISOString().slice(0, 7);
- // 引入打印初始化
- hiprint.init();
- const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondatas });
- // 获取数据
- // console.log(formattedDate);
- const res = await EmployeeDataCollect({ date: formattedDate });
- console.log(res)
- console.log(121212)
- const { data } = res;
-
- // if (res.data.印刷车间.A班.length === 0) {
- // console.log("A班数据为空");
- // } else {
- // console.log("A班数据不为空");
- // }
- // return false;
- // 将数据转换为目标格式
- const dataSource = { 'table': [] };
- // 处理“印刷车间”A班的数据
- let isFirstA班 = true;
- for (const [key, value] of Object.entries(data['印刷车间']['A班'])) {
- const [ygbh, ygxm] = key.split('(');
- dataSource.table.push({
- 'szbm': isFirstA班 ? '印刷车间' : '',
- 'banzu': isFirstA班 ? 'A班' : '',
- 'ygbh': ygbh,
- 'ygxm': ygxm.replace(')', ''),
- 'cjsje': value
- });
- isFirstA班 = false;
- }
- // 添加“印刷车间”A班的合计行
- dataSource.table.push({
- 'szbm': '',
- 'banzu': '车间班组合计',
- 'ygbh': '',
- 'ygxm': '',
- 'cjsje': data['yinshuaA']
- });
- // 处理“印刷车间”B班的数据
- let isFirstB班 = true;
- for (const [key, value] of Object.entries(data['印刷车间']['B班'])) {
- const [ygbh, ygxm] = key.split('(');
- dataSource.table.push({
- 'szbm': isFirstB班 ? '印刷车间' : '',
- 'banzu': isFirstB班 ? 'B班' : '',
- 'ygbh': ygbh,
- 'ygxm': ygxm.replace(')', ''),
- 'cjsje': value
- });
- isFirstB班 = false;
- }
- // 添加“印刷车间”B班的合计行
- dataSource.table.push({
- 'szbm': '',
- 'banzu': '车间班组合计',
- 'ygbh': '',
- 'ygxm': '',
- 'cjsje': data['yinshuaB']
- });
- // 处理“印后车间”A班的数据
- let isFirst印后A班 = true;
- for (const [key, value] of Object.entries(data['印后车间']['A班'])) {
- const [ygbh, ygxm] = key.split('(');
- dataSource.table.push({
- 'szbm': isFirst印后A班 ? '印后车间' : '',
- 'banzu': isFirst印后A班 ? 'A班' : '',
- 'ygbh': ygbh,
- 'ygxm': ygxm.replace(')', ''),
- 'cjsje': value
- });
- isFirst印后A班 = false;
- }
- // 添加“印后车间”A班的合计行
- dataSource.table.push({
- 'szbm': '',
- 'banzu': '车间班组合计',
- 'ygbh': '',
- 'ygxm': '',
- 'cjsje': data['yinhouA']
- });
- // 处理“印后车间”B班的数据
- let isFirst印后B班 = true;
- for (const [key, value] of Object.entries(data['印后车间']['B班'])) {
- const [ygbh, ygxm] = key.split('(');
- dataSource.table.push({
- 'szbm': isFirst印后B班 ? '印后车间' : '',
- 'banzu': isFirst印后B班 ? 'B班' : '',
- 'ygbh': ygbh,
- 'ygxm': ygxm.replace(')', ''),
- 'cjsje': value
- });
- isFirst印后B班 = false;
- }
- // 添加“印后车间”B班的合计行
- dataSource.table.push({
- 'szbm': '',
- 'banzu': '车间班组合计',
- 'ygbh': '',
- 'ygxm': '',
- 'cjsje': data['yinhouB']
- });
- // 获取当前日期
- const today = new Date();
- const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
- const day = String(today.getDate()).padStart(2, '0');
- const hours = String(today.getHours()).padStart(2, '0');
- const minutes = String(today.getMinutes()).padStart(2, '0');
- const seconds = String(today.getSeconds()).padStart(2, '0');
- const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
- // 初始化数据结构
- const tableDataFormatted = {
- "minong": "/src/assets/logotx.png",
- "dysj": currentDate,
- "riqi": data['日期'],
- "table": dataSource['table'],
- "cjbzhj": data['total'] // 将total作为车间班组合计
- };
- // 输出结果,确保数据格式正确
- console.log(tableDataFormatted);
- // 打印结果
- hiprintTemplate.print(tableDataFormatted);
- }
- //关闭窗口
- const exitXzgdtl = (data) => {
- dialogXzgdtl.value = data;
- };
- </script>
- <style scoped>
- :deep(.plan-usage-low div) {
- color: red !important;
- }
- .JKWTree-container {
- display: flex;
- }
- .JKWTree-tree {
- width: 100%;
- background-color: #fff;
- /*background-color: rgba(241, 224, 224, 0.99);*/
- padding: 10px;
- margin-right: 20px;
- }
- .JKWTree-tree h3 {
- font-size: 15px;
- font-weight: 700;
- margin: 10px 0;
- }
- .JKWTree-content {
- flex: 1;
- }
- :deep(.el-table .yellow-row) {
- background: #ffff80;
- }
- :deep(.red-cell div) {
- color: #ff0000 !important;
- }
- /* 选中某行时的背景色 */
- :deep(.el-table__body tr.current-row) > td {
- background: #ff80ff !important;
- }
- </style>
- <style scoped>
- :deep(.el-table td .cell) {
- line-height: 20px !important;
- }
- :deep(.el-tabs__header) {
- margin-bottom: 0;
- }
- .search {
- margin-left: 0px !important;
- margin-right: 10px !important;
- }
- .bt {
- margin-left: 2px !important;
- padding: 3px !important;
- font-size: 12px;
- }
- .el-tabs__header {
- margin: 0px !important;
- }
- .gva-table-box {
- padding: 0px !important;
- }
- .mab {
- margin-bottom: 5px;
- }
- </style>
|