| | |
| | | <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"; |
| | |
| | | |
| | | }) |
| | | |
| | | /*onMounted(() => { |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value, gridOptions) |
| | | })*/ |
| | | |
| | | |
| | | let inputDisabled = ref(false) |
| | | onMounted(() =>{ |
| | |
| | | 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: { |
| | | menuConfig: { |
| | | /*body: { |
| | | options: [ |
| | | [ |
| | | { |
| | |
| | | }, |
| | | ] |
| | | ] |
| | | } |
| | | },*/ |
| | | }*/ |
| | | }, |
| | | //表头参数 |
| | | 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 |
| | |
| | | } |
| | | //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}) { |
| | | menuClick({menu, row, column}) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | |
| | | } |
| | | } |
| | | } |
| | | },*/ |
| | | }, |
| | | } |
| | | |
| | | |
| | |
| | | align: 'center',//文字居中 |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | id: 'CustomerListDetail', |
| | | //showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | |
| | | //判断早晚班 |
| | | 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) |
| | |
| | | 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> |
| | | |