From 26a983e0c22f1fe54c91c66c2b52888858e52cd1 Mon Sep 17 00:00:00 2001 From: qx <1084500556@qq.com> Date: 星期四, 31 七月 2025 17:57:28 +0800 Subject: [PATCH] qx --- src/views/hosp/project/index.vue | 175 +++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 112 insertions(+), 63 deletions(-) diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue index ec93cd3..3a457bc 100644 --- a/src/views/hosp/project/index.vue +++ b/src/views/hosp/project/index.vue @@ -1193,7 +1193,7 @@ }, created() { // this.getConsumables(); - // this.getDeptList(); + this.getDeptList(); // this.getDeptTree().then(() => { // this.precomputePinyin(); // }); @@ -1383,12 +1383,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; @@ -1543,10 +1547,10 @@ getDeptList() { listDept(this.queryParams).then((response) => { this.parentNameList = response.data; - this.deptList = this.handleTree(response.data, "proId"); + this.deptList = this.handleTree(response.data, "deptId"); }); }, - getDeptTree() { + /* getDeptTree() { this.loadings = true; return deptTree111() .then((response) => { @@ -1564,7 +1568,7 @@ .finally(() => { this.loadings = false; // 鏃犺鎴愬姛鎴栧け璐ワ紝缁撴潫鍔犺浇 }); - }, + }, */ handleNodeClick(date) { this.treeDate = date; this.xiugaiList = {}; @@ -1722,28 +1726,39 @@ } }, handleUpdate1() { - this.updateLoading = true; + // this.updateLoading = true; this.form = {}; - this.form = this.xiugaiList; - this.form.proStatus = this.form.proStatus.toString(); - this.form.sfcyyc = this.form.sfcyyc.toString(); this.proParent = true; this.isPriceDisabled = true; - 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); - } - }) - .finally(() => { - this.updateLoading = false; - }); - this.open = true; + + // 鍏堝姞杞界瀹ゅ垪琛ㄦ暟鎹紝鍐嶈缃〃鍗曟暟鎹� + 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(listResponse.data.list, "proId"); + this.key = listResponse.data.key; + this.projectOptions.push(project); + } + + this.open = true; + }).catch((error) => { + console.error("鍔犺浇鏁版嵁澶辫触:", error); + this.$message.error("鍔犺浇鏁版嵁澶辫触"); + }) }, handleUpdate(row) { this.reset(); @@ -1751,48 +1766,79 @@ 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; + // this.deptList = this.handleTree(response.data, "proId"); + getProject(proId).then((response) => { + this.form = response.data; + this.form.deptId = response.data.deptId; + 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); + } + }); + // this.loadPage(); + this.open = true; + this.title = "浣撴椤圭洰淇℃伅缁存姢"; }); - // this.loadPage(); - this.open = true; - this.title = "浣撴椤圭洰淇℃伅缁存姢"; }); + }, + // 鍒锋柊褰撳墠閫変腑椤圭洰鐨勬暟鎹� + async refreshCurrentProjectData() { + if (this.id) { + try { + const response = await getInfoByProId(this.id); + this.xiugaiList = response.data; + console.log("鍒锋柊椤圭洰鏁版嵁鎴愬姛:", this.xiugaiList); + return response.data; + } catch (error) { + console.error("鍒锋柊椤圭洰鏁版嵁澶辫触:", error); + this.$message.error("鍒锋柊椤圭洰鏁版嵁澶辫触"); + this.xiugaiList = null; // 鍒锋柊澶辫触鏃堕噸缃负 null + return null; + } + } + return null; + }, + // 璋冭瘯鏂规硶锛氭鏌ュ綋鍓嶆暟鎹姸鎬� + debugDataState() { + console.log("=== 鏁版嵁鐘舵�佽皟璇� ==="); + console.log("褰撳墠ID:", this.id); + console.log("xiugaiList:", this.xiugaiList); + console.log("form:", this.form); + console.log("treeDate:", this.treeDate); + console.log("=================="); }, getSelectValue(val) { this.form.consumablesList.forEach((formitem) => { @@ -1896,6 +1942,9 @@ // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊 await this.getList(); + + // 绔嬪嵆鍒锋柊褰撳墠椤圭洰鏁版嵁锛岀‘淇濇暟鎹槸鏈�鏂扮殑 + await this.refreshCurrentProjectData(); this.pageLoading = false; // 鉁� 缁熶竴鍔犺浇鐘舵�佹帶鍒� }, -- Gitblit v1.8.0