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 {
  onBeforeSaveHandleRecord(params) {
    params.record.TaskID = params.data.TaskID    //TaskID传递消息表ID
    params.record.STATUS = params.customParams;
    // onBeforeSaveHandleRecordLog(params, 'DM010', '设备点检')
  },

  onBeforeEdit: ({ isNew, stateData, data, setFieldEditable, setFieldValue, setRowFieldLabel,initFilter, editConfig }) => {
    // var isTask = (data.tableKey != undefined && data.tableKey == '1') ? true : false
    // if (isTask) {
    //   setFieldEditable("Nav_DeviceBase.NAME", false)
    // }

    if (stateData.DEVICEBASE_ID) {
      setFieldEditable("Nav_DeviceBase.NAME", false)
    }
    if (stateData.CHECKTYPE == 20) {
      //巡检 修改显示
      setRowFieldLabel(
        "T_DM_DEVICE_CHECK_DETAIL", {
        ITEM1: '巡检部位',
        ITEM2: '巡检内容',
        ITEM3: '巡检标准',
        CHECK_VALUE: '巡检结论',
      })

      if (editConfig.columns.length > 0) {
        for (let i = 0; i < editConfig.columns.length; i++) {
          if (editConfig.columns[i].field == 'RECORD_DATE') {
            editConfig.columns[i].label = '巡检时间';
            editConfig.columns[i].promptInfo = '巡检时间';
          }
          if (editConfig.columns[i].field == 'Nav_ListUser') {
            editConfig.columns[i].label = '巡检人员';
            editConfig.columns[i].promptInfo = '巡检人员';
          }
        }
      }
    }
  },
}