| | |
| | | font-size: 18px; |
| | | } |
| | | |
| | | .el-select-dropdown__item { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | </style> |
| | | <style> |
| | | .ins_order_add .el-input-group__append, |
| | |
| | | .ins_order_add .el-table__row .cell { |
| | | font-size: 12px; |
| | | } |
| | | |
| | | |
| | | .ins_order_add .el-table .warning-row .cell{ |
| | | color: #bababa; |
| | | } |
| | |
| | | <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;"> |
| | | <el-option v-for="(a, ai) in templates" :key="ai" :value="a.value" :label="a.label"></el-option> |
| | | <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=""> |
| | | <el-button size="medium" @click="templateDia=true" v-show="active==1"> |
| | | <span style="color: #3A7BFA;">保存模板</span> |
| | | </el-button> |
| | | <el-button size="medium" type="primary" @click="save" :loading="saveLoad">提交</el-button> |
| | | <el-button size="medium" type="primary" @click="save" :loading="saveLoad" v-show="active==1">提交</el-button> |
| | | <el-button size="medium" @click="upInsOrderOfState(2)" :loading="saveLoad" v-show="active==3">审核不通过</el-button> |
| | | <el-button size="medium" type="primary" @click="upInsOrderOfState(1)" :loading="saveLoad" v-show="active==3">审核通过</el-button> |
| | | <el-button size="medium" @click="$parent.playOrder(0)"> |
| | | <span style="color: #3A7BFA;">返回</span> |
| | | </el-button> |
| | |
| | | </el-row> |
| | | </div> |
| | | <div> |
| | | <div style="text-align: right;line-height: 45px;"> |
| | | <el-button type="primary" size="small" @click="addSampleDia = true">添加样品</el-button> |
| | | <div style="text-align: right;line-height: 45px;" v-if="active<2"> |
| | | <el-button type="primary" size="small" @click="addSampleDia = true" >添加样品</el-button> |
| | | <el-button size="small" @click="delSample"> |
| | | <span style="color: #3A7BFA;">删除样品</span> |
| | | </el-button> |
| | | </div> |
| | | <el-table class="el-table" ref="sampleTable" :data="sampleList" height="250px" tooltip-effect="dark" border |
| | | @selection-change="selectSample" highlight-current-row @row-click="rowClick"> |
| | | <el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" height="250px" tooltip-effect="dark" border |
| | | @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;"> |
| | | <el-table-column type="selection" width="60"></el-table-column> |
| | | <el-table-column type="index" label="序号" width="65" align="center"></el-table-column> |
| | | <el-table-column prop="sample" label="样品名称" align="center" show-overflow-tooltip |
| | |
| | | <el-table-column label="操作" width="65" align="center"> |
| | | <template slot-scope="scope"> |
| | | {{scope.index}} |
| | | <el-button type="text" size="small" @click="sampleList.splice(scope.$index, 1)">删除</el-button> |
| | | <el-button type="text" size="small" @click="sampleList.splice(scope.$index, 1)" :disabled="active!=1">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <el-button type="primary" @click="onSample()" :loading="getProductLoad">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="保存模板" :visible.sync="templateDia" width="30%"> |
| | | <div class="body" style="height: 10vh;display: flex;align-items: center;" v-if="templateDia"> |
| | | <div class="search_label"><span class="required-span">* </span>模板名称:</div> |
| | | <div class="search_input"> |
| | | <el-input size="small" clearable v-model="templateName"></el-input> |
| | | </div> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="templateDia = false">取 消</el-button> |
| | | <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> |
| | | |
| | |
| | | components: { |
| | | ValueTable |
| | | }, |
| | | props:{ |
| | | active: { |
| | | type: Number, |
| | | default: () => 0 |
| | | }, |
| | | currentId:{ |
| | | type: Number, |
| | | default: () => 0 |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | template: null, |
| | |
| | | productList: [], |
| | | productIds: [], |
| | | getProductLoad: false, |
| | | saveLoad: false |
| | | saveLoad: false, |
| | | templateDia:false, |
| | | templateLoading:false, |
| | | 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 { |
| | | // 查看/审核流程 |
| | | // 请求接口,回显数据 |
| | | this.$axios.post(this.$api.insOrder.getInsOrder, { |
| | | orderId: this.currentId |
| | | }).then(res => { |
| | | this.addObj = {...res.data.insOrder}; |
| | | this.addObj.type = String(this.addObj.type) |
| | | this.sampleList = this.HaveJson(res.data.sampleProduct); |
| | | this.$nextTick(()=>{ |
| | | this.$refs.sampleTable.doLayout() |
| | | }) |
| | | }) |
| | | } |
| | | }, |
| | | 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 |
| | | 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 |
| | | this.$axios.post(this.$api.insOrder.upInsOrderOfState,{ |
| | | state, |
| | | id:this.currentId |
| | | },{ |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | |
| | | }).then(res=>{ |
| | | this.saveLoad = false |
| | | if(res.code==201)return |
| | | this.$message.success('已提交') |
| | | 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() { |
| | | this.$axios.get(this.$api.user.getUserNow).then(res => { |
| | | let selects = res.data |
| | |
| | | return 'warning-row'; |
| | | } |
| | | return ''; |
| | | } |
| | | }, |
| | | selectInsOrderTemplate(){ |
| | | this.$axios.get(this.$api.insOrder.selectInsOrderTemplate).then(res=>{ |
| | | if(res.code==201)return |
| | | this.templates = res.data |
| | | }) |
| | | }, |
| | | // 删除模板--调用接口 |
| | | handleDelete(row){ |
| | | this.$confirm('是否删除当前数据?', "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | 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> |
| | | </script> |