From b977b7e4b46d14ee407f4d8f07b4c818b19b87be Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期四, 05 十二月 2024 12:28:29 +0800 Subject: [PATCH] lkk-12-05 --- src/views/system/tijian/index.vue | 238 +++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 140 insertions(+), 98 deletions(-) diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue index da8a012..65631ab 100644 --- a/src/views/system/tijian/index.vue +++ b/src/views/system/tijian/index.vue @@ -574,6 +574,9 @@ :data="packagedataList" node-key="proId" :props="defaultpackProps" + :filter-node-method="filterpackage" + @check-change="handlePackageChecked" + :default-checked-keys="checkedListkey1" :render-content="renderContent" > </el-tree> @@ -1593,6 +1596,7 @@ treedataList: [], checkedkey: [], checkedListkey: [], + checkedListkey1: [], defaultProps: { children: [], label: "proName", @@ -1615,10 +1619,11 @@ pacName: null, pacRemark: null, }, - valueUrl: "ws://127.0.0.1:18890", + // valueUrl: "ws://127.0.0.1:18890", + valueUrl: "ws://127.0.0.1:6789/websocket", valueUrls: "ws://127.0.0.1:6789/websocket", // valueUrls: "ws://"+getIp() +":6789/websocket", - WebSocket: null, + webSocket: null, // 韬唤璇侀渶瑕� // socket: null, // value: 1, @@ -1648,12 +1653,13 @@ // 琛ㄥ崟鍙傛暟 // 琛ㄥ崟鍙傛暟 + obj: {}, form: { cusIdcard: "", - tjType: "2", + tjType: "3", cusSex: 1, cusNational: "1", - cusMarryStatus: "1", + cusMarryStatus: "5", idType: "1", ageUnit: "0", }, @@ -1685,6 +1691,10 @@ this.startTimer(); this.getList1(); // this.getData(); + }, + mounted(){ + console.log(this.dict.type.dict_user_marry,555); + }, methods: { @@ -2192,7 +2202,7 @@ this.discount = this.form.discount; } if (this.form.tjType === null) { - this.form.tjType = "2"; + this.form.tjType = "3"; } if (this.form.reservationId != null) { if (this.form.groupingId) { @@ -2275,6 +2285,7 @@ } else { let configKey = "getInfoFromSqlData"; getconfigKey(configKey).then((res) => { + console.log(res); if (res.code == 200) { if (res.msg == "N") { var websocket = null; @@ -2301,16 +2312,17 @@ this.websocket = websocket; // 杩炴帴璁惧 var jsonObj = { - name: "connect", + // name: "connect", + type: "1", }; var jStr = JSON.stringify(jsonObj); this.websocket.send(jStr); alert("璇锋斁韬唤璇佸啀鐐圭‘璁�"); var jsonObj = { - name: "readCert", + // name: "readCert", }; - var jStr = JSON.stringify(jsonObj); - this.websocket.send(jStr); + // var jStr = JSON.stringify(jsonObj); + // this.websocket.send(jStr); this.dialogVisible = false; }; @@ -2318,6 +2330,7 @@ websocket.onmessage = function (event) { var resultObj = eval("(" + event.data + ")"); //resultFlag涓�0浠h〃璇诲崱鎴愬姛 + if ( resultObj.name == "readCard" || resultObj.name == "readCert" || @@ -2478,8 +2491,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 +2528,7 @@ }; } else { // if (_this.inputSSS.indexOf(":1") != -1) { - + // var str1 = _this.inputSSS.indexOf(":1"); // var result1 = _this.inputSSS.substring(0, str1); @@ -2501,7 +2540,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 +2591,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; }; @@ -2857,33 +2928,6 @@ 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.loading = false; }); @@ -2901,6 +2945,8 @@ this.loading = true; getProParentIdDxList().then((response) => { this.Treedata = response.data.list; + console.log(response, 77788); + if (this.tableData[0]) { this.tableData[0].tjProjectList.forEach((selectionitem) => { this.Treedata.forEach((item) => { @@ -2910,40 +2956,12 @@ }); }); } - // if (this.DataLists.length != 0) { - // this.DataLists.forEach((selectionitem) => { - // this.Treedata.forEach((item) => { - // if (selectionitem.propinName == item.proName) { - // item.disabled = true; - // } - // }); - // }); - // } - // 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; }); }, + handlepackage(data, checked, checkedNodes) { + this.dataObj = data; if (checked.checkedNodes.length != 0) { this.$refs.treas.setCheckedKeys([data.id]); let datas = { @@ -2951,16 +2969,27 @@ }; getlistByZhId(datas).then((res) => { this.packagedataList = res.data.tjProjectList; + console.log(this.packagedataList, 1122); + this.DataLists = []; + this.checkedListkey1 = []; for (var i = 0; i < this.packagedataList.length; i++) { let proId = this.packagedataList[i].proId; + this.checkedListkey1.push(proId); + // this.DataLists.push(this.packagedataList[i]); getProSonDxList(proId).then((res) => { this.TreedataList = res.data.list; + console.log(this.TreedataList, 888); + this.TreedataList.forEach((item) => { + // this.checkedListkey1.push(item.proId); + this.DataLists.push(item); + // console.log(this.DataLists,556644); 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; @@ -2973,25 +3002,12 @@ } }); } else if (checked.checkedNodes.length == 0) { - // for (var i = 0; i < data.tjProjectList.length; i++) { - // let proId = data.tjProjectList[i].proId; - // getProSonDxList(proId).then((res) => { - // this.TreedataList = res.data.list; - // this.TreedataList.forEach((item) => { - // this.DataLists.forEach((item1, index) => { - // if (item.proId == item1.proId) { - // this.DataLists.splice(index, 1); - // } - // }); - // }); - // this.marryalls = 0 - // if(this.DataLists.length != 0){ - // this.DataLists.forEach((item1, index) => { - // this.marryalls += item1.proPrice; - // }) - // } - // }); - // } + this.DataLists = []; + this.marryalls = 0; // 娓呴浂鎬讳环 + this.checkedListkey1 = []; + + // 浣犲彲浠ュ湪姝ゅ鏍规嵁闇�瑕佽繘琛屽叾浠栨搷浣滐紝濡傛洿鏂� UI + console.log("鍙栨秷閫変腑锛屾暟鎹凡娓呯┖锛屾�讳环宸查噸缃�"); } }, objectspanmethod({ row, column, rowIndex, columnIndex }) { @@ -3024,17 +3040,43 @@ // return [rowspan, 1]; // } }, - + handlePackageChecked(data, checked, checkedNodes) { + if (checked == false) { + this.DataLists.forEach((item, index) => { + if (item.proId == data.proId) { + this.DataLists.splice(index, 1); + this.marryalls = 0; // 閲嶇疆鍚堣閲戦 + this.DataLists.forEach((item1) => { + this.marryalls += item1.proPrice; // 閲嶆柊璁$畻鍚堣閲戦 + }); + } + }); + } else if (checked == true) { + this.DataLists.push(data); // 娣诲姞鏁版嵁鍒板凡閫夊垪琛� + this.DataLists.forEach((item1) => { + if (item1.proParentId == this.dataObj.proId) { + item1.propinName = this.dataObj.proName; // 璁剧疆鐖剁骇鍚嶇О + } + }); + // this.spliceData(); + this.marryalls = 0; // 閲嶇疆鍚堣閲戦 + this.DataLists.forEach((item1) => { + this.marryalls += item1.proPrice; // 閲嶆柊璁$畻鍚堣閲戦 + }); + } + }, // 鐐瑰嚮鑾峰彇姣忎釜鏍戣妭鐐� handleCurrentChecked(data, checked, checkedNodes) { this.dataObj = data; if (checked.checkedNodes.length != 0) { this.$refs.tree.setCheckedKeys([data.proId]); + let proId = data.proId; getProSonDxList(proId).then((res) => { this.TreedataList = res.data.list; this.TreedataList.forEach((item) => { this.checkedListkey.push(item.proId); + this.DataList.push(item); this.spliceData(); this.DataList.forEach((item1) => { -- Gitblit v1.8.0