|
@@ -856,7 +856,6 @@
|
|
|
let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
|
|
|
// 手机验证
|
|
|
let reg = /^1[3456789]\d{9}$/;
|
|
|
- // let reg = /^0\d{2,3}-\d{7,8}$/
|
|
|
if (query.deliveryPhone && !reg.test(query.deliveryPhone)) return this.$message.warning('请输入正确手机号码');
|
|
|
// 供应商数据
|
|
|
if (!query.organizationName) query.organizationName = this.supplierInfo.name;
|
|
@@ -883,8 +882,8 @@
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
if (this.isAdd) {
|
|
|
api.saveList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
- loading.close();
|
|
|
this.isAdd = false;
|
|
|
this.isChange = false;
|
|
|
this.isSubmit = true;
|
|
@@ -894,8 +893,8 @@
|
|
|
}).catch(() => loading.close());
|
|
|
} else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
|
|
|
api.updateList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
- loading.close();
|
|
|
this.$message.success('保存成功');
|
|
|
this.isChange = false;
|
|
|
this.isSubmit = true;
|
|
@@ -939,13 +938,13 @@
|
|
|
if (parentData.sourceType === '手工输入') {
|
|
|
// 已提交
|
|
|
if (parentData.submitState === 1) {
|
|
|
- loading.close();
|
|
|
- return this.setReadonly(parentData, true)
|
|
|
+ this.setReadonly(parentData, true);
|
|
|
+ return loading.close();
|
|
|
};
|
|
|
// 回收站
|
|
|
if (this.tabType === 'recycleBin') {
|
|
|
- loading.close();
|
|
|
- return this.setReadonly(parentData, false)
|
|
|
+ this.setReadonly(parentData, false);
|
|
|
+ return loading.close();
|
|
|
};
|
|
|
let data = parentData.suborderList
|
|
|
data.map((v : any) => {
|
|
@@ -982,8 +981,8 @@
|
|
|
(this.$refs.bill as any).showTab = 'bill';
|
|
|
loading.close();
|
|
|
} else {
|
|
|
- loading.close();
|
|
|
this.setReadonly(parentData, false);
|
|
|
+ loading.close();
|
|
|
};
|
|
|
}
|
|
|
})
|
|
@@ -1009,44 +1008,43 @@
|
|
|
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: '取消',
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.submitTo({ id: selectData[0].id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('提交成功');
|
|
|
this.clickTab('draftsBox');
|
|
|
- loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
- })
|
|
|
+ }).catch(() => loading.close());
|
|
|
}).catch(() => this.$message.info('已取消提交'));
|
|
|
} else {
|
|
|
if (this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
|
|
|
console.log('isChange ==> ', this.isChange);
|
|
|
console.log('isSubmit ==> ', this.isSubmit);
|
|
|
if (this.isSubmit) {
|
|
|
- let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定提交吗!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
let id = this.dataId ? this.dataId : this.baseInfo.id;
|
|
|
api.submitTo({ id: id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('提交成功');
|
|
|
- this.clickTab(this.tabType);
|
|
|
this.isSubmit = false;
|
|
|
this.dataId = '';
|
|
|
- (this.$refs.bill as any).showTab = this.tabType;
|
|
|
- loading.close();
|
|
|
+ this.clickTab(this.tabType);
|
|
|
} else this.$message.error(res.msg)
|
|
|
- })
|
|
|
+ }).catch(() => loading.close());
|
|
|
}).catch(() => this.$message.info('已取消提交'));
|
|
|
} else {
|
|
|
// 表单旧数据
|
|
@@ -1068,20 +1066,18 @@
|
|
|
if (this.isChange || oldbillForm != newBillForm || oldData != newData) {
|
|
|
return this.$message.warning('数据变更必须先保存再提交');
|
|
|
} else {
|
|
|
- let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定提交吗!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
- // console.log(this.baseInfo.id);
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.submitTo({ id: this.baseInfo.id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('提交成功');
|
|
|
this.clickTab(this.tabType);
|
|
|
- (this.$refs.bill as any).showTab = this.tabType;
|
|
|
- loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
}).catch(() => loading.close());
|
|
|
}).catch(() => this.$message.info('已取消提交'));
|
|
@@ -1092,18 +1088,18 @@
|
|
|
// 操作反提交
|
|
|
onReturnSmt(e : any) {
|
|
|
console.log('反提交 ==>', e);
|
|
|
- let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定反提交吗!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.cancelSubmission({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('反提交成功');
|
|
|
this.clickTab(this.tabType);
|
|
|
- loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
}).catch(() => loading.close());
|
|
|
}).catch(() => this.$message.info('已取消反提交'));
|
|
@@ -1119,11 +1115,10 @@
|
|
|
}).then(() => {
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
api.cancelSubmission({ id: this.baseInfo.id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
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)
|
|
|
}).catch(() => loading.close());
|
|
|
}).catch(() => this.$message.info('已取消反提交'));
|
|
@@ -1148,8 +1143,8 @@
|
|
|
if (query.length > 1) return this.$message.warning('只能派单一条数据');
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
api.single({ id: query[0].id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
- loading.close();
|
|
|
this.supplierSelectData = res.data;
|
|
|
(this.$refs.supplierModal as any).setShow(true);
|
|
|
}
|
|
@@ -1164,11 +1159,10 @@
|
|
|
console.log(query);
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
api.updateList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('派单成功');
|
|
|
- this.getDataList();
|
|
|
- (this.$refs.bill as any).showTab = 'all';
|
|
|
- loading.close();
|
|
|
+ this.clickTab(this.tabType);
|
|
|
} else this.$message.error(res.msg);
|
|
|
}).catch(() => loading.close());
|
|
|
}
|
|
@@ -1176,6 +1170,7 @@
|
|
|
// 切换tab栏
|
|
|
clickTab(e : any) {
|
|
|
this.tabType = e;
|
|
|
+ (this.$refs.bill as any).showTab = e;
|
|
|
// submitState: 提交状态
|
|
|
if (e === 'all') this.getPageList({}, 'all'); // 综合数据
|
|
|
if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
|
|
@@ -1202,8 +1197,13 @@
|
|
|
}
|
|
|
// 获取分页数据
|
|
|
getPageList(query : any, type : any) {
|
|
|
+ let data = (this.$refs.bill as any).getTablePage(this.tabType);
|
|
|
+ query.pageNo = data.pageNo;
|
|
|
+ query.pageSize = data.pageSize;
|
|
|
+ console.log('分页数据 ==> ', query);
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
api.pageList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
(this.$refs.bill as any).setTabTableValue(type, res.data.records);
|
|
|
let page = {
|
|
@@ -1212,7 +1212,6 @@
|
|
|
total: res.data.total //总条数
|
|
|
};
|
|
|
(this.$refs.bill as any).setTablePage(type, page);
|
|
|
- loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
}).catch(() => loading.close());
|
|
|
}
|
|
@@ -1224,9 +1223,9 @@
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
if (e.type === 'recycleBin') {
|
|
|
api.selectDeleteList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
(this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
|
|
|
- loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
}).catch(() => loading.close());
|
|
|
} else {
|
|
@@ -1234,16 +1233,18 @@
|
|
|
if (e.type == 'draftsBox') query.submitState = 0; // 草稿箱数据
|
|
|
if (e.type == 'smt') query.submitState = 1; // 已提交数据
|
|
|
api.pageList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
(this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
|
|
|
- loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
}).catch(() => loading.close());
|
|
|
}
|
|
|
}
|
|
|
// 回收站数据
|
|
|
getSelectDeleteList(query : any) {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.selectDeleteList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
(this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
|
|
|
let page = {
|
|
@@ -1253,21 +1254,18 @@
|
|
|
};
|
|
|
(this.$refs.bill as any).setTablePage('recycleBin', page)
|
|
|
} else this.$message.error(res.msg)
|
|
|
- });
|
|
|
+ }).catch(() => loading.close());
|
|
|
}
|
|
|
// 搜索
|
|
|
search(parames : any) {
|
|
|
- let loading = this.$loading({ target: '.main-container' });
|
|
|
let query = parames.value;
|
|
|
if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
|
|
|
if (parames.type === 'smt') query.submitState = 1 // 已提交数据
|
|
|
console.log('搜索 ==> ', query);
|
|
|
if (this.tabType === 'recycleBin') {
|
|
|
this.getSelectDeleteList(query); // 回收站分页数据
|
|
|
- loading.close()
|
|
|
} else {
|
|
|
this.getPageList(query, parames.type) // 获取分页数据
|
|
|
- loading.close()
|
|
|
}
|
|
|
}
|
|
|
// 刷新/重置
|
|
@@ -1336,14 +1334,12 @@
|
|
|
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张单据表格数据
|
|
@@ -1359,37 +1355,37 @@
|
|
|
selectData.map((v : any) => {
|
|
|
ids.push(v.id)
|
|
|
})
|
|
|
- } else return this.$message({ type: 'warning', message: '请选择删除数据' });
|
|
|
- let loading = this.$loading({ target: '.main-container' });
|
|
|
+ } else return this.$message.warning('请选择删除数据');
|
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.deleteList(ids, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
+ this.$message.success('删除成功');
|
|
|
this.clickTab(this.tabType);
|
|
|
- this.$message.success('删除成功!');
|
|
|
- loading.close();
|
|
|
} else this.$message.error(res.msg)
|
|
|
}).catch(() => loading.close());
|
|
|
}).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 操作删除
|
|
|
doDelete2(item : any) {
|
|
|
- let loading = this.$loading({ target: '.main-container' });
|
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.deleteList({ ids: item.id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ loading.close();
|
|
|
if (res.code === 200) {
|
|
|
this.clickTab(this.tabType);
|
|
|
- this.$message.success('删除成功!');
|
|
|
- loading.close();
|
|
|
+ this.$message.success('删除成功');
|
|
|
} else this.$message.error(res.msg)
|
|
|
}).catch(() => loading.close());
|
|
|
}).catch(() => this.$message.info('已取消删除'));
|