import API from '../api/api'
// 货主管理配置
const custom = {
  custom: function(that) {
    return [
      {
        type: 'input',
        span: 8,
        name: 'cargoOwnerId',
        label: '货主ID',
        hidden: true,
        title: '货主ID'
      },
      {
        type: 'input',
        span: 8,
        name: 'warehouseId',
        hidden: true,
        label: '仓库ID',
        title: '仓库ID'
      },
      {
        type: 'search',
        span: 8,
        required: true,
        name: 'cargoOwnerName',
        label: '货主',
        title: '货主',
        targetClick: true,
        targetValueKey: 'cargoOwnerName',
        toolBar: {
          items: [
            {
              type: 'input',
              name: 'cargoOwnerName',
              label: '货主名称',
              span: 6,
              // placeholder: '请输入单位编号/单位名称/助记码',
              value: ''
            },

            {
              type: 'input',
              name: 'cargoOwnerType',
              label: '货主类型',
              span: 6,
              // placeholder: '请输入单位编号/单位名称/助记码',
              value: ''
            },
            {
              type: 'input',
              name: 'cargoOwnerId',
              label: '货主ID',
              span: 6,
              // placeholder: '请输入单位编号/单位名称/助记码',
              value: ''
            }
          ]
        },
        tableConfig: {
          rowKey: 'cargoOwnerName',
          rowSelectType: 1,
          hasRowSelectCheck: true,
          columns: [
            { dataIndex: 'cargoOwnerName', title: '货主名称', key: 'cargoOwnerName' },
            { dataIndex: 'cargoOwnerType', title: '货主类型', key: 'cargoOwnerType' }
          ]
        },
        value: '',
        remoteUrl: API.CargoOwnerLicenseList,
        remoteData: {},

        on: {
          ok(event, value, rowData, form) {
            // console.log(event, value, rowData, form)
            that.cargoOwner = rowData[0]
            console.log(rowData[0])
            form.setFieldsValue({ cargoOwnerId: rowData[0].cargoOwnerId })
          },
          change(event, value, rowData, form) {
            if (!value) {
              form.setFieldsValue({
                cargoOwnerName: null,
                cargoOwnerCode: null,
                cargoOwnerId: null
              })
            }
          }
        }
      },
      {
        type: 'search',
        name: 'warehouseName',
        label: '仓库',
        title: '仓库',
        required: true,
        targetClick: true,
        span: 8,
        value: '',
        targetValueKey: 'warehouseName',
        toolBar: {
          items: [
            {
              type: 'input',
              name: 'warehouseName',
              label: '仓库名称',
              span: 6,
              // placeholder: '请输入单位编号/单位名称/助记码',
              value: ''
            },

            {
              type: 'input',
              name: 'warehouseCode',
              label: '仓库编码',
              span: 6,
              // placeholder: '请输入单位编号/单位名称/助记码',
              value: ''
            },
            {
              type: 'input',
              name: 'warehouseId',
              label: '仓库ID',
              span: 6,
              // placeholder: '请输入单位编号/单位名称/助记码',
              value: ''
            }
          ]
        },
        tableConfig: {
          rowKey: 'warehouseName',
          rowSelectType: 1,
          hasRowSelectCheck: true,
          columns: [
            { dataIndex: 'warehouseName', title: '仓库名称', key: 'warehouseName' },
            { dataIndex: 'warehouseCode', title: '仓库编码', key: 'warehouseCode' }
          ]
        },
        value: '',
        remoteUrl: API.warehouse,
        remoteData: {},

        on: {
          ok(event, value, rowData, form) {
            // console.log(event, value, rowData, form)
            that.warehouse = rowData[0]
            form.setFieldsValue({ warehouseId: rowData[0].warehouseId })
          },
          change(event, value, rowData, form) {
            if (!value) {
              form.setFieldsValue({
                warehouseName: null,
                warehouseCode: null,
                warehouseId: null
              })
            }
          }
        }
      }
    ]
  },
  HealthScopecolumns: [
    {
      dataIndex: 'customerName',
      title: '客户名称',
      align: 'center',
      // required: true,
      // type: 'edit',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'customerCode',
      title: '客户编码',
      align: 'center',
      // required: true,
      // type: 'edit',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'customerId',
      title: '客户ID',
      align: 'center'
      // required: true,
      // type: 'edit'
    },
    {
      dataIndex: 'gmtCreate',
      title: '创建时间',
      align: 'center'
      // required: true,
      // type: 'edit'
    },
    {
      dataIndex: 'gmtModified',
      title: '修改时间',
      align: 'center'
      // required: true,
      // type: 'edit'
    }
    // gmtModified
  ],
  HealthLicensecolumns: [
    {
      dataIndex: 'scopeType5',
      title: '证件名称',
      align: 'center',
      // required: true,
      type: 'select',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'scopeType6',
      title: '证件编码',
      align: 'center',
      // required: true,
      type: 'edit'
      // hidden: true,
    },
    {
      dataIndex: 'scopeType7',
      title: '证件状态',
      align: 'center',
      // required: true,
      type: 'select',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
      // hidden: true,
    },
    {
      dataIndex: 'scopeType8',
      title: '证件起始日期',
      align: 'center',
      // required: true,
      width: 400,
      type: 'edit'
      // hidden: true,
    },
    {
      dataIndex: 'endAt',
      title: '证件截止日期',
      align: 'center',
      // required: true,
      width: 400,
      type: 'edit'
      // hidden: true,
    },
    {
      dataIndex: 'picUpload',
      title: '图片文件',
      align: 'center',
      // required: true,
      width: 200,
      scopedSlots: { customRender: 'file' }
      // type: 'select'
    }
  ]
}

export default custom
