| | |
| | | </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" |
| | |
| | | </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, |
| | |
| | | getTransitionList, |
| | | getProParentIdDxList, |
| | | getProSonDxList, |
| | | getaddTj, |
| | | getaddTj,getconfigKey, |
| | | getHistryTjOrderProByCusIdCard, |
| | | delTbBycusCardIdAndProId, |
| | | } from "@/api/system/tijian"; |
| | |
| | | export default { |
| | | components: { |
| | | VTreeTransfer, |
| | | historyTj, |
| | | historyTj,Packages |
| | | }, |
| | | dicts: [ |
| | | "dict_user_national", |
| | |
| | | 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: {}, |
| | |
| | | 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("请检查读卡器连接是否正常"); |
| | | }; |
| | | |
| | | //连接成功建立的回调方法 |
| | | 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代表读卡成功 |
| | | 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("请检查读卡器连接是否正常"); |
| | | }; |
| | | } 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("请检查读卡器连接是否正常"); |
| | | }; |
| | | } |
| | | }, |
| | | |
| | | |
| | | // checkSelectable(row, index) { |
| | | // if (!row) { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | 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(); |
| | | }, |
| | | |
| | | // 折扣 |
| | |
| | | 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; |
| | | }); |
| | |
| | | // }); |
| | | // }); |
| | | // } |
| | | 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; |
| | | }); |
| | | }, |
| | |
| | | // this.DataLists.forEach((item1, index) => { |
| | | // if (item.proId == item1.proId) { |
| | | // this.DataLists.splice(index, 1); |
| | | |
| | | // } |
| | | // }); |
| | | // }); |
| | |
| | | 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 = "单项"; |
| | | } |
| | |
| | | } |
| | | }); |
| | | this.taocan = false; |
| | | this.defaultKeys = []; |
| | | this.DataLists = []; |
| | | }, |
| | | |
| | | // 最后提交按钮 |