From e48af621e9c9a6fd97cdcff2cafa515347d05995 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期一, 04 八月 2025 15:19:13 +0800
Subject: [PATCH] :“体检项目、常规检查

---
 src/views/hosp/project/index.vue |  346 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 262 insertions(+), 84 deletions(-)

diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue
index 0ae2020..a4485d8 100644
--- a/src/views/hosp/project/index.vue
+++ b/src/views/hosp/project/index.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="app-container">
+  <div class="app-container" v-loading="pageLoading">
     <el-row :gutter="20">
       <el-col :span="3" :xs="24">
         <div class="head-container">
@@ -75,6 +75,17 @@
           <el-table-column label="鏄惁绌鸿吂" align="center" prop="proCheckMethod" :show-overflow-tooltip="true" width="75px">
             <template slot-scope="scope">
               <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.proCheckMethod" />
+            </template>
+          </el-table-column>
+          <el-table-column label="鏄惁澶栭��" align="center" prop="proDelivery" :show-overflow-tooltip="true" width="75px">
+            <template v-slot="scope">
+              {{
+                scope.row.proDelivery === 0
+                  ? "鏄�"
+                  : scope.row.proDelivery === 1
+                    ? "鍚�"
+                    : ""
+              }}
             </template>
           </el-table-column>
           <el-table-column label="椤圭洰鏍囧噯鍊�" align="center" prop="proScope" :show-overflow-tooltip="true" width="90px">
@@ -231,8 +242,12 @@
         </el-form-item>
         <el-form-item label="鏄惁鍙備笌寮傚父" prop="sfcyyc">
           <el-select v-model="form.sfcyyc" placeholder="璇烽�夋嫨鏄惁鍙備笌寮傚父" style="width: 260px">
-            <el-option v-for="dict in dictTypesy" :key="dict.value" :label="dict.label"
-              :value="dict.value"></el-option>
+            <el-option v-for="dict in dictTypesy" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="鏄惁澶栭��" prop="proDelivery">
+          <el-select v-model="form.proDelivery" placeholder="璇烽�夋嫨鏄惁澶栭��" style="width: 200px">
+            <el-option v-for="dict in wsTypesy" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
           </el-select>
         </el-form-item>
       </el-form>
@@ -376,8 +391,8 @@
 </template>
 
 <script>
-import debounce from 'lodash/debounce';
-import cnchar from 'cnchar';
+import debounce from "lodash/debounce";
+import cnchar from "cnchar";
 import Packagese from "@/components/Packagese";
 import {
   getProject,
@@ -434,6 +449,7 @@
       }
     };
     return {
+      pageLoading: true,
       xiugais: true,
       xiugaiList: [],
       deptOptions: [],
@@ -449,13 +465,23 @@
       chargeId: [],
       dictTypesy: [
         {
-          value:"0",
-          label:"鏄�"
+          value: "0",
+          label: "鏄�",
         },
         {
-          value:"1",
-          label:"鍚�"
-        }
+          value: "1",
+          label: "鍚�",
+        },
+      ],
+      wsTypesy: [
+        {
+          value: "1",
+          label: "鏄�",
+        },
+        {
+          value: "0",
+          label: "鍚�",
+        },
       ],
       List: false,
       deptName: "",
@@ -532,6 +558,7 @@
         proSex: "2",
         resultType: "",
         sfcyyc: "0",
