From 18f35fe78de41a1b240758c91e05380decb48978 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期五, 25 七月 2025 17:39:59 +0800 Subject: [PATCH] 1 --- src/views/hosp/project/index.vue | 332 +++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 260 insertions(+), 72 deletions(-) diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue index 219515f..ec93cd3 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="4" :xs="24"> <div class="head-container"> @@ -12,11 +12,20 @@ style="margin-bottom: 15px" /> </div> - <div class="scrollable-container"> + <div class="scrollable-container" v-loading="loadings"> <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" /> + <el-tree + :data="deptOptions" + :props="defaultProps" + :expand-on-click-node="false" + :filter-node-method="filterNode" + ref="tree1" + node-key="id" + :default-expanded-keys="treeId" + highlight-current + @node-click="handleNodeClick" + :render-content="renderContent" + /> </div> </div> </el-col> @@ -77,6 +86,7 @@ icon="el-icon-plus" size="mini" @click="handleUpdate1" + :loading="updateLoading" v-hasPermi="['hosp:project:add']" >淇敼</el-button > @@ -118,8 +128,10 @@ <el-table v-if="refreshTable" v-loading="loading" + style="width: 100%" :data="projectList" ref="tableRef" + height="580" border > <el-table-column @@ -206,7 +218,13 @@ 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缂栫爜" @@ -291,6 +309,7 @@ width="1200px" append-to-body :before-close="handleClose" + v-loading="loading" :close-on-click-modal="false" > <el-form @@ -452,11 +471,27 @@ ></el-option> </el-select> </el-form-item> + <el-form-item label="鏍锋湰绫诲瀷" prop="yb"> + <el-select + v-model="form.yb" + placeholder="璇烽�夋嫨鏍锋湰绫诲瀷" + style="width: 200px" + filterable + clearable + > + <el-option + v-for="dict in dict.type.yblx" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> + </el-select> + </el-form-item> <el-form-item label="妫�鏌ラ儴浣�" prop="checkBw"> <el-select v-model="form.checkBw" placeholder="璇烽�夋嫨妫�鏌ラ儴浣�" - style="width: 200px" + style="width: 260px" filterable clearable > @@ -472,7 +507,7 @@ <el-input v-model="form.proMetering" placeholder="璇疯緭鍏ュ崟浣�" - style="width: 260px" + style="width: 200px" /> </el-form-item> <el-form-item label="鍙傝�冭寖鍥�" prop="proScope"> @@ -486,14 +521,14 @@ <el-input v-model="form.sl" placeholder="璇疯緭鍏ユ暟閲�" - style="width: 200px" + style="width: 260px" /> </el-form-item> <el-form-item label="缁勫悎鏍囧織" prop="sfzhfy"> <el-select v-model="form.sfzhfy" placeholder="璇烽�夋嫨鏄惁缁勫悎鏍囧織" - style="width: 260px" + style="width: 200px" > <el-option v-for="dict in dict.type.sys_yes_no" @@ -530,7 +565,7 @@ <el-input v-model="form.hisXmmc" placeholder="his椤圭洰鍚嶇О" - style="width: 200px" + style="width: 260px" ></el-input> </el-form-item> <el-form-item label="his椤圭洰鍚嶇О" prop="hisXmmc" v-if="key == 'N'"> @@ -544,7 +579,7 @@ <el-input v-model="form.hisXmbm" placeholder="璇疯緭鍏is缂栫爜" - style="width: 260px" + style="width: 200px" /> </el-form-item> <el-form-item label="his鍗曚环" prop="hisdj"> @@ -565,14 +600,14 @@ <el-input v-model="form.lisXmmc" placeholder="璇疯緭鍏IS椤圭洰" - style="width: 200px" + style="width: 260px" ></el-input> </el-form-item> <el-form-item label="LIS缂栫爜" prop="lisXmbm"> <el-input v-model="form.lisXmbm" placeholder="璇疯緭鍏is缂栫爜" - style="width: 260px" + style="width: 200px" /> </el-form-item> <el-form-item label="澶囨敞" prop="proRemark"> @@ -586,8 +621,36 @@ <el-input v-model="form.xh" placeholder="璇疯緭鍏ユ帓搴�" - style="width: 200px" + style="width: 260px" /> + </el-form-item> + <el-form-item label="鏄惁鍙備笌寮傚父" prop="sfcyyc"> + <el-select + v-model="form.sfcyyc" + placeholder="璇烽�夋嫨鏄惁鍙備笌寮傚父" + style="width: 200px" + > + <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> <el-button @@ -939,6 +1002,7 @@ "sys_dict_position", "tj_result_type", "sys_yes_no", + "yblx", ], components: { Treeselect, IconSelect, Packagese }, data() { @@ -958,12 +1022,33 @@ deptOptions: [], dialogTableVisible: false, isPriceDisabled: false, + pageLoading: true, sfxmList: [], deptOptionstree: [], defaultPropstree: { children: "dictSfxms", label: "xmmc", }, + dictTypesy: [ + { + value: "0", + label: "鏄�", + }, + { + value: "1", + label: "鍚�", + }, + ], + wsTypesy: [ + { + value: "1", + label: "鏄�", + }, + { + value: "0", + label: "鍚�", + }, + ], xmmc: "", chargeId: [], List: false, @@ -972,6 +1057,8 @@ ChangeList: [], loading: true, loadings: false, + addLoading: false, + updateLoading: false, key: "", ids: [], single: true, @@ -1040,6 +1127,7 @@ proScope: "", proSex: "2", resultType: "", + sfcyyc: "0", }, rules: { createTime: [ @@ -1069,11 +1157,13 @@ this.debounceFilter(val); }, treeId(newVal) { - console.log(newVal,8989) + console.log(newVal, 8989); if (newVal && newVal.length > 0) { 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( @@ -1102,36 +1192,33 @@ }, }, created() { - this.getConsumables(); - this.getDeptList(); - this.getDeptTree().then(() => { - this.precomputePinyin(); - }); + // this.getConsumables(); + // this.getDeptList(); + // this.getDeptTree().then(() => { + // this.precomputePinyin(); + // }); }, mounted() { - this.getDeptTree().then(() => { - this.precomputePinyin(); - }); + // this.getDeptTree().then(() => { + // this.precomputePinyin(); + // }); + // this.precomputePinyin(); + this.loadPage(); }, methods: { debounceFilter: debounce(function (val) { - this.$refs.tree.filter(val); - }, 800), + this.$refs.tree1.filter(val); + }, 300), precomputePinyin() { const traverse = (nodes) => { 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 shortPinyin = node.label - .split('') - .map(char => cnchar.spell(char, 'array')[0]?.[0]?.toLowerCase() || char) // 鎷奸煶棣栧瓧姣� - .join(''); + const lowerSpell = node.label.spell("low", "array").join(""); + const upperSpell = node.label.spell("up", "array").join(""); this.pinyinCache.set(node.id, { lowerSpell, upperSpell, - shortPinyin, // 缂撳瓨鎷奸煶绠�鍐� - label: node.label + label: node.label, }); } if (node.children) traverse(node.children); @@ -1139,15 +1226,66 @@ }; traverse(this.deptOptions); }, + + 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; + + // 淇濊瘉 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; + } + }, + filterNode(value, data) { if (!value) return true; const cached = this.pinyinCache.get(data.id); - if (!cached) return false; // 濡傛灉娌℃湁缂撳瓨鏁版嵁锛屼笉鏄剧ず璇ヨ妭鐐� - const searchLower = value.toLowerCase(); // 灏嗘悳绱㈣瘝杞负灏忓啓 + if (!cached) return false; return ( - cached.label.includes(value) || // 鐩存帴鍖归厤姹夊瓧 - cached.shortPinyin.includes(searchLower) || // 鍖归厤鎷奸煶绠�鍐� - cached.lowerSpell.includes(searchLower) // 鍖归厤瀹屾暣鎷奸煶 + cached.label.includes(value) || + cached.lowerSpell.includes(value) || + cached.upperSpell.includes(value) ); }, filterNode2(value, data) { @@ -1265,8 +1403,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) => { @@ -1278,10 +1416,9 @@ }); } - this.open = true; } else { - this.form.proParentId = "0" + this.form.proParentId = "0"; this.open = true; } } @@ -1305,7 +1442,7 @@ this.dialogTableVisible = true; if (this.deptOptionstree.length != 0) { this.$nextTick(() => { - this.chargeId.push(this.deptOptionstree[0].id); + // this.chargeId.push(this.deptOptionstree[0].id); }); } @@ -1332,10 +1469,13 @@ } }, getlistSfxm() { + console.log(2222); this.loading = true; this.List = true; listSfxm(this.querycharge).then((response) => { - this.sfxmList = response.rows; + this.sfxmList = response.rows || []; + console.log(response.rows, 111222); + response.rows.forEach((item, index) => { item.newID = (this.querycharge.pageNum - 1) * this.querycharge.pageSize + @@ -1360,18 +1500,26 @@ this.queryParam.id = data.id; this.List = false; this.getListByXmId(); + this.total = 0; }, getListByXmId() { + console.log(this.sfxmList); this.loading = true; + 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; - }); + this.sfxmList = response.data.date || []; + if (response.data.date == null) { + return; + } else { + response.data.date.forEach((item, index) => { + item.newID = + (this.queryParam.page - 1) * this.queryParam.pageSize + index + 1; + }); + } + this.total = response.data.total; - this.loading = false; }); + this.loading = false; }, normalizer(node) { if (node.children && !node.children.length) { @@ -1399,15 +1547,27 @@ }); }, getDeptTree() { - return deptTree111().then((response) => { - this.deptOptions = response.data; - this.treeId.push(this.treeDate.id); - }); + this.loadings = true; + return deptTree111() + .then((response) => { + this.deptOptions = response.data; + this.treeId = []; + if (this.treeDate.id) { + this.treeId.push(this.treeDate.id); + } else { + this.treeId.push("532"); + } + }) + .catch((err) => { + console.error("鍔犺浇閮ㄩ棬鏍戝け璐ワ細", err); + }) + .finally(() => { + this.loadings = false; // 鏃犺鎴愬姛鎴栧け璐ワ紝缁撴潫鍔犺浇 + }); }, handleNodeClick(date) { this.treeDate = date; - this.treeId = [] - console.log(this.treeId,2222); + this.xiugaiList = {}; this.xiugais = date.qf === "0"; let proId = date.id; getInfoByProId(proId).then((response) => { @@ -1562,20 +1722,27 @@ } }, handleUpdate1() { + 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); - } - }); + 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; }, handleUpdate(row) { @@ -1589,6 +1756,7 @@ 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) { @@ -1613,7 +1781,7 @@ } 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"); @@ -1621,6 +1789,7 @@ this.projectOptions.push(project); } }); + // this.loadPage(); this.open = true; this.title = "浣撴椤圭洰淇℃伅缁存姢"; }); @@ -1640,6 +1809,7 @@ }, submitForm() { this.noclick = true; + this.pageLoading = true; this.$refs["form"].validate((valid) => { if (valid) { const isUpdate = this.form.proId != null; @@ -1666,9 +1836,13 @@ this.form.lisXmbm = this.form.lisXmbm; if (this.key === "N") { this.processSubmission(isUpdate, false); + this.open = false; + // this.pageLoading = false; } else if (this.key === "Y") { this.form.sfxmId = this.sfxmId; this.processSubmission(isUpdate, true); + this.open = false; + // this.pageLoading = false; } } }); @@ -1701,15 +1875,29 @@ } } }, - handleSuccess(isY) { + /* handleSuccess(isY) { this.cancel(); - this.getList(); + // this.getList(); if (this.proParent || isY) { this.getDeptTree().then(() => { this.precomputePinyin(); }); } - console.log(this.treeId) + console.log(this.treeId); + }, */ + async handleSuccess(isY) { + this.cancel(); + + if (this.proParent || isY) { + // 绛夊緟宸︿晶鏍戝姞杞藉拰鎷奸煶澶勭悊 + await this.getDeptTree(); + this.precomputePinyin(); + } + + // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊 + await this.getList(); + + this.pageLoading = false; // 鉁� 缁熶竴鍔犺浇鐘舵�佹帶鍒� }, submit() { this.ChangeList.forEach((item) => { @@ -1741,7 +1929,7 @@ this.getList(); this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); }) - .catch(() => { }); + .catch(() => {}); }, handleExport() { this.download( -- Gitblit v1.8.0