|
@@ -17,6 +17,7 @@
|
|
|
export default class OrderTask extends Vue {
|
|
|
// 左边
|
|
|
tabType : any = 'all';
|
|
|
+ isAdd : any = false
|
|
|
// 右边
|
|
|
tableData : any = []
|
|
|
mergeObj : any = []
|
|
@@ -147,7 +148,8 @@
|
|
|
compConfig: {
|
|
|
attr: {
|
|
|
size: 'mini',
|
|
|
- type: 'number'
|
|
|
+ type: 'number',
|
|
|
+ defaultValue: 1,
|
|
|
},
|
|
|
}
|
|
|
},
|
|
@@ -180,8 +182,8 @@
|
|
|
compConfig: {
|
|
|
attr: {
|
|
|
size: 'mini',
|
|
|
- defaultValue: '0',
|
|
|
- type: 'number'
|
|
|
+ type: 'number',
|
|
|
+ defaultValue: 0,
|
|
|
},
|
|
|
}
|
|
|
},
|
|
@@ -437,17 +439,23 @@
|
|
|
checkbox: true
|
|
|
},
|
|
|
columns: [
|
|
|
- {
|
|
|
- width: 70,
|
|
|
- title: '单据编号',
|
|
|
- field: 'orderNumber',
|
|
|
- },
|
|
|
{
|
|
|
width: 200,
|
|
|
title: '机构名称',
|
|
|
field: 'organizationName',
|
|
|
isDetail: true,
|
|
|
},
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '单据编号',
|
|
|
+ field: 'orderNumber',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 80,
|
|
|
+ title: '状态',
|
|
|
+ field: 'status',
|
|
|
+ component: Assembly,
|
|
|
+ },
|
|
|
{
|
|
|
width: 200,
|
|
|
title: '交货地点',
|
|
@@ -459,21 +467,20 @@
|
|
|
field: 'deliveryData',
|
|
|
},
|
|
|
{
|
|
|
+ width: 130,
|
|
|
title: '交货人',
|
|
|
field: 'delivery',
|
|
|
},
|
|
|
{
|
|
|
- title: '交货人联系方式',
|
|
|
+ width: 130,
|
|
|
+ title: '联系方式',
|
|
|
field: 'deliveryPhone',
|
|
|
},
|
|
|
{
|
|
|
+ width: 130,
|
|
|
title: '交货方式',
|
|
|
field: 'deliveryWay',
|
|
|
},
|
|
|
- {
|
|
|
- title: '备注',
|
|
|
- field: 'remark',
|
|
|
- },
|
|
|
{
|
|
|
width: 110,
|
|
|
title: '操作',
|
|
@@ -483,8 +490,8 @@
|
|
|
name: '编辑',
|
|
|
audit: '',
|
|
|
event: {
|
|
|
- click: (item : any) => {
|
|
|
- (this as any).openEdit(item)
|
|
|
+ click: (e : any) => {
|
|
|
+ (this as any).openEdit(e)
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
@@ -586,7 +593,7 @@
|
|
|
isDetail: true,
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
+ width: 150,
|
|
|
title: '单据编号',
|
|
|
field: 'orderNumber',
|
|
|
},
|
|
@@ -607,21 +614,20 @@
|
|
|
field: 'deliveryData',
|
|
|
},
|
|
|
{
|
|
|
+ width: 130,
|
|
|
title: '交货人',
|
|
|
field: 'delivery',
|
|
|
},
|
|
|
{
|
|
|
- title: '交货人联系方式',
|
|
|
+ width: 130,
|
|
|
+ title: '联系方式',
|
|
|
field: 'deliveryPhone',
|
|
|
},
|
|
|
{
|
|
|
+ width: 130,
|
|
|
title: '交货方式',
|
|
|
field: 'deliveryWay',
|
|
|
},
|
|
|
- {
|
|
|
- title: '备注',
|
|
|
- field: 'remark',
|
|
|
- },
|
|
|
{
|
|
|
width: 110,
|
|
|
title: '操作',
|
|
@@ -631,8 +637,8 @@
|
|
|
name: '编辑',
|
|
|
audit: '',
|
|
|
event: {
|
|
|
- click: (item : any) => {
|
|
|
- (this as any).openEdit(item)
|
|
|
+ click: (e : any) => {
|
|
|
+ (this as any).openEdit(e)
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
@@ -724,17 +730,17 @@
|
|
|
checkbox: true
|
|
|
},
|
|
|
columns: [
|
|
|
- {
|
|
|
- width: 70,
|
|
|
- title: '单据编号',
|
|
|
- field: 'orderNumber',
|
|
|
- },
|
|
|
{
|
|
|
width: 200,
|
|
|
title: '机构名称',
|
|
|
field: 'organizationName',
|
|
|
isDetail: true,
|
|
|
},
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '单据编号',
|
|
|
+ field: 'orderNumber',
|
|
|
+ },
|
|
|
{
|
|
|
width: 80,
|
|
|
title: '状态',
|
|
@@ -752,21 +758,20 @@
|
|
|
field: 'deliveryData',
|
|
|
},
|
|
|
{
|
|
|
+ width: 130,
|
|
|
title: '交货人',
|
|
|
field: 'delivery',
|
|
|
},
|
|
|
{
|
|
|
- title: '交货人联系方式',
|
|
|
+ width: 130,
|
|
|
+ title: '联系方式',
|
|
|
field: 'deliveryPhone',
|
|
|
},
|
|
|
{
|
|
|
+ width: 130,
|
|
|
title: '交货方式',
|
|
|
field: 'deliveryWay',
|
|
|
},
|
|
|
- {
|
|
|
- title: '备注',
|
|
|
- field: 'remark',
|
|
|
- },
|
|
|
{
|
|
|
width: 110,
|
|
|
title: '操作',
|
|
@@ -800,22 +805,34 @@
|
|
|
// 保存
|
|
|
onSave(e : any) {
|
|
|
console.log('保存 ==>', this.tabType);
|
|
|
- if (this.tabType === 'all' || this.tabType === 'draftsBox') {
|
|
|
- (this as any).$refs.bill.$refs.billForm.validate().then(() => {
|
|
|
- let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
|
|
|
- // 子表数据
|
|
|
- query.suborderList = this.tableData;
|
|
|
- if (query.suborderList.length > 0) {
|
|
|
- query.suborderList.map((v : any) => {
|
|
|
- v.taskOrderId = query.id
|
|
|
- })
|
|
|
- };
|
|
|
- // 表格删除
|
|
|
- query.suborderList.map((v : any, i : any) => {
|
|
|
- if (v.isDeleted !== 1 && !v.id) {
|
|
|
- v.splice(i, 1)
|
|
|
- }
|
|
|
- });
|
|
|
+ (this as any).$refs.bill.$refs.billForm.validate().then(() => {
|
|
|
+ let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
|
|
|
+ // 子表数据
|
|
|
+ query.suborderList = this.tableData;
|
|
|
+ if (query.suborderList.length > 0) {
|
|
|
+ query.suborderList.map((v : any) => {
|
|
|
+ v.taskOrderId = query.id
|
|
|
+ })
|
|
|
+ };
|
|
|
+ // 表格删除
|
|
|
+ query.suborderList.map((v : any, i : any) => {
|
|
|
+ if (v.isDeleted === 1 && !v.id) {
|
|
|
+ v.splice(i, 1)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (this.isAdd) {
|
|
|
+ query.submitState = 0
|
|
|
+ console.log('保存进草稿箱 ==>', query);
|
|
|
+ api.saveList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(res.msg);
|
|
|
+ this.getDataList();
|
|
|
+ (this.$refs.bill as any).showTab = 'all';
|
|
|
+ (this.$refs.bill as any).setBillFormValue({});
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
+ })
|
|
|
+ } else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
|
|
|
+
|
|
|
if (this.tabType === 'draftsBox') query.submitState = 0;
|
|
|
console.log('保存 ==>', query);
|
|
|
api.updateList(query, 'supplyTaskOrder').then((res : any) => {
|
|
@@ -826,8 +843,10 @@
|
|
|
(this.$refs.bill as any).setBillFormValue({});
|
|
|
} else this.$message.error(res.msg);
|
|
|
})
|
|
|
- })
|
|
|
- };
|
|
|
+
|
|
|
+ };
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
// 确定商品新增
|
|
|
confirmProduct(e : any) {
|
|
@@ -849,49 +868,65 @@
|
|
|
confirmButtonText: '确定',
|
|
|
});
|
|
|
};
|
|
|
+ console.log('this.tableData ==> ', this.tableData);
|
|
|
(this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
|
|
|
}
|
|
|
// 打开新增
|
|
|
onAdd(e : any) {
|
|
|
console.log('新增 ==>', e);
|
|
|
if (e === 'billTable_0') {
|
|
|
- (this.$refs.product as any).setShow(true)
|
|
|
+ (this.$refs.product as any).setShow(true); // 打开sku弹窗
|
|
|
let obj = (this.$refs.bill as any).getBillFormValue();
|
|
|
- // console.log('BillFormValue ==> ', 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; // 设置只读
|
|
|
+ billConfig.tool.tools = { save: true, };
|
|
|
+ if (e === 'all') billConfig.tool.tools = { save: true, smt: true };
|
|
|
+ billConfig.tableConfig[0].tool.tools = { add: true };
|
|
|
+ this.isAdd = true;
|
|
|
+ (this.$refs.bill as any).setBillConfig(billConfig);
|
|
|
+ (this.$refs.bill as any).setBillFormValue({}); // 设置单据表单数据
|
|
|
};
|
|
|
- if (e != 'billTable_0') (this.$refs.bill as any).setBillFormValue({}); // 设置单据表单数据
|
|
|
(this.$refs.bill as any).showTab = 'bill';
|
|
|
}
|
|
|
// 打开编辑
|
|
|
openEdit(e : any) {
|
|
|
- console.log('编辑 ==>', e);
|
|
|
- if (e.type === 'all' || e.type === 'draftsBox') {
|
|
|
+ console.log('编辑this.tabType ==>', this.tabType);
|
|
|
+ if (this.tabType === 'all' || this.tabType === 'draftsBox') {
|
|
|
e = e.row ? e.row : e;
|
|
|
+ console.log('编辑 ==>', e);
|
|
|
let data = e.suborderList
|
|
|
data.map((v : any, i : any) => {
|
|
|
v.dataIndex = i
|
|
|
});
|
|
|
let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
- billConfig.form.attr.readonly = false; // 设置只可读
|
|
|
+ billConfig.form.attr.readonly = false; // 设置只读
|
|
|
billConfig.tool.tools = { save: true, };
|
|
|
billConfig.tableConfig[0].tool.tools = { add: true };
|
|
|
this.tableData = data;
|
|
|
(this.$refs.bill as any).setBillConfig(billConfig);
|
|
|
+ (this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
|
|
|
(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
|
|
|
+ this.isAdd = false;
|
|
|
(this.$refs.bill as any).showTab = 'bill';
|
|
|
- } else this.setReadonly(e.row ? e.row : e);
|
|
|
+ } else {
|
|
|
+ this.setReadonly(e.row ? e.row : e);
|
|
|
+ };
|
|
|
}
|
|
|
// 设置只读
|
|
|
setReadonly(e : any) {
|
|
|
let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
- readonly.form.attr.readonly = true; // 设置只可读
|
|
|
+ readonly.form.attr.readonly = true; // 设置只读
|
|
|
readonly.tool.tools = {};
|
|
|
readonly.tableConfig[0].tool.tools = {};
|
|
|
let data = e.suborderList;
|
|
|
(this.$refs.bill as any).setBillConfig(readonly);
|
|
|
+ (this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
|
|
|
(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
|
|
|
+ this.isAdd = false;
|
|
|
(this.$refs.bill as any).showTab = 'bill';
|
|
|
|
|
|
}
|
|
@@ -968,18 +1003,17 @@
|
|
|
}
|
|
|
// 搜索
|
|
|
search(parames : any) {
|
|
|
- console.log('搜索 ==> ', parames);
|
|
|
let query = parames.value
|
|
|
if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
|
|
|
- if (parames.type === 'smt') query.submitState = 1 // 草稿箱数据
|
|
|
- // if (parames.type === 'recycleBin') // 回收站
|
|
|
+ if (parames.type === 'smt') query.submitState = 1 // 已提交数据
|
|
|
+ console.log('搜索 ==> ', query);
|
|
|
this.getPageList(query, parames.type) // 获取分页数据
|
|
|
}
|
|
|
// 刷新
|
|
|
onRefresh(e : any) {
|
|
|
console.log('刷新 ==>', e);
|
|
|
(this as any).$refs.bill.$refs[e].resert();
|
|
|
- if (e === 'all') this.getPageList({}, 'all'); // 草稿箱数据
|
|
|
+ if (e === 'all') this.getPageList({}, 'all'); // 综合查询
|
|
|
if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
|
|
|
if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
|
|
|
if (e === 'recycleBin') this.getSelectDeleteList('supplyTaskOrder') // 回收站数据
|
|
@@ -1028,24 +1062,14 @@
|
|
|
api.deleteList({ ids: ids }, 'supplyTaskOrder').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.getDataList();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
+ this.$message.success('删除成功!');
|
|
|
} else this.failHandle(res)
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 操作删除
|
|
|
doDelete2(item : any) {
|
|
|
- if (this.tabType === '') {
|
|
|
-
|
|
|
- };
|
|
|
+ // if (this.tabType === '') {// };
|
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|