From e17811c1d7b1e6318af32a366d23bd586750b6d2 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期三, 27 十一月 2024 11:32:48 +0800 Subject: [PATCH] 2024 11 27 --- src/views/doctor/checkAll/index.vue | 276 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 204 insertions(+), 72 deletions(-) diff --git a/src/views/doctor/checkAll/index.vue b/src/views/doctor/checkAll/index.vue index e6fafd8..ef48f09 100644 --- a/src/views/doctor/checkAll/index.vue +++ b/src/views/doctor/checkAll/index.vue @@ -229,7 +229,7 @@ :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.pageSize" - @pagination="getList" + @pagination="submitForm" /> </div> </div> @@ -481,7 +481,7 @@ <textarea placeholder="璇疯緭鍏ュ唴瀹�" :autosize="{ minRows: 2, maxRows: 2 }" - style="width: 100%; height: 100%;resize: none;" + style="width: 100%; height: 100%; resize: none" v-model="changedate[index].remark" v-on:input="change" ></textarea> @@ -493,34 +493,31 @@ </div> <div v-else> <table style="width: 100%" v-if="tjproject != '1'"> - <tr - style="border: 1px solid #dfe6ec; border-collapse: collapse" - > + <tr style="border: 1px solid #dfe6ec"> <td style=" border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%; + height: 52px; " > 妫�鏌ユ墍瑙侊細 </td> - <td style="border: 1px solid #dfe6ec;" colspan="2"> - - <textarea + <td + style="border: 1px solid #dfe6ec; height: 52px" + colspan="2" + > + <textarea placeholder="璇疯緭鍏ュ唴瀹�" :autosize="{ minRows: 3, maxRows: 4 }" - style="width: 100%; height: 100%;resize: none;" + style="width: 100%; height: 100%; resize: none" v-model="item.jgbx" ></textarea> </td> - </tr> <tr - style=" - border: 1px solid #dfe6ec; - border-collapse: collapse; - " + style="border: 1px solid #dfe6ec; border-collapse: collapse" > <td style=" @@ -535,33 +532,31 @@ style=" border: 1px solid #dfe6ec; border-collapse: collapse; - " colspan="2" > - <el-input v-model="item.remark" ></el-input> - <!-- <textarea + <!-- <el-input v-model="item.remark"></el-input> --> + <textarea placeholder="璇疯緭鍏ュ唴瀹�" - :autosize="{ minRows: 2, maxRows: 2 }" - style="width: 100%; height: 100%" - v-model="changedate[index].remark" - v-on:input="change" - ></textarea> --> - + :autosize="{ minRows: 2, maxRows: 3 }" + style="width: 100%; height: 100%; resize: none" + v-model="item.remark" + ></textarea> </td> </tr> - <tr style=" + <tr + style=" border: 1px solid #dfe6ec; border-collapse: collapse; width: 200px; height: 36px; - "> + " + > <td style=" border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%; - " > 涓绘鍖诲笀锛� @@ -1157,6 +1152,9 @@ name: "checkAll", data() { return { + // 鏇存柊鎬绘寤鸿 + initialTotalCheckAdvice: "", + initialState: "", preObj: {}, baogao: [], flags: false, @@ -1528,6 +1526,8 @@ radioChange(value) { this.loading = true; this.queryParams.checkStatus = value; + this.queryParams.page = 1; + this.queryParams.pageSize = 10; getcheckList(this.queryParams).then((response) => { if (response.data) { this.checkList = response.data.customers; @@ -1546,7 +1546,6 @@ }, eventchange(data) { this.dataText = data; - console.log(this.textarea1); if (this.textarea1 == null) { this.textarea1 = ""; } @@ -1659,6 +1658,7 @@ // 鎼滅储 submitForm() { + console.log(this.tjStatus); this.loading = true; this.queryParams.compId = this.CheckBox.drugManufacturerId; this.queryParams.checkStatus = this.tjStatus; @@ -1702,8 +1702,25 @@ } }, + /* changRed(row) { + if (row.label === "鈫�") { + return { + color: "green", // 璁剧疆涓婄澶翠负缁胯壊 + }; + } else if (row.label === "鈫�") { + return { + color: "red", // 璁剧疆涓嬬澶翠负绾㈣壊 + }; + } + // 榛樿棰滆壊 + return { + color: "black", + }; + }, */ handleCurrentChange(val) { - this.handleClick(val); + if (val != null) { + this.handleClick(val); + } }, // 鐐瑰嚮璇︽儏 @@ -1711,15 +1728,7 @@ this.$refs.Pre.open = false; this.tableAll = row; this.tjproject = "0"; - // if (this.tableAll.cusSex === 0) { - // this.tableAll.cusSex = "鐢�"; - // } - // if (this.tableAll.cusSex === 1) { - // this.tableAll.cusSex = "濂�"; - // } - // if (this.tableAll.cusSex === 2) { - // this.tableAll.cusSex = "鏈煡"; - // } + this.tjNumber = this.tableAll.tjNumber; getState(this.tjNumber).then((res) => { this.status = res.data; @@ -1739,12 +1748,20 @@ this.changedate = response.data; if (this.changedate) { this.changedate.forEach((item) => { - this.textarea1 = item.checkAdvice; + this.textarea1 = item.checkAdvice || ""; }); + + // 杩欓噷璁剧疆鍒濆鍊� + this.initialTotalCheckAdvice = this.textarea1; // 淇濆瓨鎬绘寤鸿 + + // 淇濆瓨鍒濆鐘舵�� + this.initialState = JSON.parse( + JSON.stringify(this.changedate) + ); + for (let i = 0; i < this.changedate.length; i++) { this.remark = this.changedate[i].remark; } - console.log(this.changedate); this.changedate.forEach((item) => { // this.remark = item.remark; // item.sons.forEach((item3) => { @@ -1794,8 +1811,12 @@ for (let i = 0; i < this.changedate.length; i++) { this.remark = this.changedate[i].remark; } + this.initialState = JSON.parse( + JSON.stringify(this.changedate) + ); + this.changedate.forEach((item) => { - this.textarea1 = item.checkAdvice; + this.textarea1 = item.checkAdvice || ""; // this.remark = item.remark; // item.sons.forEach((item3) => { @@ -1808,6 +1829,11 @@ // }); // item.remark = ""; }); + + // 淇濆瓨鎬绘寤鸿 + this.totalCheckAdvice = this.changedate.map( + (item) => item.totalCheckAdvice + ); } else { this.$message({ type: "warning ", @@ -1858,28 +1884,44 @@ if (this.loading) { return; } - this.$confirm("纭畾瑕佹彁浜ゅ悧锛�") - .then((_) => { - this.loading = true; - this.timer = setTimeout(() => { - done(); - this.determine(); - // 鍔ㄧ敾鍏抽棴闇�瑕佷竴瀹氱殑鏃堕棿 - setTimeout(() => { - this.loading = false; - }, 400); - }, 2000); - }) - .catch((_) => { - this.drawer = false; - let data = { - userId: this.userId, - tjNumber: this.tjNumber, - state: 1, - id: this.MsgId, - }; - getfiedState(data).then((res) => {}); - }); + + // 妫�鏌ユ槸鍚︽湁淇敼 + let isModified = + JSON.stringify(this.changedate) !== JSON.stringify(this.initialState) || + (this.textarea1 !== this.initialTotalCheckAdvice && + this.textarea1 !== null); + console.log("Initial Total Check Advice:", this.initialTotalCheckAdvice); + + console.log("Current textarea1:", this.textarea1); + if (isModified) { + // 濡傛灉鏈変慨鏀癸紝寮瑰嚭纭妗� + this.$confirm("妫�娴嬪唴瀹规湁淇敼锛岀‘瀹氳鎻愪氦鍚楋紵") + .then(() => { + this.loading = true; + this.timer = setTimeout(() => { + done(); + this.determine(); + setTimeout(() => { + this.loading = false; + }, 400); + }, 2000); + }) + .catch(() => { + // 鐢ㄦ埛鍙栨秷鎿嶄綔 + this.drawer = false; + let data = { + userId: this.userId, + tjNumber: this.tjNumber, + state: 1, + id: this.MsgId, + }; + getfiedState(data).then((res) => {}); + this.submitForm(); + }); + } else { + // 濡傛灉娌℃湁淇敼锛岀洿鎺ュ叧闂� + done(); + } }, handleClose1() { this.jianqians = false; @@ -1905,10 +1947,8 @@ // }); // } // }, - change(vale) { - // console.log(this.changedate[index].remark); - }, - determine() { + change(vale) {}, + /* determine() { let tjNumber = this.tableAll.tjNumber; let advice = this.textarea1; let data = { @@ -1916,6 +1956,7 @@ advice, checkStatus: 1, }; + this.loading = true; getTjdetailList(data).then((response) => { if (response.code === 200) { this.$modal.msgSuccess("鎻愪氦鎴愬姛"); @@ -1926,13 +1967,22 @@ state: 1, id: this.MsgId, }; - gettoPdf(tjNumber).then((res) => { - this.$modal.msgSuccess("宸茬敓鎴愭姤鍛婏紒璇峰墠寰�鎶ュ憡鏍告敹椤甸潰纭锛�"); - }); + gettoPdf(tjNumber) + .then((res) => { + this.$modal.msgSuccess("宸茬敓鎴愭姤鍛婏紒璇峰墠寰�鎶ュ憡鏍告敹椤甸潰纭锛�"); + }) + .catch((error) => { + this.$modal.msgError( + "鎵撳嵃鎶ュ憡澶辫触锛岃鍓嶅線鎶ュ憡鎵撳嵃椤甸潰琛ユ墦鎶ュ憡锛�" + ); + }) getfiedState(data).then((res) => { this.drawer = false; }); - } + this.queryParams.page = 1; + this.queryParams.pageSize = 10; + this.submitForm(); + this.$forceUpdate(); }); for (let i = 0; i < this.changedate.length; i++) { @@ -1947,12 +1997,94 @@ ]; getModified(updateOrderRemarkVos).then((response) => {}); } - this.submitForm(); - this.$forceUpdate(); + // this.changedate.forEach((item) => { // this.proIds = item.parentId; // // this.remark = item.remark; // }); + }, */ + determine() { + let tjNumber = this.tableAll.tjNumber; + let advice = this.textarea1; + let data = { + tjNumber, + advice, + checkStatus: 1, + }; + + // 寮�濮嬪姞杞� + this.loading = true; + + // 鎻愪氦鏁版嵁 + getTjdetailList(data) + .then((response) => { + if (response.code === 200) { + this.$modal.msgSuccess("鎻愪氦鎴愬姛"); + + // 鍑嗗鐢熸垚鎶ュ憡鐨勮姹傛暟鎹� + let reportData = { + userId: this.userId, + tjNumber: tjNumber, + state: 1, + id: this.MsgId, + }; + + // 鐢熸垚鎶ュ憡骞朵繚鎸� loading 鎵撳紑 + const reportPromise = gettoPdf(tjNumber) + .then((res) => { + this.$modal.msgSuccess("宸茬敓鎴愭姤鍛婏紒璇峰墠寰�鎶ュ憡鏍告敹椤甸潰纭锛�"); + }) + .catch((error) => { + this.$modal.msgError( + "鎵撳嵃鎶ュ憡澶辫触锛岃鍓嶅線鎶ュ憡鎵撳嵃椤甸潰琛ユ墦鎶ュ憡锛�" + ); + }); + + // 鏇存柊鐘舵�佸苟鎻愪氦淇敼璇锋眰 + const statePromise = getfiedState(reportData).then((res) => { + this.drawer = false; + }); + + // 澶勭悊鍏朵粬淇敼鎿嶄綔 + const updatePromises = this.changedate.map((item) => { + this.proIds = item.parentId; + let remarks = item.remark; + let updateOrderRemarkVos = [ + { + tjNumber, + proId: this.proIds.toString(), + remarks, + }, + ]; + return getModified(updateOrderRemarkVos); // 杩斿洖 Promise + }); + + // 绛夊緟鎵�鏈夎姹傚畬鎴� + Promise.all([reportPromise, statePromise, ...updatePromises]) + .then(() => { + // 鎵�鏈夎姹傚畬鎴愶紝鍏抽棴 loading + this.loading = false; + // 鏇存柊鍒嗛〉淇℃伅 + this.queryParams.page = 1; + this.queryParams.pageSize = 10; + this.submitForm(); + this.$forceUpdate(); + }) + .catch((error) => { + // 澶勭悊閿欒鎯呭喌 + this.loading = false; + console.error("鍙戠敓閿欒:", error); + }); + } else { + // 鎻愪氦澶辫触锛屽叧闂� loading + this.loading = false; + } + }) + .catch((error) => { + // 鎻愪氦璇锋眰澶辫触锛屽叧闂� loading + this.loading = false; + console.error("鎻愪氦璇锋眰澶辫触:", error); + }); }, }, }; -- Gitblit v1.8.0