From d289be3b10e9b259625ca9128b54bc62950c4e48 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期一, 08 九月 2025 17:57:49 +0800 Subject: [PATCH] 出库状态改为生命周期 其他文档改为电子文档 电子文档新增指派设备结构树 --- 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 2d7a3d3..b9e0a03 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,13 +131,25 @@ align:"left", dataIndex: 'outboundQuantity' }, + { + title:'棰濆畾瀵垮懡', + align:"center", + dataIndex: 'ratedLife', + scopedSlots: { customRender: 'ratedLife' }, + }, + { + title:'浣跨敤瀵垮懡', + align:"center", + dataIndex: 'useLife', + scopedSlots: { customRender: 'useLife' }, + }, // { // title:'宸插嚭搴撴暟閲�', // align:"left", // dataIndex: 'outActualCount' // }, { - title:'鍑哄簱鐘舵��', + title:'鐢熷懡鍛ㄦ湡', align:"center", dataIndex: 'status_dictText' }, @@ -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