import { message } from "antd/lib/index";
import { getPropertyData, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, empty } from "../../utils/common";
import { connect } from 'dva';
/**
 * @return {string}
 */
// 编辑  安全检查库
export default {
  onChange: ({ value, stateData, colInfo, setFieldValue, setFieldValueByBatch }) => {
    // debugger
    if (colInfo.FIELD_NAME == "QUESTION_LEVEL") {
      if (value == 10) {
        //重大问题 设置为 是重大隐患  1
        //FIELD_NAME: "SERIOUS_RISK"
        setFieldValue("SERIOUS_RISK", '1');
      } else {
        //否则不是  0
        setFieldValue("SERIOUS_RISK", '0');
      }
    } else if (colInfo.FIELD_NAME == 'Nav_CheckType.NAME') {
      setFieldValue("Nav_CheckTypeLevel.Nav_Enums.NAME", null);
    } else if (colInfo.FIELD_NAME == 'CHECKCONTENT') {
      if (!stateData.CHECKCONTENT) {
        var arry = []
        arry.push({ field: 'CHECK_QUESTION_ID', value: null })
        arry.push({ field: 'Nav_CheckQuestion.DESCREPTION', value: null })
        arry.push({ field: 'Nav_CheckQuestion.DEMAND', value: null })
        arry.push({ field: 'QUESTION_LEVEL', value: null })
        arry.push({ field: 'SERIOUS_RISK', value: null })
        setFieldValueByBatch(arry)
      }
    } else if (colInfo.FIELD_NAME == 'CHECKOBJECT') {
      var arry = []
      arry.push({ field: 'CHECK_PROJECT_CATEGORY_ID', value: null })
      arry.push({ field: 'Nav_CheckProjectCategory.NAME', value: null })
      arry.push({ field: 'CHECK_CONTENTS_ID', value: null })
      arry.push({ field: 'CHECKCONTENT', value: null })
      arry.push({ field: 'Nav_Contents.CHECKCONTENT', value: null })
      arry.push({ field: 'CHECK_QUESTION_ID', value: null })
      arry.push({ field: 'Nav_CheckQuestion.DESCREPTION', value: null })
      arry.push({ field: 'Nav_CheckQuestion.DEMAND', value: null })
      arry.push({ field: 'QUESTION_LEVEL', value: null })
      arry.push({ field: 'SERIOUS_RISK', value: null })
      setFieldValueByBatch(arry)
    }
  }
}