From 25c777002fb57397320b65b830cc805b29f7c23a Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 13 三月 2025 16:18:01 +0800
Subject: [PATCH] qx

---
 src/views/system/tijian/index.vue |  317 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 180 insertions(+), 137 deletions(-)

diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue
index 0ddf8eb..ad39758 100644
--- a/src/views/system/tijian/index.vue
+++ b/src/views/system/tijian/index.vue
@@ -89,7 +89,7 @@
               <span slot="label" style="display: inline-block; border-bottom: 2px solid blue" @click="openname">
                 濮撳悕
               </span>
-              <el-input v-model="form.cusName" placeholder="璇疯緭鍏ュ鍚�" :disabled="isDisabled" />
+              <el-input v-model="form.cusName" placeholder="璇疯緭鍏ュ鍚�" :disabled="isDisabled" @input="form.cusName = $event.replace(/\s/g, '')" />
             </el-form-item>
 
             <el-form-item label="璇佷欢绫诲瀷" prop="idType">
@@ -147,7 +147,7 @@
               <span slot="label" style="display: inline-block; border-bottom: 2px solid blue" @click="handleQuery">
                 璇佷欢鍙风爜
               </span>
-              <el-input :disabled="isDisabled" v-model="form.cusIdcard" placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�" @input="inputChange" />
+              <el-input :disabled="isDisabled" v-model="form.cusIdcard" placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�" @input="handleIdCardInput"/>
               <!-- <i style="
                     font-size: 1rem;
                     position: absolute;
@@ -179,7 +179,7 @@
                 trigger: 'blur',
               },
             ]">
-              <el-input v-model="form.cusPhone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" :disabled="isDisabled" />
+              <el-input v-model="form.cusPhone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" :disabled="isDisabled" @input="form.cusPhone = $event.replace(/\s/g, '')"/>
             </el-form-item>
 
             <el-form-item label="鍑虹敓鏃ユ湡" prop="cusBrithday">
@@ -731,6 +731,7 @@
   getByTjNum,
 } from "@/api/hosp/customer";
 import { getPrintSetUp } from "@/api/system/examcharge";
+import cnchar from 'cnchar';
 import {
   tuantiSelect,
   deptTreeSelect,
@@ -742,15 +743,12 @@
   getPackageListName,
   getaddtTransition,
   tuantiqueren,
-  getTransitionList,
   getTransitionList1,
-  getByTeamNo,
   delTbBycusCardIdAndProId,
   getLoadFile,
   getIsRequired,
   getconfigKey,
   getHistryTjOrderProByCusIdCard,
-  readCertCardInfos,
   gaibianzhekou,
 } from "@/api/system/tijian";
 import { addComp } from "@/api/system/comp";
