const baseUrl = '/api/upcloud-base-wh-dev-mysql-eistest'

const config = {
  remoteUrl: {
    url: baseUrl + '/deviceInfo/get-monitoring-page',
    headers: {
      'Content-Type': 'application/JSON',
    },
    method: 'get',
  },
  items: [
    // {
    //     type: 'searchModal',
    //     name: 'project',
    //     labelCol: { span: 6 },
    //     label: '服务名称',
    //     value: '',
    //     toolBar: {
    //       span: 8,
    //       labelCol: { span: 9 },
    //       items: [
    //         {
    //           type: 'input',
    //           name: 'serviceCode',
    //           label: '服务名称',
    //           value: ''
    //         },
    //         {
    //           type: 'input',
    //           name: 'serviceName',
    //           label: '服务中文名',
    //           value: ''
    //         },
    //         {
    //           type: 'select',
    //           name: 'category',
    //           label: '服务类型',
    //           value: '',
    //           remoteUrl: '/api/service-authorization/microServiceType/search',
    //           options: [{ label: '全部分类', value: '' }],
    //           replaceFields: {
    //             label: 'name',
    //             value: 'name'
    //           }
    //         }
    //       ]
    //     },
    //     targetValueKey: 'serviceCode',
    //     rowKey: 'id',
    //     remoteUrl: '/api/service-authorization/microService/getMicroservices?category=1',
    //     tableConfig: {
    //       rowSelectType: 1,
    //       columns: [
    //         {
    //           title: 'ID',
    //           dataIndex: 'id',
    //           hidden: true
    //         },
    //         {
    //           title: '服务名称',
    //           dataIndex: 'serviceCode',
    //           ellipsis: true,
    //           width: 160
    //         },
    //         {
    //           title: '服务中文名称',
    //           dataIndex: 'serviceName',
    //           ellipsis: true,
    //           width: 250
    //         },

    //         {
    //           title: '类型',
    //           dataIndex: 'typeName',
    //           ellipsis: true,
    //           width: 120
    //         }
    //       ]
    //     }
    //   },
    {
      span: 8,
      type: 'input',
      name: 'deviceNo',
      label: '设备编号',
      value: '',
    },
    {
      span: 8,
      type: 'select',
      name: 'deviceType',
      label: '设备类型',
      value: '',
      options: [
        { label: '四向车', value: 1 },
        { label: '堆垛机', value: 2 },
        { label: 'AGV', value: 3 },
        { label: '提升机', value: 4 },
        { label: '多穿车', value: 5 },
        { label: '托盘输送线', value: 6 },
        { label: '料箱输送线', value: 7 },
      ],
    },
    {
      span: 8,
      type: 'select',
      name: 'deviceStatus',
      label: '设备状态',
      value: '',
      options: [
        { label: '自动', value: 1 },
        { label: '手动', value: 2 },
        { label: '故障', value: 3 },
      ],
    },

    // {
    //   span: 8,
    //   type: 'select',
    //   name: 'type',
    //   label: '站台类型',
    //   value: '',
    //   options: [
    //     { label: '出库口', value: 1 },
    //     { label: '钢平台拣选', value: 2 },
    //     { label: '在线拣选', value: 3 }
    //   ]
    // },

    {
      span: 8,
      type: 'buttonGroup',
      style: { textAlign: 'right' },
      options: [
        {
          value: '查询',
          icon: 'search',
          btnType: 'primary',
          style: 'margin-right:10px',
          htmlType: 'submit',
        },
        {
          value: '重置',
          icon: 'redo',
          style: 'margin-right:50px',
          on: {
            click: (event, form) => {
              console.log(form)
              form.resetFields()
            },
          },
        },
      ],
    },
  ],
  columns: [
    {
      dataIndex: 'deviceNo',
      key: 'deviceNo',
      align: 'center',
      title: '设备编号',
    },
    {
      title: '设备描述',
      dataIndex: 'deviceDescription',
      align: 'center',
      key: 'deviceDescription',
    },
    {
      title: '设备类型',
      dataIndex: 'deviceType',
      align: 'center',
      key: 'deviceType',
      customRender(text) {
        text == 1 && (text = '四向车')
        text == 2 && (text = '堆垛机')
        text == 3 && (text = 'AGV')
        text == 4 && (text = '提升机')
        text == 5 && (text = '多穿车')
        text == 6 && (text = '托盘输送线')
        text == 7 && (text = '料箱输送线')
        return text
      },
    },
    {
      title: '设备状态',
      key: 'deviceStatus',
      dataIndex: 'deviceStatus',
      scopedSlots: { customRender: 'deviceStatus' },
      align: 'center',
      //   customRender(text) {
      //     text == 1 && (text = '自动')
      //     text == 2 && (text = '手动')
      //     text == 3 && (text = '故障')
      //     return text
      //   }
    },
    {
      title: '累计运行时长',
      dataIndex: 'cumulativeRunTime',
      align: 'center',
      key: 'cumulativeRunTime',
      customRender(text) {
        text == 0 && (text = '不索取')
        text == 1 && (text = '索取')
        return text
      },
    },
    {
      title: '故障时间',
      dataIndex: 'errorTime',
      align: 'center',
      key: 'errorTime',
    },
    {
      title: '累计故障时长',
      dataIndex: 'cumulativeErrorTime',
      align: 'center',
      key: 'cumulativeErrorTime',
    },
    {
      title: '影响区域',
      dataIndex: 'rangeOfInfluence',
      align: 'center',
      key: 'rangeOfInfluence',
    },

    // {
    //   title: '操作',
    //   key: 'operation',
    //   scopedSlots: { customRender: 'operation' },
    //   align: 'center'
    // }
  ],
  Modelitems: [
    {
      span: 24,
      type: 'input',
      name: 'stationNo',
      required: true,
      label: '站台编号',
      value: '',
    },
    {
      span: 24,
      type: 'input',
      name: 'id',
      hidden: true,
      label: 'id',
      value: '',
    },
    {
      span: 24,
      type: 'input',
      hidden: true,
      name: 'createTime',
      label: 'createTime',
      value: '',
    },
    {
      span: 24,
      type: 'input',
      name: 'areaNo',
      required: true,
      label: '站台区域',
      value: '',
    },

    {
      span: 24,
      type: 'select',
      required: true,
      name: 'type',
      label: '站台类型',
      value: 1,
      options: [
        { label: '出库口', value: 1 },
        { label: '钢平台拣选', value: 2 },
        { label: '在线拣选', value: 3 },
      ],
    },
    {
      span: 24,
      type: 'radio',
      required: true,
      name: 'isLock',
      label: '是否锁定',
      value: 0,
      options: [
        {
          value: 0,
          label: '开启',
        },
        {
          value: 1,
          label: '关闭',
        },
      ],
    },
    {
      span: 24,
      type: 'radio',
      name: 'claim',
      required: true,
      label: '是否索取',
      value: 1,
      options: [
        {
          value: 0,
          label: '不索取',
        },
        {
          value: 1,
          label: '索取',
        },
      ],
    },
  ],
  details: {
    currentArea: '当前节点区域',
    nextArea: '下个节点区域',
    routeTaskState: '任务状态',
    routeExecuteState: '执行状态',
    currentLocation: '当前节点点位',
    nextLocation: '下个节点点位',
    deviceTask_id: '设备任务ID',
    deviceNo: '执行设备编号',
    arriveTime: '到位时间',
    errorMsg: '错误消息',
    updateTime: '修改时间',
  },
}
export default config
