| | |
| | | import request from "@/utils/request"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {changeFilterEvent, filterChanged} from "@/hook" |
| | | import domZIndex from 'dom-zindex' |
| | | import {indexOf} from "xe-utils"; |
| | | import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | import userInfo from "@/stores/userInfo" |
| | | import { useI18n } from 'vue-i18n' |
| | | import footSum from "@/hook/footSum" |
| | | import companyInfo from "@/stores/sd/companyInfo" |
| | | domZIndex.setCurrent(3000) |
| | | const company = companyInfo() |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | | let brokenVisible = ref(false) |
| | |
| | | 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' |
| | | //判断是否传入报工编号 |
| | |
| | | titleUploadData.value = res.data.reportingWork |
| | | titleSelectJson.value = res.data.basic |
| | | layer= res.data.layer |
| | | |
| | | //添加补片状态列 |
| | | let column = {field: 'patchStatusOther', width: 90,title: t('reportingWorks.patchCondition')} |
| | | gridOptions.columns.push(column) |
| | | |
| | | const s01Values = []; |
| | | for (let i = 0; i < res.data.reportingWorkDetails.length; i++) { |
| | |
| | | button.name=t('basicData.review') |
| | | titleUploadData.value.qualityInspector=user.user.userName |
| | | } |
| | | |
| | | |
| | | gridOptions.toolbarConfig.buttons.push(button) |
| | | } |
| | | // getQuantity() |
| | |
| | | }) |
| | | |
| | | const data = [{id:1,num:2},{id:1,num:3},{id:2,num:2},{id:1,num:2}]; |
| | | |
| | | |
| | | //表尾求和 |
| | | const sumNum = (list, field) => { |
| | |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | { |
| | | code: 'SecondaryBreakage', |
| | | name: "序号次破相同", |
| | | prefixIcon: 'vxe-icon-indicator', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | { |
| | | code: 'checkedBreakage', |
| | | name: "选中次破相同", |
| | | prefixIcon: 'vxe-icon-indicator', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | ] |
| | | ] |
| | | } |
| | |
| | | }, |
| | | {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 |
| | | }, |
| | | |
| | | ], |
| | | //表单验证 |
| | |
| | | return new Error(t('reportingWorks.enterIntegerGreaterThanEqualTo')) |
| | | }else if((row.completedQuantity*1+brokenNum*1)>row.quantity*1){ |
| | | return new Error((`${row.completedQuantity}+${brokenNum}>${row.quantity}`)) |
| | | }else if(row.quantity_card<row.completedQuantity){ |
| | | return new Error(t('reportingWorks.pleaseNumber10')) |
| | | } |
| | | if(titleUploadData.value.reportingWorkId!=null && row.completedQuantity<row.minQuantity){ |
| | | const completedNum = |
| | | (row.completedQuantity === undefined || row.completedQuantity===null || row.completedQuantity==='') ? 0 : row.completedQuantity |
| | | if(titleUploadData.value.reportingWorkId!=null && completedNum>row.minQuantity){ |
| | | return new Error(`${t('reportingWorks.pleaseGreaterThanOrEqual1')} |
| | | ${row.minQuantity} |
| | | ${t('reportingWorks.pleaseGreaterThanOrEqual2')}`) |
| | |
| | | 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) { |
| | | console.log(res.data) |
| | | if (res.data > 0) { |
| | | ElMessage.error("该报工包含已补片数据,不可修改!") |
| | | return |
| | | } else { |
| | | // request.post(`/reportingWork/getPatchCondition/${route.query.reportingWorkId}`).then(async (res) => { |
| | | // if (res.code == 200) { |
| | | // if (res.data > 0) { |
| | | // ElMessage.error("该报工包含已补片数据,不可修改!") |
| | | // return |
| | | // } else { |
| | | getQuantity() |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | |
| | | return |
| | | } |
| | | saveReportingWork(0, 'update') |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | // } |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // }) |
| | | |
| | | break |
| | | } |
| | |
| | | const { rows, column, cell } = params; // 解构获取行、列和单元格信息 |
| | | //点击次破数量时打开明细界面 |
| | | if(column.field=="breakageQuantity"){ |
| | | brokenVisible.value = true |
| | | if (row.patchStatusOther!="已补片"){ |
| | | brokenVisible.value = true |
| | | } |
| | | } |
| | | }, |
| | | menuClick({menu, row, column}) { |
| | | menuClick({menu, row, column}) {//右键菜单 |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | |
| | | dataList.forEach((item, index) => { |
| | | if (index >= result.start && index <= result.end) { |
| | | item[result.cell] = '' |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | case 'SecondaryBreakage' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "breakageQuantity" || result.cell === "completedQuantity"){ |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const seenOrders = {} |
| | | dataList.forEach((item, index) => { |
| | | const list = item.damageDetails |
| | | if (list!== null || list.length > 0){ |
| | | const { order_number, damageDetails, breakageQuantity } = item; |
| | | // 如果 order_number 还没有处理过 |
| | | if (!seenOrders[order_number]) { |
| | | // 记录第一个出现的 damageDetails 和 breakageQuantity |
| | | seenOrders[order_number] = { |
| | | damageDetails, |
| | | breakageQuantity |
| | | }; |
| | | } else { |
| | | // 将后续的 damageDetails 和 breakageQuantity 更新为第一个的 |
| | | item.damageDetails = seenOrders[order_number].damageDetails; |
| | | item.breakageQuantity = seenOrders[order_number].breakageQuantity; |
| | | } |
| | | } |
| | | |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | case 'checkedBreakage' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "breakageQuantity" || result.cell === "completedQuantity"){ |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start].damageDetails |
| | | const quantity = dataList[result.start].breakageQuantity |
| | | dataList.forEach((item, index) => { |
| | | if (index >= result.start && index <= result.end) { |
| | | item.damageDetails = val |
| | | item.breakageQuantity = quantity |
| | | if (index!=result.start){ |
| | | item.completedQuantity = item.completedQuantity - quantity |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |
| | |
| | | }, |
| | | { |
| | | field: 'responsiblePersonnel', |
| | | title: t('reportingWorks.responsiblePersonnel'), |
| | | title: '责任信息', |
| | | editRender: {name: 'input', attrs: {placeholder: ''}} |
| | | |
| | | }, |
| | |
| | | return row.order_number === brokenRow.value.order_number |
| | | }) |
| | | const maxQuantity = Math.max(...equalByOrderNum.map(item =>item.breakageQuantity || 0)) |
| | | let process = titleUploadData.value.thisProcess |
| | | let laminating = titleUploadData.value.laminating |
| | | equalByOrderNum.forEach((row) =>{ |
| | | row.completedQuantity= brokenRow.value.quantity*1-maxQuantity |
| | | if (laminating == 'laminating'){ |
| | | row.completedQuantity= brokenRow.value.quantity*1-maxQuantity |
| | | } |
| | | }) |
| | | |
| | | |
| | |
| | | |
| | | //第一次加载数据 |
| | | let groupChangeProcess = ref(false)//用于本班组显示问题 |
| | | request.post(`/reportingWork/selectProcess`).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 |
| | | gridOptions.toolbarConfig.buttons[1].visible=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 |
| | | } |
| | | |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | function checkSameNumForId(data, targetId) { |
| | | // 初始化一个对象来存储遇到的id及其对应的num值 |
| | |
| | | const notFinishList = xGrid.value.getTableData().fullData.filter(item =>{ |
| | | return item.saveFlag === 0 |
| | | }) |
| | | |
| | | let process = titleUploadData.value.thisProcess |
| | | //暂时取消 |
| | | for(let item of uniqueByOrderNum){ |
| | | if(!checkSameNumForId(notFinishList,item.order_number )){ |
| | | if(!checkSameNumForId(notFinishList,item.order_number ) && (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框')){ |
| | | ElMessage.error(`${t('reportingWorks.pleaseCheckTheOrderNumber1')}':' |
| | | ${item.order_number} |
| | | ${t('reportingWorks.pleaseCheckTheOrderNumber1')}`) |
| | |
| | | ElMessage.warning(t('reportingWorks.atLeastOneFinishedAndWornEligible')) |
| | | return false |
| | | } |
| | | |
| | | let status=company.qualityInsStatus |
| | | const requestData = { |
| | | title:titleUploadData.value, |
| | | detail:xGrid.value.getTableData().fullData, |
| | | type:state//审核状态 |
| | | type:state,//审核状态 |
| | | userId:user.user.userId, |
| | | userName:user.user.userName, |
| | | qualityInsStatus:status |
| | | } |
| | | gridOptions.toolbarConfig.buttons[0].disabled=true |
| | | gridOptions.toolbarConfig.buttons[1].disabled=true |
| | |
| | | } |
| | | |
| | | const saveReportingWorkRequest = (requestData) =>{ |
| | | //request.post(`/reportingWork/saveReportingWorkLog`, requestData) |
| | | request.post(`/reportingWork/saveReportingWork`,requestData).then(res =>{ |
| | | if (res.code == 200){ |
| | | ElMessage.success(t('reportingWorks.successfulJobApplication')) |
| | |
| | | ElMessage.error(msg) |
| | | } |
| | | }).catch(err =>{ |
| | | ElMessage.error(err.message) |
| | | ElMessage.error('提交失败,请刷新后重试') |
| | | }).finally(()=>{ |
| | | |
| | | gridOptions.toolbarConfig.buttons[0].disabled=false |
| | |
| | | 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')) |
| | | } |
| | | }) |
| | | } |
| | |
| | | ElMessage.warning(t('reportingWorks.firstProcessNotReview')) |
| | | return |
| | | } |
| | | //匹配“/”前后字符串 |
| | | const regex = /([^\/]+)\/([^\/]+)/; |
| | | //查找匹配的字符串 |
| | | const result = processId.match(regex); |
| | | //流程卡号 |
| | | let processIdStr = result[1]; |
| | | //层号 |
| | | let technologyStr = result[2]; |
| | | const reportWork = { |
| | | process: titleUploadData.value.previousProcess, |
| | | processId:processId, |
| | | thisProcess:titleUploadData.value.thisProcess |
| | | thisProcess:titleUploadData.value.thisProcess, |
| | | technologyStr:technologyStr, |
| | | userName:user.user.userName |
| | | } |
| | | loadingFlag.value= true |
| | | request.post("/reportingWork/reviewReportingWork",reportWork).then((res) =>{ |
| | |
| | | router.push({path:'/main/reportingWorks/AddReportingWork', |
| | | query:{ |
| | | processId:titleUploadData.value.processId, |
| | | reviewStatus:1, |
| | | random:Math.random() |
| | | } |
| | | }) |
| | |
| | | //流程卡号 |
| | | let processIdStr = result[1]; |
| | | //层号 |
| | | |
| | | let technologyStr = result[2]; |
| | | request.post(`/reportingWork/addSelectLastWork/${processIdStr}/${technologyStr}/${process}`).then((res) => { |
| | | |
| | | let reportType= company.reportType |
| | | request.post(`/reportingWork/addSelectLastWork/${processIdStr}/${technologyStr}/${process}/${reportType}`).then((res) => { |
| | | if (res.code == 200) { |
| | | if(res.data.data==null){ |
| | | ElMessage.error(t('reportingWorks.noDataThisProcessCard')) |
| | |
| | | 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 |
| | | //班组下拉框 |
| | | titleSelectJson.value.teamsType = res.data.teams |
| | | //titleSelectJson.value.teamsType = res.data.teams |
| | | //当前流程卡工序 |
| | | titleSelectJson.value.thisProcessType = res.data.thisProcess |
| | | //历史班组 |
| | |
| | | |
| | | //绑定下方表格 |
| | | 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){ |
| | | 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)=>{ |
| | |
| | | } |
| | | |
| | | } |
| | | const changeRowClass = ({ row, rowIndex, $rowIndex }) => { |
| | | return row?.rowClass |
| | | |
| | | } |
| | | const editConfigDisable = reactive({ |
| | | trigger: 'click', |
| | | mode: 'cell', |
| | | beforeEditMethod ({ row }) { |
| | | if (row.patchStatusOther === '已补片') { |
| | | return false |
| | | } |
| | | return true |
| | | } |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="height: 100%;width: 100%"> |
| | | <div id="head" style="height: 5%;width: 100%;margin-bottom: 5px"> |
| | | <div style="width: 100%;height: 100%"> |
| | | <div class="head"> |
| | | <el-input :disabled="inputDisabled" v-if="titleUploadData.reportingWorkId" v-model="titleUploadData.reportingWorkId" :placeholder="$t('reportingWorks.reportingWorkId')" style="width: 200px" /> |
| | | <el-input :disabled="inputDisabled" v-model="titleUploadData.processId" :placeholder="$t('processCard.processId')" style="width: 200px" @keyup.enter.native="getWork();getQuantity()"/> |
| | | |
| | |
| | | |
| | | <label>{{technologicalProcess}}</label> |
| | | </div> |
| | | <div style="background-color: white;margin-bottom: 5px;height: 17%;width: 100%"> |
| | | <div class="head1"> |
| | | <el-row> |
| | | <el-col :span="2"> |
| | | <el-text>{{$t('order.orderId')}}:</el-text> |
| | |
| | | |
| | | </el-row> |
| | | </div> |
| | | <div class="main-div-customer" style="width: 100%;height: 70%"> |
| | | <div class="main-table"> |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | max-height="100%" |
| | | height="400px" |
| | | :row-class-name="changeRowClass" |
| | | height="100%" |
| | | size="small" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | @edit-closed="editClosedEvent" |
| | | :cell-class-name="cellClassName" |
| | | :edit-config="editConfigDisable" |
| | | |
| | | > |
| | | |
| | |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input v-model="option.data" type="type" @input="changeFilterEvent($event, option, $panel)"/> |
| | | <input v-model="option.data" type="type" |
| | | @keyup.enter.native="$panel.confirmFilter()" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | <el-dialog |
| | | @opened="openedBrokenTable" |
| | | :before-close="checkClose" |
| | |
| | | |
| | | </vxe-grid> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .head{ |
| | | width: 100%; |
| | | height: 35px; |
| | | } |
| | | .head1{ |
| | | width: 100%; |
| | | height: 105px; |
| | | background-color: white; |
| | | } |
| | | |
| | | .main-table{ |
| | | width: 100%; |
| | | height: calc(100% - 135px); |
| | | } |
| | | |
| | | .processCard { |
| | | width: 140px; |
| | |
| | | color: #fff; |
| | | } |
| | | |
| | | |
| | | ::v-deep(.latter) { |
| | | //display: none; |
| | | } |
| | | </style> |