From d4461e39ce7bda79998febbfa72502b61c743142 Mon Sep 17 00:00:00 2001
From: cuikaidong <ckd2942379034@163.com>
Date: 星期五, 15 八月 2025 14:29:52 +0800
Subject: [PATCH] 修改故障保修,故障简称字段
---
src/views/tms/modules/outBound/OutboundDetailSelectList.vue | 80 ++++++++++++++++++++++++++++++++++++++--
1 files changed, 76 insertions(+), 4 deletions(-)
diff --git a/src/views/tms/modules/outBound/OutboundDetailSelectList.vue b/src/views/tms/modules/outBound/OutboundDetailSelectList.vue
index 2d7a3d3..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",
@@ -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