From cb1f69717eed3b6a61b6c61a8934bac752782b2d Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期三, 05 三月 2025 17:00:38 +0800 Subject: [PATCH] 1 --- src/views/hosp/project/index.vue | 254 ++++++++++++++++++-------------------------------- 1 files changed, 92 insertions(+), 162 deletions(-) diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue index 59f180d..31609a5 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" /> + :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> @@ -244,14 +244,13 @@ </el-form-item> <el-form-item label="LIS缂栫爜" prop="lisXmbm"> - <el-input - v-model="form.lisXmbm" - placeholder="璇疯緭鍏is缂栫爜" - style="width: 260px" - /> + <el-input v-model="form.lisXmbm" placeholder="璇疯緭鍏is缂栫爜" style="width: 260px" /> </el-form-item> <el-form-item label="澶囨敞" prop="proRemark"> <el-input v-model="form.proRemark" placeholder="璇疯緭鍏ュ娉�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鎺掑簭" prop="xh"> + <el-input v-model="form.xh" placeholder="璇疯緭鍏ュ娉�" style="width: 200px" /> </el-form-item> </el-form> <el-button style="margin-left: 40px" type="primary" plain size="mini" icon="el-icon-plus" @@ -419,6 +418,7 @@ import IconSelect from "@/components/IconSelect"; import { listConsumables } from "@/api/hosp/consumables"; import { Message } from "element-ui"; +import cnchar from 'cnchar'; import { listSfxm, getSfxm, @@ -476,6 +476,7 @@ ChangeList: [], // 閬僵灞� loading: true, + loadings: false, key: "", // 閫変腑鏁扮粍 ids: [], @@ -550,6 +551,7 @@ sfzhfy: "Y", hisdj: "", sl: "", + xh:"0", proStatus: "0", proName: "", proPrice: "", @@ -667,6 +669,8 @@ }; getAllChildListById(data).then((response) => { this.projectList = response.data.list; + // console.log("杩涙潵浜嗗垪琛ㄥ苟涓旇幏鍙栧埌浜嗗��", this.projectList); + this.loading = false; }); }, @@ -885,7 +889,6 @@ deptTree111().then((response) => { this.deptOptions = response.data; this.treeId.push(this.treeDate.id); - console.log(this.treeId) }); }, @@ -920,14 +923,37 @@ return data.xmmc.indexOf(value) !== -1; }, // 绛涢�夎妭鐐� + // filterNode(value, data) { + // console.log(value, data) + // if (!value) return true; + // return data.label.indexOf(value) !== -1; + // }, filterNode(value, data) { - if (!value) return true; - return data.label.indexOf(value) !== -1; + if (!value) return true; + if (data.label.indexOf(value) !== -1) return true; + // 鍖归厤灏忓啓 + let arr = data.label.spell('low', 'array'); + let spell = arr.join(''); + let lengths = [0]; + for (var i = 0; i < arr.length - 1; i++) { + lengths.push(lengths[i] + arr[i].length); + }; + //鍒ゆ柇label瀹屾暣鎷奸煶 涓� 杈撳叆鍊肩殑 index 鏄笉鏄瓑浜庢煇涓眽瀛楃涓�涓嫾闊冲瓧姣嶇殑index鍊� + if(lengths.indexOf(spell.indexOf(value)) !== -1) return true + // 澶у啓 + let arrUp = data.label.spell('up', 'array'); + let spellUp = arrUp.join(''); + let lengthsUp = [0]; + for (var i = 0; i < arrUp.length - 1; i++) { + lengthsUp.push(lengthsUp[i] + arrUp[i].length); + }; + return lengthsUp.indexOf(spellUp.indexOf(value)) !== -1; }, + // 鑺傜偣鍗曞嚮浜嬩欢 handleNodeClick(date) { - console.log("璋冪敤浜唄andleNodeClick ", date.id, this.id) + // console.log("璋冪敤浜唄andleNodeClick ", date.id, this.id) this.treeDate = date; if (date.qf == "0") { this.xiugais = true; @@ -988,9 +1014,7 @@ proId: this.queryParams.proId, }; getAllChildListById(data).then((response) => { - // this.projectList = this.handleTree(response.data.list, "proId"); - // this.ListId.push(this.projectList[0].proId); - // this.key = response.data.key; + this.loading = false; }); }, @@ -1006,6 +1030,7 @@ proEngName: null, proPrice: "0.00", proRemark: null, + xh:"0", createBy: null, createTime: null, updateBy: null, @@ -1155,7 +1180,6 @@ }, handleUpdate1() { this.form = this.xiugaiList; - console.log('璋冪敤浜唄andleUpdate1'); this.form.proStatus = this.form.proStatus.toString(); this.proParent = true; @@ -1164,9 +1188,6 @@ // if(){ // this.proParent = true // } - // 杩欎釜鏄共鍟ョ殑 - // 鎸夌悊鏉ヨ姝ゆ椂鍙渶瑕乷pen涓簍rue灏卞ソ浜嗗晩 - // 鍘嬫牴涓嶇悊瑙o紝浣犲氨鐪嬫垜缁欎綘璇寸殑閭d釜闂锛岃繖閲岄潰闂澶氱殑寰� getlist().then((response) => { if (response.code == 200) { this.loading = false; @@ -1252,8 +1273,6 @@ this.projectOptions.push(project); } }); - // 鐢ㄧ殑閮芥槸鍚屼竴涓猟ialog鍟� - this.open = true; this.title = "浣撴椤圭洰淇℃伅缁存姢"; }); @@ -1290,157 +1309,68 @@ /** 鎻愪氦鎸夐挳 */ submitForm() { - this.noclick = true - if (this.key == "N") { - console.log('1111'); + this.noclick = true; + this.$refs["form"].validate(valid => { + if (valid) { + const isUpdate = this.form.proId != null; - // 杩欎釜鏄笂闈慨鏀硅繕鏄崟琛屼慨鏀� - this.$refs["form"].validate((valid) => { - if (valid) { - if (this.form.proId != null) { - if (this.form.tjStandardList != null) { - this.form.tjStandardList.forEach((items) => { - if (items.tjSex === "鐢�" || items.tjSex === "0") { - items.tjSex = "0"; - } else if (items.tjSex === "濂�" || items.tjSex === "1") { - items.tjSex = "1"; - } else { - items.tjSex = null; - } - if (items.tjType === "濠村効") { - items.tjType = 0; - } - if (items.tjType === "骞煎効") { - items.tjType = 1; - } - if (items.tjType === "鍎跨") { - items.tjType = 2; - } - if (items.tjType === "灏戝勾") { - items.tjType = 3; - } - if (items.tjType === "闈掑勾") { - items.tjType = 4; - } - if (items.tjType === "涓勾") { - items.tjType = 5; - } - if (items.tjType === "鑰佸勾") { - items.tjType = 6; - } - }); - } - this.form.lisXmbm = this.form.lisXmbm; - updateProject(this.form).then((response) => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - if (this.proParent == true) { - console.log('杩涘叆浜唒roParent == true') - this.getDeptTree(); - this.cancel(); - } else { - console.log('杩涘叆浜唒roParent == false') - this.cancel(); - this.getList(); - } - }); - } else { - if (this.form.proParentId === 0) { - this.form.tjStandardList = null; - } else { - this.form.consumablesList = null; - } - - if (this.form.deptId === null || this.form.proParentId === null) { - this.$message.error("璇峰~鍐欑埗椤瑰悕绉版垨绉戝鍚嶇О"); - this.open = true; - } else { - this.form.lisXmbm = this.form.lisXmbm; - addProject(this.form).then((response) => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.cancel(); - this.getList(); - }); - } - } + // 澶勭悊鎬у埆鍜屽勾榫勭粍鐨勮浆鎹� + 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; + }); } - }); - } else if (this.key == "Y") { - this.form.sfxmId = this.sfxmId; - this.$refs["form"].validate((valid) => { - if (valid) { - console.log('222'); - if (this.form.proId != null) { - console.log('22-11'); - if (this.form.tjStandardList != null) { - this.form.tjStandardList.forEach((items) => { - if (items.tjSex === "鐢�" || items.tjSex === "0") { - items.tjSex = "0"; - } else if (items.tjSex === "濂�" || items.tjSex === "1") { - items.tjSex = "1"; - } else { - items.tjSex = null; - } - if (items.tjType === "濠村効") { - items.tjType = 0; - } - if (items.tjType === "骞煎効") { - items.tjType = 1; - } - if (items.tjType === "鍎跨") { - items.tjType = 2; - } - if (items.tjType === "灏戝勾") { - items.tjType = 3; - } - if (items.tjType === "闈掑勾") { - items.tjType = 4; - } - if (items.tjType === "涓勾") { - items.tjType = 5; - } - if (items.tjType === "鑰佸勾") { - items.tjType = 6; - } - }); - } - this.form.lisXmbm = this.form.lisXmbm; - updateProject(this.form).then((response) => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - if (this.proParent == true) { - this.getDeptTree(); - this.cancel(); - } else { - this.cancel(); - this.getList(); - } - }); - } else { - console.log('22-22'); + // 璁剧疆 lisXmbm + this.form.lisXmbm = this.form.lisXmbm; - if (this.form.proParentId === 0) { - this.form.tjStandardList = null; - } else { - this.form.consumablesList = null; - } - - if (this.form.deptId === null || this.form.proParentId === null) { - this.$message.error("璇峰~鍐欑埗椤瑰悕绉版垨绉戝鍚嶇О"); - this.open = true; - } else { - this.form.lisXmbm = this.form.lisXmbm; - addProject(this.form).then((response) => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.cancel(); - this.getList(); - }); - } - } + // 鏍规嵁 key 鍊奸�夋嫨涓嶅悓鐨勬搷浣滄祦绋� + if (this.key === "N") { + this.processSubmission(isUpdate, false); + } else if (this.key === "Y") { + this.form.sfxmId = this.sfxmId; + this.processSubmission(isUpdate, true); } + } + }); + }, + + processSubmission(isUpdate, isY) { + if (isUpdate) { + updateProject(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.handleSuccess(isY); }); + } else { + // 鏂板閫昏緫 + if (this.form.proParentId === 0) { + this.form.tjStandardList = null; + } else { + this.form.consumablesList = null; + } + + if (this.form.deptId === null || this.form.proParentId === null) { + this.$message.error("璇峰~鍐欑埗椤瑰悕绉版垨绉戝鍚嶇О"); + this.open = true; + } else { + addProject(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.handleSuccess(isY); + }); + } } }, + handleSuccess(isY) { + this.cancel(); + this.getList(); + if (this.proParent || isY) { + this.getDeptTree(); + } + }, // 鏀惰垂椤圭洰纭 submit() { this.ChangeList.forEach((item) => { -- Gitblit v1.8.0