diff --git a/src/views/mtm/route_form.vue b/src/views/mtm/route_form.vue index 42260439..ead4e9e3 100644 --- a/src/views/mtm/route_form.vue +++ b/src/views/mtm/route_form.vue @@ -162,12 +162,60 @@ + + + + + + + + + + - 提交 + 提交 取消 @@ -182,9 +230,9 @@ const defaultForm = { material_in:'', material_out:'', hour_work:0, + div_number:1, batch_bind: true, is_autotask: true, - // is_count_utask: false, }; export default { props: { @@ -209,9 +257,18 @@ export default { materialsOut: [], mgroups: [], options: [], + routemats:[], + materialOptions:[], titleMap: { add: "新增", edit: "编辑" }, setFiltersVisible: false, + routeId: "", project_code: "", + addTemplate:{ + id:'', + material:'', + route:'', + + } }; }, mounted() { @@ -219,6 +276,7 @@ export default { this.getProcess(); this.getMaterialIn(); this.getMaterialOut(); + this.getMaterialOptions(); this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code; this.form.routepack = this.routepack; }, @@ -228,24 +286,30 @@ export default { }, getMgroup() { let that = this; - this.$API.mtm.mgroup.list.req({ page: 0 }).then((res) => { - this.mgroups = res; + that.$API.mtm.mgroup.list.req({ page: 0 }).then((res) => { + that.mgroups = res; + }); + }, + getMaterialOptions() { + let that = this; + that.$API.mtm.material.list.req({ page: 0, type__in: "20,30"}).then((res) => { + that.materialOptions = res; }); }, getMaterialIn() { let that = this; - this.$API.mtm.material.list + that.$API.mtm.material.list .req({ page: 0, type__in: "10,20,30" }) .then((res) => { - this.materialsIn = res; + that.materialsIn = res; }); }, getMaterialOut() { let that = this; - this.$API.mtm.material.list + that.$API.mtm.material.list .req({ page: 0, type__in: "10,20" }) .then((res) => { - this.materialsOut = res; + that.materialsOut = res; }); }, getProcess() { @@ -254,6 +318,32 @@ export default { that.options = res; }); }, + getroutemats(){ + let that = this; + that.$API.mtm.routemat.list.req({ route: that.routeId,page: 0}).then((res) => { + that.routemats = res; + }); + }, + formTableSave(row){ + let that = this; + that.$API.mtm.routemat.create.req(row).then((res) => { + that.getroutemats(); + }); + }, + formTableDel(row){ + this.$confirm(`确定删除吗?`, "提示", { + type: "warning", + }).then(() => { + this.$API.mtm.routemat.delete.req(row.id).then((res) => { + let index = this.routemats.findIndex((item) => item.id === row.id); + this.routemats.splice(index, 1); + this.$message.success("删除成功"); + that.getroutemats(); + }).catch((err) => { + return err; + }); + }).catch(() => {}); + }, //显示 open(mode = "add") { this.mode = mode; @@ -263,6 +353,9 @@ export default { //表单注入数据 setData(data) { Object.assign(this.form, data); + this.routeId = data.id; + this.addTemplate.route = data.id; + this.getroutemats(); }, //表单提交方法 submit() {