IView form user defined verification, prompt information does not disappear

Time:2021-4-23

IView form user-defined verification. After opening the bullet box, the red prompt message of the parent bullet box does not disappear,
Because the parent bullet box does not receive the information of the bullet box;
IView form user defined verification, prompt information does not disappear

resolvent

//Write the position above the data return
const validate_dept = (rule, value, callback) => {
          value = this.addInfo.deptId || this.modifyInfo.deptId
          if (!value) {
              Return callback (new error ('Please select department ');
          } else {
              callback();
              return;
          }
      };
//Rule customization
ruleValidate: {
        deptId: [
            { required: true, validator:validate_dept, trigger:'change'}
        ]
 },

After selecting the successful department, the components need to return the data to the parent page. After the parent page receives the data, it calls.

//Select Department method
   //`Deptinfo 'is the content of the bullet box page
  deptInfoMethod(name) {
    this.addInfo.deptName = this.deptInfo.name;
    this.addInfo.deptId  =  this.deptInfo.deptId ;// newly added
    this.modifyInfo.deptName = this.deptInfo.name;
    this.modifyInfo.deptId  =  this.deptInfo.deptId ;// edit
    this.modal_ dept = false;// Close the box
    this.$ refs.addInfo.validateField ('deptId');// Check the rules again, otherwise the red prompt box will not disappear
      },

It’s over~