| | |
| | | <el-row class="title"> |
| | | <el-col :span="6" style="padding-left: 20px;">委托单信息</el-col> |
| | | <el-col :span="18" style="text-align: right;"> |
| | | <el-select v-model="template" size="medium" placeholder="下单模板" style="margin-right: 10px;" v-show="active==1"> |
| | | <el-option v-for="(a, ai) in templates" :key="ai" :value="a.value" :label="a.label"> |
| | | <span style="float: left">{{ a.label }}</span> |
| | | <i class="el-icon-delete" style="float: right; color: #66b1ff; font-size: 16px" @click.stop="handleDelete"></i> |
| | | <el-select v-model="template" size="medium" placeholder="下单模板" style="margin-right: 10px;" v-show="active==1" @change="selectInsOrderTemplateById"> |
| | | <el-option v-for="(a, ai) in templates" :key="ai" :value="a.id" :label="a.name"> |
| | | <span style="float: left">{{ a.name }}</span> |
| | | <i class="el-icon-delete" style="float: right; color: #66b1ff; font-size: 16px" @click.stop="handleDelete(a)"></i> |
| | | </el-option> |
| | | </el-select> |
| | | <el-button size="medium" @click="templateDia=true" v-show="active==1"> |
| | |
| | | <el-button type="primary" @click="addTemplateDia" :loading="templateLoading">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="检验下发" :visible.sync="issuedDialogVisible" width="400px"> |
| | | <div class="body" style="max-height: 60vh;"> |
| | | <el-row> |
| | | <el-col class="search_thing" :span="22"> |
| | | <div class="search_label"><span class="required-span">* </span>约定时间:</div> |
| | | <div class="search_input"> |
| | | <el-date-picker size="small" v-model="distributeData.appointed" type="date" placeholder="选择日期" |
| | | value-format="yyyy-MM-dd" style="width: 100%;" format="yyyy-MM-dd"> |
| | | </el-date-picker> |
| | | </div> |
| | | </el-col> |
| | | <el-col class="search_thing" :span="22"> |
| | | <div class="search_label"><span class="required-span">* </span>指派人员:</div> |
| | | <div class="search_input"> |
| | | <el-select v-model="distributeData.userId" placeholder="请选择" size="small" style="width: 100%;"> |
| | | <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-row> |
| | | <el-button @click="issuedDialogVisible=false">取 消</el-button> |
| | | <el-button type="primary" @click="submitForm2" :loading="upLoad">确 定</el-button> |
| | | </el-row> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | data() { |
| | | return { |
| | | template: null, |
| | | templates: [ |
| | | { |
| | | label:'0000', |
| | | value:1 |
| | | } |
| | | ], |
| | | templates: [], |
| | | addObj: { |
| | | entrustCode: null, |
| | | custom: null, |
| | |
| | | saveLoad: false, |
| | | templateDia:false, |
| | | templateLoading:false, |
| | | templateName:'' |
| | | templateName:'', |
| | | issuedDialogVisible:false, |
| | | distributeData:{ |
| | | appointed:'', |
| | | userId:'' |
| | | }, |
| | | personList:[], |
| | | upLoad:false, |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.selectEnumByCategoryForType() |
| | | this.getUserNow() |
| | | this.selectStandardTreeList() |
| | | this.selectInsOrderTemplate() |
| | | this.getAuthorizedPerson(); |
| | | if(this.active==1){ |
| | | // 下单流程 |
| | | }else { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | getAuthorizedPerson() { |
| | | this.$axios.get(this.$api.user.getUserMenu).then(res => { |
| | | let data = [] |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | | label: a.name, |
| | | value: a.id |
| | | }) |
| | | }) |
| | | this.personList = data |
| | | }) |
| | | }, |
| | | selectEnumByCategoryForType() { |
| | | this.$axios.post(this.$api.enums.selectEnumByCategory, { |
| | | category: "紧急程度" |
| | |
| | | this.selectUserDia = false |
| | | }, |
| | | save() { |
| | | this.saveLoad = true |
| | | this.$axios.post(this.$api.insOrder.addInsOrder,{ |
| | | insOrder: this.addObj, |
| | | list: this.sampleList |
| | | },{ |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res=>{ |
| | | this.saveLoad = false |
| | | if(res.code==201)return |
| | | this.$message.success('已提交') |
| | | this.$parent.playOrder(0) |
| | | }) |
| | | if(!this.addObj.custom){ |
| | | this.$message.error('未选择下单客户') |
| | | }else if(!this.addObj.type){ |
| | | this.$message.error('未选择紧急程度') |
| | | }else if(this.sampleList.length<1){ |
| | | this.$message.error('请添加一个样品') |
| | | }else if(!this.sampleList.every(m=>m.sampleCode)){ |
| | | this.$message.error('输入样品编号') |
| | | }else{ |
| | | this.saveLoad = true |
| | | this.$axios.post(this.$api.insOrder.addInsOrder,{ |
| | | insOrder: this.addObj, |
| | | list: this.sampleList |
| | | },{ |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res=>{ |
| | | this.saveLoad = false |
| | | if(res.code==201)return |
| | | this.$message.success('已提交') |
| | | // 如果紧急程度为紧急,需要直接下发人员 |
| | | if(this.addObj.type==2){ |
| | | this.issuedDialogVisible = true; |
| | | this.$axios.post(this.$api.insOrder.selectOrderManDay,{ |
| | | id: res.data |
| | | }).then(ress=>{ |
| | | // TODO 需要再确认一下返回值 |
| | | this.distributeData.orderId = res.data |
| | | // this.distributeData.sampleId = res.data.sampleId |
| | | this.distributeData.appointed = ress.data |
| | | }) |
| | | }else{ |
| | | this.$parent.playOrder(0) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | upInsOrderOfState(state){ |
| | | this.saveLoad = true |
| | |
| | | if(res.code==201)return |
| | | this.$message.success('提交成功') |
| | | this.$parent.playOrder(0) |
| | | }) |
| | | }, |
| | | // 下发 |
| | | submitForm2(){ |
| | | if(this.distributeData.appointed==null||this.distributeData.appointed==''){ |
| | | this.$message.error('约定时间未填写') |
| | | return |
| | | } |
| | | if(this.distributeData.userId==null||this.distributeData.userId==''){ |
| | | this.$message.error('指派人员未填写') |
| | | return |
| | | } |
| | | this.upLoad = true; |
| | | this.$axios.post(this.$api.insOrder.upInsOrder, { |
| | | orderId: this.distributeData.orderId, |
| | | sampleId: this.distributeData.sampleId, |
| | | appointed: this.distributeData.appointed, |
| | | userId: this.distributeData.userId |
| | | }).then(res => { |
| | | if (res.code === 201) { |
| | | this.upLoad = false |
| | | return |
| | | } |
| | | this.$message.success('提交成功') |
| | | this.upLoad = false |
| | | this.issuedDialogVisible = false |
| | | this.$parent.playOrder(0) |
| | | }).catch(e => { |
| | | this.$message.error('修改失败') |
| | | this.upLoad = false |
| | | }) |
| | | }, |
| | | getUserNow() { |
| | |
| | | } |
| | | return ''; |
| | | }, |
| | | selectInsOrderTemplate(){ |
| | | this.$axios.get(this.$api.insOrder.selectInsOrderTemplate).then(res=>{ |
| | | if(res.code==201)return |
| | | this.templates = res.data |
| | | }) |
| | | }, |
| | | // 删除模板--调用接口 |
| | | handleDelete(){ |
| | | handleDelete(row){ |
| | | this.$confirm('是否删除当前数据?', "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | // this.$axios.post(this.delUrl, { |
| | | // id: row.id |
| | | // }).then(res => { |
| | | // if (res.code === 201) { |
| | | // return |
| | | // } |
| | | // this.$message.success('删除成功') |
| | | // this.selectList() |
| | | // }).catch(e => { |
| | | // this.$message.error('删除失败') |
| | | // }) |
| | | this.$axios.post(this.$api.insOrder.delInsOrderTemplate, { |
| | | id: row.id |
| | | }).then(res => { |
| | | if (res.code === 201) { |
| | | return |
| | | } |
| | | this.$message.success('删除成功') |
| | | this.selectInsOrderTemplate() |
| | | }).catch(e => { |
| | | this.$message.error('删除失败') |
| | | }) |
| | | }).catch(() => {}) |
| | | }, |
| | | // 保存模板 |
| | | addTemplateDia(){ |
| | | if(this.templateName){ |
| | | this.templateLoading = true; |
| | | this.$axios.post(this.$api.insOrder.addInsOrderTemplate,{ |
| | | name:this.templateName, |
| | | thing:JSON.stringify({addObj:this.addObj,sampleList:this.sampleList}) |
| | | },{ |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res=>{ |
| | | if(res.code==201)return |
| | | this.templateLoading = false; |
| | | this.templateDia = false; |
| | | this.$message.success('保存成功') |
| | | this.selectInsOrderTemplate() |
| | | this.templateName = '' |
| | | }) |
| | | }else{ |
| | | this.$message.error('请填写模板名称') |
| | | } |
| | | } |
| | | }, |
| | | // 查询模板 |
| | | selectInsOrderTemplateById(e){ |
| | | this.$axios.post(this.$api.insOrder.selectInsOrderTemplateById+'?id='+e).then(res=>{ |
| | | if(res.code==201)return |
| | | let obj = JSON.parse(res.data) |
| | | this.addObj = obj.addObj; |
| | | this.sampleList = obj.sampleList; |
| | | }) |
| | | }, |
| | | } |
| | | } |
| | | </script> |