import { message } from "antd/lib/index";
import { getPropertyData, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, guid } from "../../utils/common";
import moment from 'moment';
import { Button, Row, Col, Form, Input, Select, Upload, Icon, Modal, Spin,Table } from 'antd';
/**
 * @return {string}
 */
// 编辑
export default {
  onBeforeSaveHandleRecord(params) {
    params.record.TaskID = params.data.TaskID    //TaskID传递消息表ID
    params.record.PUBLISH = params.customParams;
    // params.record.FORM_CODE = params.data.reloadKey.substring(0,params.data.reloadKey.indexOf("_"));
  },
   //加载前处理事件
onBeforeEdit(params) {
  const { isNew,stateData,saveRowRecord,setFieldValue,setFieldVisible,setFieldRequired} = params ? params : {};
  if(!isNew)
  {
    setFieldValue("Nav_Department.NAME", stateData.Nav_Department?.NAME)
    setFieldValue("Nav_User.NAME", stateData.Nav_User?.NAME)
  }
}
  // onChange: ({ colInfo, getFieldValue, dispatch, setFieldValueByBatch, setFieldEditable, setFieldRequired, resetFields }) => {
  //   if (!(colInfo.FIELD_NAME == 'PRODUCTION_UNIT'))
  //   return;

  //   let code = getFieldValue('PRODUCTION_UNIT')  
  //   let json = initFilter(null,code);
  //   dispatch({
  //     type: 'app/getDataByPost',
  //     url: 'PE/PECorrectivePreventive/GetPreventiveDetail',
  //     payload: json,
  //     onlyData: false,
  //     onComplete: (re) => {
  //       if (re && re.IsSuccessful && re.Data) {
  //           let temps = [];
  //           let detail=re.Data.Nav_Details.map((item,i)=>{
  //               item['ROW_NO'] = i+1;
  //               return item;
  //            });
  //           temps.push({ field: 'Nav_Details', value: detail })
  //           setFieldValueByBatch(temps);
  //           //updateSubTableData(params.pageCode,detail,true)
  //       }
  //     }
  //   })
  // },
}
