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.PUBLISH = params.customParams;
  },
  onBeforeEdit: ({ isNew, pageCode, login, dispatch, app, updateSubTableData, stateData, setFieldVisible, getFieldValue, setFieldEditable, setFieldValue }) => {
    let s = 0;
    var status = getFieldValue('STATUS');
    var curUid = login.user.ID;
    var launchUid = getFieldValue('USER_ID');
    if (!isNew && status !== undefined) {
      s = status;
    }
    setFieldVisible("DO_TYPE", s >= 10);
    setFieldVisible("Nav_DoDepartment.NAME", s >= 10);
    setFieldVisible("Nav_DoUser.NAME", s >= 10);
    setFieldVisible("DO_DESC", s >= 10);
    setFieldVisible("COMMENT", s == 20);


    setFieldEditable("TYPE", s == 0 && (!launchUid || curUid === launchUid));
    setFieldEditable("HAPPEN_TIME", s == 0 && (!launchUid || curUid === launchUid));
    setFieldEditable("PLACE", s == 0 && (!launchUid || curUid === launchUid));
    setFieldEditable("DESC", s == 0 && (!launchUid || curUid === launchUid));
    setFieldEditable("Nav_Files", s == 0 && (!launchUid || curUid === launchUid));
    setFieldEditable("DO_TYPE", s == 10);
    setFieldEditable("Nav_DoDepartment.NAME", s == 10);
    setFieldEditable("Nav_DoUser.NAME", s == 10);
    setFieldEditable("DO_DESC", s == 10);
    setFieldEditable("COMMENT", s == 20);
  },
}
