import { upcloud_base_common} from "@/config/serviceSettings";
const remote = type => {
  return {
    remoteUrl: {
      url: upcloud_base_common+`/dict/listbytype/?dicttypeCodes=${type}`,
      method: 'post'
    },
    replaceFields: {
      label: 'dictName',
      value: 'dictId'
    },
    autoLoad: true
  }
}
const remote2 = type => {
  return {
    remoteUrl: {
        // 河南思源项目中，下拉列表取值逻辑变化：取通用字典【出库单类型】分组1=2的单据类型名称。
        // 暂不能确定分组字段名是什么
      url: upcloud_base_common+`/dict/listbytype/?dicttypeCodes=${type}`,
      method: 'post'
    },
    replaceFields: {
      label: 'dictName',
      value: 'dictCode'
    },
    autoLoad: true
  }
}

const regions = id => {
  return {
    remoteUrl: {
      url: upcloud_base_common+`/list?fatherId=${id}`,
      method: 'get'
    },
    replaceFields: {
      label: 'regionsName',
      value: 'regionsId'
    },
    autoLoad: false
  }
}

export { remote, remote2, regions }
