diff --git a/src/views/reagent/buy/index.vue b/src/views/reagent/buy/index.vue index 5bc34b7..9e06c4b 100644 --- a/src/views/reagent/buy/index.vue +++ b/src/views/reagent/buy/index.vue @@ -163,13 +163,13 @@ export default { adddialogVisible:false, row_id:'', formData: { - name: undefined, - cas_number: undefined, - purity: undefined, - export_count:undefined, - speci: undefined, - net_weight_unit: undefined, - net_weight: undefined + name: '', + cas_number: '', + purity: '', + export_count:'', + speci: '', + net_weight_unit: '', + net_weight: '' }, statusColorMap: ['warning','success','danger'], statusMap: ['未处理', '已处理','已驳回'], @@ -224,17 +224,7 @@ export default { } ], net_weight_unit: [ - { required: true, message: '请输入单位', trigger: 'change' }, - { - validator (rule, value, callback) { - if (/(^[1-9]\d*$)/.test(value)) { - callback() - } else { - callback(new Error('请输入正整数')) - } - }, - trigger: 'blur' - } + { required: true, message: '请输入单位', trigger: 'change' } ], net_weight: [ @@ -367,6 +357,16 @@ export default { //打开申请列表 openDialogTableVisible(){ this.title='新增采购试剂' + this.checkList=[] + this.formData = { + name: '', + cas_number: '', + purity: '', + export_count:'', + speci: '', + net_weight_unit: '', + net_weight: '' + } this.adddialogVisible = true }, //关闭申请列表 @@ -374,53 +374,59 @@ export default { this.adddialogVisible = false this.checkList=[] this.formData = { - name: undefined, - cas_number: undefined, - purity: undefined, - export_count:undefined, - speci: undefined, - net_weight_unit: undefined, - net_weight: undefined + name: '', + cas_number: '', + purity: '', + export_count:'', + speci: '', + net_weight_unit: '', + net_weight: '' } }, //提交申请 create_apply(){ var that =this let datalist = that.checkList.map((item) => { - return Object.assign({}, {net_weight_unit: item.net_weight_unit, net_weight: item.net_weight, name: item.name, cas_number: item.cas_number,purity: item.purity, export_count: item.export_count, speci: item.speci}) + return Object.assign({}, {net_weight_unit: item.net_weight_unit, total: item.net_weight, name: item.name,value:item.name, cas_number: item.cas_number,purity: item.purity, remark6:'瓶', + export_count: item.export_count, speci: item.speci,distributor:'',english_name:'',expiration_date:'',manufacturer:'',medicament_id:'',production_date:'',net_weight:'',shelf_life:''}) }) - if(this.title=='编辑采购试剂'){ - const data = { - id: this.row_id, - use_content: JSON.stringify(datalist), - } - update(stringify(data)).then(rsp => { - console.log("rsp>>", rsp) - if (rsp.status==0){ - this.dialogTableClose() - //清空表格多选框 - this.$refs.multipleTable.clearSelection(); - that.checkList=[] - this.page =1 - this.get_drug_group() - } - }) + console.log(datalist,'5') + if(datalist.length==0){ + this.$message.error('没有数据') }else{ - const data = { - use_doc: '', - use_content: JSON.stringify(datalist), - } - add(stringify(data)).then(rsp => { - console.log("rsp>>", rsp) - if (rsp.status==0){ - this.dialogTableClose() - //清空表格多选框 - this.$refs.multipleTable.clearSelection(); - that.checkList=[] - this.page =1 - this.get_drug_group() + if(this.title=='编辑采购试剂'){ + const data = { + id: this.row_id, + use_content: JSON.stringify(datalist), } - }) + update(stringify(data)).then(rsp => { + console.log("rsp>>", rsp) + if (rsp.status==0){ + this.dialogTableClose() + //清空表格多选框 + this.$refs.multipleTable.clearSelection(); + that.checkList=[] + this.page =1 + this.get_drug_group() + } + }) + }else{ + const data = { + use_doc: '', + use_content: JSON.stringify(datalist), + } + add(stringify(data)).then(rsp => { + console.log("rsp>>", rsp) + if (rsp.status==0){ + this.dialogTableClose() + //清空表格多选框 + this.$refs.multipleTable.clearSelection(); + that.checkList=[] + this.page =1 + this.get_drug_group() + } + }) + } } }, }