From c7b33db117fd2893d7d1c93bf5d46e87d33e44d0 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期一, 16 十二月 2024 16:08:51 +0800 Subject: [PATCH] 初审结果查询 --- src/views/sampling/sampling/index.vue | 213 +++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 149 insertions(+), 64 deletions(-) diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue index fa9158e..ba8ecc1 100644 --- a/src/views/sampling/sampling/index.vue +++ b/src/views/sampling/sampling/index.vue @@ -8,10 +8,10 @@ v-show="showSearch" label-width="68px" > - <el-form-item label="浣撴鍙�" prop="tjNum"> + <el-form-item label="浣撴鍙�" prop="tjNumber"> <el-input ref="inputName" - v-model="queryParams.tjNum" + v-model="queryParams.tjNumber" placeholder="璇疯緭鍏ヤ綋妫�鍙�" clearable @keyup.enter.native="handleQuery" @@ -86,8 +86,12 @@ @input="radioChange" style="margin: 10px 15px" > - <el-radio-button label="1">鏈噰鏍�</el-radio-button> - <el-radio-button label="0">宸查噰鏍�</el-radio-button> + <el-radio-button label="1" :disabled="qiehuan && disabledId === 0" + >鏈噰鏍�</el-radio-button + > + <el-radio-button label="0" :disabled="qiehuan && disabledId === 1" + >宸查噰鏍�</el-radio-button + > </el-radio-group> </el-col> <el-col @@ -107,19 +111,22 @@ <el-button type="primary" :disabled="!disabled" @click="Cancellation" >鎾ら攢鍚堝苟</el-button > - <el-button type="primary" @click="Confirmreceipt">閲囨牱鎵撶爜</el-button> + <el-button + type="primary" + @click="Confirmreceipt" + :disabled="!selectList.length" + >閲囨牱鎵撶爜</el-button + > </el-col> <el-col :span="12" style="margin: 10px 15px" v-show="samplingList.length > 0 && tjStatus == 0" > - <el-button - type="primary" - :disabled="!selectList.length" - @click="Collection" + <el-button type="primary" :disabled="!selectList.length" @click="buda" >琛ユ墦鏉$爜</el-button > + <!-- @click="Collection" --> <el-button type="primary" :disabled="!disabled" @click="Cancellation" >鎾ら攢鍚堝苟</el-button > @@ -185,15 +192,10 @@ </el-table> </div> <div style="width: 50%"> - <!-- :default-sort="{ prop: 'specimenType', order: 'ascending' }" :default-sort="{ prop: 'specimenType', order: 'ascending' }" - @sort-change="handleSortChange" - :span-method="objectSpanMethod" - @selection-change="handleChange" ref="tab1" - :row-class-name="tableRowClassName"--> + <!-- v-if="this.rightTabShow" --> <el-table v-loading="loading" :data="tableList" - @sort-change="handleSortChange" @selection-change="handleChange" :span-method="objectSpanMethod" ref="tab1" @@ -376,6 +378,8 @@ return { msg: "", getNumbr: null, + valueUrl: "ws://127.0.0.1:6789/websocket", + webSocket: null, list: [], selectList: [], selectedRows: [], @@ -387,6 +391,9 @@ ids: [], // 缁戝畾鍗曢�夋寜閽� tjStatus: "1", + dayinData: [], + jsonObj: {}, + // 闈炲崟涓鐢� single: true, // 闈炲涓鐢� @@ -411,7 +418,7 @@ pageNum: 1, pageSize: 20, name: null, - tjNum: null, + tjNumber: null, applicationTime: null, isSignFor: null, tjTime: null, @@ -455,12 +462,14 @@ form: {}, // 琛ㄥ崟鏍¢獙 rules: {}, + // rightTabShow: false }; }, created() { // this.getNowTime(); getTxmmccd().then((res) => { this.msg = Number(res.msg); + console.log(res, 444); }); this.getdate(); }, @@ -476,21 +485,15 @@ this.selectList[this.selectList.length - 1].isMerge === 1 ); }, + qiehuan() { + return this.selectList.length > 0; + }, + disabledId() { + return this.tjStatus == "1" ? 1 : 0; + }, }, methods: { - handleSortChange({ prop, order }) { - if (order === null) return; // 鏃犳帓搴忔椂涓嶅鐞� - - this.tableList.sort((a, b) => { - // 濡傛灉鏍囨湰绫诲瀷鐩稿悓锛岀户缁寜鐓ч噰鏍风紪鍙锋帓搴� - if (a.jyxh !== b.jyxh) { - return order === "ascending" ? a.jyxh - b.jyxh : b.jyxh - a.jyxh; - } - - return 0; - }); - }, getTruncatedName(proName) { // 鍘绘帀鎵�鏈夌┖鏍� const trimmedProName = proName.replace(/\s+/g, ""); @@ -600,7 +603,9 @@ // 鍒ゆ柇鏄惁闇�瑕佸埛鏂板彸杈硅〃鏍� this.$nextTick(() => { this.$refs.tb.toggleRowSelection(this.samplingList[0], true); - this.fetchData(this.samplingList[0].cusId); + // this.fetchData(this.samplingList[0].tjNumber); + // ddddddddddddddd + // this.rightTabShow = true }); } this.total = response.data.total; @@ -650,7 +655,7 @@ this.form = { id: null, samplingNumber: null, - cusId: null, + tjNumber: null, applicationTime: null, isSignFor: null, tjTime: null, @@ -663,10 +668,9 @@ updateTime: null, deleted: null, }; - this.resetForm("form"); }, hb() { - if (this.queryParams.tjNum != null) { + if (this.queryParams.tjNumber != null) { this.handleQuery(); } }, @@ -678,7 +682,6 @@ /** 閲嶇疆鎸夐挳鎿嶄綔 */ resetQuery() { this.createTimeList = []; - this.resetForm("queryForm"); this.handleQuery(); }, // 鍗曢�夋閫変腑鏁版嵁 @@ -712,9 +715,10 @@ // 鍙湁涓�涓汉琚�変腑鏃惰繘琛屾搷浣� if (selection.length === 1) { const selectedPerson = selection[0]; // 鑾峰彇閫変腑鐨勯偅涓汉 - const cusId = selectedPerson.cusId; // 鍋囪cusId鍦ㄩ�変腑鐨勫璞′腑 + const tjNumber = selectedPerson.tjNumber; + console.log(selectedPerson.tjNumber, 6363); - this.fetchData(cusId); + this.fetchData(tjNumber); } else { // 濡傛灉閫変腑澶氫汉锛屽垯鍙栨秷閫変腑 if (selection.length > 1) { @@ -730,10 +734,10 @@ this.selectedRows = selection; }, - fetchData(cusId) { + fetchData(tjNumber) { this.loading = true; // 鏄剧ず鍔犺浇鐘舵�� - getCusCyList(cusId, this.tjStatus) // 璋冪敤API鑾峰彇鏁版嵁 + getCusCyList(tjNumber, this.tjStatus) // 璋冪敤API鑾峰彇鏁版嵁 .then((response) => { if (response.data) { console.log(response, 2525); @@ -779,7 +783,7 @@ this.$message.success("鍚堝苟鎴愬姛銆�"); // console.log("鍚堝苟鐨勮:", this.selectedRows); // this.getList(); - this.fetchData(this.selectedRows[0].cusId); + this.fetchData(this.selectedRows[0].tjNumber); }); } else { this.$message.error("鏍囨湰绫诲瀷涓嶄竴鑷达紝鏃犳硶鍚堝苟锛�"); @@ -808,7 +812,7 @@ this.$message.success("鎾ら攢鎴愬姛锛�"); // 鍒锋柊鏁版嵁鍒楄〃鎴栬繘琛屽叾浠栨搷浣� // this.getList(); - this.fetchData(this.selectedRows[0].cusId); + this.fetchData(this.selectedRows[0].tjNumber); } else { this.$message.error(res.msg || "鎾ら攢澶辫触锛岃閲嶈瘯锛�"); } @@ -820,14 +824,12 @@ /** 鐐瑰嚮琛ユ墦鏉$爜鎸夐挳 **/ async Collection() { + const jyxh = this.selectList.map((item) => item.jyxh); + console.log("jyxh:", jyxh); try { // 璇锋眰鎺ュ彛骞惰幏鍙栧搴﹀�� const widthResponse = await getTxmkd(); const barcodeWidth = `${Number(widthResponse.msg)}%` || "70%"; // 鑾峰彇瀹藉害鍊硷紝榛樿浣跨敤 70% - - const jyxh = this.selectList.map((item) => item.jyxh); - - await this.$nextTick(); // 纭繚 DOM 鏇存柊 jyxh.forEach((number, index) => { const barcodeContent = number; // 纭繚 jyxh 鏄湁鏁堢殑 @@ -843,7 +845,7 @@ } }); - await this.$nextTick(); // 纭繚鏉″舰鐮佺敓鎴愬畬鎴� + // await this.$nextTick(); const barcodeElements = jyxh.map((_, index) => document.querySelector(`#barcode${index}`) @@ -918,11 +920,11 @@ } .last p { // font-weight: bold; - margin-left: 10px; + margin-left: 1px; // font-family: "Arial Black", sans-serif !important; } p { - margin-left: 10px; + margin-left: 1px; // font-weight: bold; // font-family: "Arial Black", sans-serif !important; } @@ -935,7 +937,7 @@ font-family: "Arial Black", sans-serif !important; } .tj span { - margin-left: 10px; + margin-left: 1px; } } </style> @@ -964,26 +966,62 @@ // console.log(selection); this.selectList = selection; + console.log(this.selectList, 9977); + var array = selection; - this.ids = selection.map((item) => item.id); + this.ids = array.map((item) => item.id); }, - - // 绂侀�� - // selectEnable(row, rowIndex) { - // if(row.isSignFor === "0"){ - // return false - // }else{ - // return true - // } - // }, // 纭畾鎸夐挳 submitForm() {}, + buda() { + var websocket = null; + var url = this.valueUrl; + if ("WebSocket" in window) { + websocket = new WebSocket(url); + } else if ("MozWebSocket" in window) { + websocket = new MozWebSocket(url); + } + if (websocket == null) { + alert("鍒涘缓WebSocket瀵硅薄澶辫触"); + } + websocket.onerror = function () { + alert("璇锋鏌ヨ鍗″櫒杩炴帴鏄惁姝e父"); + }; + websocket.onopen = () => { + this.websocket = websocket; + this.dayinData = this.selectList.map((item) => ({ + jyxh: item.jyxh, + proName: item.proName, + cusName: item.cusName, + cusSex: item.customer.cusSex, + age: item.customer.age, + cardId: item.cardId, + tjTime: item.createTime, + })); + console.log(this.dayinData, 2222); + + // 杩炴帴璁惧 + this.jsonObj = { + type: "3", + array: { + data: this.dayinData, + }, + }; + var jStr = JSON.stringify(this.jsonObj); + this.websocket.send(jStr); + this.jsonObj = {}; + // this.dialogVisible = false; + }; + // this.getList(); + }, + // 纭閲囨牱 Confirmreceipt() { - let data = this.ids; - console.log(this.ids, 999); + console.log(this.selectList, 999); + + console.log(1111); const loadingInstance = this.$loading({ lock: true, // 閿佸畾灞忓箷 @@ -993,16 +1031,63 @@ }); confirmSampling(this.ids) .then((res) => { + console.log(this.selectList, 2222); + if (res.code === 200) { - this.$modal.msgSuccess("閲囨牱鎴愬姛"); - this.Collection(); - }else{ - this.$message.error(res.msg) + // var websocket = null; + this.buda(); + + /* var url = this.valueUrl; + if ("WebSocket" in window) { + websocket = new WebSocket(url); + } else if ("MozWebSocket" in window) { + websocket = new MozWebSocket(url); + } + if (websocket == null) { + alert("鍒涘缓WebSocket瀵硅薄澶辫触"); + } + websocket.onerror = function () { + alert("璇锋鏌ヨ鍗″櫒杩炴帴鏄惁姝e父"); + }; + websocket.onopen = () => { + this.websocket = websocket; + var list = this.selectList; + var data = list.map((item) => ({ + jyxh: item.jyxh, + proName: item.proName, + cusName: item.cusName, + cusSex: item.customer.cusSex, + age: item.customer.age, + cardId: item.cardId, + tjTime: item.createTime, + })); + + // 杩炴帴璁惧 + var jsonObj = { + type: "3", + array: { + data: data, + }, + }; + var jStr = JSON.stringify(jsonObj); + this.websocket.send(jStr); + var jsonObj = {}; + this.dialogVisible = false; + }; + websocket.onmessage = (event) => { + var resultObj = eval("(" + event.data + ")"); + console.log(resultObj, 9988); + }; */ + + // this.Collection(); + this.getList(); + } else { + this.$message.error(res.msg); } // this.getList(); }) .catch((error) => { - this.$message.error(res.msg); + // this.$message.error("閲囨牱澶辫触"); }) .finally(() => { loadingInstance.close(); -- Gitblit v1.8.0