+        proDelivery: "1",
       },
       rules: {
         createTime: [
@@ -565,9 +592,13 @@
         this.$nextTick(() => {
           const lastId = newVal[newVal.length - 1] || "532";
           const node = this.findNodeById(this.deptOptions, lastId);
+          this.queryParams.proId = lastId
+          this.getList()
           if (node) {
             this.$refs.tree1.setCurrentKey(lastId);
-            const nodeElement = document.querySelector(`.el-tree-node[data-key="${lastId}"] .el-tree-node__content`);
+            const nodeElement = document.querySelector(
+              `.el-tree-node[data-key="${lastId}"] .el-tree-node__content`
+            );
             if (nodeElement) {
               nodeElement.click();
             }
@@ -591,36 +622,93 @@
     },
   },
   created() {
-    this.getConsumables();
+    // this.getConsumables();
     this.getDeptList();
-    this.getDeptTree().then(() => {
-      this.precomputePinyin();
-    });
+    // this.getDeptTree().then(() => {
+    //   this.precomputePinyin();
+    // });
   },
   mounted() {
-    this.getDeptTree().then(() => {
-      this.precomputePinyin();
-    });
+    // this.getDeptTree().then(() => {
+    //   this.precomputePinyin();
+    // });
+    this.loadPage();
   },
   methods: {
+    async loadPage() {
+      this.pageLoading = true;
+      try {
+        await Promise.all([
+          this.getDeptTree(), // 鑾峰彇宸︿晶鏍�
+          //this.getList(),  鑾峰彇鍙充晶琛ㄦ牸
+        ]);
+      } catch (error) {
+        console.error("鍔犺浇椤甸潰鍑洪敊", error);
+      } finally {
+        this.pageLoading = false; // 涓や釜閮藉姞杞藉畬鍐嶅叧闂� loading
+      }
+    },
+
+    async getDeptTree() {
+      this.loadings = true;
+      try {
+        const response = await deptTree111();
+        this.deptOptions = response.data;
+        this.precomputePinyin();
+        // 淇濊瘉 treeId 鏄暟缁勬牸寮�
+        this.treeId = [];
+
+        if (this.treeDate?.id) {
+          this.treeId.push(this.treeDate.id);
+        } else {
+          this.treeId.push("532");
+        }
+      } catch (error) {
+        console.error("鍔犺浇閮ㄩ棬鏍戝け璐ワ細", error);
+      } finally {
+        this.loadings = false; // loading 鐘舵�佺粨鏉�
+      }
+    },
+
+    async getList() {
+      this.loading = true;
+      let data = {
+        proName: this.queryParams.proName,
+        checkType: this.queryParams.checkType,
+        deptId: this.queryParams.deptId,
+        proId: this.queryParams.proId,
+      };
+      try {
+        const res = await getAllChildListById(data); // 鏇挎崲鎴愪綘瀹為檯鐨勬帴鍙�
+        this.projectList = res.data.list;
+      } finally {
+        this.loading = false;
+      }
+    },
+
     debounceFilter: debounce(function (val) {
       this.$refs.tree1.filter(val);
     }, 300),
     precomputePinyin() {
       const traverse = (nodes) => {
-        nodes.forEach(node => {
+        nodes.forEach((node) => {
           if (node.label) {
-            const lowerSpell = cnchar.spell(node.label, 'low', 'array').join(''); // 瀹屾暣灏忓啓鎷奸煶
-            const upperSpell = cnchar.spell(node.label, 'up', 'array').join('');  // 瀹屾暣澶у啓鎷奸煶
+            const lowerSpell = cnchar
+              .spell(node.label, "low", "array")
+              .join(""); // 瀹屾暣灏忓啓鎷奸煶
+            const upperSpell = cnchar.spell(node.label, "up", "array").join(""); // 瀹屾暣澶у啓鎷奸煶
             const shortPinyin = node.label
-              .split('')
-              .map(char => cnchar.spell(char, 'array')[0]?.[0]?.toLowerCase() || char) // 鎷奸煶棣栧瓧姣�
-              .join('');
+              .split("")
+              .map(
+                (char) =>
+                  cnchar.spell(char, "array")[0]?.[0]?.toLowerCase() || char
+              ) // 鎷奸煶棣栧瓧姣�
+              .join("");
             this.pinyinCache.set(node.id, {
               lowerSpell,
               upperSpell,
               shortPinyin, // 缂撳瓨鎷奸煶绠�鍐�
-              label: node.label
+              label: node.label,
             });
           }
           if (node.children) traverse(node.children);
@@ -634,9 +722,9 @@
       if (!cached) return false; // 濡傛灉娌℃湁缂撳瓨鏁版嵁锛屼笉鏄剧ず璇ヨ妭鐐�
       const searchLower = value.toLowerCase(); // 灏嗘悳绱㈣瘝杞负灏忓啓
       return (
-        cached.label.includes(value) ||           // 鐩存帴鍖归厤姹夊瓧
+        cached.label.includes(value) || // 鐩存帴鍖归厤姹夊瓧
         cached.shortPinyin.includes(searchLower) || // 鍖归厤鎷奸煶绠�鍐�
-        cached.lowerSpell.includes(searchLower)   // 鍖归厤瀹屾暣鎷奸煶
+        cached.lowerSpell.includes(searchLower) // 鍖归厤瀹屾暣鎷奸煶
       );
     },
     filterNode2(value, data) {
@@ -698,15 +786,16 @@
       this.form.hisXmbm = "";
       this.form.hisXmmc = "";
       this.form.hisdj = "";
-      this.loading = true;
+      // this.loading = true;
       this.proParent = false;
       this.form.proPrice = 0.0;
       this.form.proName = "";
       this.form.proId = null;
       this.form.resultType = "1";
+      this.getDeptList();
       getlist().then((response) => {
         if (response.code == 200) {
-          this.loading = false;
+          // this.loading = false;
           this.projectOptions = [];
           const project = { proId: 0, proName: "涓荤被鐩�", children: [] };
           project.children = this.handleTree(response.data.list, "proId");
@@ -718,8 +807,8 @@
             this.open = true;
           } else if (this.treeDate.id) {
             if (this.treeDate.qf == "0") {
-              this.form.proParentId = "0"
-              this.form.deptId = this.treeDate.id
+              this.form.proParentId = "0";
+              this.form.deptId = this.treeDate.id;
             } else {
               this.form.proParentId = this.treeDate.id;
               this.projectOptions.forEach((item) => {
@@ -731,10 +820,9 @@
               });
             }
 
-
             this.open = true;
           } else {
-            this.form.proParentId = "0"
+            this.form.proParentId = "0";
             this.open = true;
           }
         }
@@ -742,6 +830,7 @@
       this.title = "浣撴椤圭洰淇℃伅缁存姢";
       this.form.deptId = this.queryParams.deptId || null;
       this.form.proCheckMethod = "N";
+      this.form.proDelivery = "1";
       if (this.key === "Y") {
         gettreeList().then((response) => {
           this.deptOptionstree = response.data;
@@ -787,7 +876,10 @@
       listSfxm(this.querycharge).then((response) => {
         this.sfxmList = response.rows;
         response.rows.forEach((item, index) => {
-          item.newID = (this.querycharge.pageNum - 1) * this.querycharge.pageSize + index + 1;
+          item.newID =
+            (this.querycharge.pageNum - 1) * this.querycharge.pageSize +
+            index +
+            1;
         });
         this.total = response.total;
         this.loading = false;
@@ -813,7 +905,8 @@
       getListByXmId(this.queryParam).then((response) => {
         this.sfxmList = response.data.date;
         response.data.date.forEach((item, index) => {
-          item.newID = (this.queryParam.page - 1) * this.queryParam.pageSize + index + 1;
+          item.newID =
+            (this.queryParam.page - 1) * this.queryParam.pageSize + index + 1;
         });
         this.total = response.data.total;
         this.loading = false;
@@ -844,16 +937,15 @@
         this.deptList = this.handleTree(response.data, "proId");
       });
     },
-    getDeptTree() {
+    /* getDeptTree() {
       return deptTree111().then((response) => {
         this.deptOptions = response.data;
         this.treeId.push(this.treeDate.id);
       });
-    },
+    }, */
     handleNodeClick(date) {
-
       this.treeDate = date;
-      this.xiugaiList ={}
+      this.xiugaiList = {};
       this.xiugais = date.qf === "0";
       let proId = date.id;
       getInfoByProId(proId).then((response) => {
@@ -868,8 +960,13 @@
       this.loading = true;
       getAllChildListById(data).then((response) => {
         if (response.code == 200) {
-          this.projectList = response.data.list.length >= 1 ? this.handleTree(response.data.list, "proId") : [];
-          this.ListId = this.projectList.length ? [this.projectList[0].proId] : [];
+          this.projectList =
+            response.data.list.length >= 1
+              ? this.handleTree(response.data.list, "proId")
+              : [];
+          this.ListId = this.projectList.length
+            ? [this.projectList[0].proId]
+            : [];
           this.key = response.data.key;
           this.loading = false;
         }
@@ -923,6 +1020,7 @@
         tjStandardList: [],
         proStatus: "0",
         resultType: "1",
+        proDelivery: "1",
       };
       this.resetForm("form");
     },
@@ -1003,24 +1101,38 @@
       }
     },
     handleUpdate1() {
-      this.form ={}
-      this.form = this.xiugaiList;
-      this.form.proStatus = this.form.proStatus.toString();
-      this.form.sfcyyc = this.form.sfcyyc.toString();
+      // this.updateLoading = true;
+      this.form = {};
       this.proParent = true;
       this.isPriceDisabled = true;
-      getlist().then((response) => {
-        if (response.code == 200) {
+
+      // 鍏堝姞杞界瀹ゅ垪琛ㄦ暟鎹紝鍐嶈缃〃鍗曟暟鎹�
+      Promise.all([
+        listDept(this.queryParams),
+        getlist()
+      ]).then(([deptResponse, listResponse]) => {
+        // 鍏堣缃瀹ゅ垪琛�
+        this.parentNameList = deptResponse.data;
+
+        // 鍐嶈缃〃鍗曟暟鎹�
+        this.form = this.xiugaiList;
+        this.form.proStatus = this.form.proStatus.toString();
+        this.form.sfcyyc = this.form.sfcyyc.toString();
+
+        // 澶勭悊椤圭洰閫夐」
+        if (listResponse.code == 200) {
           this.loading = false;
           this.projectOptions = [];
           const project = { proId: 0, proName: "涓荤被鐩�", children: [] };
-          project.children = this.handleTree(response.data.list, "proId");
-          this.key = response.data.key;
+          project.children = this.handleTree(listResponse.data.list, "proId");
+          this.key = listResponse.data.key;
           this.projectOptions.push(project);
-          console.log( this.projectOptions,11111)
         }
-      });
-      this.open = true;
+
+        this.open = true;
+      }).catch((error) => {
+        this.$message.error("鍔犺浇鏁版嵁澶辫触");
+      })
     },
     handleUpdate(row) {
       this.reset();
@@ -1028,35 +1140,52 @@
       const proId = row.proId || this.ids;
       this.proParent = false;
       this.isPriceDisabled = false;
-      getProject(proId).then((response) => {
-        this.form = response.data;
-        this.showPrise = this.form.proParentId === "0";
-        this.showRentPrise = !this.showPrise;
-        this.form.proStatus = this.form.proStatus.toString();
-        this.form.sfcyyc = this.form.sfcyyc.toString();
-        this.form.consumablesList = response.data.consumablesList;
-        this.form.tjStandardList = response.data.tjStandardList;
-        if (this.form.tjStandardList) {
-          this.form.tjStandardList.forEach((item) => {
-            item.tjSex = item.tjSex === "0" || item.tjSex === "鐢�" ? "鐢�" : (item.tjSex === "1" || item.tjSex === "濂�" ? "濂�" : null);
-            item.tjType = {
-              0: "濠村効", 1: "骞煎効", 2: "鍎跨", 3: "灏戝勾", 4: "闈掑勾", 5: "涓勾", 6: "鑰佸勾"
-            }[item.tjType] || item.tjType;
-          });
-        }
-        getlist().then((response) => {
-          if (response.code == 200) {
-            this.loading = false;
-            this.projectOptions = [];
-            const project = { proId: 0, proName: "涓荤被鐩�", children: [] };
-            project.children = this.handleTree(response.data.list, "proId");
-            this.key = response.data.key;
-            this.projectOptions.push(project);
+      listDept(this.queryParams).then((response) => {
+        this.parentNameList = response.data;
+        getProject(proId).then((response) => {
+          this.form = response.data;
+          this.showPrise = this.form.proParentId === "0";
+          this.showRentPrise = !this.showPrise;
+          this.form.proStatus = this.form.proStatus.toString();
+          this.form.sfcyyc = this.form.sfcyyc.toString();
+          this.form.proDelivery = this.form.proDelivery.toString();
+          this.form.consumablesList = response.data.consumablesList;
+          this.form.tjStandardList = response.data.tjStandardList;
+          if (this.form.tjStandardList) {
+            this.form.tjStandardList.forEach((item) => {
+              item.tjSex =
+                item.tjSex === "0" || item.tjSex === "鐢�"
+                  ? "鐢�"
+                  : item.tjSex === "1" || item.tjSex === "濂�"
+                    ? "濂�"
+                    : null;
+              item.tjType =
+                {
+                  0: "濠村効",
+                  1: "骞煎効",
+                  2: "鍎跨",
+                  3: "灏戝勾",
+                  4: "闈掑勾",
+                  5: "涓勾",
+                  6: "鑰佸勾",
+                }[item.tjType] || item.tjType;
+            });
           }
+          getlist().then((response) => {
+            if (response.code == 200) {
+              this.loading = false;
+              this.projectOptions = [];
+              const project = { proId: 0, proName: "涓荤被鐩�", children: [] };
+              project.children = this.handleTree(response.data.list, "proId");
+              this.key = response.data.key;
+              this.projectOptions.push(project);
+            }
+          });
+          this.open = true;
+          this.title = "浣撴椤圭洰淇℃伅缁存姢";
         });
-        this.open = true;
-        this.title = "浣撴椤圭洰淇℃伅缁存姢";
-      });
+      })
+
     },
     getSelectValue(val) {
       this.form.consumablesList.forEach((formitem) => {
@@ -1073,15 +1202,28 @@
     },
     submitForm() {
       this.noclick = true;
+      this.pageLoading = true;
       this.$refs["form"].validate((valid) => {
         if (valid) {
           const isUpdate = this.form.proId != null;
           if (this.form.tjStandardList) {
             this.form.tjStandardList.forEach((item) => {
-              item.tjSex = item.tjSex === "鐢�" || item.tjSex === "0" ? "0" : (item.tjSex === "濂�" || item.tjSex === "1" ? "1" : null);
-              item.tjType = {
-                "濠村効": 0, "骞煎効": 1, "鍎跨": 2, "灏戝勾": 3, "闈掑勾": 4, "涓勾": 5, "鑰佸勾": 6
-              }[item.tjType] || null;
+              item.tjSex =
+                item.tjSex === "鐢�" || item.tjSex === "0"
+                  ? "0"
+                  : item.tjSex === "濂�" || item.tjSex === "1"
+                    ? "1"
+                    : null;
+              item.tjType =
+                {
+                  濠村効: 0,
+                  骞煎効: 1,
+                  鍎跨: 2,
+                  灏戝勾: 3,
+                  闈掑勾: 4,
+                  涓勾: 5,
+                  鑰佸勾: 6,
+                }[item.tjType] || null;
             });
           }
           this.form.lisXmbm = this.form.lisXmbm;
@@ -1122,7 +1264,24 @@
         }
       }
     },
-    handleSuccess(isY) {
+    async handleSuccess(isY) {
+      this.cancel();
+
+      if (this.proParent || isY) {
+        // 绛夊緟宸︿晶鏍戝姞杞藉拰鎷奸煶澶勭悊
+        await this.getDeptTree();
+        this.precomputePinyin();
+      }
+
+      // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊
+      await this.getList();
+
+      // 绔嬪嵆鍒锋柊褰撳墠椤圭洰鏁版嵁锛岀‘淇濇暟鎹槸鏈�鏂扮殑
+      await this.refreshCurrentProjectData();
+
+      this.pageLoading = false; // 鉁� 缁熶竴鍔犺浇鐘舵�佹帶鍒�
+    },
+    /* handleSuccess(isY) {
       this.cancel();
       this.getList();
       if (this.proParent || isY) {
@@ -1130,6 +1289,21 @@
           this.precomputePinyin();
         });
       }
+    }, */
+    // 鍒锋柊褰撳墠閫変腑椤圭洰鐨勬暟鎹�
+    async refreshCurrentProjectData() {
+      if (this.id) {
+        try {
+          const response = await getInfoByProId(this.id);
+          this.xiugaiList = response.data;
+          return response.data;
+        } catch (error) {
+          this.$message.error("鍒锋柊椤圭洰鏁版嵁澶辫触");
+          this.xiugaiList = null; // 鍒锋柊澶辫触鏃堕噸缃负 null
+          return null;
+        }
+      }
+      return null;
     },
     submit() {
       this.ChangeList.forEach((item) => {
@@ -1140,6 +1314,10 @@
         this.sfxmId = parseInt(item.id);
       });
       this.dialogTableVisible = false;
+      this.getDeptList();
+      this.getDeptTree().then(() => {
+        this.precomputePinyin();
+      });
     },
     handleDelete(row) {
       const proIds = row.proId || this.ids;

--
Gitblit v1.8.0