import {SERVICE_CTRL_TOWER} from "@/config/serviceSettings";

// 货主
export const getConsignorItems = changeFun => {
  return [
    {
      "hidden": true,
      "type": "input",
      "name": "consignorid",
      "label": "货主ID",
      "value": ""
    },
    {
      "hidden": true,
      "type": "input",
      "name": "consignorcode",
      "label": "货主编码",
      "value": ""
    },
    {
      "type": "searchModal",
      "name": "consignorname",
      "label": "货主名称",
      "title": "货主名称",
      "value": "",
      "rowKey": "companyId",
      "destroyOnClose": true,
      "targetClick": true,
      "targetValueKey": "companyName",
      "labelCol": {
        "span": 6
      },
      "wrapperCol": {
        "span": 14
      },
      "span": 6,
      "remoteUrl": {
        "url": SERVICE_CTRL_TOWER + "/userDataAuth/allDataAuthByUser/?companyType=H",
        "method": "get"
      },
      "required": true,
      "toolBar": {
        "items": []
      },
      "tableConfig": {
        "columns": [
          {
            "dataIndex": "companyId",
            "title": "货主ID",
            "hidden": true
          },
          {
            "dataIndex": "companyName",
            "title": "货主名称"
          },
          {
            "dataIndex": "companyCode",
            "title": "货主编码"
          }
        ],
        "hasRowSelectCheck": true,
        "rowSelectType": 1
      },
      "on": {
        change: changeFun
      }
    },
  ]
}

// 仓库
export const getBranchItems = changeFun => {
  return [
    {
      "hidden": true,
      "type": "input",
      "name": "dcId",
      "label": "仓配中心Id",
      "value": ""
    },
    {
      "hidden": true,
      "type": "input",
      "name": "branchid",
      "label": "仓库ID",
      "value": ""
    },
    {
      "hidden": true,
      "type": "input",
      "name": "branchcode",
      "label": "仓库编码",
      "value": ""
    },
    {
      "type": "searchModal",
      "name": "branchname",
      "label": "仓库名称",
      "title": "仓库名称",
      "value": "",
      "rowKey": "companyId",
      "destroyOnClose": true,
      "targetClick": true,
      "targetValueKey": "companyName",
      "labelCol": {
        "span": 6
      },
      "wrapperCol": {
        "span": 14
      },
      "span": 6,
      "remoteUrl": {
        "url": SERVICE_CTRL_TOWER + "/userDataAuth/allDataAuthByUser/?companyType=S",
        "method": "get"
      },
      "required": true,
      "toolBar": {
        "items": []
      },
      "tableConfig": {
        "columns": [
          {
            "dataIndex": "companyId",
            "title": "仓库ID",
            "hidden": true
          },
          {
            "dataIndex": "dcId",
            "title": "仓配中心ID",
            "hidden": true
          },
          {
            "dataIndex": "companyName",
            "title": "仓库名称"
          },
          {
            "dataIndex": "companyCode",
            "title": "仓库编码"
          }
        ],
        "hasRowSelectCheck": true,
        "rowSelectType": 1
      },
      "on": {
        change: changeFun
      }
    },
  ]
}