From b52dea255fd3ada4eeb021f61709db26305cac8b Mon Sep 17 00:00:00 2001 From: qx <1084500556@qq.com> Date: 星期二, 18 三月 2025 15:06:38 +0800 Subject: [PATCH] Qx --- src/views/hosp/project/index.vue | 127 +++++++++++++++++------------------------- 1 files changed, 51 insertions(+), 76 deletions(-) diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue index e0f0ba6..0e6a6a9 100644 --- a/src/views/hosp/project/index.vue +++ b/src/views/hosp/project/index.vue @@ -9,8 +9,8 @@ <div class="scrollable-container"> <div class="content"> <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" - :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId" - highlight-current @node-click="handleNodeClick" :render-content="renderContent" v-loading="loadings" /> + :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId" + highlight-current @node-click="handleNodeClick" :render-content="renderContent" v-loading="loadings"/> </div> </div> </el-col> @@ -79,7 +79,7 @@ </el-table-column> <el-table-column label="椤圭洰鏍囧噯鍊�" align="center" prop="proScope" :show-overflow-tooltip="true" width="90px"> </el-table-column> - <el-table-column label="Lis椤圭洰鍚嶇О" align="center" prop="lisXmmc" :show-overflow-tooltip="true" width="200px"> + <el-table-column label="Lis椤圭洰鍚嶇О" align="center" prop="lisXmmc" :show-overflow-tooltip="true" width="200px"> </el-table-column> <el-table-column label="Lis缂栫爜" align="center" prop="lisXmbm" :show-overflow-tooltip="true" width="90px"> </el-table-column> @@ -94,7 +94,7 @@ <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width" width="80px"> <template slot-scope="scope"> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" - v-hasPermi="['hosp:project:edit']" title="淇敼1"></el-button> + v-hasPermi="['hosp:project:edit']" title="淇敼"></el-button> <el-button v-if="scope.row.proParentId == '0'" size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)" v-hasPermi="['system:dept:add']" title="澧炲姞"></el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" @@ -586,7 +586,7 @@ }); }, methods: { - debounceFilter: debounce(function (val) { + debounceFilter: debounce(function(val) { this.$refs.tree.filter(val); }, 300), precomputePinyin() { @@ -690,30 +690,30 @@ this.form.proParentId = row.proId || 0; this.open = true; } else if (this.treeDate.id) { - if (this.treeDate.qf == "0") { - this.form.proParentId = "0" - this.projectOptions.forEach((item) => { - item.children.forEach((item1) => { - if (this.treeDate.id == item1.deptId) { - this.form.deptId = item1.deptId; - } - }); + if(this.treeDate.qf == "0"){ + this.form.proParentId = "0" + this.projectOptions.forEach((item) => { + item.children.forEach((item1) => { + if (this.treeDate.id == item1.deptId) { + this.form.deptId = item1.deptId; + } }); - } else { - this.form.proParentId = this.treeDate.id; - this.projectOptions.forEach((item) => { - item.children.forEach((item1) => { - if (this.form.proParentId == item1.proId) { - this.form.deptId = item1.deptId; - } - }); + }); + }else{ + this.form.proParentId = this.treeDate.id; + this.projectOptions.forEach((item) => { + item.children.forEach((item1) => { + if (this.form.proParentId == item1.proId) { + this.form.deptId = item1.deptId; + } }); - } - - + }); + } + + this.open = true; } else { - this.form.proParentId = "0" + this.form.proParentId = "0" this.open = true; } } @@ -829,56 +829,31 @@ this.treeId.push(this.treeDate.id); }); }, - handleNodeClick(date, node) { - // 褰� qf 涓� "0" 鏃讹紝浠呮墽琛屽睍寮�/鎶樺彔鎿嶄綔 - if (date.qf === "0") { - if (node.expanded) { - node.collapse(); // 鎶樺彔鑺傜偣 - } else { - node.expand(); // 灞曞紑鑺傜偣 - } - return; // 鐩存帴杩斿洖锛屼笉鎵ц鍚庣画鎿嶄綔 - } - - // 浠ヤ笅閫昏緫浠呭湪 qf 涓嶄负 "0" 鏃舵墽琛� - this.treeDate = date; - console.log('Selected node:', this.treeDate); - - this.id = date.id; - this.queryParams.proId = this.id; - this.xiugais = date.qf === "0"; - let data = { - proId: this.queryParams.proId, - proName: this.queryParams.proName || '', - }; - - this.loading = true; - getInfoByProId(this.id) - .then((response) => { - this.xiugaiList = response.data; - }) - .catch((error) => { - console.error('Failed to get info by proId:', error); - this.$message.error('鑾峰彇鏁版嵁澶辫触'); - }); - - 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[0].proId] : []; - this.key = response.data.key; - this.getList(); - } - }) - .catch((error) => { - console.error('Failed to get all child list:', error); - this.$message.error('鍔犺浇鍒楄〃澶辫触'); - }) - .finally(() => { - this.loading = false; - }); -}, + handleNodeClick(date) { + + this.treeDate = date; + console.log(this.treeDate) + this.xiugais = date.qf === "0"; + let proId = date.id; + getInfoByProId(proId).then((response) => { + this.xiugaiList = response.data; + }); + this.id = date.id; + this.queryParams.proId = date.id; + let data = { + proId: this.queryParams.proId, + proName: this.queryParams.proName, + }; + 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.key = response.data.key; + this.loading = false; + } + }); + }, toggleExpandAll() { this.refreshTable = false; this.isExpandAll = !this.isExpandAll; @@ -1147,7 +1122,7 @@ this.getList(); this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); }) - .catch(() => { }); + .catch(() => {}); }, handleExport() { this.download( -- Gitblit v1.8.0