| | |
| | | const user=userInfo() |
| | | //定义表头数据 |
| | | const titleUploadData = ref({ |
| | | //是否合片工序 |
| | | laminating:'', |
| | | reportingWorkId: null, |
| | | //流程卡号 |
| | | processId: null, |
| | |
| | | |
| | | |
| | | let inputDisabled = ref(false) |
| | | onMounted(() =>{ |
| | | onMounted(async () =>{ |
| | | await initTiltle() |
| | | if(route.query.processId !== undefined && route.query.processId!=='' && route.query.processId!=null ){ |
| | | titleUploadData.value.processId = route.query.processId |
| | | //当质检审核后加载明细信息 |
| | | if(route.query.reviewStatus === '1'){ |
| | | if(titleUploadData.value.thisProcess !== undefined |
| | | && titleUploadData.value.thisProcess!=='' |
| | | && titleUploadData.value.thisProcess!=null){ |
| | | getWork() |
| | | getQuantity() |
| | | } |
| | | } |
| | | } |
| | | //route.query.reportingWorkId = 'BG2403150004' |
| | | //判断是否传入报工编号 |
| | |
| | | button.name=t('basicData.review') |
| | | titleUploadData.value.qualityInspector=user.user.userName |
| | | } |
| | | |
| | | |
| | | gridOptions.toolbarConfig.buttons.push(button) |
| | | } |
| | | // getQuantity() |
| | |
| | | }, |
| | | {field: 'completed', width: 90, title:t('reportingWorks.completed'),}, |
| | | {field: 'onceBroken', width: 90, title: t('reportingWorks.onceBroken'),}, |
| | | { |
| | | field: 'reviewed_state', |
| | | title: t('processCard.reviewedState'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | |
| | | ], |
| | | //表单验证 |
| | |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'saveReportingWork': { |
| | | case 'saveReportingWork': {//保存 |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | |
| | | saveReportingWork(1,'save') |
| | | break |
| | | } |
| | | case 'update': { |
| | | case 'update': {//修改 |
| | | //根据补片状态判断是否能修改 |
| | | // request.post(`/reportingWork/getPatchCondition/${route.query.reportingWorkId}`).then(async (res) => { |
| | | // if (res.code == 200) { |
| | |
| | | } |
| | | } |
| | | }, |
| | | menuClick({menu, row, column}) { |
| | | menuClick({menu, row, column}) {//右键菜单 |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | |
| | | }) |
| | | const maxQuantity = Math.max(...equalByOrderNum.map(item =>item.breakageQuantity || 0)) |
| | | let process = titleUploadData.value.thisProcess |
| | | let laminating = titleUploadData.value.laminating |
| | | equalByOrderNum.forEach((row) =>{ |
| | | if (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框'){ |
| | | if (laminating == 'laminating'){ |
| | | row.completedQuantity= brokenRow.value.quantity*1-maxQuantity |
| | | } |
| | | |
| | | }) |
| | | |
| | | |
| | |
| | | |
| | | //第一次加载数据 |
| | | let groupChangeProcess = ref(false)//用于本班组显示问题 |
| | | request.post(`/reportingWork/selectProcess/${user.user.userId}`).then((res) => { |
| | | if (res.code == 200) { |
| | | titleSelectJson.value.processType = res.data.process |
| | | if(user.user.address!==null && user.user.address!==''){ |
| | | titleUploadData.value.thisProcess = user.user.address |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | groupChangeProcess.value = true |
| | | if (user.user.address==='技术部多曲' || user.user.address==='夹胶'){ |
| | | groupChangeProcess.value = false |
| | | const initTiltle = async () => { |
| | | await request.post(`/reportingWork/selectProcess/${user.user.userId}`).then((res) => { |
| | | if (res.code == 200) { |
| | | titleSelectJson.value.processType = res.data.process |
| | | if(user.user.address!==null && user.user.address!==''){ |
| | | titleUploadData.value.thisProcess = user.user.address |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | groupChangeProcess.value = true |
| | | if (user.user.address==='技术部多曲' || user.user.address==='夹胶'){ |
| | | groupChangeProcess.value = false |
| | | } |
| | | gridOptions.toolbarConfig.buttons[1].visible=false |
| | | } |
| | | gridOptions.toolbarConfig.buttons[1].visible=false |
| | | } |
| | | |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | function checkSameNumForId(data, targetId) { |
| | | // 初始化一个对象来存储遇到的id及其对应的num值 |
| | |
| | | return item.saveFlag === 0 |
| | | }) |
| | | let process = titleUploadData.value.thisProcess |
| | | //暂时取消 |
| | | for(let item of uniqueByOrderNum){ |
| | | if(!checkSameNumForId(notFinishList,item.order_number ) && (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框')){ |
| | | ElMessage.error(`${t('reportingWorks.pleaseCheckTheOrderNumber1')}':' |
| | |
| | | reviewState = 'review' |
| | | } |
| | | request.post(`/reportingWork/updateReportingWork/${reviewState}`,requestData).then(res =>{ |
| | | if (res.code == 200){ |
| | | if (res.code == 200 && res.data===true){ |
| | | ElMessage.success(t('reportingWorks.successfulModificationOfWorkApplication')) |
| | | router.push({path:'/main/reportingWorks/AddReportingWork', |
| | | query:{ |
| | | processId:titleUploadData.value.processId, |
| | | random:Math.random()} |
| | | }) |
| | | } else { |
| | | ElMessage.warning(t('reportingWorks.changeFailed')) |
| | | } |
| | | }) |
| | | } |
| | |
| | | router.push({path:'/main/reportingWorks/AddReportingWork', |
| | | query:{ |
| | | processId:titleUploadData.value.processId, |
| | | reviewStatus:1, |
| | | random:Math.random() |
| | | } |
| | | }) |
| | |
| | | titleUploadData.value = res.data.data |
| | | titleUploadData.value.processId = processId |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | titleUploadData.value.laminating = res.data.laminating |
| | | //设备下拉框 |
| | | titleSelectJson.value.deviceType = res.data.device |
| | | //班组下拉框 |
| | |
| | | |
| | | //绑定下方表格 |
| | | detail.value = res.data.Detail |
| | | xGrid.value.reloadData(detail.value) |
| | | // 使用map方法来处理每个对象 |
| | | let modifiedCollection = detail.value.map(item => { |
| | | if (item.reviewed_state === 1) { |
| | | return { ...item, reviewed_state: "已审核" }; |
| | | } |
| | | else if (item.reviewed_state === 0) { |
| | | return { ...item, reviewed_state: "未审核" }; |
| | | } |
| | | else { |
| | | // 其他情况保持不变 |
| | | return item; |
| | | } |
| | | }); |
| | | xGrid.value.reloadData(modifiedCollection) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | |
| | | |
| | | const editClosedEvent = ({ row, column }) => { |
| | | let process = titleUploadData.value.thisProcess |
| | | let laminating = titleUploadData.value.laminating |
| | | if (column.property==='completedQuantity') { |
| | | xGrid.value.getTableData().fullData.forEach((item, index) =>{ |
| | | if(item.order_number===row.order_number && (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框')){ |
| | | if(item.order_number===row.order_number && laminating == 'laminating'){ |
| | | item.completedQuantity=row.completedQuantity |
| | | } |
| | | }) |
| | |
| | | const getQuantity = () => { |
| | | titleUploadData.value.thisCompletedQuantity = 0 |
| | | titleUploadData.value.thisWornQuantity = 0 |
| | | let laminating = titleUploadData.value.laminating |
| | | const arr = xGrid.value.getTableData().fullData |
| | | const returnArr = arr.filter((obj, index, self) => |
| | | self.findIndex((t) => t.order_number === obj.order_number) === index |
| | | ) |
| | | |
| | | |
| | | //根据是否合片工序过滤 |
| | | const returnArr = |
| | | laminating === "laminating" |
| | | ? arr.filter((obj, index, self) => |
| | | self.findIndex((t) => t.order_number === obj.order_number) === index |
| | | ) |
| | | : arr; |
| | | let sumBreak = 0 |
| | | let sumQuantity = 0 |
| | | returnArr.forEach((item)=>{ |