| | |
| | | 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" |
| | | domZIndex.setCurrent(3000) |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | | let brokenVisible = ref(false) |
| | |
| | | layer= res.data.layer |
| | | |
| | | const s01Values = []; |
| | | // 遍历 res.data.numberList 数组,获取每个元素的 S01 值并存储到 s01Values 数组中 |
| | | res.data.numberList.forEach(element => { |
| | | try { |
| | | const otherColumnsObject = JSON.parse(element.other_columns); |
| | | const s01Value = otherColumnsObject.S01; |
| | | if (s01Value) { |
| | | s01Values.push(s01Value); |
| | | } else { |
| | | // 如果 S01 值为空,可以选择添加默认值或者忽略这个元素 |
| | | s01Values.push(''); // 例如添加空字符串 |
| | | } |
| | | } catch (error) { |
| | | // console.error('Error parsing JSON or accessing S01 value:', error); |
| | | // 处理 JSON 解析错误或其他异常情况 |
| | | for (let i = 0; i < res.data.reportingWorkDetails.length; i++) { |
| | | const s01Values = []; |
| | | // 遍历 detailList 数组,提取 S01 值到 s01Values 数组 |
| | | if (res.data.reportingWorkDetails[i].other_columns!=null|| res.data.reportingWorkDetails[i].other_columns!=undefined){ |
| | | res.data.reportingWorkDetails.forEach(element => { |
| | | const otherColumnsObject = JSON.parse(element.other_columns); |
| | | const s01Value = otherColumnsObject.S01; |
| | | s01Values.push(s01Value || ''); // 如果 S01 值为空,添加空字符串或者其他默认值 |
| | | }); |
| | | |
| | | // 将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性 |
| | | res.data.reportingWorkDetails.forEach((detail, index) => { |
| | | detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 赋值给 s01Value 属性 |
| | | }); |
| | | } |
| | | }); |
| | | // 遍历 res.data.Detail 数组,将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性 |
| | | res.data.reportingWorkDetails.forEach((detail, index) => { |
| | | if (index < s01Values.length) { |
| | | detail.s01Value = s01Values[index]; // 添加一个名为 s01Value 的新属性,存储对应的 S01 值 |
| | | } else { |
| | | detail.s01Value = ''; // 如果 s01Values 中的值不足,可以添加默认值或者不进行赋值处理 |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | //titleUploadData.value.processId=titleUploadData.value.processId+'/'+layer |
| | | xGrid.value.reloadData(res.data.reportingWorkDetails) |
| | | let button = { |
| | |
| | | button.name=t('basicData.review') |
| | | titleUploadData.value.qualityInspector=user.user.userName |
| | | } |
| | | |
| | | |
| | | gridOptions.toolbarConfig.buttons.push(button) |
| | | } |
| | |
| | | isChecked: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | trigger: 'dblclick', |
| | | mode: 'row', |
| | | showStatus: true |
| | | }, |
| | | menuConfig: { |
| | | /*body: { |
| | | body: { |
| | | //右键菜单 |
| | | options: [ |
| | | [ |
| | |
| | | }, |
| | | ] |
| | | ] |
| | | }*/ |
| | | } |
| | | }, |
| | | //表头参数 |
| | | columns: [ |
| | |
| | | break |
| | | } |
| | | case 'update': { |
| | | getQuantity() |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | | return |
| | | } |
| | | saveReportingWork(0,'update') |
| | | //根据补片状态判断是否能修改 |
| | | 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) { |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | | return |
| | | } |
| | | saveReportingWork(0, 'update') |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | break |
| | | } |
| | | } |
| | |
| | | showStatus: true |
| | | },//表头参数 |
| | | columns: [ |
| | | {type: 'checkbox', fixed: "left", title: t('basicData.check'),width: 78}, |
| | | {type: 'seq',fixed:"left", title: t('basicData.Number'), width: 80 }, |
| | | // { |
| | | // field: 'order_number', |
| | |
| | | }, |
| | | { |
| | | field: 'responsiblePersonnel', |
| | | title: t('reportingWorks.responsiblePersonnel'), |
| | | title: '责任信息', |
| | | editRender: {name: 'input', attrs: {placeholder: ''}} |
| | | |
| | | }, |
| | |
| | | break |
| | | } |
| | | case 'removeRow': { |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | $grid.remove(result.row) |
| | | const $grid = brokenGrid.value |
| | | const checkedList = $grid.getCheckboxRecords() |
| | | if(checkedList){ |
| | | $grid.remove(checkedList) |
| | | } |
| | | break |
| | | } |
| | |
| | | } |
| | | } |
| | | const openedBrokenTable = () => { |
| | | addListener(brokenGrid.value,brokenGridOptions) |
| | | //addListener(brokenGrid.value,brokenGridOptions) |
| | | let damage =ref(brokenRow.value.damageDetails) |
| | | brokenGrid.value.reloadData(damage.value) |
| | | } |
| | |
| | | |
| | | |
| | | //第一次加载数据 |
| | | |
| | | let groupChangeProcess = ref(false)//用于本班组显示问题 |
| | | request.post(`/reportingWork/selectProcess`).then((res) => { |
| | | if (res.code == 200) { |
| | | titleSelectJson.value.processType = res.data.process; |
| | | 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 |
| | | } |
| | | |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | |
| | | }) |
| | | |
| | | for(let item of uniqueByOrderNum){ |
| | | if(!checkSameNumForId(notFinishList,item.order_number)){ |
| | | if(!checkSameNumForId(notFinishList,item.order_number )){ |
| | | ElMessage.error(`${t('reportingWorks.pleaseCheckTheOrderNumber1')}':' |
| | | ${item.order_number} |
| | | ${t('reportingWorks.pleaseCheckTheOrderNumber1')}`) |
| | | return false |
| | | } |
| | | } |
| | | |
| | | |
| | | titleUploadData.value.creator = user.user.userName |
| | | titleUploadData.value.creatorId = user.user.userId |
| | |
| | | const b = (row.breakageQuantity !== undefined && row.breakageQuantity !== null && row.breakageQuantity !== '' && row.breakageQuantity*1!==0) |
| | | return (a || b) |
| | | }) |
| | | if(requestDetailData.length === 0){ |
| | | if(requestDetailData.length === 0 && (route.query.reportingWorkId===undefined)){ |
| | | ElMessage.warning(t('reportingWorks.atLeastOneFinishedAndWornEligible')) |
| | | return false |
| | | } |
| | |
| | | const requestData = { |
| | | title:titleUploadData.value, |
| | | detail:xGrid.value.getTableData().fullData, |
| | | type:state//审核状态 |
| | | type:state,//审核状态 |
| | | userId:user.user.userId, |
| | | userName:user.user.userName, |
| | | } |
| | | gridOptions.toolbarConfig.buttons[0].disabled=true |
| | | gridOptions.toolbarConfig.buttons[1].disabled=true |
| | |
| | | }) |
| | | // 查询责任班组 |
| | | const computedResponsibleTeam = computed((responsibleProcess) => { |
| | | titleSelectJson.value.historyTeams.push({basic_name: user.user.userName, process: titleUploadData.value.thisProcess, basic_type: 'teamsgroups', basic_category: 179, id: 555}) |
| | | return function (responsibleProcess){ |
| | | return titleSelectJson.value.historyTeams.filter((item) => { |
| | | return item.process === responsibleProcess |
| | |
| | | } |
| | | const reportWork = { |
| | | process: titleUploadData.value.previousProcess, |
| | | processId:processId |
| | | processId:processId, |
| | | thisProcess:titleUploadData.value.thisProcess |
| | | } |
| | | loadingFlag.value= true |
| | | request.post("/reportingWork/reviewReportingWork",reportWork).then((res) =>{ |
| | |
| | | //表头赋值 |
| | | titleUploadData.value = res.data.data |
| | | titleUploadData.value.processId = processId |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | //设备下拉框 |
| | | titleSelectJson.value.deviceType = res.data.device |
| | | //班组下拉框 |
| | |
| | | titleUploadData.value.classes=t('reportingWorks.early') |
| | | titleUploadData.value.reportingWorkTime = formatCurrentTime() |
| | | |
| | | // 声明一个空数组,用于存储每个订单的 S01 值 |
| | | //处理编号列 |
| | | //定义存放编号数组 |
| | | const s01Values = []; |
| | | for (let i = 0; i < res.data.Detail.length; i++) { |
| | | const s01Values = []; |
| | | // 遍历 detailList 数组,提取 S01 值到 s01Values 数组 |
| | | if (res.data.Detail[i].other_columns!=null|| res.data.Detail[i].other_columns!=undefined){ |
| | | res.data.Detail.forEach(element => { |
| | | const otherColumnsObject = JSON.parse(element.other_columns); |
| | | const s01Value = otherColumnsObject.S01; |
| | | s01Values.push(s01Value || ''); // 如果 S01 值为空,添加空字符串或者其他默认值 |
| | | }); |
| | | |
| | | // 遍历 res.data.numberList 数组,获取每个元素的 S01 值并存储到 s01Values 数组中 |
| | | res.data.numberList.forEach(element => { |
| | | try { |
| | | const otherColumnsObject = JSON.parse(element.other_columns); |
| | | const s01Value = otherColumnsObject.S01; |
| | | if (s01Value) { |
| | | s01Values.push(s01Value); |
| | | } else { |
| | | // 如果 S01 值为空,可以选择添加默认值或者忽略这个元素 |
| | | s01Values.push(''); // 例如添加空字符串 |
| | | } |
| | | } catch (error) { |
| | | // console.error('Error parsing JSON or accessing S01 value:', error); |
| | | // 处理 JSON 解析错误或其他异常情况 |
| | | // 将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性 |
| | | res.data.Detail.forEach((detail, index) => { |
| | | detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 赋值给 s01Value 属性 |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | // 遍历 res.data.Detail 数组,将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性 |
| | | res.data.Detail.forEach((detail, index) => { |
| | | if (index < s01Values.length) { |
| | | detail.s01Value = s01Values[index]; // 添加一个名为 s01Value 的新属性,存储对应的 S01 值 |
| | | } else { |
| | | detail.s01Value = ''; // 如果 s01Values 中的值不足,可以添加默认值或者不进行赋值处理 |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | //绑定下方表格 |
| | |
| | | } |
| | | onMounted(() => { |
| | | window.addEventListener('keypress', qrcodeScanner); |
| | | //addListener(xGrid.value, gridOptions) |
| | | addListener(xGrid.value, gridOptions) |
| | | }) |
| | | |
| | | // 在组件卸载时移除键盘事件监听 |
| | |
| | | if(codeArr.length!==0){ |
| | | titleUploadData.value.processId = codeArr.join('') |
| | | } |
| | | if(user.user.address!==null || user.user.address!==''){ |
| | | getWork() |
| | | } |
| | | |
| | | codeArr=[] |
| | | lastTime = '' |
| | |
| | | lastCode = '' |
| | | nextCode = '' |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | const cellClassName = ({ row, column }) => { |
| | | if (column.field === 'breakageQuantity') { |
| | | return 'col-red' |
| | | } |
| | | |
| | | } |
| | | const changeRowClass = ({ row, rowIndex, $rowIndex }) => { |
| | | return row?.rowClass |
| | | |
| | | } |
| | | |
| | |
| | | <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()"/> |
| | | |
| | | <el-select :disabled="inputDisabled" v-model="titleUploadData.thisProcess" clearable :placeholder="$t('reportingWorks.selectProcess')" style="width: 120px" |
| | | <el-select :disabled="inputDisabled || groupChangeProcess" |
| | | v-model="titleUploadData.thisProcess" |
| | | clearable |
| | | :placeholder="$t('reportingWorks.selectProcess')" |
| | | style="width: 120px" |
| | | @change="getWork();getQuantity()"> |
| | | <el-option |
| | | v-for="item in titleSelectJson['processType']" |
| | |
| | | <el-text class="customClass"></el-text> |
| | | </el-col> |
| | | <el-col :span="2"> |
| | | <el-text>{{$t('order.project')}}:</el-text> |
| | | <el-text >{{$t('order.project')}}:</el-text> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-text wrap-text="false">{{ titleUploadData.order.project }}</el-text> |
| | | <el-input :readonly="true" v-model="titleUploadData.order.project"/> |
| | | <!-- <el-text style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">{{ titleUploadData.order.project }}</el-text>--> |
| | | </el-col> |
| | | |
| | | </el-row> |
| | |
| | | <el-text>{{$t('reportingWorks.teamsType')}}:</el-text> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-select v-model="titleUploadData.teamsGroupsName" clearable :placeholder="$t('reportingWorks.selectTeam')"> |
| | | <el-select :disabled="groupChangeProcess" |
| | | v-model="titleUploadData.teamsGroupsName" |
| | | clearable |
| | | :placeholder="$t('reportingWorks.selectTeam')"> |
| | | <el-option |
| | | v-for="item in titleSelectJson['teamsType']" |
| | | :key="item.id" |
| | |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | :row-class-name="changeRowClass" |
| | | max-height="100%" |
| | | height="400px" |
| | | height="100%" |
| | | size="small" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | @edit-closed="editClosedEvent" |
| | | :cell-class-name="cellClassName" |
| | | |
| | | > |
| | | |
| | |
| | | user-select: none; |
| | | } |
| | | |
| | | ::v-deep(.mytable-scrollbar .col-red) { |
| | | background-color: rgb(66,159,254); |
| | | color: #fff; |
| | | } |
| | | |
| | | |
| | | ::v-deep(.latter) { |
| | | //display: none; |
| | | } |
| | | </style> |