From c32f4ff056b564331a2b81f2b6981f8b27dd7aa4 Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期四, 14 八月 2025 09:44:59 +0800 Subject: [PATCH] Merge branch 'dev_ztns' into dev_y_ztns --- src/views/business/inspectionTask/inspection.vue | 227 +++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 156 insertions(+), 71 deletions(-) diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue index 512b516..d750b75 100644 --- a/src/views/business/inspectionTask/inspection.vue +++ b/src/views/business/inspectionTask/inspection.vue @@ -141,7 +141,7 @@ <el-button :loading="dataAcquisitionLoading" v-if="state == 1" size="small" type="primary" @click="getDataAcquisitionDevice">鏁版嵁閲囬泦</el-button> <el-button :type="dataAcquisitionEidtAble ? '' : 'primary'" v-if="state == 1" size="small" - @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble">{{ dataAcquisitionEidtAble ? "鍏抽棴缂栬緫" : "缂栬緫鏁伴噰" + @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble,disconnect()">{{ dataAcquisitionEidtAble ? "鍏抽棴缂栬緫" : "缂栬緫鏁伴噰" }}</el-button> </div> </div> @@ -422,67 +422,76 @@ <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)"> - <el-option v-for="(item, index) in item.child[0].arr" :key="index" :filter-method="filterMethod" - :label="index + 1 + '^' + item.result" :value="index + '^' + item.result"> + <el-option v-for="(subItem, subIndex) in item.child[0].arr" :key="index + '-' + subIndex" :filter-method="filterMethod" + :label="subIndex + 1 + '^' + subItem.result" :value="subIndex + '^' + subItem.result"> <span>{{ "搴忓彿锛�" + - (index + 1) + + (subIndex + 1) + "锛�" + "缁撴灉锛�" + - item.result + + subItem.result + "锛�" + "鍘氬害锛�" + - item.thickness + + subItem.thickness + "锛�" + "鏃堕棿锛�" + - item.mergedDateTime + subItem.mergedDateTime }}</span> </el-option> </el-select> <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="j" :label="j + '^' + n">{{ n }}</el-checkbox> + <el-checkbox v-for="(n, j) in item.child[0].arr" :key="index + '-' + j + 'aaaaaa'" :label="j + '^' + n" + @change="handleGroupSelect(item.child[0], j, item.child[0].arr.length)" >{{ n }}</el-checkbox> </el-checkbox-group> - </td> - </tr> - <tr v-for="(m, i) in item.child" v-show="i > 0" :key="i + 'bbbbbbbbbbbbbb'"> - <td>{{ m.name }}</td> - <td style="text-align: left"> + </div> + </td> + </tr> + <tr v-for="(m, i) in item.child" v-show="i > 0" :key="index + '-' + i + 'bbbbbbbbbbbbbb'"> + <td>{{ m.name }}</td> + <td style="text-align: left"> + <!-- 娣诲姞瀹瑰櫒 div --> + <div class="data-collection-items"> <el-select v-if="m.isShowSelect" v-model="m.getDataIndex1" :multiple-limit="m.maxNum" clearable filterable multiple placeholder="璇烽�夋嫨"> - <el-option v-for="(item, index1) in m.arr" :key="index1" :label="index + 1 + '^' + item.result" - :value="index1 + '^' + item.result"> + <el-option v-for="(subItem, index1) in m.arr" :key="index + '-' + index1 + 'cccccccc'" + :label="index1 + 1 + '^' + subItem.result" :value="index1 + '^' + subItem.result"> <span>{{ "搴忓彿锛�" + (index1 + 1) + "锛�" + "缁撴灉锛�" + - item.result + + subItem.result + "锛�" + "鍘氬害锛�" + - item.thickness + + subItem.thickness + "锛�" + "鏃堕棿锛�" + - item.mergedDateTime + subItem.mergedDateTime }}</span> </el-option> </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="j" :label="j + '^' + n">{{ n }}</el-checkbox> + <el-checkbox v-for="(n, j) in m.arr" :key="index + '-' + j + 'dddddddd'" :label="j + '^' + n" + @change="handleGroupSelect(m, j, m.arr.length)" >{{ n }}</el-checkbox> </el-checkbox-group> - </td> - </tr> - </template> - </table> - </div> - <span slot="footer" class="dialog-footer"> - <el-button @click="dataGetDia = false">鍙� 娑�</el-button> - <el-button :loading="getDataIndexLoading" type="primary" @click="submitDataGet()">纭� 瀹�</el-button> - </span> - </el-dialog> + </div> + </td> + </tr> + </template> + </table> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="dataGetDia = false">鍙� 娑�</el-button> + <el-button :loading="getDataIndexLoading" type="primary" @click="submitDataGet()">纭� 瀹�</el-button> + </span> + </el-dialog> + <el-dialog :close-on-click-modal="false" :visible.sync="addCheck" title="鎸囧畾鎶ュ憡瀹℃牳浜哄憳" width="400px" @close="closeAddVerifyDia"> <div class="body" style="display: flex; padding: 10px; align-items: center"> @@ -501,13 +510,18 @@ <el-button :loading="reviewLoading" type="primary" @click="upInsReview(1)">纭� 瀹�</el-button> </span> </el-dialog> + <!-- 娣诲姞涓嶅悎鏍煎娴嬪脊妗�--> <add-un-pass v-if="addUnPassDialog" ref="addUnPassDialog" :addUnPassDialog="addUnPassDialog" @resetAddUnPass="resetAddUnPass"></add-un-pass> + <!-- 涓嶅悎鏍煎鐞嗗脊妗�--> <UnPassDialog v-if="unPassDialog" ref="unPassDialog" :orderId="orderId" :unPassDialog="unPassDialog" @resetForm="resetForm"></UnPassDialog> + <!-- 涓嶅悎鏍煎娴嬪脊妗�--> <InspectionWord v-if="unPassCheck" :inspectorList="inspectorList" :orderId="orderId" + :cableTag="temCableTag" :repetitionTag="repetitionTag" :rawMaterialTag="rawMaterialTag" :sonLaboratory="sonLaboratory" :state="state" :typeSource="typeSource" :unPassCheck="unPassCheck" @closeUnPassCheckDialog="closeUnPassCheckDialog" @refreshView="refreshView" /> + <!-- 杩涜揣楠岃瘉寮规--> <purchase-verification v-if="purchaseDialog" ref="purchaseDialog" :orderId="orderId" :purchaseDialog="purchaseDialog" @resetPurchaseDialog="resetPurchaseDialog"></purchase-verification> <!--鏌ョ湅宸ユ椂寮规--> @@ -522,6 +536,8 @@ import AddUnPass from "../unpass/components/addUnPass.vue"; import InspectionWord from "./components/InspectionWord.vue"; import PurchaseVerification from "../unpass/components/PurchaseVerification.vue"; + + import { doInsOrder, getCableTag, @@ -541,10 +557,11 @@ delfile, inspectionOrderDetailsTaskSwitching } from "@/api/business/inspectionTask.js"; -import InspectionWorker from '../../../workers/InspectionWorker.worker'; -import DataWorker from '../../../workers/DataWorker.worker'; +import InspectionWorker from '@/workers/InspectionWorker.worker.js'; +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', @@ -582,6 +599,8 @@ sampleName: null, state: null, }, + isSerialConnected: false, // 鏂板鐘舵�佸彉閲忥紝涓插彛杩炴帴鐘舵�� + serialPort: null, // 瀛樺偍涓插彛瀵硅薄 id: null, changeType: null, insOrder: {}, @@ -871,8 +890,16 @@ beforeDestroy() { // 鍦ㄧ粍浠堕攢姣佸墠纭繚鍋滄 Worker锛岄伩鍏嶅唴瀛樻硠婕� this.stopWorker(); + disconnect(); + // 璋冪敤鍓嶅厛鍒ゆ柇鏂规硶鏄惁瀛樺湪锛岄伩鍏嶆姤閿� + if (this.closeSerialPort) { + this.closeSerialPort();// 缁勪欢閿�姣佸墠鍏抽棴涓插彛 + } }, methods: { + sss() { + console.log(this.$store.state.weightList) // + }, // 鏂囦欢绠$悊--寮�濮� getList() { this.tableLoading = true; @@ -908,6 +935,22 @@ }).catch(() => { }); }, // 鏂囦欢绠$悊--缁撴潫 + // 澶勭悊鏁寸粍鍕鹃�夐�昏緫鐨勬柟娉� + handleGroupSelect(childItem, clickedIndex, groupSize = 5) { + if(groupSize == 6){ + groupSize = 6; + }else{ + groupSize = 5; + } + // 璁$畻鎵�鍦ㄧ粍鐨勮捣濮嬬储寮� + const groupStartIndex = Math.floor(clickedIndex / groupSize) * groupSize; + // 娓呯┖褰撳墠宸查�� + childItem.getDataIndex1 = []; + // 閬嶅巻褰撳墠缁勭殑 groupSize 涓厓绱狅紝娣诲姞鍒伴�変腑鍒楄〃 + for (let i = groupStartIndex; i < groupStartIndex + groupSize && i < childItem.arr.length; i++) { + childItem.getDataIndex1.push(i + '^' + childItem.arr[i]); + } + }, // 浠诲姟鍒囨崲--寮�濮� getList0() { @@ -1038,8 +1081,9 @@ id: this.currentSample.id, type: this.type, laboratory: this.sonLaboratory, - cableTag: "", + cableTag: this.temCableTag, rawMaterialTag: this.rawMaterialTag, + repetitionTag: this.repetitionTag, }; this.$nextTick(() => { this.$refs.addUnPassDialog.getInsOrder(info); @@ -1088,31 +1132,59 @@ this.$refs.purchaseDialog.$refs["purchaseForm"].resetFields(); this.purchaseDialog = false; }, + // 鏁版嵁閲囬泦 - getDataAcquisitionDevice() { - 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; + }); }); }, objectOrder(obj) { @@ -1241,7 +1313,7 @@ } else { str0 = i + "," + j; } - } + }; let list = this.tableList[0].arr; let maxNum = 0; list.forEach((item, index) => { @@ -1274,6 +1346,7 @@ } let num = 0; list[index].forEach((n) => { + // console.log(n.v.ps.value); if ( n.v.ps && n.v.ps.value && @@ -1635,20 +1708,6 @@ this.comparisonList = this.dictToValue(response.data); }); }, - // 鑾峰彇妫�楠屽�间负涓嬫媺鏃剁殑涓嬫媺鍒楄〃 - // selectEnumByCategoryOfSelect(val) { - // this.enumList = []; - // if (val === undefined || val === null) { - // return; - // } - // this.$axios - // .post(this.$api.enums.selectEnumByCategory, { - // category: val, - // }) - // .then((res) => { - // this.enumList = res.data; - // }); - // }, tableRowClassName({ row, rowIndex }) { row.index = rowIndex + 1; }, @@ -2671,12 +2730,23 @@ } else { param = this.param; } + let isNoTestValue = '' + for (let key in param) { + if (param[key]) { + if (param[key].insValue?.length === 0) { + isNoTestValue = 1 + } else { + isNoTestValue = '' + } + } + } saveInsContext({ param: JSON.stringify(param), currentTable: this.currentTable, sampleId: this.currentSample.id, orderId: this.orderId, - sonLaboratory: this.sonLaboratory + sonLaboratory: this.sonLaboratory, + isNoTestValue: isNoTestValue }).then((res) => { this.$message.success("宸蹭繚瀛�"); }); @@ -2875,6 +2945,9 @@ goback() { this.$router.go(-1) } + }, + destroyed() { + disconnect() }, }; </script> @@ -3148,4 +3221,16 @@ max-width: 1000px; /* 璁剧疆鏈�澶у搴� */ } + + +.data-collection-items { + display: flex; + flex-wrap: wrap; +} +.data-collection-items .el-select, +.data-collection-items .el-checkbox { + flex-basis: 20% ; + box-sizing: border-box; + padding: 5px 2%; +} </style> -- Gitblit v1.9.3