From 16ba2ae07d1790ff5f38deebdba7baa5537f1f3d Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期一, 20 一月 2025 17:24:50 +0800 Subject: [PATCH] Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb --- src/views/hosp/project/index.vue | 213 ++++++++++++++--------------------------------------- 1 files changed, 57 insertions(+), 156 deletions(-) diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue index 59f180d..33172a1 100644 --- a/src/views/hosp/project/index.vue +++ b/src/views/hosp/project/index.vue @@ -244,11 +244,7 @@ </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" /> @@ -667,6 +663,8 @@ }; getAllChildListById(data).then((response) => { this.projectList = response.data.list; + console.log("杩涙潵浜嗗垪琛ㄥ苟涓旇幏鍙栧埌浜嗗��", this.projectList); + this.loading = false; }); }, @@ -988,9 +986,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; }); }, @@ -1155,7 +1151,6 @@ }, handleUpdate1() { this.form = this.xiugaiList; - console.log('璋冪敤浜唄andleUpdate1'); this.form.proStatus = this.form.proStatus.toString(); this.proParent = true; @@ -1164,9 +1159,6 @@ // if(){ // this.proParent = true // } - // 杩欎釜鏄共鍟ョ殑 - // 鎸夌悊鏉ヨ姝ゆ椂鍙渶瑕乷pen涓簍rue灏卞ソ浜嗗晩 - // 鍘嬫牴涓嶇悊瑙o紝浣犲氨鐪嬫垜缁欎綘璇寸殑閭d釜闂锛岃繖閲岄潰闂澶氱殑寰� getlist().then((response) => { if (response.code == 200) { this.loading = false; @@ -1252,8 +1244,6 @@ this.projectOptions.push(project); } }); - // 鐢ㄧ殑閮芥槸鍚屼竴涓猟ialog鍟� - this.open = true; this.title = "浣撴椤圭洰淇℃伅缁存姢"; }); @@ -1290,157 +1280,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