| | |
| | | <script setup> |
| | | import {computed, nextTick, onMounted, reactive, ref, toRefs} from "vue"; |
| | | import {computed, nextTick, onMounted, onUnmounted, reactive, ref, toRefs} from "vue"; |
| | | import {useRouter,useRoute} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import {ElMessage} from "element-plus"; |
| | |
| | | |
| | | }) |
| | | |
| | | |
| | | |
| | | let inputDisabled = ref(false) |
| | | onMounted(() =>{ |
| | | if(route.query.processId !== undefined && route.query.processId!=='' && route.query.processId!=null ){ |
| | |
| | | titleUploadData.value = res.data.reportingWork |
| | | titleSelectJson.value = res.data.basic |
| | | 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 解析错误或其他异常情况 |
| | | } |
| | | }); |
| | | // 遍历 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 = { |
| | |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | mouseConfig:{selected: true},//鼠标选中 |
| | | keyboardConfig:{ |
| | | isArrow: true, |
| | | isDel: true, |
| | | isEnter: true, |
| | | isTab: true, |
| | | isEdit: true, |
| | | isChecked: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | },//表头参数 |
| | | }, |
| | | menuConfig: { |
| | | /*body: { |
| | | options: [ |
| | | [ |
| | | { |
| | | code: 'copyChecked', |
| | | name: t('basicData.selectSame'), |
| | | prefixIcon: 'vxe-icon-copy', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | { |
| | | code: 'copyAll', |
| | | name: t('basicData.sameAfterwards'), |
| | | prefixIcon: 'vxe-icon-feedback', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | { |
| | | code: 'clearChecked', |
| | | name: t('basicData.clearSelection'), |
| | | prefixIcon: 'vxe-icon-indicator', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | ] |
| | | ] |
| | | }*/ |
| | | }, |
| | | //表头参数 |
| | | columns: [ |
| | | // {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | { |
| | | field: 'order_number', |
| | | title: t('order.OrderNum'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 's01Value', |
| | | title: t('reportingWorks.glassNumber'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | |
| | | return new Error((`${row.completedQuantity}+${brokenNum}>${row.quantity}`)) |
| | | } |
| | | if(titleUploadData.value.reportingWorkId!=null && row.completedQuantity<row.minQuantity){ |
| | | return new Error(`请输入大于等于${row.minQuantity}的数字`) |
| | | return new Error(`${t('reportingWorks.pleaseGreaterThanOrEqual1')} |
| | | ${row.minQuantity} |
| | | ${t('reportingWorks.pleaseGreaterThanOrEqual2')}`) |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | //brokenGrid.value.reloadData(brokenRow.damageDetail) |
| | | //改变brokenVisible的值触发openedBrokenTable()方法 |
| | | brokenVisible.value = true |
| | | const { rows, column, cell } = params; // 解构获取行、列和单元格信息 |
| | | //点击次破数量时打开明细界面 |
| | | if(column.field=="breakageQuantity"){ |
| | | brokenVisible.value = true |
| | | } |
| | | }, |
| | | menuClick({menu, row, column}) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | | case 'copyChecked' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "completedQuantity"){ |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | dataList.forEach((item, index) => { |
| | | if (index >= result.start && index <= result.end) { |
| | | item[result.cell] = val |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | } |
| | | break |
| | | } |
| | | case 'copyAll' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "completedQuantity" ) { |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | dataList.forEach((item, index) => { |
| | | if (index >= result.start) { |
| | | item[result.cell] = val |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | case 'clearChecked' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "completedQuantity" ) { |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | dataList.forEach((item, index) => { |
| | | if (index >= result.start && index <= result.end) { |
| | | item[result.cell] = '' |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | |
| | | |
| | |
| | | align: 'center',//文字居中 |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | id: 'CustomerListDetail', |
| | | //showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | |
| | | |
| | | let reportingWorkNum = isNaN(brokenRow.value.completedQuantity*1)?0:brokenRow.value.completedQuantity*1 |
| | | if((breakageQuantityCount>brokenRow.value.quantity*1) ){ |
| | | ElMessage.warning(`损耗数:'${breakageQuantityCount}' |
| | | 不能大于${brokenRow.value.quantity*1}`) |
| | | ElMessage.warning(`${t('reportingWorks.lossCount1')}':'${breakageQuantityCount} |
| | | ${t('reportingWorks.lossCount2')}${brokenRow.value.quantity*1}`) |
| | | return false |
| | | } |
| | | brokenRow.value.completedQuantity = brokenRow.value.quantity-breakageQuantityCount |
| | |
| | | |
| | | for(let item of uniqueByOrderNum){ |
| | | if(!checkSameNumForId(notFinishList,item.order_number)){ |
| | | ElMessage.error(`请检查订单序号: ${item.order_number} 报工数量是否相同!`) |
| | | ElMessage.error(`${t('reportingWorks.pleaseCheckTheOrderNumber1')}':' |
| | | ${item.order_number} |
| | | ${t('reportingWorks.pleaseCheckTheOrderNumber1')}`) |
| | | return false |
| | | } |
| | | } |
| | |
| | | router.push({path:'/main/reportingWorks/AddReportingWork',query:{processId:titleUploadData.value.processId,random:Math.random()}}) |
| | | }else{ |
| | | const errorObj = JSON.parse(res.msg) |
| | | const msg = "序号:"+errorObj.orderNumber+'\n' |
| | | +'小片顺序:'+errorObj.technologyNumber+'\n' |
| | | +"实际可报工数量:"+errorObj.processNum+'<'+ |
| | | "报工数量:"+errorObj.sumNum+'\n' |
| | | +"请刷新界面重新报工" |
| | | const msg = t('reportingWorks.pleaseNumber1')+":"+errorObj.orderNumber+'\n' |
| | | +t('reportingWorks.pleaseNumber2')+':'+errorObj.technologyNumber+'\n' |
| | | +t('reportingWorks.pleaseNumber3')+':'+errorObj.processNum+'<'+ |
| | | +t('reportingWorks.pleaseNumber4')+':'+errorObj.sumNum+'\n' |
| | | +t('reportingWorks.pleaseNumber5') |
| | | |
| | | ElMessage.error(msg) |
| | | } |
| | |
| | | ElMessage.warning(t('reportingWorks.selectProcess')) |
| | | return |
| | | } |
| | | |
| | | if (titleSelectJson.value.thisProcessType.indexOf(process) == -1 && process != "切割" && titleSelectJson.value.thisProcessType != "") { |
| | | ElMessage.warning(t('reportingWorks.thisProcessNotProcessCard')) |
| | | return |
| | | if (titleSelectJson.value.thisProcessType.length!=0){ |
| | | if (titleSelectJson.value.thisProcessType.indexOf(process) === -1 && process !== t('machine.cutting')) { |
| | | ElMessage.warning(t('reportingWorks.thisProcessNotProcessCard')) |
| | | return |
| | | } |
| | | } |
| | | |
| | | //匹配“/”前后字符串 |
| | | const regex = /([^\/]+)\/([^\/]+)/; |
| | | //查找匹配的字符串 |
| | |
| | | //判断早晚班 |
| | | titleUploadData.value.classes=t('reportingWorks.early') |
| | | titleUploadData.value.reportingWorkTime = formatCurrentTime() |
| | | |
| | | // 声明一个空数组,用于存储每个订单的 S01 值 |
| | | 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 解析错误或其他异常情况 |
| | | } |
| | | }); |
| | | |
| | | // 遍历 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 中的值不足,可以添加默认值或者不进行赋值处理 |
| | | } |
| | | }); |
| | | |
| | | |
| | | //绑定下方表格 |
| | | detail.value = res.data.Detail |
| | | xGrid.value.reloadData(detail.value) |
| | |
| | | } |
| | | |
| | | if (item.quantity < item.completedQuantity) { |
| | | ElMessage.success("序号" + item.order_number + "的数量不能大于上工序数量") |
| | | ElMessage.success(t('reportingWorks.pleaseNumber6') + item.order_number + t('reportingWorks.pleaseNumber7')) |
| | | |
| | | |
| | | } else if (item.breakageQuantity * 1 + item.completedQuantity * 1 > item.quantity * 1) { |
| | | ElMessage.success("请输入序号" + item.order_number + "正确的完工或次破数量") |
| | | ElMessage.success(t('reportingWorks.pleaseNumber8') + item.order_number + t('reportingWorks.pleaseNumber9')) |
| | | } |
| | | |
| | | sum = item.completedQuantity * 1 + sum * 1 |
| | |
| | | const changeTable=()=>{ |
| | | const $grid = xGrid.value |
| | | this.$grid.commitProxy('data', yourData) |
| | | } |
| | | onMounted(() => { |
| | | window.addEventListener('keypress', qrcodeScanner); |
| | | //addListener(xGrid.value, gridOptions) |
| | | }) |
| | | |
| | | // 在组件卸载时移除键盘事件监听 |
| | | onUnmounted(() => { |
| | | window.removeEventListener('keypress', qrcodeScanner); |
| | | }) |
| | | |
| | | let code = ''; |
| | | let codeArr = []; |
| | | let lastTime,nextTime = '' |
| | | let lastCode,nextCode = '' |
| | | const qrcodeScanner = (e) =>{ |
| | | |
| | | nextCode = e.key; |
| | | |
| | | |
| | | // 当前触发时间 |
| | | nextTime = new Date().getTime(); |
| | | // 第一次获取 |
| | | if(!lastTime && !lastCode && e.key !== 'Enter'){ |
| | | codeArr = [] |
| | | codeArr.push(e.key) |
| | | } |
| | | |
| | | if(lastCode && lastTime && (nextTime - lastTime > 50)){ |
| | | // 相隔时间大于30 说明不是扫码枪扫描的 清空重新 |
| | | codeArr = [] |
| | | // 当扫码前有keypress事件时,防止首字缺失 |
| | | } else if(lastCode && lastTime && e.key !== 'Enter'){ |
| | | codeArr.push(e.key) |
| | | } |
| | | lastCode = nextCode |
| | | lastTime = nextTime |
| | | // 扫描结束 |
| | | if(e.keyCode === 13){ |
| | | // 可进行下一步操作 |
| | | /* 下一步操作 */ |
| | | if(codeArr.length!==0){ |
| | | titleUploadData.value.processId = codeArr.join('') |
| | | } |
| | | |
| | | codeArr=[] |
| | | lastTime = '' |
| | | nextTime = '' |
| | | lastCode = '' |
| | | nextCode = '' |
| | | } |
| | | |
| | | } |
| | | |
| | | </script> |
| | |
| | | <!-- 刺破类型breakageType --> |
| | | <template #breakageType="{ row }"> |
| | | <vxe-select v-model="row.breakageType " |
| | | filterable |
| | | clearable |
| | | placeholder=""> |
| | | clearable placeholder=" " allow-create filterable> |
| | | <vxe-option v-for="item in titleSelectJson.breakageType" :key="item.id" :label="item.basic_name" :value="item.basic_name"/> |
| | | </vxe-select> |
| | | </template> |
| | |
| | | <!--次破原因--> |
| | | <template #breakageReason="{ row }"> |
| | | <vxe-select v-model="row.breakageReason " |
| | | filterable |
| | | clearable |
| | | placeholder=""> |
| | | clearable placeholder=" " allow-create filterable> |
| | | <vxe-option v-for="item in titleSelectJson.breakageReason" :key="item.id" :label="item.basic_name" :value="item.basic_name"/> |
| | | </vxe-select> |
| | | </template> |