From 04b1f3d4e1adf1e0dbe19ba95201f111f911d9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Fri, 12 Aug 2022 17:37:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MdpDateRangeX/index.vue | 3 + .../xm/core/xmIteration/XmIterationEdit.vue | 60 +++++++++++-------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/components/MdpDateRangeX/index.vue b/src/components/MdpDateRangeX/index.vue index 6db8df5d..2fbe845e 100644 --- a/src/components/MdpDateRangeX/index.vue +++ b/src/components/MdpDateRangeX/index.vue @@ -192,6 +192,9 @@ export default { }else if(dates && dates.length===0){ this.value[this.startKey]=null this.value[this.endKey]=null + }else{ + this.value[this.startKey]=null + this.value[this.endKey]=null } this.$emit('input',this.value) }else if(this.value instanceof Array){ diff --git a/src/views/xm/core/xmIteration/XmIterationEdit.vue b/src/views/xm/core/xmIteration/XmIterationEdit.vue index d1d98092..b2f123ed 100644 --- a/src/views/xm/core/xmIteration/XmIterationEdit.vue +++ b/src/views/xm/core/xmIteration/XmIterationEdit.vue @@ -162,34 +162,44 @@ this.userSelectVisible = false; }, - editSomeFields(row,fieldName,$event){ + editSomeFields(row,fieldName,$event){ if(this.opType==='add'){ return; - } - let params={}; - params['ids']=[row].map(i=>i.id) - if(fieldName=='adminUserid'){ - params['adminUserid']=$event[0].userid - params['adminUsername']=$event[0].username - }else if(fieldName=='startTime'){ - params['startTime']=row.startTime - params['endTime']=row.endTime - }else{ - params[fieldName]=$event - } + } + this.$refs.editForm.validate((vali)=>{ + if(!vali){ + this.$notify({position:'bottom-left',showClose:true,message:"表单检查不通过,请修改后提交", type: 'error' }); + return; + }else{ + + let params={}; + params['ids']=[row].map(i=>i.id) + if(fieldName=='adminUserid'){ + params['adminUserid']=$event[0].userid + params['adminUsername']=$event[0].username + }else if(fieldName=='startTime'){ + params['startTime']=row.startTime + params['endTime']=row.endTime + }else{ + params[fieldName]=$event + } + + var func = editSomeFieldsXmIteration + func(params).then(res=>{ + let tips = res.data.tips; + if(tips.isOk){ + this.editFormBak=[...this.editForm] + Object.assign(this.editForm,params) + this.$emit('edit-fields',params) + }else{ + Object.assign(this.editForm,this.editFormBak) + this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'}) + } + }).catch((e)=>Object.assign(this.editForm,this.editFormBak)) + + } + }); - var func = editSomeFieldsXmIteration - func(params).then(res=>{ - let tips = res.data.tips; - if(tips.isOk){ - this.editFormBak=[...this.editForm] - Object.assign(this.editForm,params) - this.$emit('edit-fields',params) - }else{ - Object.assign(this.editForm,this.editFormBak) - this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'}) - } - }).catch((e)=>Object.assign(this.editForm,this.editFormBak)) }, initData(){ this.editForm=Object.assign(this.editForm, this.xmIteration);