@@ -1075,6 +1073,10 @@
     this.marryall = 0;
   },
   methods: {
+    handleIdCardInput(value) {
+  this.form.cusIdcard = value.replace(/\s/g, '');
+  this.inputChange(); // 淇濈暀鍘熸湁鐨勮韩浠借瘉杈撳叆澶勭悊閫昏緫
+},
     debounceNumberChange(currentValue, oldValue) {
       clearTimeout(this.debounceTimer);
       this.debounceTimer = setTimeout(() => {
@@ -1272,13 +1274,33 @@
       }, 1000); //姣忕閽熸洿鏂颁竴娆�
     },
     filterNode(value, data) {
-      if (!value) return true;
+      // if (!value) return true;
       // return data.proName.indexOf(value) !== -1;
-      if (data.proName.indexOf(value) !== -1) {
-        return data.proName.indexOf(value) !== -1;
-      } else {
-        return data.proEngName.indexOf(value) !== -1;
-      }
+      // if (data.proName.indexOf(value) !== -1) {
+      //   return data.proName.indexOf(value) !== -1;
+      // } else {
+      //   return data.proEngName.indexOf(value) !== -1;
+      // }
+      if (!value) return true;
+        if (data.proName.indexOf(value) !== -1) return true;
+        if (data.proEngName.indexOf(value) !== -1) return true;
+        // 鍖归厤灏忓啓
+        let arr = data.proName.spell('low', 'array');
+        let spell = arr.join('');
+        let lengths = [0];
+        for (var i = 0; i < arr.length - 1; i++) {
+            lengths.push(lengths[i] + arr[i].length);
+        };
+        //鍒ゆ柇label瀹屾暣鎷奸煶 涓� 杈撳叆鍊肩殑 index 鏄笉鏄瓑浜庢煇涓眽瀛楃涓�涓嫾闊冲瓧姣嶇殑index鍊�
+        if(lengths.indexOf(spell.indexOf(value)) !== -1) return true
+        // 澶у啓
+        let arrUp = data.proName.spell('up', 'array');
+        let spellUp = arrUp.join('');
+        let lengthsUp = [0];
+        for (var i = 0; i < arrUp.length - 1; i++) {
+            lengthsUp.push(lengthsUp[i] + arrUp[i].length);
+        };
+        return lengthsUp.indexOf(spellUp.indexOf(value)) !== -1;  
     },
     filterpackage(value, data) {
       if (!value) return true;
@@ -1678,36 +1700,41 @@
         });
     },
     /** 鐧昏鎻愪氦鎸夐挳 */
