|
|
@@ -20,8 +20,22 @@
|
|
|
:row-click-checked-intelligent="false"
|
|
|
@update:selection="handleSelectionChange"
|
|
|
>
|
|
|
+ <template v-slot:totalQuantity="{ row }">
|
|
|
+ <span>{{ row.totalQuantity || row.quantity }}{{ row.measuringUnit }}</span>
|
|
|
+ </template>
|
|
|
+
|
|
|
<template v-slot:quantity="{ row }">
|
|
|
- <span>{{ row.quantity }}{{ row.measuringUnit }}</span>
|
|
|
+ <span>{{ row.quantity ?? 0 }}{{ row.measuringUnit }}</span>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:remainingDeliverableQuantity="{ row }">
|
|
|
+ <el-input
|
|
|
+ placeholder=""
|
|
|
+ v-model="row.remainingDeliverableQuantity"
|
|
|
+ @blur="validateDeliverableQuantity(row)"
|
|
|
+ >
|
|
|
+ <template slot="append">{{ row.measuringUnit }}</template>
|
|
|
+ </el-input>
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:weight="{ row }">
|
|
|
@@ -92,14 +106,30 @@
|
|
|
showOverflowTooltip: true
|
|
|
},
|
|
|
|
|
|
+ {
|
|
|
+ prop: 'totalQuantity',
|
|
|
+ slot: 'totalQuantity',
|
|
|
+ label: '总数量',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
{
|
|
|
prop: 'quantity',
|
|
|
slot: 'quantity',
|
|
|
- label: '数量',
|
|
|
+ label: '已发数量',
|
|
|
align: 'center',
|
|
|
minWidth: 110,
|
|
|
showOverflowTooltip: true
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: 'remainingDeliverableQuantity',
|
|
|
+ slot: 'remainingDeliverableQuantity',
|
|
|
+ label: '可发数量',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
|
|
|
{
|
|
|
prop: 'workOrderCode',
|
|
|
@@ -168,7 +198,12 @@
|
|
|
await pleaseEntrustAllGoodsDetail({
|
|
|
id
|
|
|
}).then((res) => {
|
|
|
- this.workinProgress = res.data;
|
|
|
+ this.workinProgress = (res.data || []).map((item) => {
|
|
|
+ const remainingDeliverableQuantity =
|
|
|
+ (Number(item.totalQuantity) || 0) - (Number(item.quantity) || 0);
|
|
|
+ item.remainingDeliverableQuantity = remainingDeliverableQuantity < 0 ? 0 : remainingDeliverableQuantity;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
|
|
|
@@ -181,12 +216,29 @@
|
|
|
return this.$message.warning('请至少选择一条在制品数据');
|
|
|
}
|
|
|
|
|
|
+ this.allSelection = this.allSelection.filter((item) => {
|
|
|
+ return item.remainingDeliverableQuantity > 0;
|
|
|
+ });
|
|
|
this.$emit('chooseData', this.allSelection);
|
|
|
this.visible = false;
|
|
|
},
|
|
|
|
|
|
cancel() {
|
|
|
this.visible = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ validateDeliverableQuantity(row) {
|
|
|
+ const remainingDeliverableQuantity = row.remainingDeliverableQuantity;
|
|
|
+ const quantity = row.totalQuantity - row.quantity;
|
|
|
+ if (
|
|
|
+ remainingDeliverableQuantity !== null &&
|
|
|
+ remainingDeliverableQuantity !== undefined &&
|
|
|
+ remainingDeliverableQuantity !== '' &&
|
|
|
+ Number(remainingDeliverableQuantity) > Number(quantity)
|
|
|
+ ) {
|
|
|
+ this.$message.warning('可发数量不能大于剩余数量');
|
|
|
+ row.remainingDeliverableQuantity = quantity;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|