export const formRules = {
  parDescription: [
    { required: true, message: "请输入规则名称", trigger: ["blur"] },
    {
      validator: (rule, value, callback) => {
        if (value.length > 100) {
          callback(new Error("规则名称不能超过100字"));
        } else {
          callback();
        }
      },
      trigger: ["change"]
    }
  ],
  parRuleType: [
    { required: true, message: "请选择规则类型", trigger: ["change"] }
  ],
  parLenCode: [
    { required: true, message: "请选择规则术语类型", trigger: ["change"] }
  ],
  parConceptId: [
    { required: true, message: "请输入医学标准术语", trigger: ["change"] }
  ],
  parHasSub: [
    { required: true, message: "请选择有无子条件", trigger: ["change"] }
  ],
  parMsg: [
    { required: true, message: "请输入附加信息", trigger: ["change"] },
    {
      validator: (rule, value, callback) => {
        if (value.length > 100) {
          callback(new Error("附加信息不能超过100字"));
        } else {
          callback();
        }
      },
      trigger: "change"
    }
  ],

}

export const tableRules = {
  conceptId: [
    { required: true, message: '请输入疾病名称', trigger: ['change'] }
  ],
  subDescription: [
    { required: true, message: "请输入基础规则名称", trigger: ["change", "blur"] },
    {
      validator: (rule, value, callback) => {
        if (value && value.length > 100) {
          callback(new Error("规则名称不能超过100字"));
        } else {
          callback();
        }
      },
      trigger: ["change", "blur"]
    }
  ],
  conditionType: [
    { required: true, message: "请选择诊断依据类型", trigger: ["blur"] }
  ],
  fitNo: [
    { required: true, message: "请选择符合条件的数量", trigger: ["blur"] }
  ],

  basDescription: [
    { required: true, message: "请输入基础依据名称", trigger: ["blur"] }
  ],
  subType: [
    { required: true, message: "请选择基础规则类型", trigger: ["change"] }
  ],
  basType: [
    { required: true, message: "请选择基础依据类型", trigger: ["blur"] }
  ],
  subLenCode: [
    {
      required: true,
      message: "请选择基础规则术语类型",
      trigger: ["blur"]
    }
  ],
  basLibType: [
    {
      required: true,
      message: "请选择基础依据术语类型",
      trigger: ["blur"]
    }
  ],
  subConceptId: [
    { required: true, message: "请输入医学标准术语", trigger: ["blur"] }
  ],
  
  dataType: [
    { required: true, message: "请选择类型", trigger: ["change"] }
  ],


  subEqValue: [
    {
      validator: (rule, value, callback) => {
        if (value === "") {
          callback(new Error("请输入" + this.textName));
        } else if (value.length > 200) {
          callback(new Error(this.textName + "不能超过200字"));
        } else {
          callback();
        }
      },
      trigger: "blur"
    }
  ]
}