-    submitForm() {
-      let _this = this;
-      this.$refs["form"].validate((valid) => {
-        if (valid) {
-          // return;
-          if (this.form.cusSex === "濂�") {
-            this.form.cusSex = 1;
-          }
-          if (this.form.cusSex === "鐢�") {
-            this.form.cusSex = 0;
-          }
-          if (this.form.cusSex === "鏈煡") {
-            this.form.cusSex = 2;
-          }
-          if (this.form.tjType === "") {
-            this.form.tjType = this.dict.type.dict_team[0].value;
-          }
+    /** 鐧昏鎻愪氦鎸夐挳 */
+submitForm() {
+  let _this = this;
+  this.$refs["form"].validate((valid) => {
+    if (valid) {
+      // 鍒涘缓琛ㄥ崟鏁版嵁鐨勫壇鏈苟鍘婚櫎绌烘牸
+      const formData = { ...this.form };
+      formData.cusName = formData.cusName ? formData.cusName.replace(/\s/g, '') : '';
+      formData.cusPhone = formData.cusPhone ? formData.cusPhone.replace(/\s/g, '') : '';
+      formData.cusIdcard = formData.cusIdcard ? formData.cusIdcard.replace(/\s/g, '') : '';
 
-          addCustomer(this.form).then((response) => {
-            this.responseList = response.data;
+      // 澶勭悊鎬у埆鍊�
+      if (formData.cusSex === "濂�") {
+        formData.cusSex = 1;
+      }
+      if (formData.cusSex === "鐢�") {
+        formData.cusSex = 0;
+      }
+      if (formData.cusSex === "鏈煡") {
+        formData.cusSex = 2;
+      }
+      if (formData.tjType === "") {
+        formData.tjType = this.dict.type.dict_team[0].value;
+      }
 
-            this.$modal.msgSuccess("鏂板鎴愬姛");
-
-            _this.tcShow = true;
-            _this.isDisabled = true;
-            _this.top = false;
-          });
-        }
+      addCustomer(formData).then((response) => {
+        this.responseList = response.data;
+        this.$modal.msgSuccess("鏂板鎴愬姛");
+        _this.tcShow = true;
+        _this.isDisabled = true;
+        _this.top = false;
       });
-    },
+    }
+  });
+},
 
     getmailType() {
       if (this.getType == "2") {
@@ -1820,7 +1847,6 @@
         let configKey = "getInfoFromSqlData";
         getconfigKey(configKey).then((res) => {
           if (res.code == 200) {
-            console.log(res.msg, 'res.msg');
             if (res.msg == "N") {
               var websocket = null;
               var url = this.valueUrl;
@@ -1860,11 +1886,9 @@
 
               //鎺ユ敹鍒版秷鎭殑鍥炶皟鏂规硶
               websocket.onmessage = (event) => {
-                var resultObj = eval("(" + event.data + ")");  // 娉ㄦ剰锛歟val瀛樺湪瀹夊叏闅愭偅锛屽缓璁敤JSON.parse
+                var resultObj = eval("(" + event.data + ")");
                 this.readCardWebSocket(resultObj);
-               
               };
-          
             } else if (res.msg == "Y") {
               /* this.$refs.aaa.open = true;
               this.$refs.aaa.getAllList();
@@ -1883,8 +1907,8 @@
     // 鏈�鏂颁娇鐢╳ebSocket閫氫俊
     readCardWebSocket(resultObj) {
       let _this = this;
-      console.log(resultObj, 'resultObj');
-      if (resultObj.code === 200 && resultObj.data.name && resultObj.data.name != null) {
+
+      if (resultObj.code === 200 && resultObj.data.name != null) {
         //鍥炴樉鐩稿叧鏁版嵁
         _this.form.cusName = resultObj.data.name;
         _this.form.cusSex = resultObj.data.sex == "0" ? "濂�" : "鐢�";
@@ -2914,103 +2938,122 @@
       });
     },
     submitCheckinfee() {
-      let _this = this;
-      if (_this.tjCategory !== "") {
-        let List = _this.tableData1;
-        if (this.responseList.cusId) {
-          var userId = this.responseList.cusId;
-        } else {
-          var userId = _this.form.cusId;
-        }
-        let tjType = _this.form.tjType;
-        if (this.tableData[0]) {
-          var pacId = this.tableData[0].pacId;
-        }
-        List.forEach((item) => {
-          if (item.list) {
-            item.list.forEach((item1) => {
-              this.tjOrderList.push({
-                proName: item1.proName,
-                proPrice: item1.nowPrice,
-                proId: item1.proId,
-              });
-            });
-          } else if (item.tjProjectList) {
-            item.tjProjectList.forEach((item1) => {
-              this.tjOrderList.push({
-                proName: item1.proName,
-                proPrice: item1.priceNow,
-                proId: item1.proId,
-              });
-            });
-          } else {
-            this.tjOrderList.push({
-              proName: item.proName,
-              proPrice: item.ysPrice,
-              proId: item.proId,
-            });
-          }
-        });
-        let copeWith = this.TotalPrice1;
-        let paidIn = this.TotalPrice.toString();
-        let discount = this.discount;
-        this.tjFlowingWater = { copeWith, paidIn, discount };
+  let _this = this;
+  if (_this.tjCategory !== "") {
+    let List = _this.tableData1;
+    if (this.responseList.cusId) {
+      var userId = this.responseList.cusId;
+    } else {
+      var userId = _this.form.cusId;
+    }
+    let tjType = _this.form.tjType;
+    if (this.tableData[0]) {
+      var pacId = this.tableData[0].pacId;
+    }
 
-        let data;
-        if (pacId || this.getType == "2") {
-          data = {
-            photo: this.srcUrl,
-            pacId,
-            tjOrderList: this.tjOrderList,
-            tjFlowingWater: this.tjFlowingWater,
-            userId,
-            tjType,
-            getType: this.getType,
-            addAddress: this.addAddress,
-            tjCategory: this.tjCategory,
-          };
-        } else {
-          data = {
-            photo: this.srcUrl,
-            tjOrderList: this.tjOrderList,
-            tjFlowingWater: this.tjFlowingWater,
-            userId,
-            tjType,
-            getType: this.getType,
-            tjCategory: this.tjCategory,
-          };
-        }
-        getOrder(data).then((res) => {
-          this.$modal.msgSuccess("鎻愪氦鎴愬姛");
-          this.tjNumbers = res.msg;
-          this.charge = true;
-          let data = {
-            tjNum: res.msg,
-          };
-          getfindTj(data).then((response) => {
-            if (response.data) {
-              this.feeitems = response.data;
-              if (this.feeitems.length != 0) {
-                this.$nextTick(() => {
-                  this.$refs.multipleTable.toggleRowSelection(
-                    this.feeitems[0],
-                    true
-                  );
-                });
-              } else {
-                this.$refs.multipleTable.clearSelection();
-              }
-              this.loading = false;
-            } else {
-              this.feeitems = [];
-              this.loading = false;
-            }
+    // 鍘荤┖鏍煎鐞�
+    const processedForm = {
+      ...this.form,
+      cusName: this.form.cusName ? this.form.cusName.replace(/\s/g, '') : '',
+      cusPhone: this.form.cusPhone ? this.form.cusPhone.replace(/\s/g, '') : '',
+      cusIdcard: this.form.cusIdcard ? this.form.cusIdcard.replace(/\s/g, '') : ''
+    };
+
+    List.forEach((item) => {
+      if (item.list) {
+        item.list.forEach((item1) => {
+          this.tjOrderList.push({
+            proName: item1.proName,
+            proPrice: item1.nowPrice,
+            proId: item1.proId,
+          });
+        });
+      } else if (item.tjProjectList) {
+        item.tjProjectList.forEach((item1) => {
+          this.tjOrderList.push({
+            proName: item1.proName,
+            proPrice: item1.priceNow,
+            proId: item1.proId,
           });
         });
       } else {
-        this.$modal.msgError("璇烽�夋嫨浣撴绫诲埆");
+        this.tjOrderList.push({
+          proName: item.proName,
+          proPrice: item.ysPrice,
+          proId: item.proId,
+        });
       }
-    },
+    });
+    
+    let copeWith = this.TotalPrice1;
+    let paidIn = this.TotalPrice.toString();
+    let discount = this.discount;
+    this.tjFlowingWater = { copeWith, paidIn, discount };
+
+    let data;
+    if (pacId || this.getType == "2") {
+      data = {
+        photo: this.srcUrl,
+        pacId,
+        tjOrderList: this.tjOrderList,
+        tjFlowingWater: this.tjFlowingWater,
+        userId,
+        tjType,
+        getType: this.getType,
+        addAddress: this.addAddress,
+        tjCategory: this.tjCategory,
+        // 浣跨敤鍘绘帀绌烘牸鍚庣殑鏁版嵁
+        cusName: processedForm.cusName,
+        cusPhone: processedForm.cusPhone,
+        cusIdcard: processedForm.cusIdcard
+      };
+    } else {
+      data = {
+        photo: this.srcUrl,
+        tjOrderList: this.tjOrderList,
+        tjFlowingWater: this.tjFlowingWater,
+        userId,
+        tjType,
+        getType: this.getType,
+        tjCategory: this.tjCategory,
+        // 浣跨敤鍘绘帀绌烘牸鍚庣殑鏁版嵁
+        cusName: processedForm.cusName,
+        cusPhone: processedForm.cusPhone,
+        cusIdcard: processedForm.cusIdcard
+      };
+    }
+
+    getOrder(data).then((res) => {
+      this.$modal.msgSuccess("鎻愪氦鎴愬姛");
+      this.tjNumbers = res.msg;
+      this.charge = true;
+      let data = {
+        tjNum: res.msg,
+      };
+      getfindTj(data).then((response) => {
+        if (response.data) {
+          this.feeitems = response.data;
+          if (this.feeitems.length != 0) {
+            this.$nextTick(() => {
+              this.$refs.multipleTable.toggleRowSelection(
+                this.feeitems[0],
+                true
+              );
+            });
+          } else {
+            this.$refs.multipleTable.clearSelection();
+          }
+          this.loading = false;
+        } else {
+          this.feeitems = [];
+          this.loading = false;
+        }
+      });
+    });
+  } else {
+    this.$modal.msgError("璇烽�夋嫨浣撴绫诲埆");
+  }
+},
 
     // 琛ㄦ牸鍗曢��
     handleSelect(selection, val) {

--
Gitblit v1.8.0