From 7ae3f52d904c8f3fdf1ba5fc015da54d7ab782e5 Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期三, 26 三月 2025 17:44:20 +0800 Subject: [PATCH] 修改 --- src/views/doctor/checkAll/index.vue | 151 +++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 117 insertions(+), 34 deletions(-) diff --git a/src/views/doctor/checkAll/index.vue b/src/views/doctor/checkAll/index.vue index af522a9..cf88b1d 100644 --- a/src/views/doctor/checkAll/index.vue +++ b/src/views/doctor/checkAll/index.vue @@ -371,11 +371,13 @@ style="margin-bottom: 10px"> <div> 鏍囬锛� - <el-input v-model="jianyi.bt" size="small" type="textarea" autosize></el-input> + <el-input v-model="jianyi.bt" size="small" type="textarea" autosize + @blur="handleAdviceBlur(props.row, index1)"></el-input> </div> <div> 鍐呭锛� - <el-input v-model="jianyi.nr" size="small" type="textarea" autosize></el-input> + <el-input v-model="jianyi.nr" size="small" type="textarea" autosize + @blur="handleAdviceBlur(props.row, index1)"></el-input> </div> </div> </div> @@ -384,14 +386,15 @@ <div v-else> <div> 鏍囬锛� - <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize></el-input> + <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize + @blur="handleAdviceBlur(props.row, -1)"></el-input> </div> <div> 鍐呭锛� - <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize></el-input> + <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize + @blur="handleAdviceBlur(props.row, -1)"></el-input> </div> </div> - <div style="margin-top: 10px;"> <el-button @click="shanchu(props.row)" type="danger" size="small">鍒犻櫎</el-button> @@ -428,11 +431,13 @@ style="margin-bottom: 10px"> <div> 鏍囬锛� - <el-input v-model="jianyi.bt" size="small" type="textarea" autosize></el-input> + <el-input v-model="jianyi.bt" size="small" type="textarea" autosize + @blur="handleAdviceBlur(props.row, index1)"></el-input> </div> <div> 鍐呭锛� - <el-input v-model="jianyi.nr" size="small" type="textarea" autosize></el-input> + <el-input v-model="jianyi.nr" size="small" type="textarea" autosize + @blur="handleAdviceBlur(props.row, index1)"></el-input> </div> </div> </div> @@ -441,14 +446,15 @@ <div v-else> <div> 鏍囬锛� - <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize></el-input> + <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize + @blur="handleAdviceBlur(props.row, -1)"></el-input> </div> <div> 鍐呭锛� - <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize></el-input> + <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize + @blur="handleAdviceBlur(props.row, -1)"></el-input> </div> </div> - <div style="margin-top: 10px;"> <el-button @click="shanchu(props.row)" type="danger" size="small">鍒犻櫎</el-button> @@ -743,7 +749,8 @@ <el-input v-model="advice.bt" placeholder="璇疯緭鍏ュ缓璁爣棰�" clearable @focus="tan"></el-input> </el-form-item> <el-form-item label="寤鸿鍐呭" :prop="'map.' + index + '.nr'"> - <el-input v-model="advice.nr" type="textarea" rows="3" placeholder="璇疯緭鍏ュ缓璁唴瀹�" resize="none" @focus="tan"></el-input> + <el-input v-model="advice.nr" type="textarea" rows="3" placeholder="璇疯緭鍏ュ缓璁唴瀹�" resize="none" + @focus="tan"></el-input> </el-form-item> <el-button v-if="index > 0" type="danger" size="small" @click="removeAdvice(index)" style="margin-left: 100px; margin-bottom: 10px;">鍒犻櫎</el-button> @@ -781,13 +788,13 @@ <!-- 鍒嗛〉缁勪欢 --> - <div class="pag"> + <div class="pag"> <div class="pag2"> <pagination v-show="total1 > 0" :total="total1" :page.sync="queryParams1.pageNum" :limit.sync="queryParams1.pageSize" @pagination="filterAdvices(false)" /> </div> - </div> - + </div> + <span slot="footer" class="dialog-footer"> <el-button @click="showjianyi = false">鍙栨秷</el-button> <el-button type="primary" @click="applySelectedAdvice" :disabled="!selectedAdvice">纭畾</el-button> @@ -1041,6 +1048,60 @@ }); }, methods: { + handleAdviceBlur(row, index) { + // 鏋勯�� advices 鏁版嵁 + let advicesToSubmit = []; + + if (index === -1) { + // advices 涓虹┖锛屼娇鐢� emptyAdvice 鐨勫�� + if (this.emptyAdvice.bt || this.emptyAdvice.nr) { + advicesToSubmit = [{ bt: this.emptyAdvice.bt || '', nr: this.emptyAdvice.nr || '' }]; + // 灏� emptyAdvice 鐨勫�艰祴鍊肩粰 row.advices + this.$set(row, 'advices', advicesToSubmit); + } + } else { + // advices 涓嶄负绌猴紝鐩存帴浣跨敤 row.advices + advicesToSubmit = row.advices; + } + + // 濡傛灉 advicesToSubmit 涓虹┖鎴栨病鏈夋湁鏁堟暟鎹紝涓嶆彁浜� + if (!advicesToSubmit || advicesToSubmit.length === 0) { + return; + } + + + const parentItem = this.yichangList.find(item => + item.sone.some(soneItem => soneItem.orderDetailId === row.orderDetailId) + ); + + if (!parentItem) { + this.$message.error('鏈壘鍒板搴旂殑鐖剁骇椤圭洰'); + return; + } + + const data = { + tjh: this.tableAll.tjNumber, // 浣撴鍙� + parentName: parentItem.proName, // 鐖剁骇椤圭洰鍚嶇О + jcxm: row.proName, // 妫�娴嬮」鐩� + jcjg: row.proResult, // 妫�娴嬬粨鏋� + ckfw: row.stanId, // 鍙傝�冭寖鍥� + dw: row.proAdvice, // 鍗曚綅 + map: advicesToSubmit, // 寤鸿鍒楄〃 + jyjc: parentItem.jyjc, // 妫�鏌ョ被鍨嬶紙0 鎴� 1锛� + id: row.orderDetailId, // 褰撳墠椤圭殑 orderDetailId + }; + + addOrder1(data).then((res) => { + if (res.code === 200) { + + } else { + this.$message.error('寤鸿鏇存柊澶辫触锛�' + (res.msg || '鏈煡閿欒')); + } + }).catch((error) => { + console.error('寤鸿鏇存柊澶辫触:', error); + this.$message.error('寤鸿鏇存柊澶辫触锛�' + error.message); + }); + }, handleCurrentChangeAdvice(currentRow) { this.selectedAdvice = currentRow; // 瀛樺偍閫変腑鐨勫缓璁」 }, @@ -1191,19 +1252,24 @@ this.$message.warning('鑷冲皯淇濈暀涓�缁勫缓璁�'); } }, + shanchu(row) { + // 绂佺敤鍒犻櫎鎸夐挳锛岄槻姝㈤噸澶嶇偣鍑� + this.isdisabled = true; + + // 璋冪敤鍚庣鎺ュ彛鍒犻櫎鏁版嵁 shanchu({ id: row.orderDetailId, }).then((res) => { - if (res.code === 200) { // 娣诲姞鎴愬姛鍝嶅簲妫�鏌� + if (res.code === 200) { // 鍚庣鍒犻櫎鎴愬姛 // 鎵惧埌瑕佸垹闄ら」鎵�鍦ㄧ殑鐖剁骇鏁扮粍 const parentItem = this.yichangList.find(item => - item.sone.some(soneItem => soneItem.proId === row.proId) + item.sone.some(soneItem => soneItem.orderDetailId === row.orderDetailId) ); if (parentItem) { // 浠庣埗绾х殑 sone 鏁扮粍涓垹闄よ椤� - const index = parentItem.sone.findIndex(item => item.proId === row.proId); + const index = parentItem.sone.findIndex(item => item.orderDetailId === row.orderDetailId); if (index > -1) { parentItem.sone.splice(index, 1); @@ -1215,22 +1281,40 @@ } } - // 鏇存柊 expends 鏁扮粍 + // 鏇存柊 expends 鏁扮粍锛岀‘淇濆睍寮�鐘舵�佹纭� this.getExpends(); + + // 寮哄埗鍒锋柊琛ㄦ牸 + this.$forceUpdate(); this.$message.success('鍒犻櫎鎴愬姛'); - // 鑷姩鏇存柊寮傚父缁撴灉鏁版嵁 - this.yichangjieguo(); + // 鍙�夛細璋冪敤 yichangjieguo 鍒锋柊鏁版嵁锛堝鏋滈渶瑕佷笌鍚庣鍚屾锛� + // this.yichangjieguo(); + } else { + this.$message.error('鏈壘鍒拌鍒犻櫎鐨勫瓙椤�'); } + } else { + this.$message.error('鏈壘鍒拌鍒犻櫎鐨勭埗椤�'); } } else { - this.$message.error('鍒犻櫎澶辫触'); + this.$message.error('鍚庣鍒犻櫎澶辫触锛�' + (res.msg || '鏈煡閿欒')); } }).catch((error) => { console.error('鍒犻櫎澶辫触:', error); - this.$message.error('鍒犻櫎鎿嶄綔澶辫触'); + this.$message.error('鍒犻櫎鎿嶄綔澶辫触锛�' + error.message); + }).finally(() => { + // 鎭㈠鍒犻櫎鎸夐挳鐘舵�� + this.isdisabled = false; }); + }, + + // 纭繚 getExpends 鏂规硶瀛樺湪锛岀敤浜庢洿鏂板睍寮�鐘舵�� + getExpends() { + this.expends = this.yichangList.flatMap(item => + item.sone.map(soneItem => soneItem.orderDetailId) + ); + console.log('Updated expends:', this.expends); }, getConfigKey() { getconfigKey("sfkqtwbg").then((res) => { @@ -1244,12 +1328,7 @@ }); }, //璁剧疆table涓殑鎵╁睍椤癸紝灞曞紑鐨刬d锛屾澶勬垜闇�瑕佸叏閮ㄥ睍寮� - getExpends() { - // 閫氳繃flatMap灏嗘瘡涓猻one鏁扮粍涓殑ID鎻愬彇鍑烘潵锛屽苟杩斿洖涓�涓墎骞冲寲鐨処D鏁扮粍 - this.expends = this.yichangList.flatMap((item) => - item.sone.map((subItem) => subItem.proId) - ); - }, + getRowKeys(row) { return row.orderDetailId; @@ -1276,8 +1355,7 @@ }).then((res) => { this.yichangList = res.data; - console.log(this.yichangList, 3232); - this.getExpends(); + this.yichangList.forEach((item) => { item.sone.forEach((soneItem) => { @@ -2420,6 +2498,7 @@ margin-top: 15px; /* 涓庤〃鏍肩殑闂磋窛 */ } + .pag2 { width: auto; /* 绉婚櫎鍥哄畾瀹藉害锛岃鍒嗛〉鍣ㄦ牴鎹唴瀹硅嚜閫傚簲 */ @@ -2428,11 +2507,15 @@ text-align: center; /* 纭繚鍒嗛〉鍣ㄥ唴閮ㄥ厓绱犲眳涓� */ } -@media (max-width: 768px) { + +@media (max-width: 750px) { .pag2 { - min-width: 300px; /* 绉诲姩绔渶灏忓搴� */ - overflow-x: auto; /* 鍏佽妯悜婊氬姩 */ - padding: 10px; /* 绉诲姩绔唴杈硅窛 */ + min-width: 300px; + /* 绉诲姩绔渶灏忓搴� */ + overflow-x: auto; + /* 鍏佽妯悜婊氬姩 */ + padding: 10px; + /* 绉诲姩绔唴杈硅窛 */ } } -- Gitblit v1.8.0