|
|
@@ -97,7 +97,11 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="编码" prop="assetCode">
|
|
|
+ <el-table-column
|
|
|
+ label="编码"
|
|
|
+ prop="assetCode"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<span
|
|
|
v-if="
|
|
|
@@ -116,7 +120,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="名称" prop="name">
|
|
|
+ <el-table-column label="名称" prop="name" show-overflow-tooltip>
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<span
|
|
|
v-if="
|
|
|
@@ -129,22 +133,33 @@
|
|
|
<span> {{ row.name }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="型号" prop="modelType"> </el-table-column>
|
|
|
- <el-table-column label="规格" prop="specification">
|
|
|
+ <el-table-column
|
|
|
+ label="型号"
|
|
|
+ prop="modelType"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="规格"
|
|
|
+ prop="specification"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="批次号"
|
|
|
+ prop="batchNo"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="批次号" prop="batchNo"> </el-table-column>
|
|
|
|
|
|
- <el-table-column label="数量" prop="demandQuantity">
|
|
|
+ <el-table-column label="数量" prop="demandQuantity" width="140">
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<el-form-item>
|
|
|
<el-input
|
|
|
v-model="row.demandQuantity"
|
|
|
- @input="
|
|
|
- row.demandQuantity > row.availableCountBase
|
|
|
- ? (row.demandQuantity = row.availableCountBase)
|
|
|
- : row.demandQuantity
|
|
|
- "
|
|
|
+ @input="changeInput(row, $index, idx)"
|
|
|
size="mini"
|
|
|
+ style="width: 120px"
|
|
|
>
|
|
|
<template slot="append">{{ row.measuringUnit }}</template>
|
|
|
</el-input>
|
|
|
@@ -152,13 +167,32 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="计量库存数量" prop="availableCountBase">
|
|
|
+ <el-table-column
|
|
|
+ label="计量库存数量"
|
|
|
+ prop="availableCountBase"
|
|
|
+ width="220"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
- {{ row.availableCountBase }} {{ row.measuringUnit }}
|
|
|
+ <div v-for="it of row.warehouseList">
|
|
|
+ <span
|
|
|
+ v-if="it.availableCountBase != '0'"
|
|
|
+ style="cursor: pointer"
|
|
|
+ >{{ it.name ? it.name : it.warehouse_name }}库存数:<span
|
|
|
+ style="color: green"
|
|
|
+ >{{ it.availableCountBase }}</span
|
|
|
+ >{{ row.measuringUnit }}</span
|
|
|
+ >
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="领料仓库" prop="warehouseId">
|
|
|
+ <el-table-column
|
|
|
+ label="领料仓库"
|
|
|
+ prop="warehouseId"
|
|
|
+ width="180"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<div
|
|
|
v-if="
|
|
|
@@ -167,10 +201,11 @@
|
|
|
"
|
|
|
>
|
|
|
<el-select
|
|
|
- v-model="row.warehouseId"
|
|
|
+ v-model="row.warehouseIdList"
|
|
|
placeholder="请选择"
|
|
|
filterable
|
|
|
- size="mini"
|
|
|
+ multiple
|
|
|
+ @change="changeWarehouse(row, $index)"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in row.warehouseList"
|
|
|
@@ -184,12 +219,14 @@
|
|
|
|
|
|
<div v-else>
|
|
|
<el-select
|
|
|
- v-model="row.warehouseId"
|
|
|
+ v-model="row.warehouseIdList"
|
|
|
placeholder="请选择"
|
|
|
filterable
|
|
|
+ multiple
|
|
|
+ @change="changeWarehouse(row, $index)"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in row.warehouseLists"
|
|
|
+ v-for="item in row.warehouseList"
|
|
|
:label="item.warehouse_name"
|
|
|
:value="item.warehouse_id"
|
|
|
:key="item.warehouse_id"
|
|
|
@@ -285,23 +322,32 @@
|
|
|
},
|
|
|
|
|
|
getList(ids, taskId) {
|
|
|
- let param = {
|
|
|
- ids: ids,
|
|
|
- taskId: taskId
|
|
|
- };
|
|
|
- workorderList(param)
|
|
|
- .then((res) => {
|
|
|
- let _arr = res.map((e) => {
|
|
|
- e.pickList = [...e.bomDetailDTOS];
|
|
|
- e.bomDetailDTOS = [];
|
|
|
- return e;
|
|
|
+ const param = { ids, taskId };
|
|
|
+
|
|
|
+ workorderList(param).then((res) => {
|
|
|
+ this.workList = res.map((item) => {
|
|
|
+ // 处理 pickList 并统一 warehouse 字段
|
|
|
+ const pickList = item.bomDetailDTOS.map((it) => {
|
|
|
+ const warehouseList = (it.warehouseList || []).map((wh) => ({
|
|
|
+ ...wh,
|
|
|
+ warehouse_id: wh.id,
|
|
|
+ warehouse_name: wh.name
|
|
|
+ }));
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...it,
|
|
|
+ warehouseIdList: it.warehouseId ? [it.warehouseId] : [],
|
|
|
+ warehouseList
|
|
|
+ };
|
|
|
});
|
|
|
|
|
|
- this.workList = JSON.parse(JSON.stringify(_arr));
|
|
|
-
|
|
|
- this.$forceUpdate();
|
|
|
- })
|
|
|
- .finally(() => {});
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ pickList,
|
|
|
+ bomDetailDTOS: [] // 清空原 bomDetailDTOS
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
async getOrderCode() {
|
|
|
@@ -330,7 +376,6 @@
|
|
|
},
|
|
|
|
|
|
save() {
|
|
|
- console.log(this.workList, 'this.workList');
|
|
|
if (this.workList.length > 0) {
|
|
|
let bol;
|
|
|
let _i;
|
|
|
@@ -389,7 +434,6 @@
|
|
|
m.instanceList.push(e);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
m.workOrderId = m.id;
|
|
|
delete m.id;
|
|
|
|
|
|
@@ -418,6 +462,44 @@
|
|
|
this.getList(ids, taskId);
|
|
|
|
|
|
this.orderShow = false;
|
|
|
+ },
|
|
|
+ changeWarehouse(item, index) {},
|
|
|
+ changeInput(item, index, idx) {
|
|
|
+ if (Number(item.demandQuantity) >= Number(item.availableCountBase)) {
|
|
|
+ this.$set(
|
|
|
+ this.workList[idx].pickList[index],
|
|
|
+ 'demandQuantity',
|
|
|
+ Number(item.availableCountBase)
|
|
|
+ );
|
|
|
+ const idsList = [];
|
|
|
+ item.warehouseList.forEach((it) => {
|
|
|
+ idsList.push(it.id);
|
|
|
+ });
|
|
|
+ this.$set(
|
|
|
+ this.workList[idx].pickList[index],
|
|
|
+ 'warehouseIdList',
|
|
|
+ idsList
|
|
|
+ );
|
|
|
+ } else if (!Number(item.demandQuantity)) {
|
|
|
+ this.$set(this.workList[idx].pickList[index], 'warehouseIdList', []);
|
|
|
+ } else {
|
|
|
+ const idsList = [];
|
|
|
+ let totalNum = 0;
|
|
|
+ for (let i = 0; i < item.warehouseList.length; i++) {
|
|
|
+ totalNum += Number(item.warehouseList[i].availableCountBase);
|
|
|
+ if (Number(item.demandQuantity) > totalNum) {
|
|
|
+ idsList.push(item.warehouseList[i].id);
|
|
|
+ } else {
|
|
|
+ idsList.push(item.warehouseList[i].id);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$set(
|
|
|
+ this.workList[0].pickList[index],
|
|
|
+ 'warehouseIdList',
|
|
|
+ idsList
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|