|
@@ -47,11 +47,11 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="24 / 2">
|
|
|
- <a-form-model-item :label="`审核人${index+1}`" :labelCol="labelCol" :wrapperCol="wrapperCol" :prop="`auditNodes[${index}].auditor`" :rules="item.auditorType===1?{
|
|
|
- required: true,
|
|
|
- message: '请选择',
|
|
|
+ <a-form-model-item :label="`审核人${index+1}`" :labelCol="labelCol" :wrapperCol="wrapperCol" :prop="`auditNodes[${index}].auditor`" :rules="{
|
|
|
+ required: item.auditorType==1,
|
|
|
trigger: 'change',
|
|
|
- }:{}">
|
|
|
+ validator: (rule, value, callback) => validatorAuditor(rule, value, callback, index)
|
|
|
+ }">
|
|
|
<a-select v-model="item.auditor" @change="changeAuditor($event,index)" allowClear placeholder="请选择" :disabled="item.auditorType!=1||isReadOnly" style="width: 100%;">
|
|
|
<a-select-option v-for="(item, index) in _userList" :disabled="item.disabled" :key="index" :value="item.id">
|
|
|
{{ item.userName }}
|
|
@@ -232,7 +232,6 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
changeAuditorType(v,index){
|
|
|
- // this.$refs.form.clearValidate([`auditNodes[${index}].auditor`])
|
|
|
this.model.auditNodes[index].auditor = undefined
|
|
|
this.$forceUpdate()
|
|
|
this.$nextTick(() => {
|
|
@@ -240,8 +239,10 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
changeAuditor(val,index){
|
|
|
- this.$refs.form.clearValidate([`auditNodes[${index}].auditor`])
|
|
|
this.$forceUpdate()
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.form.validate()
|
|
|
+ })
|
|
|
},
|
|
|
validatorAuditorType(rule, value, callback, index){
|
|
|
if(index === 0){
|
|
@@ -258,6 +259,19 @@ export default {
|
|
|
callback()
|
|
|
}
|
|
|
},
|
|
|
+ validatorAuditor(rule, value, callback, index){
|
|
|
+ const auditorType = this.model.auditNodes[index].auditorType
|
|
|
+ const auditor = this.model.auditNodes[index].auditor
|
|
|
+ if(auditorType==1){
|
|
|
+ if(auditor){
|
|
|
+ callback()
|
|
|
+ }else{
|
|
|
+ callback(new Error(`请选择审核人${index+1}`))
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
handleOk() {
|
|
|
const that = this
|
|
|
// 触发表单验证
|