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/tijian/index.vue | 82 +++++++++++++++++++++++++++++++++++------ 1 files changed, 70 insertions(+), 12 deletions(-) diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue index da8a012..f84b262 100644 --- a/src/views/system/tijian/index.vue +++ b/src/views/system/tijian/index.vue @@ -2478,8 +2478,34 @@ "$1-$2-$3" ); } - _this.form.cusAddr = resultObj.data.addres; _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; }; @@ -2489,7 +2515,7 @@ }; } else { // if (_this.inputSSS.indexOf(":1") != -1) { - + // var str1 = _this.inputSSS.indexOf(":1"); // var result1 = _this.inputSSS.substring(0, str1); @@ -2501,7 +2527,7 @@ // _this.inputSSS = result1 + result2; // } - _this.inputSSS = _this.inputSSS.replace(":1",""); + _this.inputSSS = _this.inputSSS.replace(":1", ""); var websocket = null; var url = this.valueUrls; // var url = 'ws://'+ getIp() +':6789/websocket' @@ -2552,17 +2578,49 @@ websocket.onmessage = function (event) { var resultObj = JSON.parse(event.data); _this.form.cusName = resultObj.data.name; - _this.form.cusSex = resultObj.data.gender; - _this.form.cusNational = resultObj.data.nation; - // _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" - // ); - // } + + 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; }; -- Gitblit v1.8.0