|
|
@@ -83,7 +83,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-table :data="form.productInfoList" border>
|
|
|
+ <el-table :data="form.productInfoList" border height="40vh">
|
|
|
<el-table-column label="序号" align="center" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.$index + 1 }}</span>
|
|
|
@@ -154,7 +154,11 @@
|
|
|
<EquipmentDialog
|
|
|
ref="equipmentRefs"
|
|
|
@choose="confirmChoose"
|
|
|
- :selectList="form.productInfoList"
|
|
|
+ :selectList="
|
|
|
+ form.productInfoList.filter(
|
|
|
+ (i) => !disabledList.find((p) => p.productCode === i.productCode)
|
|
|
+ )
|
|
|
+ "
|
|
|
>
|
|
|
</EquipmentDialog>
|
|
|
</ele-modal>
|
|
|
@@ -164,6 +168,7 @@
|
|
|
import { getCode } from '@/api/codeManagement';
|
|
|
import EquipmentDialog from '../components/EquipmentDialog.vue';
|
|
|
import { createOrUpdate, getOrderDetail } from '@/api/saleOrder';
|
|
|
+ import { deepClone } from '@/utils';
|
|
|
import dayjs from 'dayjs';
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -173,6 +178,7 @@
|
|
|
return {
|
|
|
visible: false,
|
|
|
loading: false,
|
|
|
+ disabledList: [], //已保存数据不做删除
|
|
|
form: {
|
|
|
productInfoList: [],
|
|
|
deliveryRequirements: 1,
|
|
|
@@ -204,6 +210,11 @@
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ disabledList () {
|
|
|
+ console.log(this.disabledList, 'disabledList');
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
// 是否开启响应式布局
|
|
|
styleResponsive () {
|
|
|
@@ -224,6 +235,7 @@
|
|
|
},
|
|
|
getDetail (code) {
|
|
|
getOrderDetail(code).then((res) => {
|
|
|
+ this.disabledList = res.productInfoList;
|
|
|
this.form = res;
|
|
|
});
|
|
|
},
|
|
|
@@ -288,19 +300,36 @@
|
|
|
},
|
|
|
// 确定选择
|
|
|
confirmChoose (list) {
|
|
|
- list = list.map((item, index) => {
|
|
|
- return {
|
|
|
- categoryId: item.id,
|
|
|
- productCode: item.code,
|
|
|
- productName: item.name,
|
|
|
- productUnitWeight:
|
|
|
- item.netWeightUnit == 'G'
|
|
|
- ? (item.netWeight * 1000000) / 1000000000
|
|
|
- : item.netWeight,
|
|
|
- model: item.modelType,
|
|
|
- brandNo: item.brandNum
|
|
|
- };
|
|
|
- });
|
|
|
+ console.log(
|
|
|
+ 'this.form.productInfoList',
|
|
|
+ deepClone(this.form.productInfoList)
|
|
|
+ );
|
|
|
+ list = list
|
|
|
+ .filter(
|
|
|
+ (i) =>
|
|
|
+ !this.disabledList.find(
|
|
|
+ (p) => p.productCode == i.code || p.productCode == i.productCode
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .map((item, index) => {
|
|
|
+ if (item.productCode) {
|
|
|
+ return item;
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ categoryId: item.id,
|
|
|
+ productCode: item.code,
|
|
|
+ productName: item.name,
|
|
|
+ productUnitWeight:
|
|
|
+ item.netWeightUnit == 'G'
|
|
|
+ ? (item.netWeight * 1000000) / 1000000000
|
|
|
+ : item.netWeight,
|
|
|
+ model: item.modelType,
|
|
|
+ brandNo: item.brandNum
|
|
|
+ };
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .concat(this.disabledList);
|
|
|
+ console.log('list', list);
|
|
|
// 取出在弹窗中选中并且不在表格中的数据
|
|
|
const result = list.filter(
|
|
|
(i) =>
|
|
|
@@ -308,19 +337,27 @@
|
|
|
(p) => p.productCode === i.productCode
|
|
|
) === -1
|
|
|
);
|
|
|
+ console.log('result', result);
|
|
|
// 取出在表格中并且不在弹窗中选中的数据 即取消选中的数据
|
|
|
const del = this.form.productInfoList.filter(
|
|
|
(i) => list.findIndex((p) => p.productCode === i.productCode) === -1
|
|
|
);
|
|
|
+ console.log('del', del);
|
|
|
for (let i = this.form.productInfoList.length - 1; i >= 0; i--) {
|
|
|
for (let j in del) {
|
|
|
+ console.log(
|
|
|
+ this.form.productInfoList[i].productCode,
|
|
|
+ del[j].productCode
|
|
|
+ );
|
|
|
if (
|
|
|
this.form.productInfoList[i].productCode === del[j].productCode
|
|
|
) {
|
|
|
this.form.productInfoList.splice(i, 1);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
this.form.productInfoList = this.form.productInfoList.concat(result);
|
|
|
this.changeLineNumber();
|
|
|
},
|