diff --git a/src/components/mdp-ui/mixin/MdpFormMixin.js b/src/components/mdp-ui/mixin/MdpFormMixin.js index 094dc43..5aafada 100644 --- a/src/components/mdp-ui/mixin/MdpFormMixin.js +++ b/src/components/mdp-ui/mixin/MdpFormMixin.js @@ -315,6 +315,7 @@ export const MdpFormMixin = { if(this.currOpType=='add' || this.currOpType=='subAdd' || this.currOpType=='detail'){ return false; }else{ + return true; } }, @@ -331,9 +332,8 @@ export const MdpFormMixin = { return true; }, editSomeFields(row,fieldName,$event){ - if(!this.editSomeFieldQxCheck()){ - return; - } + + var params={}; var that=this; var sels=[row] @@ -346,6 +346,9 @@ export const MdpFormMixin = { } return; } + if(!this.editSomeFieldQxCheck()){ + return; + } this.setPks(sels,params); var apiName="apis.editSomeFields" if(!this.apiCheck(this.apis.editSomeFields,apiName)){ @@ -353,22 +356,33 @@ export const MdpFormMixin = { } this.load.editSomeFields=true; var func = this.apis.editSomeFields; - func(params).then(res=>{ - var tips = res.data.tips; - if(tips.isOk){ - Object.assign(row,params) - that.afterEditSomeFields(res,tips.isOk,params,row) - that.dataBak=Object.assign({},this.editForm) - }else{ - if(this.dataBak && this.justPkIsMatch(row,this.dataBak)){ - Object.assign(row,this.dataBak) - } - that.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'}) + var form=this.$refs['editFormRef']; + if(!form){ + form=this.$refs['editForm']; + } + form.validate((valid) => { + if (valid) { + func(params).then(res=>{ + var tips = res.data.tips; + if(tips.isOk){ + Object.assign(row,params) + that.afterEditSomeFields(res,tips.isOk,params,row) + that.dataBak=Object.assign({},this.editForm) + }else{ + if(this.dataBak && this.justPkIsMatch(row,this.dataBak)){ + Object.assign(row,this.dataBak) + } + that.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'}) + } + + }).catch(err=>{ + this.load.editSomeFields=false; + }); + }else{ + this.$notify({ showClose:true, message: "表单验证不通过,请修改表单数据再提交", type: 'error' }); } - - }).catch(err=>{ - this.load.editSomeFields=false; }); + }, afterSubmit(res,isOk,currOpType){ if(isOk && currOpType=='add'){ diff --git a/src/views/mdp/sys/dept/Form.vue b/src/views/mdp/sys/dept/Form.vue index 268fb94..f624384 100644 --- a/src/views/mdp/sys/dept/Form.vue +++ b/src/views/mdp/sys/dept/Form.vue @@ -16,13 +16,13 @@ - + - +