From 1c1000a93a88b5af5eabbf410aa264b0911dbee4 Mon Sep 17 00:00:00 2001 From: cuikaidong <ckd2942379034@163.com> Date: 星期二, 29 七月 2025 14:18:58 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/tms/modules/outBound/OutboundDetailSelectList.vue | 82 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 77 insertions(+), 5 deletions(-) diff --git a/src/views/tms/modules/outBound/OutboundDetailSelectList.vue b/src/views/tms/modules/outBound/OutboundDetailSelectList.vue index 6ba9e73..87c4314 100644 --- a/src/views/tms/modules/outBound/OutboundDetailSelectList.vue +++ b/src/views/tms/modules/outBound/OutboundDetailSelectList.vue @@ -14,6 +14,36 @@ :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'checkbox'}" @change="handleTableChange"> + <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index"> + <div :key="col.dataIndex"> + + <a-input-number + v-if="col.dataIndex === 'ratedLife'" + :disabled="record.accuracyClass !== '1'" + :value="text" + @change="(e) => handleChange(e, record.key, col, index)" + :min="1" + /> + <div v-if="col.dataIndex === 'ratedLife' && record.accuracyClass === '1' && isFieldEmpty(record.ratedLife)" + style="color: #ff4d4f; font-size: 12px;"> + 蹇呭~ + </div> + + <a-input-number + v-if="col.dataIndex === 'useLife'" + :disabled="record.accuracyClass !== '1'" + :value="text" + @change="(e) => handleChange(e, record.key, col, index)" + :min="1" + /> + <div v-if="col.dataIndex === 'useLife' && record.accuracyClass === '1' && isFieldEmpty(record.useLife)" + style="color: #ff4d4f; font-size: 12px;"> + 蹇呭~ + </div> + + </div> + </template> + <span slot="action" slot-scope="text, record"> <a @click="handleOutbound(record)">鍑哄簱</a> </span> @@ -101,6 +131,18 @@ align:"left", dataIndex: 'outboundQuantity' }, + { + title:'棰濆畾瀵垮懡', + align:"center", + dataIndex: 'ratedLife', + scopedSlots: { customRender: 'ratedLife' }, + }, + { + title:'浣跨敤瀵垮懡', + align:"center", + dataIndex: 'useLife', + scopedSlots: { customRender: 'useLife' }, + }, // { // title:'宸插嚭搴撴暟閲�', // align:"left", @@ -157,7 +199,7 @@ ], url: { list: "/tms/outboundOrder/listOutboundDetailByMainId", - outbound: "/tms/outboundOrder/outBound", + outbound: "/tms/outboundOrder/outBoundByApply", delete: "/tms/outboundOrder/deleteOutboundDetail", deleteBatch: "/tms/outboundOrder/deleteBatchOutboundDetail", exportXlsUrl: "/tms/outboundOrder/exportOutboundDetail", @@ -176,6 +218,9 @@ } }, methods: { + isFieldEmpty(value) { + return value === undefined || value === null || value === ''; + }, onSelectChange(selectedRowKeys, selectionRows) { this.selectedRowKeys = selectedRowKeys; this.selectionRows = selectionRows; @@ -187,13 +232,19 @@ this.ipagination.current = 1 }, handleOutbound(record) { - console.log(this.mainId) - console.log(record) + // 鍏堣繘琛屽繀濉牎楠� + const errors = this.validateRequiredFields(record); + if (errors.length > 0) { + this.$message.error(errors.join('锛�')); + return; + } const params = [ { outBoundOrderId: this.mainId, outboundDetailId: record.id, - outboundQuantity: record.outboundQuantity + outboundQuantity: record.outboundQuantity, + ratedLife: record.ratedLife, + useLife: record.useLife } ] postAction(this.url.outbound, params).then(res=>{ @@ -205,8 +256,29 @@ this.$message } }) + }, + handleChange(value, key, column, index) { + console.log(value, key, column, index) + const temp = [...this.dataSource] + const target = temp.filter(item => key === item.key)[index]; + if (target) { + target[column.dataIndex] = value + this.dataSource = temp + } + }, + validateRequiredFields(record) { + const errors = []; + // 鍙湁鍦ㄤ笉绂佺敤鐘舵�佷笅鎵嶉渶瑕佹牎楠屽繀濉� + if (record.accuracyClass === '1') { + if (this.isFieldEmpty(record.ratedLife)) { + errors.push('棰濆畾瀵垮懡涓哄繀濉」'); + } + if (this.isFieldEmpty(record.useLife)) { + errors.push('浣跨敤瀵垮懡涓哄繀濉」'); + } + } + return errors; } - } } </script> -- Gitblit v1.9.3