|
@@ -15,6 +15,8 @@
|
|
|
import productModal from "./components/productModal.vue";
|
|
|
@Component({ components: { productModal } })
|
|
|
export default class OrderTask extends Vue {
|
|
|
+ // 左边
|
|
|
+ tabType : any = 'all';
|
|
|
// 右边
|
|
|
tableData : any = []
|
|
|
mergeObj : any = []
|
|
@@ -124,7 +126,7 @@
|
|
|
size: 'mini',
|
|
|
height: 500,
|
|
|
align: 'center',
|
|
|
- readonly:true
|
|
|
+ readonly: true
|
|
|
},
|
|
|
columns:
|
|
|
[{
|
|
@@ -797,22 +799,24 @@
|
|
|
}
|
|
|
// 保存
|
|
|
onSave(e : any) {
|
|
|
- // console.log('保存 ==>', e);
|
|
|
- if (e === 'bill') {
|
|
|
+ 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) {
|
|
|
- console.log(v);
|
|
|
v.splice(i, 1)
|
|
|
}
|
|
|
});
|
|
|
+ if (this.tabType === 'draftsBox') query.submitState = 0;
|
|
|
console.log('保存 ==>', query);
|
|
|
api.updateList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
@@ -823,7 +827,7 @@
|
|
|
} else this.$message.error(res.msg);
|
|
|
})
|
|
|
})
|
|
|
- }
|
|
|
+ };
|
|
|
}
|
|
|
// 确定商品新增
|
|
|
confirmProduct(e : any) {
|
|
@@ -863,17 +867,18 @@
|
|
|
// 打开编辑
|
|
|
openEdit(e : any) {
|
|
|
console.log('编辑 ==>', e);
|
|
|
- if (e.tpye === 'all') {
|
|
|
+ if (e.type === 'all' || e.type === 'draftsBox') {
|
|
|
e = e.row ? e.row : 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.tool.tools = { save: true, };
|
|
|
+ billConfig.tableConfig[0].tool.tools = { add: true };
|
|
|
this.tableData = data;
|
|
|
- // let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
- // console.log(this.config.bill);
|
|
|
- // (this.$refs.bill as any).setBillConfig(readonly);
|
|
|
- (this.$refs.bill as any).setBillFormValue(e); // 设置单据表单数据
|
|
|
+ (this.$refs.bill as any).setBillConfig(billConfig);
|
|
|
(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
|
|
|
(this.$refs.bill as any).showTab = 'bill';
|
|
|
} else this.setReadonly(e.row ? e.row : e);
|
|
@@ -882,17 +887,13 @@
|
|
|
setReadonly(e : any) {
|
|
|
let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
readonly.form.attr.readonly = true; // 设置只可读
|
|
|
- for (let key in readonly.tool) {
|
|
|
- delete readonly.tool[key]
|
|
|
- };
|
|
|
- for (let key in readonly.tableConfig[0].tool) {
|
|
|
- delete readonly.tableConfig[0].tool[key]
|
|
|
- };
|
|
|
+ readonly.tool.tools = {};
|
|
|
+ readonly.tableConfig[0].tool.tools = {};
|
|
|
let data = e.suborderList;
|
|
|
- console.log('setBillConfig ==> ', readonly);
|
|
|
(this.$refs.bill as any).setBillConfig(readonly);
|
|
|
(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
|
|
|
(this.$refs.bill as any).showTab = 'bill';
|
|
|
+
|
|
|
}
|
|
|
// 派单
|
|
|
onDispatch(e : any) {
|
|
@@ -919,6 +920,7 @@
|
|
|
// 切换tab栏
|
|
|
clickTab(e : any) {
|
|
|
console.log('切换tab ==> ', e);
|
|
|
+ this.tabType = e;
|
|
|
// submitState: 提交状态
|
|
|
if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
|
|
|
if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
|
|
@@ -1041,6 +1043,9 @@
|
|
|
}
|
|
|
// 操作删除
|
|
|
doDelete2(item : any) {
|
|
|
+ if (this.tabType === '') {
|
|
|
+
|
|
|
+ };
|
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -1053,7 +1058,7 @@
|
|
|
this.$message.success('删除成功!');
|
|
|
} else this.failHandle(res)
|
|
|
})
|
|
|
- }).catch(() => this.$message.error('已取消删除'));
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 运行错误
|
|
|
failHandle(err : any) {
|