import { genCargoownerAuthSearchModal } from '@/views/kzyWMS/SearchModal'
import moment from 'moment'
import { upcloud_base_common } from '@/config/serviceSettings'
const src = upcloud_base_common + '/dict/listbytype?dicttypeCodes='

//新增字段
const newfield = [
  // 1、增加字段：是否商品拦截。
  {
    type: 'input',
    name: 'lotNumUpper',
    span: 6,
    label: '批号个数上限',
    labelCol: { span: 10 },
    wrapperColl: { span: 6 },
    value: '',
    options: [
      { label: '是', value: '1' },
      { label: '否', value: '0' }
    ]
  },
  {
    type: 'input',
    name: 'businessScopeUpper',
    labelCol: { span: 10 },
    wrapperColl: { span: 6 },
    span: 6,
    label: '经营范围信息',
    value: '',
    options: [
      { label: '是', value: '1' },
      { label: '否', value: '0' }
    ]
  }
]
// 货主管理配置
const custom = {
  custom: [
    {
      type: 'input',
      name: 'supplierName',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '供应商名称',
      //   required: true,
      value: ''
    },
    {
      type: 'input',
      name: 'supplierCode',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      //   required: true,
      label: '供应商编码',
      value: ''
    },
    {
      type: 'input',
      name: 'supplierKeywords',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      //   required: true,
      label: '助记码',
      value: ''
    },

    {
      type: 'input',
      name: 'supplierNameEn',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      //   required: true,
      label: '供应商英文名',
      value: ''
    },

    {
      //   required: true,
      type: 'select',
      name: 'status',
      label: '供应商状态',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      value: '',
      options: [
        { label: '待审核', value: '0' },
        { label: '审核通过', value: '1' },
        { label: '驳回', value: '2' },
        { label: '作废', value: '3' }
      ]
    },

    {
      type: 'input',
      name: 'supplierShortName',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      //   required: true,
      label: '供应商简称(中文)',
      value: ''
    },

    ...genCargoownerAuthSearchModal(1, false, false, null, null, {
      span: 6,
      labelCol: { span: 10 },
      wrapperColl: { span: 6 }
    }),
    {
      type: 'input',
      name: 'cargoOwnerId',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      disabled: true,
      label: '货主编码',
      value: ''
    },
    // {
    //   type: 'select',
    //   name: 'enterpriseId',
    //   span: 6,
    //   label: '企业类型',
    //   required: true,
    //   value: '',
    //   autoLoad: true,
    //   remoteUrl: { url: src + 'wms_storeroom', method: 'post' },
    //   replaceFields: {
    //     value: 'dictCode',
    //     label: 'dictName'
    //   },
    //   on: {
    //     change(label, value, rowData, form) {
    //     }
    //   }
    // },

    // {
    //   type: 'input',
    //   name: 'cargoOwnerType',
    //   span: 6,
    //   label: '联系人',
    //   value: ''
    // },

    // {
    //   type: 'input',
    //   name: 'contactName',
    //   span: 6,
    //   label: '联系电话',
    //   value: ''
    // },
    // {
    //   type: 'input',
    //   name: 'enterpriseId',
    //   span: 6,
    //   label: '企业ID',
    //   value: ''
    // },
    // {
    //   type: 'input',
    //   name: 'cargoOwnerId',
    //   span: 6,
    //   label: '货主ID(暂定)',
    //   value: ''
    // },
    // {
    //   type: 'input',
    //   name: 'bankName',
    //   span: 6,
    //   label: '货主编码',
    //   value: ''
    // },
    // {
    //   type: 'input',
    //   name: 'bankAccountName',
    //   span: 6,
    //   label: '法人代表',
    //   value: ''
    // },
    {
      type: 'input',
      name: 'bankName',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '开户银行',
      value: ''
    },
    {
      type: 'input',
      name: 'bankAccountNum',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '银行账户',
      value: ''
    },

    {
      type: 'input',
      name: 'supplierSiteId',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      // labelCol: { span: 1, offset: 1 },
      label: '供应商地址',
      value: ''
    },
    {
      type: 'textarea',
      name: 'remark',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      limit: 100,
      //   labelCol: { span: 3, offset: 1 },
      rules: [{ max: 100, message: '输入框内容过长,最多输入100个字符' }],

      label: '备注',
      style: {
        height: '100px'
      },
      value: ''
    },

    ...newfield,
    {
      type: 'input',
      name: 'taxNumber',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '税号',
      value: ''
    },
    {
      type: 'input',
      name: 'businessLeader',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '企业负责人',
      value: ''
    },
    {
      type: 'input',
      name: 'unifiedSocialCode',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '统一社会信用代码',
      value: ''
    },
    {
      type: 'input',
      name: 'qualityLeader',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '质量负责人',
      value: ''
    },
    {
      type: 'date',
      name: 'allowBuyIndate',
      labelCol: { span: 10 },
      format: 'YYYY-MM-DD',
      wrapperColl: { span: 6 },
      span: 6,
      label: '允许购进日期',
      value: ''
    },
    {
      type: 'select',
      name: 'isRecall',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '是否召回',
      value: '',
      options: [
        { label: '否', value: 0 },
        { label: '是', value: 1 }
      ]
    }
  ],
  Healthcustom: [
    {
      type: 'select',
      name: 'businessLicense',
      span: 6,
      label: '是否三证合一',
      value: '1',
      options: [
        { value: '1', label: '是' },
        { value: '0', label: '否' }
      ]
    },
    {
      type: 'input',
      name: 'elecCode',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '马上放心编码',
      value: ''
    },
    {
      type: 'input',
      name: 'isTwoVote',
      labelCol: { span: 10 },
      wrapperColl: { span: 6 },
      span: 6,
      label: '是否两票制单位',
      value: ''
    }
  ],
  HealthLicensecolumns: [
    {
      type: 'edit',
      dataIndex: 'licenseName',
      label: '证件名称',
      title: '证件名称'
    },
    {
      dataIndex: 'licenseNumber',
      title: '证件编码',
      align: 'center',
      type: 'edit'
    },
    {
      dataIndex: 'licenseState',
      title: '证件状态',
      align: 'center',
      // required: true,
      type: 'select',
      value: '1',
      options: [
        { value: '1', label: '有效' },
        { value: '0', label: '过期' }
      ]
      // hidden: true,
    },
    {
      dataIndex: 'startAt',
      title: '证件起始日期',
      align: 'center',
      // required: true,
      //   width: 400,
      format: 'YYYY-MM-DD',
      type: 'date'
      // hidden: true,
    },
    {
      dataIndex: 'endAt',
      title: '证件截止日期',
      align: 'center',
      // required: true,
      //   width: 400,
      type: 'date',
      format: 'YYYY-MM-DD'
      //   customRender(text) {
      //     text = moment(text).format('YYYY-MM-DD')
      //     return text
      //   }
      // hidden: true,
    },
    {
      dataIndex: 'picUpload',
      title: '图片文件',
      align: 'center',
      // required: true,
      width: 200,
      scopedSlots: { customRender: 'file' }
      // type: 'select'
    }
  ],

  scopecolumns: [
    { dataIndex: 'id', title: 'id', hidden: true },
    {
      dataIndex: 'scopeType',
      title: '所属经营范围',
      align: 'center',
      // required: true,
      type: 'select',
      autoLoad: true,
      remoteUrl: { url: src + 'Business_scope', method: 'post' },
      replaceFields: {
        value: 'dictCode',
        label: 'dictName'
      },
      on: {
        change({ label, value, rowData, form }) {}
      }
    },
    {
      dataIndex: 'scopeName',
      title: '经营范围名称',
      align: 'center',
      // required: true,
      type: 'select',
      autoLoad: true,
      remoteUrl: { url: src + 'scope_name', method: 'post' },
      replaceFields: {
        value: 'dictCode',
        label: 'dictName'
      },
      on: {
        change({ label, value, rowData, form }) {}
      }
    },
    {
      dataIndex: 'scopeCode',
      title: '经营案范围编码',
      align: 'center',
      // required: true,
      type: 'edit',
      rules: [{ max: 50, message: '输入框内容过长,最多输入50个字符' }]
    }
  ],
  HealthScopecolumns: [
    {
      dataIndex: 'attribute1',
      title: '地址名称',
      align: 'center',
      // required: true,
      type: 'edit',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'areaId',
      title: '地址编码',
      align: 'center',
      // required: true,
      type: 'edit',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'contactName',
      title: '联系人',
      align: 'center',
      // required: true,
      type: 'edit',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'phoneMobile',
      title: '联系电话',
      align: 'center',
      // required: true,
      type: 'edit',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'address',
      title: '详细地址',
      align: 'center',
      // required: true,
      type: 'edit',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'attribute2',
      title: '收货工作日',
      align: 'center',
      // required: true,
      type: 'edit',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'attribute3',
      title: '窗口1开始时间',
      align: 'center',
      // required: true,
      type: 'edit',
      options: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ]
    },
    {
      dataIndex: 'attribute4',
      title: '窗口1结束时间',
      align: 'center',
      // required: true,
      type: 'edit'
    }
  ],
  companyScopecolumns: [
    {
      title: '受托人姓名',
      dataIndex: 'trusteeName',
      ellipsis: true,
      key: 'trusteeName'
    },
    {
      title: '受托人身份证号',
      dataIndex: 'trusteeIdCard',
      ellipsis: true,
      key: 'trusteeIdCard'
    },
    {
      title: '身份证截止日期',
      dataIndex: 'trusteeIdExpireDate',
      ellipsis: true,
      key: 'trusteeIdExpireDate'
    },
    {
      title: '受托人类型',
      dataIndex: 'trusteeType',
      ellipsis: true,
      key: 'trusteeType'
    },
    {
      title: '联系电话',
      dataIndex: 'trusteeTel',
      ellipsis: true,
      key: 'trusteeTel'
    },
    {
      title: '是否授权退回',
      dataIndex: 'isAuthorize',
      ellipsis: true,
      key: 'isAuthorize'
    },
    {
      title: '委托书截止日期',
      dataIndex: 'authorizationExpireDate',
      ellipsis: true,
      key: 'authorizationExpireDate'
    }
  ]
}

export default custom
