<el-form ref="form" :model="form" :rules="rules" label-width="110px">
          <el-form-item label="Job order Number" prop="postCode">
            <el-input v-model="form.postCode" />
          </el-form-item>
          <el-form-item label="Job order status" prop="status">
            <el-select v-model="form.status" style="display: block">
              <el-option
                v-for="dict in statusOptions"
                :key="dict.dictValue"
                :label="dict.dictLabel"
                :value="dict.dictValue"
              />
            </el-select>
          </el-form-item>
</el-form>
Copy the code
data() {
    var validateDeclared = (rule, value, callback) = > {
      // if (value === '') {
      // callback(new Error(' Please enter password again '));
      // } else
      // this. Form is your form parameter. Print it yourself
      if (value > this.form.plan - this.form.already) {
        callback(new Error("The declared quantity must not be greater than the difference between the planned quantity minus the declared quantity."));
      } else{ callback(); }};return {
      // Form parameters
      form: {},
      // Form validation
      rules: {
        declared: [{validator: validateDeclared,
            trigger: "blur",},],},}}Copy the code