From 18d2f40bbf40469b033de6f07ca8a8e3bc191132 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期六, 26 四月 2025 19:21:40 +0800 Subject: [PATCH] 优化代码 --- 项目代码/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue | 116 ++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 80 insertions(+), 36 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue" index d6cfb32..07fdbf3 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue" @@ -23,7 +23,7 @@ >宸查�夋暟閲忥細 {{ selectionSum }} </span> </el-col> - <el-col :span="4"> + <!-- <el-col :span="4"> <el-link type="primary" size="small" @@ -31,7 +31,7 @@ @click="revokeAssign" >鎾ら攢鍒嗛厤</el-link ></el-col - > + > --> </el-row> </el-alert> </div> @@ -62,17 +62,35 @@ :width="item.width" align="center" > - <template #default="scoped" v-if="item.type == 'icon'"> - <el-tooltip - class="item" - effect="dark" - :content="item.title" - placement="bottom" - ><el-button - type="text" - @click="tableButtonClick(scoped.row, item)" - ><i :class="item.icon" style="font-size: 22px"></i></el-button - ></el-tooltip> + <template #default="scoped"> + <template v-if="item.type == 'icon'"> + <el-tooltip + class="item" + effect="dark" + :content="item.title" + placement="bottom" + ><el-button + type="text" + @click="tableButtonClick(scoped.row, item)" + ><i + :class="item.icon" + :style="{ fontSize: item.iconSize || '22px' }" + ></i></el-button + ></el-tooltip> + </template> + <template v-else> + <el-tooltip + :content="scoped.row[item.prop]" + placement="top" + :disabled=" + !isContentOverflow(scoped.row[item.prop], item.width) + " + > + <div class="cell-content"> + {{ scoped.row[item.prop] }} + </div> + </el-tooltip> + </template> </template> </el-table-column> </el-table> @@ -81,9 +99,9 @@ <el-button type="primary" size="small" @click="outbound" >鐩存帴鍑哄簱</el-button > - <el-button type="primary" size="small" @click="lockStock" + <!-- <el-button type="primary" size="small" @click="lockStock" >閿佸畾搴撳瓨</el-button - > + > --> <el-button type="danger" size="small" @click="showDetialBox = false" >鍏抽棴</el-button > @@ -101,36 +119,43 @@ showDetialBox: false, tableData: [], tableColumns: [ - { - prop: "materielCode", - title: "鐗╂枡缂栧彿", - type: "string", - width: 150, - }, - { - prop: "materielName", - title: "鐗╂枡鍚嶇О", - type: "string", - width: 150, - }, // { - // prop: "palletCode", - // title: "鎵樼洏缂栧彿", + // prop: "materielCode", + // title: "鐗╂枡缂栧彿", + // type: "string", + // width: 150, + // }, + // { + // prop: "materielName", + // title: "鐗╂枡鍚嶇О", // type: "string", // width: 150, // }, { - prop: "batchNo", + prop: "palletCode", + title: "鎵樼洏缂栧彿", + type: "string", + width: 280, + }, + { + prop: "orderNo", title: "鎵规鍙�", type: "string", width: 150, }, - // { - // prop: "locationCode", - // title: "璐т綅缂栧彿", - // type: "string", - // width: 180, - // }, + { + prop: "batchNo", + title: "鏌滃彿", + type: "string", + width: 150, + }, + { + prop: "locationCode", + title: "璐т綅缂栧彿", + type: "string", + + width: 180, + }, { prop: "useableQuantity", title: "鍙敤鏁伴噺", @@ -144,6 +169,13 @@ }; }, methods: { + isContentOverflow(content, width) { + if (!content || !width) return false; + // 浼扮畻姣忎釜瀛楃鐨勫搴︼紙鏍规嵁瀛椾綋澶у皬璋冩暣锛� + const charWidth = 8; // 鍋囪姣忎釜瀛楃瀹藉害涓� 8px + const maxChars = Math.floor(width / charWidth); + return content.length > maxChars; + }, open(row) { this.row = row; this.showDetialBox = true; @@ -175,6 +207,12 @@ }); }, outbound() { + if (this.selection.length <= 0) { + return this.$message.error("璇烽�夋嫨鎸囧畾搴撳瓨"); + } + if (this.selectionSum > this.row.orderQuantity) { + return this.$message.error("宸查�夋暟閲忎笉鑳借秴杩囬渶姹傛暟閲�"); + } this.http .post( "api/Task/GenerateOutboundTask?id=" + this.row.id, @@ -263,6 +301,12 @@ .more-style { color: red; } +.cell-content { + white-space: nowrap; /* 闃叉鎹㈣ */ + overflow: hidden; /* 闅愯棌瓒呭嚭閮ㄥ垎 */ + text-overflow: ellipsis; /* 鏄剧ず鐪佺暐鍙� */ + width: 100%; /* 瀹藉害鍗犳弧鍗曞厓鏍� */ +} </style> <style> -- Gitblit v1.9.3