| | |
| | | --> |
| | | <template> |
| | | <basic-container> |
| | | <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit"> |
| | | <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit"><!-- --> |
| | | <template #machineCode="{}"> |
| | | <el-tree-select ref="tree" filterable v-model="attachForm.machineCode" |
| | | node-key="machineCode" |
| | |
| | | > |
| | | </el-autocomplete> |
| | | </template> |
| | | |
| | | <template #programmer="{}"> |
| | | <el-autocomplete ref="autoProgrammer" :disabled="drawingNoMatch" v-model="attachForm.programmer" |
| | | :fetch-suggestions="queryProgrammerAsync" |
| | | :trigger-on-focus="false" @select="handleProgrammerSelect" |
| | | > |
| | | </el-autocomplete> |
| | | </template> |
| | | |
| | | </avue-form> |
| | | </basic-container> |
| | | </template> |
| | |
| | | 'attachForm.drawingNo': function (val) { |
| | | if(val && this.attachForm.processNo && this.attachForm.processEdition) { |
| | | this.attachForm.title = `${val}-${this.attachForm.processNo}-${this.attachForm.processEdition}-计划任务`; |
| | | |
| | | |
| | | } |
| | | }, |
| | | 'attachForm.processNo': function (val) { |
| | |
| | | isLeaf: (data) => !data.hasChildren |
| | | }, |
| | | timeout:0, //零件号加载的timeout |
| | | drawingNoMatch:true,//零件号是否匹配分工表 |
| | | attachOption: { |
| | | labelWidth: 160, |
| | | submitBtn: true, |
| | |
| | | span: 12, |
| | | dataType: 'string', |
| | | blur: (col) => { |
| | | this.handleTrim(col) |
| | | this.handleTrim(col); |
| | | |
| | | }, |
| | | rules: [{ required: true, message: '必填', trigger: 'blur' }], |
| | | }, |
| | |
| | | this.handleTrim(col) |
| | | }, |
| | | }, |
| | | /*{ |
| | | label: '加工机床', |
| | | prop: 'machineCode', |
| | | type: 'select', |
| | | filterable: true, |
| | | dicUrl: `/blade-mdm/machine/page?size=10000`, |
| | | dicFormatter: function (res) { |
| | | that.machineCodeList = res.data.records; |
| | | return res.data.records; |
| | | }, |
| | | rules: [{ required: true, message: '必填', trigger: 'blur' }], |
| | | props: { |
| | | label: 'code', |
| | | value: 'code', |
| | | }, |
| | | span: 12 |
| | | },*/ |
| | | |
| | | { |
| | | label: '加工机床', |
| | | prop: 'machineCode', |
| | |
| | | this.handleTrim(col) |
| | | }, |
| | | // rules: [{ required: true, message: '必填', trigger: 'blur' }], |
| | | } |
| | | }, |
| | | { |
| | | label: '主管工艺', |
| | | prop: 'programmer', |
| | | type: 'input',//column 12 |
| | | disabled:true, |
| | | span: 12, |
| | | dataType: 'string', |
| | | }, |
| | | ], |
| | | }, |
| | | attachForm: {planLockDays:7,planStartTime: this.$dayjs().format('YYYY-MM-DD')},//默认7天 |
| | |
| | | // 如果既不是machine节点也没有子节点,直接返回原节点 |
| | | return node; |
| | | }, |
| | | |
| | | querySearchAsync(query, cb) {//零组件号搜索建议 |
| | | axios({ |
| | | url: '/blade-mdm/producedivision/select-data', |
| | |
| | | handleSelect(item) { |
| | | this.attachForm.productModel = item.cph; |
| | | }, |
| | | |
| | | queryProgrammerAsync(query, cb) {//主管工艺搜索建议 |
| | | axios({ |
| | | url: '/blade-mdm/producedivision/select-programmer', |
| | | method: 'get', |
| | | params: {programmer: query}, |
| | | }).then( |
| | | res => { |
| | | if(res.data.code == 200){ |
| | | let list = res.data.data; |
| | | for(let i of list){ |
| | | i.value = '主管工艺:'+i.programmerName+',校对:'+i.checkerName; |
| | | } |
| | | |
| | | clearTimeout(this.timeout) |
| | | this.timeout = setTimeout(() => { |
| | | cb(list); |
| | | }, 600) |
| | | |
| | | } |
| | | }, |
| | | error => { |
| | | console.log(error); |
| | | } |
| | | ); |
| | | |
| | | }, |
| | | handleProgrammerSelect(item){ |
| | | this.attachForm.producePlanId = item.id; |
| | | this.attachForm.planDrawingNo = this.attachForm.drawingNo;//记录此时的零组件号 |
| | | console.log('productid',this.attachForm ) |
| | | |
| | | }, |
| | | handleTrim(col){ |
| | | //console.log(col) |
| | | let value = this.attachForm[col.column.prop]; |
| | |
| | | }, |
| | | formSubmit(form, done) { |
| | | var form = { ...form }; |
| | | /* |
| | | this.machineCodeList.forEach(item => { |
| | | if (form.machineCode == item.code) { |
| | | form.machineMode = item.name; |
| | | } |
| | | }) |
| | | */ |
| | | console.log('submit',form); |
| | | if(this.attachForm.planDrawingNo == this.attachForm.drawingNo && this.attachForm.producePlanId){ |
| | | //手动指定了人员职责表id,不用继续从服务端验证 |
| | | this.startDispatch(form,done); |
| | | }else{ |
| | | axios({ |
| | | url: '/blade-mdm/producedivision/select-by-drawingno', |
| | | method: 'get', |
| | | params: {drawingNo:this.attachForm.drawingNo}, |
| | | }).then( |
| | | res => { |
| | | |
| | | if(res.data.code == 200){ |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | |
| | | this.attachForm.producePlanId = res.data.data.id; |
| | | this.drawingNoMatch = true; |
| | | console.log('planid',this.attachForm.productPlanId) |
| | | this.startDispatch(form,done); |
| | | }else{ |
| | | this.drawingNoMatch = false; |
| | | |
| | | this.$alert(res.data.msg+".或者手动选择主管工艺。", '发起任务失败',{type:'error',confirmButtonText:'关闭'}); |
| | | } |
| | | done(); |
| | | }, |
| | | error => { |
| | | console.log(error); |
| | | done(); |
| | | } |
| | | ); |
| | | } |
| | | |
| | | }, |
| | | startDispatch(form,done){ |
| | | //验证都通过了,执行启动流程 |
| | | axios({ |
| | | url: '/blade-mdm/flow/dispatch/start', |
| | | method: 'post', |
| | |
| | | }); |
| | | this.$refs.form.resetForm(); |
| | | this.attachForm = this.defaultForm; |
| | | |
| | | this.drawingNoMatch = true; |
| | | }else{ |
| | | this.$alert(res.data.msg, '发起任务失败',{type:'error',confirmButtonText:'关闭'}); |
| | | } |