|
@@ -889,8 +889,6 @@
|
|
|
this.isSubmit = true;
|
|
|
this.$message.success('保存成功');
|
|
|
this.dataId = res.data;
|
|
|
- // this.getDataList();
|
|
|
- // (this.$refs.bill as any).showTab = 'all';
|
|
|
} else this.$message.error(res.msg);
|
|
|
})
|
|
|
} else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
|
|
@@ -907,14 +905,9 @@
|
|
|
}
|
|
|
// 打开新增
|
|
|
onAdd(e : any) {
|
|
|
- console.log('新增tabType ==>', this.tabType);
|
|
|
+ // console.log('新增tabType ==>', this.tabType);
|
|
|
if (e === 'billTable_0') {
|
|
|
(this.$refs.product as any).setShow(true); // 打开sku弹窗
|
|
|
- let obj = (this.$refs.bill as any).getBillFormValue();
|
|
|
- console.log(obj);
|
|
|
- // if (!this.tableData) this.tableData = obj.suborderList;
|
|
|
- // console.log('this.tableData ==> ', this.tableData);
|
|
|
- // (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
|
|
|
} else {
|
|
|
let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
billConfig.form.attr.readonly = false; // 设置只读
|
|
@@ -934,8 +927,8 @@
|
|
|
// 打开编辑
|
|
|
openEdit(e : any) {
|
|
|
e = e.row ? e.row : e;
|
|
|
- console.log('编辑tabType ==>', this.tabType);
|
|
|
- console.log('编辑 ==>', e);
|
|
|
+ // console.log('编辑tabType ==>', this.tabType);
|
|
|
+ // console.log('编辑 ==>', e);
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
api.single({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
@@ -953,8 +946,7 @@
|
|
|
return this.setReadonly(parentData, false)
|
|
|
};
|
|
|
let data = parentData.suborderList
|
|
|
- data.map((v : any, i : any) => {
|
|
|
- v.dataIndex = i;
|
|
|
+ data.map((v : any) => {
|
|
|
if (!v.prePrice) v.prePrice = '0';
|
|
|
});
|
|
|
let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
@@ -1015,6 +1007,7 @@
|
|
|
let selectData = (this.$refs.bill as any).getTableSelectData('draftsBox'); // 获取表格选中数据
|
|
|
if (selectData.length <= 0) return this.$message.warning('请选择提交数据');
|
|
|
if (selectData.length > 1) return this.$message.warning('只能提交一条数据');
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定提交吗!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -1025,6 +1018,7 @@
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('提交成功');
|
|
|
this.clickTab('draftsBox');
|
|
|
+ loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}).catch(() => this.$message.info('已取消提交'));
|
|
@@ -1033,6 +1027,7 @@
|
|
|
console.log('isChange ==> ', this.isChange);
|
|
|
console.log('isSubmit ==> ', this.isSubmit);
|
|
|
if (this.isSubmit) {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定提交吗!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -1047,6 +1042,7 @@
|
|
|
this.isSubmit = false;
|
|
|
this.dataId = '';
|
|
|
(this.$refs.bill as any).showTab = this.tabType;
|
|
|
+ loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}).catch(() => this.$message.info('已取消提交'));
|
|
@@ -1070,6 +1066,7 @@
|
|
|
if (this.isChange || oldbillForm != newBillForm || oldData != newData) {
|
|
|
return this.$message.warning('数据变更必须先保存再提交');
|
|
|
} else {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定提交吗!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -1082,6 +1079,7 @@
|
|
|
this.$message.success('提交成功');
|
|
|
this.clickTab(this.tabType);
|
|
|
(this.$refs.bill as any).showTab = this.tabType;
|
|
|
+ loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}).catch(() => this.$message.info('已取消提交'));
|
|
@@ -1092,6 +1090,7 @@
|
|
|
// 操作反提交
|
|
|
onReturnSmt(e : any) {
|
|
|
console.log('反提交 ==>', e);
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定反提交吗!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -1103,6 +1102,7 @@
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('反提交成功');
|
|
|
this.clickTab(this.tabType);
|
|
|
+ loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}
|
|
@@ -1118,11 +1118,13 @@
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
if (this.tabType === 'smt') {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.cancelSubmission({ id: this.baseInfo.id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('反提交成功');
|
|
|
this.clickTab(this.tabType);
|
|
|
(this.$refs.bill as any).showTab = 'smt';
|
|
|
+ loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}
|
|
@@ -1156,11 +1158,13 @@
|
|
|
let query : any = (this as any).$lodash.cloneDeep(this.supplierSelectData)[0];
|
|
|
query.organizationName = e[0].name;
|
|
|
query.organizationId = e[0].id;
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.updateList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('派单成功');
|
|
|
this.getDataList();
|
|
|
(this.$refs.bill as any).showTab = 'all';
|
|
|
+ loading.close();
|
|
|
} else this.$message.error(res.msg);
|
|
|
})
|
|
|
}
|
|
@@ -1271,33 +1275,43 @@
|
|
|
}
|
|
|
// 确定商品新增
|
|
|
confirmProduct(e : any) {
|
|
|
- let contents : any = [], goodsData = e, newArr : any = [], obj : any = {};
|
|
|
- goodsData = goodsData.map((item : any) => {
|
|
|
- item.materialName = item.skuTitle
|
|
|
- item.prePrice = 0
|
|
|
- item.unitPrice = item.price
|
|
|
- item.materialSku = item.id
|
|
|
- const { id, ...newData } = item
|
|
|
- return newData
|
|
|
- })
|
|
|
- console.log('newTableData ==> ', this.newTableData);
|
|
|
- this.tableData = this.newTableData.concat(goodsData);
|
|
|
- console.log('tableData ==> ', this.tableData);
|
|
|
- newArr = this.tableData.reduce((prev : any, current : any) => {
|
|
|
- obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
|
|
|
- return prev
|
|
|
- }, []);
|
|
|
- this.tableData = newArr;
|
|
|
- this.tableData.map((v : any, i : any) => {
|
|
|
- v.dataIndex = i;
|
|
|
- if (!v.prePrice) v.prePrice = '0';
|
|
|
- });
|
|
|
- if (contents.length > 0) {
|
|
|
- this.$alert('商品 “' + contents + '” 已存在!', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- });
|
|
|
- };
|
|
|
- (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
|
|
|
+ let nowData = (this.$refs.bill as any).getBillTableData(0);
|
|
|
+ let names = '';
|
|
|
+ if (e.length > 0) {
|
|
|
+ for (const item of e) {
|
|
|
+ let t = true;
|
|
|
+ for (const t_item of nowData) {
|
|
|
+ if (item.id == t_item.materialSku) {
|
|
|
+ if (!names) {
|
|
|
+ names = item.skuTitle
|
|
|
+ } else {
|
|
|
+ names = names + ',' + item.skuTitle
|
|
|
+ }
|
|
|
+ t = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (t) {
|
|
|
+ let obj : any = {};
|
|
|
+ obj.materialName = item.skuTitle
|
|
|
+ obj.materialId = item.materialId
|
|
|
+ obj.prePrice = 0
|
|
|
+ obj.unitPrice = item.price
|
|
|
+ obj.materialSku = item.id
|
|
|
+ obj.unit = item.unit
|
|
|
+ obj.prePrice = "0"
|
|
|
+ obj.isDeleted = 0
|
|
|
+ this.tableData.push(obj);
|
|
|
+ nowData.push(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ (this.$refs.bill as any).setBillTableValue(nowData, 0);// 设置第1张单据表格数据
|
|
|
+ if (names) {
|
|
|
+ this.$alert('商品 “' + names + '”已存在!', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// 单据表格删除
|
|
|
changeTable(item : any) {
|
|
@@ -1307,11 +1321,26 @@
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
- this.tableData[item.dataIndex].isDeleted = 1;
|
|
|
- this.newTableData = this.tableData.filter((res : any) => res.isDeleted === 0);
|
|
|
- console.log('原表格数据 ==> ', this.tableData);
|
|
|
- console.log('新表格数据 ==> ', this.newTableData);
|
|
|
- (this.$refs.bill as any).setBillTableValue(this.newTableData, 0);// 设置第1张单据表格数据
|
|
|
+ let data = (this.$refs.bill as any).getBillTableData(0);
|
|
|
+ let i = -1;
|
|
|
+ let j = -1;
|
|
|
+ for (const v of data) {
|
|
|
+ i++;
|
|
|
+ if (v.materialSku == item.materialSku) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ for (const v of this.tableData) {
|
|
|
+ j++;
|
|
|
+ if (v.materialSku == item.materialSku && item.isDeleted === 0) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ this.tableData[j].isDeleted = 1;
|
|
|
+ data.splice(i, 1);
|
|
|
+ (this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
|
|
|
this.$message.success('删除成功');
|
|
|
}).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
@@ -1324,7 +1353,8 @@
|
|
|
selectData.map((v : any) => {
|
|
|
ids.push(v.id)
|
|
|
})
|
|
|
- } else return this.$message({ type: 'warning', message: '请选择删除数据' })
|
|
|
+ } else return this.$message({ type: 'warning', message: '请选择删除数据' });
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -1335,12 +1365,14 @@
|
|
|
if (res.code === 200) {
|
|
|
this.clickTab(this.tabType);
|
|
|
this.$message.success('删除成功!');
|
|
|
+ loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 操作删除
|
|
|
doDelete2(item : any) {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -1351,6 +1383,7 @@
|
|
|
if (res.code === 200) {
|
|
|
this.clickTab(this.tabType);
|
|
|
this.$message.success('删除成功!');
|
|
|
+ loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}).catch(() => this.$message.info('已取消删除'));
|