From a7a0b7a266fd3df381ab8f2b6dcf098ef9076533 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期三, 30 七月 2025 10:51:26 +0800 Subject: [PATCH] 1111 --- src/views/hosp/project/index.vue | 157 ++++++++++++++++++++++++++++----------------------- 1 files changed, 86 insertions(+), 71 deletions(-) diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue index f9a55f2..863591b 100644 --- a/src/views/hosp/project/index.vue +++ b/src/views/hosp/project/index.vue @@ -1162,8 +1162,8 @@ this.$nextTick(() => { const lastId = newVal[newVal.length - 1] || "532"; const node = this.findNodeById(this.deptOptions, lastId); - this.queryParams.proId = lastId - this.getList() + this.queryParams.proId = lastId; + this.getList(); if (node) { this.$refs.tree1.setCurrentKey(lastId); const nodeElement = document.querySelector( @@ -1252,7 +1252,6 @@ if (this.treeDate?.id) { this.treeId.push(this.treeDate.id); - } else { this.treeId.push("532"); } @@ -1723,28 +1722,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(); @@ -1752,47 +1762,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; + // 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 = "浣撴椤圭洰淇℃伅缁存姢"; }); }, getSelectValue(val) { @@ -1887,19 +1902,19 @@ console.log(this.treeId); }, */ async handleSuccess(isY) { - this.cancel(); + this.cancel(); - if (this.proParent || isY) { - // 绛夊緟宸︿晶鏍戝姞杞藉拰鎷奸煶澶勭悊 - await this.getDeptTree(); - this.precomputePinyin(); - } + if (this.proParent || isY) { + // 绛夊緟宸︿晶鏍戝姞杞藉拰鎷奸煶澶勭悊 + await this.getDeptTree(); + this.precomputePinyin(); + } - // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊 - await this.getList(); + // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊 + await this.getList(); - this.pageLoading = false; // 鉁� 缁熶竴鍔犺浇鐘舵�佹帶鍒� -}, + this.pageLoading = false; // 鉁� 缁熶竴鍔犺浇鐘舵�佹帶鍒� + }, submit() { this.ChangeList.forEach((item) => { this.form.proPrice = item.ckdj; -- Gitblit v1.8.0