/* eslint-disable no-undef */
import {extendInclude, extendRule, initFilter} from "../../utils/common";

/**
 * @return {string}
 */

export default {
  onChange: ({value,colInfo,getFieldValue,setFieldValue,setFieldEditable}) => {


  },
  onFetchAutoFilter:({colInfo,params,getFieldValue})=>{

  },
  onBeforeEdit:({isNew,getFieldValue,login,dispatch,setFieldValueByBatch,setFieldEditable})=>{
    if(isNew) {
      const json = initFilter(login.OrgId);
      json.Count = 1;
      json.CodeType = 3503

      dispatch({
        type: 'app/genSystemCode',
        payload: json,
        onComplete: (ret) => {
          if (ret) {
            const temps=[];
            temps.push({field:'CODE',value: ret});
            temps.push({field:'Nav_User.NAME',value: login.user.NAME});
            temps.push({field:'USER_ID',value:login.userId});
            setFieldValueByBatch(temps);
          }
        }
      })
    }
  },
  onBeforeSave:({data,getFieldValue,setFieldValue})=>{
  },
  onBeforeSaveHandleRecord:({record,srcRecord})=>{
    if(srcRecord&&srcRecord.Nav_Inventorys){
      if(record){
        record.Nav_Inventorys=srcRecord.Nav_Inventorys;
      }
    }
  },
}
