| | |
| | | <el-button type="primary" @click="copes">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <Packages ref="aaa" @add="handleChanges" /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | getTransitionList, |
| | | getByTeamNo, |
| | | getLoadFile, |
| | | getIsRequired, |
| | | getIsRequired, getconfigKey, |
| | | getHistryTjOrderProByCusIdCard, |
| | | } from "@/api/system/tijian"; |
| | | import Packages from "@/components/Packages"; |
| | | import { MessageBox } from "element-ui"; |
| | | import VTreeTransfer from "./TreeTransfer.vue"; |
| | | import historyTj from "@/components/historyTj/index"; |
| | |
| | | components: { |
| | | VTreeTransfer, |
| | | historyTj, |
| | | Packages |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | // this.$message.error("此用户不存在"); |
| | | // }); |
| | | } else { |
| | | 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("读卡器未连接"); |
| | | 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 { |
| | | //alert(resultObj.errorMsg); |
| | | // console.log("SockJS"); |
| | | } |
| | | } else if (resultObj.resultFlag == "-2") { |
| | | //alert(resultObj.errorMsg); |
| | | } |
| | | } else if (resultObj.name == "getStatus") { |
| | | if (resultObj.resultFlag == "0") { |
| | | if (resultObj.status == "0") { |
| | | } else { |
| | | alert("设备连接已断开,请检查读卡器连接"); |
| | | |
| | | 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 = "证件字典"; |
| | | } |
| | | } |
| | | }; |
| | | }) |
| | | |
| | | //连接关闭的回调方法 |
| | | websocket.onclose = function () { |
| | | alert("读卡器连接关闭"); |
| | | }; |
| | | } |
| | | }, |
| | | |
| | | handleChanges(param1) { |
| | | this.form.cusIdcard = param1[0].pacCode; |
| | | // this.form.cusName = param1[0].pacName; |
| | | // this.form.cusPhone = param1[0].pacRemark; |
| | | |
| | | }, |
| | | |
| | | // selected(row, index) { |
| | | // if (this.formPacId !== null) { |
| | | // if (row.pacId == this.formPacId) { |