const baseUrl = '/api/upcloud-base-wh-control-mysql-eistest'
const config = {
  remoteUrl: {
    url: baseUrl + '/deviceArea/get-deviceArea-page',
    headers: {
      'Content-Type': 'application/JSON',
    },
    method: 'get',
  },
  items: [
    //设备编号
    {
      span: 8,
      type: 'input',
      name: 'deviceNo',
      label: '设备编号',

      targetClick: true,
      targetValueKey: 'deviceNo',
      value: '',
      remoteUrl: {
        url: '/api/upcloud-base-wh-dev-mysql-eistest/deviceInfo/get-deviceInfo-page',
      },
      //   doneBefore: function(res) {
      //     console.log(res)
      //     res.data.list = res.data.list.filter(item => item.areaType == 20)
      //     return res
      //   },

      on: {
        search: () => {
          //   this.params = { name: 'hdwss' }
        },
        change: (event, value, rowData, form) => {
          //   console.log(args)
        },
      },
      toolBar: {
        rowId: 'deviceNo',
        items: [
          {
            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 },
            ],
          },
        ],
      },

      tableConfig: {
        rowKey: 'deviceNo',
        remoteBefore: function (vnode, remoteUrl) {
          console.log(remoteUrl)
          //   remoteUrl.params.deviceNo = ''
          //   remoteUrl.params.deviceType = ''
          return remoteUrl
        },
        columns: [
          {
            dataIndex: 'deviceNo',
            title: '设备编号',
          },
          {
            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
            },
          },
        ],
      },
    },
    //区域编号
    {
      span: 8,
      type: 'input',
      name: 'areaNo',
      label: '区域编号',
      targetClick: true,
      targetValueKey: 'areaNo',
      value: '',
      remoteUrl: {
        url: '/api/upcloud-base-wh-dev-mysql-eistest/storeArea/getAll-storeArea',
      },
      //   doneBefore: function(res) {
      //     console.log(res)
      //     res.data.list = res.data.list.filter(item => item.areaType == 20)
      //     return res
      //   },

      on: {
        search: () => {
          //   this.params = { name: 'hdwss' }
        },
        change: (event, value, rowData, form) => {
          //   console.log(args)
        },
      },
      toolBar: {
        rowId: 'id',
        items: [
          {
            span: 8,
            type: 'input',
            name: 'areaNo',
            label: '区域编号',
            value: '',
          },
          {
            span: 8,
            type: 'select',
            name: 'areaType',
            required: true,
            label: '区域类别',
            options: [
              { label: '区域', value: 10 },
              { label: '接驳口', value: 20 },
            ],
          },
        ],
      },

      tableConfig: {
        rowKey: 'areaNo',
        remoteBefore: function (vnode, remoteUrl) {
          console.log(remoteUrl)
          //   remoteUrl.params.deviceNo = ''
          //   remoteUrl.params.deviceType = ''
          return remoteUrl
        },
        columns: [
          {
            dataIndex: 'areaNo',
            key: 'areaNo',
            align: 'center',
            title: '区域编号',
          },
          {
            title: '区域类别',
            dataIndex: 'areaType',
            align: 'center',
            key: 'areaType',
            customRender(text) {
              text == 10 && (text = '区域')
              text == 20 && (text = '接驳口')
              return text
            },
          },
        ],
      },
    },
    {
      span: 8,
      type: 'select',
      name: 'isAvailable',
      label: '是否可用',
      value: '',
      options: [
        { label: '否', value: 0 },
        { label: '是', value: 1 },
      ],
    },

    {
      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: 'areaNo',
      align: 'center',
      key: 'areaNo',
    },
    {
      title: '是否可用',
      dataIndex: 'isAvailable',
      align: 'center',
      key: 'isAvailable',
      customRender(text) {
        text == 0 && (text = '否')
        text == 1 && (text = '是')
        return text
      },
    },
    {
      title: '注册时间',
      key: 'createTime',
      dataIndex: 'createTime',
      align: 'center',
    },
    {
      title: '更新时间',
      dataIndex: 'updateTime',
      align: 'center',
      key: 'updateTime',
    },

    {
      title: '操作',
      key: 'operation',
      scopedSlots: { customRender: 'operation' },
      //   fixed: 'right',
      align: 'center',
    },
  ],
  Modelitems: [
    {
      span: 24,
      type: 'input',
      name: 'id',
      hidden: true,
      label: 'id',
      value: '',
    },
    //设备编号
    {
      span: 24,
      type: 'searchModal',
      name: 'deviceNo',
      label: '设备编号',
      required: true,
      targetClick: true,
      targetValueKey: 'deviceNo',
      value: '',
      remoteUrl: {
        url: '/api/upcloud-base-wh-dev-mysql-eistest/deviceInfo/get-deviceInfo-page',
      },
      //   doneBefore: function(res) {
      //     console.log(res)
      //     res.data.list = res.data.list.filter(item => item.areaType == 20)
      //     return res
      //   },

      on: {
        search: () => {
          //   this.params = { name: 'hdwss' }
        },
        change: (event, value, rowData, form) => {
          //   console.log(args)
        },
      },
      toolBar: {
        rowId: 'deviceNo',
        items: [
          {
            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 },
            ],
          },
        ],
      },

      tableConfig: {
        rowKey: 'deviceNo',
        remoteBefore: function (vnode, remoteUrl) {
          console.log(remoteUrl)
          //   remoteUrl.params.deviceNo = ''
          //   remoteUrl.params.deviceType = ''
          return remoteUrl
        },
        columns: [
          {
            dataIndex: 'deviceNo',
            title: '设备编号',
          },
          {
            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
            },
          },
        ],
      },
    },
    //区域编号
    {
      span: 24,
      type: 'searchModal',
      name: 'areaNo',
      label: '区域编号',
      required: true,
      targetClick: true,
      targetValueKey: 'areaNo',
      value: '',
      remoteUrl: {
        url: '/api/upcloud-base-wh-dev-mysql-eistest/storeArea/getAll-storeArea',
      },
      //   doneBefore: function(res) {
      //     console.log(res)
      //     res.data.list = res.data.list.filter(item => item.areaType == 20)
      //     return res
      //   },

      on: {
        search: () => {
          //   this.params = { name: 'hdwss' }
        },
        change: (event, value, rowData, form) => {
          //   console.log(args)
        },
      },
      toolBar: {
        rowId: 'id',
        items: [
          {
            span: 8,
            type: 'input',
            name: 'areaNo',
            label: '区域编号',
            value: '',
          },
          {
            span: 8,
            type: 'select',
            name: 'areaType',
            required: true,
            label: '区域类别',
            options: [
              { label: '区域', value: 10 },
              { label: '接驳口', value: 20 },
            ],
          },
        ],
      },

      tableConfig: {
        rowKey: 'areaNo',
        remoteBefore: function (vnode, remoteUrl) {
          console.log(remoteUrl)
          //   remoteUrl.params.deviceNo = ''
          //   remoteUrl.params.deviceType = ''
          return remoteUrl
        },
        columns: [
          {
            dataIndex: 'areaNo',
            key: 'areaNo',
            align: 'center',
            title: '区域编号',
          },
          {
            title: '区域类别',
            dataIndex: 'areaType',
            align: 'center',
            key: 'areaType',
            customRender(text) {
              text == 10 && (text = '区域')
              text == 20 && (text = '接驳口')
              return text
            },
          },
        ],
      },
    },

    {
      span: 24,
      type: 'select',
      required: true,
      name: 'isAvailable',
      label: '是否可用',
      value: '',
      options: [
        { label: '否', value: 0 },
        { label: '是', value: 1 },
      ],
    },
  ],
  details: {
    currentArea: '当前节点区域',
    nextArea: '下个节点区域',
    routeTaskState: '任务状态',
    routeExecuteState: '执行状态',
    currentLocation: '当前节点点位',
    nextLocation: '下个节点点位',
    deviceTask_id: '设备任务ID',
    deviceNo: '执行设备编号',
    arriveTime: '到位时间',
    errorMsg: '错误消息',
    updateTime: '修改时间',
  },
}
export default config
