import {
  urbanArea
} from '@/assets/js/districtCode'
export const rules = () => {
  return [{
    field: 'provTruckEnterprise.socialCode',
    label: '社会信用代码',
    colWidth: '200',
    align: 'center',
    fixed: 'left',
  }, {
    field: 'name',
    label: '企业名称',
    colWidth: '150',
    align: 'center',
    fixed: 'left',
  }, {
    field: 'provTruckEnterprise.enterPhone',
    label: '企业联系电话',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.address',
    label: '联系地址',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.licenceNo',
    label: '运营许可证号',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.issueAuthority',
    label: '发证单位',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.issueTime',
    label: '发证日期',
    colWidth: '120',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.businessScope',
    label: '经营范围',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.qualifyImg',
    label: '资质图片',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.qualifyStartTime',
    label: '资质开始时间',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.qualifyEndTime',
    label: '资质截止时间',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.legalPerson',
    label: '法人代表',
    colWidth: '80',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.legalPersonPhone',
    label: '法人代表电话',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.securityPerson',
    label: '安全管理员',
    colWidth: '80',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.securityPersonPhone',
    label: '安全管理员电话',
    colWidth: '120',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.city',
    label: '所在城市',
    colWidth: '100',
    align: 'center',
    options: urbanArea(),
  }, {
    field: 'provTruckEnterprise.area',
    label: '所在区/县',
    colWidth: '100',
    align: 'center',
    options: urbanArea(),
  }, {
    field: 'provTruckEnterprise.enterAccount',
    label: '账号',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'provTruckEnterprise.remark',
    label: '备注',
    colWidth: '150',
    align: 'center',
  }, {
    field: 'action',
    label: '操作',
    colWidth: '360px',
    align: 'center',
    labelButton: [{
      type: 'add',
      label: '新增子级',
      icon: 'el-icon-plus',
      style: 'primary',
    }, {
      type: 'edit',
      label: '修改',
      icon: 'el-icon-edit',
      style: 'primary',
    }, {
      type: 'entry',
      label: '进入',
      style: 'primary',
    }, {
      type: 'logs',
      label: '详情',
      icon: 'el-icon-tickets',
      style: 'info',
    }, {
      type: 'del',
      label: '删除',
      icon: 'el-icon-delete',
      style: 'danger',
    }]
  }]
}

export const formRules = () => {
  return [{
    label: '基本信息',
    type: 'divider',
    colWidth: 24,
  }, {
    field: 'socialCode',
    label: '社会信用代码',
    placeholder: '社会信用代码',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入社会信用代码',
      trigger: 'blur'
    }]
  }, {
    field: 'name',
    label: '企业名称',
    placeholder: '企业名称',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入企业名称',
      trigger: 'blur'
    }]
  }, {
    field: 'enterPhone',
    label: '企业联系电话',
    placeholder: '企业联系电话',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入企业联系电话',
      trigger: 'blur'
    }]
  }, {
    field: 'address',
    label: '联系地址',
    placeholder: '联系地址',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入联系地址',
      trigger: 'blur'
    }]
  }, {
    field: 'legalPerson',
    label: '法人代表',
    placeholder: '法人代表',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入法人代表',
      trigger: 'blur'
    }]
  }, {
    field: 'legalPersonPhone',
    label: '法人代表电话',
    placeholder: '法人代表电话',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入法人代表电话',
      trigger: 'blur'
    }]
  }, {
    field: 'securityPerson',
    label: '安全管理员',
    placeholder: '安全管理员',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入安全管理员',
      trigger: 'blur'
    }]
  }, {
    field: 'securityPersonPhone',
    label: '安全管理员电话',
    placeholder: '安全管理员电话',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入安全管理员电话',
      trigger: 'blur'
    }]
  }, {
    field: 'cityRegion',
    type: 'cascader',
    label: '所在城市/地区',
    placeholder: '请选择',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请选择所在城市/地区',
      trigger: 'change,blur'
    }],
    options: urbanArea(),
  }, {
    field: 'remark',
    label: '备注',
    placeholder: '备注',
    type: 'textarea',
    colWidth: 24,
  }, {
    label: '《道路运输经营许可证》信息',
    type: 'divider',
    colWidth: 24,
  }, {
    field: 'licenceNo',
    label: '运营许可证号',
    placeholder: '运营许可证号',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入运营许可证号',
      trigger: 'blur'
    }]
  }, {
    field: 'issueAuthority',
    label: '发证单位',
    placeholder: '发证单位',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入发证单位',
      trigger: 'blur'
    }]
  }, {
    field: 'issueTime',
    label: '发证日期',
    placeholder: '发证日期',
    type: 'time',
    colWidth: 12,
    rules: [{
      type: 'string',
      required: true,
      message: '请选择发证日期',
      trigger: 'change,blur'
    }]
  }, {
    field: 'businessScope',
    label: '经营范围',
    placeholder: '经营范围',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入经营范围',
      trigger: 'blur'
    }]
  }, {
    field: 'qualifyEndTime',
    label: '资质开始时间',
    placeholder: '资质开始时间',
    type: 'time',
    colWidth: 12,
    rules: [{
      type: 'string',
      required: true,
      message: '请选择资质开始时间',
      trigger: 'change,blur'
    }]
  }, {
    field: 'qualifyStartTime',
    label: '资质截止时间',
    placeholder: '资质截止时间',
    type: 'time',
    colWidth: 12,
    rules: [{
      type: 'string',
      required: true,
      message: '请选择资质截止时间',
      trigger: 'change,blur'
    }]
  }, {
    label: '附件',
    type: 'divider',
    colWidth: 24,
  }, {
    field: 'qualifyImg',
    label: '道路运输经营许可证',
    type: 'singleUpload',
    colWidth: 6,
    rules: [{
      required: true,
      message: '请选择道路运输经营许可证',
      trigger: 'blur'
    }],
  }]
}
