From adacd2dc7ea6fd0c989b15f8f7beb06e69810d74 Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期四, 14 八月 2025 13:22:10 +0800 Subject: [PATCH] oa标题修改 --- src/views/business/inspectionTask/inspection.vue | 168 ++++++++++++++++++++++++++++++------------------------- 1 files changed, 92 insertions(+), 76 deletions(-) diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue index 01ef6f2..d750b75 100644 --- a/src/views/business/inspectionTask/inspection.vue +++ b/src/views/business/inspectionTask/inspection.vue @@ -406,24 +406,24 @@ <el-button :loading="submitLoading" type="primary" @click="submit()">纭� 瀹�</el-button> </span> </el-dialog> - <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" - :visible.sync="dataGetDia" title="鏁版嵁閲囬泦" width="80%"> - <div> - <table border="1" cellpadding="10" class="thermal-table"> - <tr> - <td style="width: 120px">妫�楠岄」鍒嗙被</td> - <td style="width: 120px">妫�楠岄」</td> - <td style="width: 120px">妫�楠屽瓙椤�</td> - <td>鏁伴噰鏁版嵁</td> - </tr> - <template v-for="(item, index) in getData"> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" + :visible.sync="dataGetDia" title="鏁版嵁閲囬泦" width="80%"> + <div> + <table border="1" cellpadding="10" class="thermal-table"> <tr> - <td :rowspan="item.child.length">{{ item.sortName }}</td> - <td :rowspan="item.child.length">{{ item.faName }}</td> - <td>{{ item.child[0].name }}</td> - <td style="text-align: left"> - <!-- 娣诲姞瀹瑰櫒 div --> - <div class="data-collection-items"> + <td style="width: 120px">妫�楠岄」鍒嗙被</td> + <td style="width: 120px">妫�楠岄」</td> + <td style="width: 120px">妫�楠屽瓙椤�</td> + <td>鏁伴噰鏁版嵁</td> + </tr> + <template v-for="(item, index) in getData"> + <tr> + <td :rowspan="item.child.length">{{ item.sortName }}</td> + <td :rowspan="item.child.length">{{ item.faName }}</td> + <td>{{ item.child[0].name }}</td> + <td style="text-align: left"> + <!-- 娣诲姞瀹瑰櫒 div --> + <div class="data-collection-items"> <el-select v-if="item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1" :multiple-limit="item.child[0].maxNum" clearable filterable multiple placeholder="璇烽�夋嫨" @change="setData(item)"> @@ -447,7 +447,7 @@ <el-checkbox-group v-if="!item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1" :max="item.child[0].maxNum"> <el-checkbox v-for="(n, j) in item.child[0].arr" :key="index + '-' + j + 'aaaaaa'" :label="j + '^' + n" - @change="handleGroupSelect(item.child[0], j)" >{{ n }}</el-checkbox> + @change="handleGroupSelect(item.child[0], j, item.child[0].arr.length)" >{{ n }}</el-checkbox> </el-checkbox-group> </div> </td> @@ -478,7 +478,7 @@ </el-select> <el-checkbox-group v-if="!m.isShowSelect" v-model="m.getDataIndex1" :max="m.maxNum"> <el-checkbox v-for="(n, j) in m.arr" :key="index + '-' + j + 'dddddddd'" :label="j + '^' + n" - @change="handleGroupSelect(m, j)" >{{ n }}</el-checkbox> + @change="handleGroupSelect(m, j, m.arr.length)" >{{ n }}</el-checkbox> </el-checkbox-group> </div> </td> @@ -536,7 +536,7 @@ import AddUnPass from "../unpass/components/addUnPass.vue"; import InspectionWord from "./components/InspectionWord.vue"; import PurchaseVerification from "../unpass/components/PurchaseVerification.vue"; -import { connect,disconnect } from "@/utils/connect.js"; + import { doInsOrder, @@ -561,6 +561,7 @@ import DataWorker from '@/workers/DataWorker.worker.js'; import html2canvas from "html2canvas"; import { mapGetters } from "vuex"; +import { connect,disconnect,weightList } from "@/utils/connect.js"; import viewManHourDia from "@/views/business/inspectionTask/components/viewManHourDia.vue"; export default { name: 'Inspection', @@ -599,6 +600,7 @@ state: null, }, isSerialConnected: false, // 鏂板鐘舵�佸彉閲忥紝涓插彛杩炴帴鐘舵�� + serialPort: null, // 瀛樺偍涓插彛瀵硅薄 id: null, changeType: null, insOrder: {}, @@ -664,18 +666,10 @@ { name: "1285nm~1330nm", arr: [12, 13, 14, 15], - // 鍒濆鍖� getDataIndex1 涓烘暟缁� - getDataIndex1: [], - isShowSelect: false, - maxNum: 5 }, { name: "1525nm~1575nm", arr: [12, 13, 14, 15], - // 鍒濆鍖� getDataIndex1 涓烘暟缁� - getDataIndex1: [], - isShowSelect: false, - maxNum: 5 }, ], }, @@ -685,10 +679,6 @@ { name: "鎴嚦娉㈤暱", arr: [12, 13, 14, 15], - // 鍒濆鍖� getDataIndex1 涓烘暟缁� - getDataIndex1: [], - isShowSelect: false, - maxNum: 5 }, ], }, @@ -821,7 +811,6 @@ this.startWorker(); // this.getList0() // 浠诲姟鍒囨崲 this.scrollInit(); - disconnect() }, activated() { this.getTypeDicts(); // 鑾峰彇绱ф�ョ▼搴︿笅鎷夋閫夐」 @@ -901,9 +890,16 @@ beforeDestroy() { // 鍦ㄧ粍浠堕攢姣佸墠纭繚鍋滄 Worker锛岄伩鍏嶅唴瀛樻硠婕� this.stopWorker(); - disconnect() + disconnect(); + // 璋冪敤鍓嶅厛鍒ゆ柇鏂规硶鏄惁瀛樺湪锛岄伩鍏嶆姤閿� + if (this.closeSerialPort) { + this.closeSerialPort();// 缁勪欢閿�姣佸墠鍏抽棴涓插彛 + } }, methods: { + sss() { + console.log(this.$store.state.weightList) // + }, // 鏂囦欢绠$悊--寮�濮� getList() { this.tableLoading = true; @@ -939,14 +935,19 @@ }).catch(() => { }); }, // 鏂囦欢绠$悊--缁撴潫 - // 澶勭悊鏁寸粍鍕鹃�夐�昏緫鐨勬柟娉� - handleGroupSelect(childItem, clickedIndex) { + // 澶勭悊鏁寸粍鍕鹃�夐�昏緫鐨勬柟娉� + handleGroupSelect(childItem, clickedIndex, groupSize = 5) { + if(groupSize == 6){ + groupSize = 6; + }else{ + groupSize = 5; + } // 璁$畻鎵�鍦ㄧ粍鐨勮捣濮嬬储寮� - const groupStartIndex = Math.floor(clickedIndex / 5) * 5; + const groupStartIndex = Math.floor(clickedIndex / groupSize) * groupSize; // 娓呯┖褰撳墠宸查�� childItem.getDataIndex1 = []; - // 閬嶅巻褰撳墠缁勭殑 5 涓厓绱狅紝娣诲姞鍒伴�変腑鍒楄〃 - for (let i = groupStartIndex; i < groupStartIndex + 5 && i < childItem.arr.length; i++) { + // 閬嶅巻褰撳墠缁勭殑 groupSize 涓厓绱狅紝娣诲姞鍒伴�変腑鍒楄〃 + for (let i = groupStartIndex; i < groupStartIndex + groupSize && i < childItem.arr.length; i++) { childItem.getDataIndex1.push(i + '^' + childItem.arr[i]); } }, @@ -1133,41 +1134,59 @@ }, // 鏁版嵁閲囬泦 - getDataAcquisitionDevice() { - if (this.isSerialConnected) { - connect(); - } - // return - let itemIds = []; - this.currentSample.insProduct.forEach((item) => { - if (item.inspectionItemType === "1") { - itemIds.push(item.id); + + getDataAcquisitionDevice() { + (async () => { + try { + // 妫�鏌ラ〉闈腑妫�娴嬮」鏄惁鍖呭惈瀵嗗害 + const hasDensityItem = this.currentSample.insProduct.some(item => { + // 鍋囪瀵嗗害鐩稿叧鐨勬娴嬮」鍚嶇О鍖呭惈 "瀵嗗害" 鍏抽敭瀛楋紝鍙寜闇�淇敼 + return item.inspectionItem && item.inspectionItem.includes('瀵嗗害'); + }); + if (hasDensityItem) { + // 妫�鏌ユ槸鍚︽敮鎸� Web Serial API + if ('serial' in navigator) { + // 璇锋眰鍙敤涓插彛 + const ports = await navigator.serial.getPorts(); + if (ports.length > 0) { + await connect(); + } else { + console.log('娌℃湁鍙敤鐨勪覆鍙�'); + } + } else { + console.log('褰撳墠娴忚鍣ㄤ笉鏀寔 Web Serial API'); + } + } + } catch (error) { + console.error('妫�娴嬩覆鍙f椂鍑洪敊:', error); } - }); - const params = { - entrustCode: this.insOrder.entrustCode, - sampleCode: this.currentSample.sampleCode, - id: this.currentSample.id, - itemIds: itemIds, - }; - this.dataAcquisitionLoading = true; - dataCollection(params).then((res) => { - this.dataAcquisitionLoading = false; - if (res.code != 200) { - return; - } - this.dataAcquisitionInfoNew = this.HaveJson(res.data); - // 瀵规暟閲囧洖鏉ョ殑鍊艰繘琛屽鐞� - this.handleDataAcquisition(res.data); - }).catch(err => { - this.dataAcquisitionLoading = false; + })().then(() => { + let itemIds = []; + this.currentSample.insProduct.forEach((item) => { + if (item.inspectionItemType === "1") { + itemIds.push(item.id); + } + }); + const params = { + entrustCode: this.insOrder.entrustCode, + sampleCode: this.currentSample.sampleCode, + id: this.currentSample.id, + itemIds: itemIds, + }; + this.dataAcquisitionLoading = true; + dataCollection(params).then((res) => { + this.dataAcquisitionLoading = false; + if (res.code != 200) { + return; + } + this.dataAcquisitionInfoNew = this.HaveJson(res.data); + // 瀵规暟閲囧洖鏉ョ殑鍊艰繘琛屽鐞� + this.handleDataAcquisition(res.data); + }).catch(err => { + this.dataAcquisitionLoading = false; + }); }); }, - // 鍋囪瀛樺湪涓�涓柟娉曠敤浜庢洿鏂颁覆鍙h繛鎺ョ姸鎬� - // updateSerialConnectionStatus(status) { - // this.isSerialConnected = status; - // }, - objectOrder(obj) { let newkey = Object.keys(obj).sort(); let newObj = {}; @@ -1229,7 +1248,6 @@ }; } let list = this.tableList[0].arr; - console.log(this.tableList[0]); // 寰幆椤甸潰鍒楄〃淇℃伅锛屽垽鏂暟閲囨暟鎹搴旈〉闈㈠垪琛ㄤ俊鎭殑妫�楠岄」鏄摢涓紝骞剁粰褰撳墠妫�楠岄」缁戝畾璁惧淇℃伅 list.forEach((item, index) => { let num0 = 0; @@ -1297,7 +1315,6 @@ } }; let list = this.tableList[0].arr; - console.log(this.tableList[0]); let maxNum = 0; list.forEach((item, index) => { let num0 = 0; @@ -1402,7 +1419,6 @@ } else { // 濡傛灉閮戒笉瀛樺湪锛屽垯锛岃繘鍏ュ鐞嗘暟閲囩嚎绋嬮噷鍘诲鐞嗘暟鎹� try { - console.log(this.dataAcquisitionInfo); // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫 this.getDataIndexLoading = false; this.dataGetDia = false; @@ -3209,11 +3225,11 @@ .data-collection-items { display: flex; - flex-wrap: wrap; + flex-wrap: wrap; } .data-collection-items .el-select, .data-collection-items .el-checkbox { - flex-basis: 20% ; + flex-basis: 20% ; box-sizing: border-box; padding: 5px 2%; } -- Gitblit v1.9.3