From f169a06cea16bc6215743a7be07febdb1d4fdc38 Mon Sep 17 00:00:00 2001 From: qinxianzhangyao <11053546+qinxianzhangyao@user.noreply.gitee.com> Date: 星期五, 12 七月 2024 17:16:55 +0800 Subject: [PATCH] qxtj --- src/views/system/tijianall/index.vue | 557 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 472 insertions(+), 85 deletions(-) diff --git a/src/views/system/tijianall/index.vue b/src/views/system/tijianall/index.vue index 00a73b2..0e68b0a 100644 --- a/src/views/system/tijianall/index.vue +++ b/src/views/system/tijianall/index.vue @@ -920,6 +920,32 @@ </el-row> <el-dialog + title="鎻愮ず" + :visible.sync="cardreader" + width="30%" + :close-on-press-escape="false" + :close-on-click-modal="false" + > + <template> + <el-radio-group v-model="cardreaderradio" @input="changeradio"> + <el-radio :label="3">韬唤璇�</el-radio> + <el-radio :label="6">鍋ュ悍鐮�</el-radio> + </el-radio-group> + <div style="margin-top: 10px" v-show="cardreaderradio == 6"> + <el-input + v-model="inputSSS" + ref="tableHeadFilterInp" + placeholder="璇疯緭鍏ュ唴瀹�" + ></el-input> + </div> + </template> + <span slot="footer" class="dialog-footer"> + <el-button @click="cardreader = false">鍙� 娑�</el-button> + <el-button type="primary" @click="cardreadercopes">纭� 瀹�</el-button> + </span> + </el-dialog> + + <el-dialog title="瀵兼鍗曢瑙�" :visible.sync="dialogVisibles" :close-on-click-modal="false" @@ -946,12 +972,14 @@ </span> </el-dialog> <historyTj :cusIdCard="form.cusIdcard" ref="historyTj"></historyTj> + <Packages ref="aaa" @add="handleChanges" /> </div> </template> <script> import printJS from "print-js"; import { getInfo } from "@/api/login"; +import Packages from "@/components/Packages"; import { getZhList, getlistByZhId } from "@/api/system/package"; import { deptTreeSelect, @@ -962,7 +990,7 @@ getTransitionList, getProParentIdDxList, getProSonDxList, - getaddTj, + getaddTj,getconfigKey, getHistryTjOrderProByCusIdCard, delTbBycusCardIdAndProId, } from "@/api/system/tijian"; @@ -971,7 +999,7 @@ export default { components: { VTreeTransfer, - historyTj, + historyTj,Packages }, dicts: [ "dict_user_national", @@ -1031,7 +1059,12 @@ tableDatas: [], packageList: [], checkedkeys: [], + valueUrl: "ws://127.0.0.1:18890", + valueUrls: "ws://127.0.0.1:6789/websocket", dialogVisiblese: false, + cardreader: false, + cardreaderradio:3, + inputSSS: "", lishi: false, table: false, HistoryList: {}, @@ -1590,30 +1623,377 @@ this.$message.error("姝ょ敤鎴蜂笉瀛樺湪"); }); } else { - var host = "ws://127.0.0.1:5001/YckjCard"; - if (this.socket == null) { - this.socket = new WebSocket(host); - if (this.socket != null) { - alert("杩炴帴鎴愬姛."); + let configKey = "getInfoFromSqlData"; + getconfigKey(configKey).then((res) => { + if (res.code == 200) { + if (res.msg == "N") { + var websocket = null; + var url = this.valueUrl; + if ("WebSocket" in window) { + websocket = new WebSocket(url); + } else if ("MozWebSocket" in window) { + websocket = new MozWebSocket(url); + } else { + // console.log("SockJS"); + } + + if (websocket == null) { + alert("鍒涘缓WebSocket瀵硅薄澶辫触"); + } + + //杩炴帴鍙戠敓閿欒鐨勫洖璋冩柟娉� + websocket.onerror = function () { + alert("璇锋鏌ヨ鍗″櫒杩炴帴鏄惁姝e父"); + }; + + //杩炴帴鎴愬姛寤虹珛鐨勫洖璋冩柟娉� + websocket.onopen = function () { + this.websocket = websocket; + // 杩炴帴璁惧 + var jsonObj = { + name: "connect", + }; + var jStr = JSON.stringify(jsonObj); + this.websocket.send(jStr); + alert("璇锋斁韬唤璇佸啀鐐圭‘璁�"); + var jsonObj = { + name: "readCert", + }; + var jStr = JSON.stringify(jsonObj); + this.websocket.send(jStr); + this.dialogVisible = false; + }; + + //鎺ユ敹鍒版秷鎭殑鍥炶皟鏂规硶 + websocket.onmessage = function (event) { + var resultObj = eval("(" + event.data + ")"); + //resultFlag涓�0浠h〃璇诲崱鎴愬姛 + if ( + resultObj.name == "readCard" || + resultObj.name == "readCert" || + resultObj.name == "PushWithImg" || + resultObj.name == "PushWithOutImg" + ) { + if (resultObj.resultFlag == "0") { + //鍥炴樉鐩稿叧鏁版嵁 + _this.form.cusName = resultObj.resultContent.partyName; + _this.form.cusSex = + resultObj.resultContent.gender == "0" ? "濂�" : "鐢�"; + _this.form.cusNational = resultObj.resultContent.nation; + _this.form.cusBrithday = resultObj.resultContent.bornDay; + if (_this.form.cusBrithday) { + _this.form.cusBrithday = _this.form.cusBrithday.replace( + /^(\d{4})(\d{2})(\d{2})$/, + "$1-$2-$3" + ); + } + _this.form.cusAddr = resultObj.resultContent.certAddress; + _this.form.cusIdcard = resultObj.resultContent.certNumber; + _this.imageUrl = + "data:image/jpeg;base64," + + resultObj.resultContent.identityPic; + if ( + resultObj.name == "readCert" || + resultObj.name == "PushWithImg" + ) { + this.imageUrl = + "data:image/jpeg;base64," + + resultObj.resultContent.identityPrintPic; + } + } else if (resultObj.resultFlag == "-1") { + if (resultObj.errorMsg == "绔彛鎵撳紑澶辫触") { + //alert("璇诲崱鍣ㄦ湭杩炴帴"); + } else { + //alert(resultObj.errorMsg); + } + } else if (resultObj.resultFlag == "-2") { + //alert(resultObj.errorMsg); + } + } else if (resultObj.name == "getStatus") { + if (resultObj.resultFlag == "0") { + if (resultObj.status == "0") { + } else { + alert("璁惧杩炴帴宸叉柇寮�锛岃妫�鏌ヨ鍗″櫒杩炴帴"); + } + } + } + }; + + //杩炴帴鍏抽棴鐨勫洖璋冩柟娉� + websocket.onclose = function () { + alert("璇诲崱鍣ㄨ繛鎺ュ叧闂�"); + }; + } else if (res.msg == "Y") { + this.$refs.aaa.open = true; + this.$refs.aaa.getAllList(); + this.$refs.aaa.title = "璇佷欢瀛楀吀"; + } else if (res.msg == "S") { + this.cardreader = true; + _this.cardreaderradio = 3; + _this.inputSSS = ""; + // let url = window.location.protocol + "//" + window.location.host; + // console.log(url); + // axios + // .get("http://localhost:81/dev-api/readCertCardInfos") + // .then((res) => { + // console.log(res); + // }) + // .catch((err) => { + // console.log(err); + // }); + + // readCertCardInfos().then((res) => { + // _this.form.cusName = res.data.name; + // _this.form.cusSex = + // res.data.sex; + // _this.form.cusNational = res.data.mz; + // _this.form.cusBrithday = res.data.csrq; + // if (_this.form.cusBrithday) { + // _this.form.cusBrithday = _this.form.cusBrithday.replace( + // /^(\d{4})(\d{2})(\d{2})$/, + // "$1-$2-$3" + // ); + // } + // _this.form.cusAddr = res.data.addres; + // _this.form.cusIdcard = res.data.card; + // }); + } } - } else { - alert("璁惧宸叉墦寮�."); - } - try { - this.socket.onmessage = function (msg) { - // if (typeof msg.data == "string") { - // var msgM = msg.data + ""; - // resultMsg("璇诲崱杩斿洖淇℃伅锛�" + msg.data); - // } - // else { - // alert("杩炴帴寮傚父,璇锋鏌ラ┍鍔�."); - // } - }; - } catch (ex) { - alert("杩炴帴寮傚父,璇锋鏌ラ┍鍔�."); - } + }); } }, + + handleChanges(param1) { + if (this.form.pacCode == "涓嶈") { + this.form.cusIdcard = param1[0].xh; + } else { + this.form.cusIdcard = param1[0].pacCode; + } + + // this.form.cusName = param1[0].pacName; + // this.form.cusPhone = param1[0].pacRemark; + }, + + + changeradio() { + if (this.cardreaderradio != 3) { + this.$nextTick(() => { + this.$refs.tableHeadFilterInp.focus(); + }); + } + }, + cardreadercopes() { + let _this = this; + + if (this.cardreaderradio == 3) { + var websocket = null; + var url = this.valueUrls; + // var url = 'ws://'+ getIp() +':6789/websocket' + if ("WebSocket" in window) { + websocket = new WebSocket(url); + } else if ("MozWebSocket" in window) { + websocket = new MozWebSocket(url); + } else { + // console.log("SockJS"); + } + if (websocket == null) { + alert("11111"); + } + websocket.onopen = function () { + try { + // 杩炴帴璁惧 + var jsonObjs = { + type: 1, + data: {}, + }; + var jStrs = JSON.stringify(jsonObjs); + websocket.send(jStrs); + } catch (err) { + var tryTime = 0; + // 閲嶈瘯10娆★紝姣忔涔嬮棿闂撮殧3绉� + if (tryTime < 1) { + var t1 = setTimeout(function () { + tryTime++; + var jsonObjs = { + type: 1, + data: {}, + }; + var jStrs = JSON.stringify(jsonObjs); + websocket.send(jStrs); + }, 1 * 1000); + } else { + console.error("閲嶈繛澶辫触."); + } + } + }; + websocket.onclose = function () { + alert("璇诲崱鍣ㄨ繛鎺ュ叧闂�"); + }; + websocket.onmessage = function (event) { + var resultObj = JSON.parse(event.data); + _this.form.cusName = resultObj.data.name; + _this.form.cusSex = resultObj.data.sex; + _this.form.cusNational = resultObj.data.mz; + _this.form.cusBrithday = resultObj.data.csrq; + if (_this.form.cusBrithday) { + _this.form.cusBrithday = _this.form.cusBrithday.replace( + /^(\d{4})(\d{2})(\d{2})$/, + "$1-$2-$3" + ); + } + _this.form.cusIdcard = resultObj.data.card; + if (_this.form.cusIdcard) { + const reg = + /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; + if (reg.test(_this.form.cusIdcard)) { + var org_birthday = _this.form.cusIdcard.substring(6, 14); + var birthday = + org_birthday.substring(0, 4) + + "-" + + org_birthday.substring(4, 6) + + "-" + + org_birthday.substring(6, 8); + var birthdays = new Date(birthday.replace(/-/g, "-")); + let d = new Date(); + let age = + d.getFullYear() - + birthdays.getFullYear() - + (d.getMonth() < birthdays.getMonth() || + (d.getMonth() == birthdays.getMonth() && + d.getDate() < birthdays.getDate()) + ? 1 + : 0); + + _this.form.age = age; + } + } + _this.form.cusAddr = resultObj.data.addres; + + _this.cardreader = false; + }; + + //杩炴帴鍙戠敓閿欒鐨勫洖璋冩柟娉� + websocket.onerror = function () { + alert("璇锋鏌ヨ鍗″櫒杩炴帴鏄惁姝e父"); + }; + } else { + // if (_this.inputSSS.indexOf(":1") != -1) { + + // var str1 = _this.inputSSS.indexOf(":1"); + // var result1 = _this.inputSSS.substring(0, str1); + + // var str2 = _this.inputSSS.indexOf(":1"); + // var result2 = _this.inputSSS.substring( + // str2 + 2, + // _this.inputSSS.length + // ); + + // _this.inputSSS = result1 + result2; + // } + _this.inputSSS = _this.inputSSS.replace(":1", ""); + var websocket = null; + var url = this.valueUrls; + // var url = 'ws://'+ getIp() +':6789/websocket' + if ("WebSocket" in window) { + websocket = new WebSocket(url); + } else if ("MozWebSocket" in window) { + websocket = new MozWebSocket(url); + } else { + // console.log("SockJS"); + } + if (websocket == null) { + alert("11111"); + } + websocket.onopen = function () { + try { + // 杩炴帴璁惧 + var jsonObjs = { + type: 2, + data: { + qrcode: _this.inputSSS, + }, + }; + var jStrs = JSON.stringify(jsonObjs); + websocket.send(jStrs); + } catch (err) { + var tryTime = 0; + // 閲嶈瘯10娆★紝姣忔涔嬮棿闂撮殧3绉� + if (tryTime < 1) { + var t1 = setTimeout(function () { + tryTime++; + var jsonObjs = { + type: 2, + data: { + qrcode: _this.inputSSS, + }, + }; + var jStrs = JSON.stringify(jsonObjs); + websocket.send(jStrs); + }, 1 * 1000); + } else { + console.error("閲嶈繛澶辫触."); + } + } + }; + websocket.onclose = function () { + alert("璇诲崱鍣ㄨ繛鎺ュ叧闂�"); + }; + websocket.onmessage = function (event) { + var resultObj = JSON.parse(event.data); + _this.form.cusName = resultObj.data.name; + + if( resultObj.data.nation == "姹夋棌"){ + _this.form.cusNational ="1"; + } + if(resultObj.data.gender == "鐢�"){ + _this.form.cusSex = 0; + }else{ + _this.form.cusSex = 1; + } + _this.form.cusBrithday = resultObj.data.birthday; + if (_this.form.cusBrithday) { + _this.form.cusBrithday = _this.form.cusBrithday.replace( + /^(\d{4})(\d{2})(\d{2})$/, + "$1-$2-$3" + ); + } + _this.form.cusPhone = resultObj.data.phone; + _this.form.cusIdcard = resultObj.data.idenno; + if (_this.form.cusIdcard) { + const reg = + /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; + if (reg.test(_this.form.cusIdcard)) { + var org_birthday = _this.form.cusIdcard.substring(6, 14); + var birthday = + org_birthday.substring(0, 4) + + "-" + + org_birthday.substring(4, 6) + + "-" + + org_birthday.substring(6, 8); + var birthdays = new Date(birthday.replace(/-/g, "-")); + let d = new Date(); + let age = + d.getFullYear() - + birthdays.getFullYear() - + (d.getMonth() < birthdays.getMonth() || + (d.getMonth() == birthdays.getMonth() && + d.getDate() < birthdays.getDate()) + ? 1 + : 0); + + _this.form.age = age; + } + } + _this.cardreader = false; + }; + + //杩炴帴鍙戠敓閿欒鐨勫洖璋冩柟娉� + websocket.onerror = function () { + alert("璇锋鏌ヨ鍗″櫒杩炴帴鏄惁姝e父"); + }; + } + }, + // checkSelectable(row, index) { // if (!row) { @@ -1669,33 +2049,34 @@ } }); }, - Package() { this.taocan = true; - let cusSex = this.form.cusSex; this.activeNames = "first"; + let cusSex = this.form.cusSex; this.datekey = Date.now(); //鍏ㄩ儴濂楅 this.loading = true; deptTreeSelect(cusSex).then((response) => { this.newpacName = response.rows; try { - this.newpacName.forEach((item3) => { - this.tableData1.forEach((item4) => { - item4.list.forEach((item6) => { - if (item6.pacName === item3.pacName) { - this.$nextTick(() => { - this.$refs.tb.toggleRowSelection(item3, true); - }); - throw Error(); - } + if (this.tableData1.length >= 1) { + this.newpacName.forEach((item3) => { + this.tableData1.forEach((item4) => { + item4.list.forEach((item6) => { + if (item6.pacName === item3.pacName) { + this.$nextTick(() => { + this.$refs.tb.toggleRowSelection(item3, true); + }); + throw Error(); + } + }); }); }); - }); + } } catch (error) {} this.loading = false; }); - // this.getDataList(); + // this.getData(); }, // 鎶樻墸 @@ -1793,39 +2174,41 @@ handleClick(tab, event) { if (this.activeNames == "second") { this.DataList = []; + this.checkedkey = []; this.getDataList(); } else if (this.activeNames == "third") { this.DataLists = []; + this.checkedkeys = []; getZhList().then((response) => { if (response.data) { this.packageList = response.data; - this.checkedkeys.push(this.packageList[0].id); - let datas = { - zhId: this.packageList[0].id, - }; - getlistByZhId(datas).then((res) => { - this.packagedataList = res.data.tjProjectList; - for (var i = 0; i < this.packagedataList.length; i++) { - let proId = this.packagedataList[i].proId; - getProSonDxList(proId).then((res) => { - this.TreedataList = res.data.list; - this.TreedataList.forEach((item) => { - this.DataLists.push(item); - if (this.DataLists.length >= 1) { - this.marryalls = 0; - this.DataLists.forEach((item1) => { - this.marryalls += item1.proPrice; - this.packagedataList.forEach((item3) => { - if (item1.proParentId == item3.proId) { - item1.propinName = item3.proName; - } - }); - }); - } - }); - }); - } - }); + // this.checkedkeys.push(this.packageList[0].id); + // let datas = { + // zhId: this.packageList[0].id, + // }; + // getlistByZhId(datas).then((res) => { + // this.packagedataList = res.data.tjProjectList; + // for (var i = 0; i < this.packagedataList.length; i++) { + // let proId = this.packagedataList[i].proId; + // getProSonDxList(proId).then((res) => { + // this.TreedataList = res.data.list; + // this.TreedataList.forEach((item) => { + // this.DataLists.push(item); + // if (this.DataLists.length >= 1) { + // this.marryalls = 0; + // this.DataLists.forEach((item1) => { + // this.marryalls += item1.proPrice; + // this.packagedataList.forEach((item3) => { + // if (item1.proParentId == item3.proId) { + // item1.propinName = item3.proName; + // } + // }); + // }); + // } + // }); + // }); + // } + // }); } this.loading = false; }); @@ -1869,27 +2252,27 @@ // }); // }); // } - this.checkedkey.push(this.Treedata[0].proId); - let proId = this.Treedata[0].proId; - getProSonDxList(proId).then((res) => { - this.TreedataList = res.data.list; - this.TreedataList.forEach((item) => { - this.checkedListkey.push(item.proId); - this.DataList.push(item); - this.DataList.forEach((item) => { - item.propinName = this.Treedata[0].proName; - }); - }); - this.TotalPrice1 = 0; - this.marryall = 0; - if (this.DataList.length != 0) { - this.list1 = false; - this.DataList.forEach((item) => { - this.TotalPrice1 = item.proPrice + this.TotalPrice1; - this.marryall += item.proPrice; - }); - } - }); + // this.checkedkey.push(this.Treedata[0].proId); + // let proId = this.Treedata[0].proId; + // getProSonDxList(proId).then((res) => { + // this.TreedataList = res.data.list; + // this.TreedataList.forEach((item) => { + // this.checkedListkey.push(item.proId); + // this.DataList.push(item); + // this.DataList.forEach((item) => { + // item.propinName = this.Treedata[0].proName; + // }); + // }); + // this.TotalPrice1 = 0; + // this.marryall = 0; + // if (this.DataList.length != 0) { + // this.list1 = false; + // this.DataList.forEach((item) => { + // this.TotalPrice1 = item.proPrice + this.TotalPrice1; + // this.marryall += item.proPrice; + // }); + // } + // }); this.loading = false; }); }, @@ -1932,7 +2315,6 @@ // this.DataLists.forEach((item1, index) => { // if (item.proId == item1.proId) { // this.DataLists.splice(index, 1); - // } // }); // }); @@ -2170,6 +2552,9 @@ this.tableData1.forEach((item) => { this.TotalPrice1 += item.nowPrice; this.TotalPrice = this.TotalPrice1 + ".00"; + if (item.tjCategory != null) { + this.form.category = item.tjCategory; + } if (item.pacName === null) { item.pacName = "鍗曢」"; } @@ -2185,6 +2570,8 @@ } }); this.taocan = false; + this.defaultKeys = []; + this.DataLists = []; }, // 鏈�鍚庢彁浜ゆ寜閽� -- Gitblit v1.8.0