import { getPropertyData, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, guid } from "../../utils/common";
/**
 * @return {string}
 */
// 编辑
export default {
  onBeforeSaveHandleRecord(params) {
    params.record.TaskID = params.data.TaskID    //TaskID传递消息表ID
    params.record.PUBLISH = params.customParams;
  },
  onBeforeEdit(params) {
    const { isNew, dispatch, login, setFieldRequired,setFieldValueByBatch, setFieldEditable, getFieldValue,stateData } = params ? params : {};
    if (isNew) {
      let json = initFilter(login.OrgId);
      dispatch({
        type: 'app/getDataByPost',
        payload: json,
        url: 'OG/OGRelatedEstimate/FullGet',
        onComplete: (ret) => {
          if (ret) {
            let temps = [];
            ret.Nav_Details.forEach(element => {
              element.ROW_NO=element.NUM;
            });
            temps.push({ field: 'ID', value: ret.ID })
            temps.push({ field: 'RELATED_ID', value: ret.RELATED_ID })
            temps.push({ field: 'Nav_Details', value: ret.Nav_Details })
            setFieldValueByBatch(temps);
          }
        }
      });
    }
  },
}
