import {
  remote
} from '@/views/EIS/remote/index.js'

import moment from 'moment'

const config = {
  items: [{
      span: 8,
      type: 'input',
      name: 'containerNo',
      label: '托盘号',
      value: ''
    },
    {
      span: 8,
      type: 'input',
      name: 'groupNo',
      label: '任务组号',
      value: ''
    },
    {
      span: 8,
      type: 'row',
      label: '日期',
      list: [{
          type: 'date',
          name: 'startTime',
          placeholder: '请输入开始日期',
          value: '',
          format: 'YYYY-MM-DD HH:mm:ss',
          style: 'padding-right:5px;'
        },
        {
          type: 'date',
          name: 'endTime',
          placeholder: '请输入结束日期',
          format: 'YYYY-MM-DD HH:mm:ss',
          value: ''
        }
      ]
    },
    {
      span: 8,
      type: 'select',
      name: 'taskState',
      label: '站台号',
      value: '',
    },
    {
      span: 8,
      type: 'select',
      name: 'sourceArea',
      label: '任务状态',
      value: '',
      ...remote('b_2f_task_group_container_task_state')
    },
    {
      span: 8,
      type: 'buttonGroup',
      style: {
        textAlign: 'left'
      },
      options: [{
          value: '查询',
          icon: 'search',
          btnType: 'primary',
          style: 'margin-right:10px',
          htmlType: 'submit'
        },
        {
          value: '重置',
          icon: 'redo',
          on: {
            click: (event, form) => {
              console.log(form)
              form.resetFields()
            }
          }
        }
      ]
    }
  ],
  columns: [{
      dataIndex: 'containerNo',
      key: 'containerNo',
      align: 'center',
      width: 100,
      title: '托盘号'
    },
    {
      title: '当前位置',
      dataIndex: 'currentArea',
      align: 'center',
      width: 100,
      key: 'currentArea'
    },
    {
      title: '目标位置',
      ellipsis: true,
      width: 100,
      dataIndex: 'targetArea',
      align: 'center',
      key: 'targetArea'
    },
    {
      title: '任务状态',
      key: 'taskStatus',
      width: 100,
      dataIndex: 'taskStatus',
      align: 'center',
      customRender(text) {
        text == 0 && (text = '未开始')
        text == 1 && (text = '进行中')
        return text
      }
    },
    {
      title: '业务属性',
      dataIndex: 'property',
      ellipsis: true,
      width: 200,
      align: 'center',
      key: 'property'
    },
    {
      title: '任务开始时间',
      dataIndex: 'startTime',
      align: 'center',
      key: 'startTime'
    },
    {
      title: '任务进行时长',
      dataIndex: 'longTime',
      width: 150,
      align: 'center',
      key: 'longTime',
      customRender(text) {
        var theTime = parseInt(text); // 秒
        var theTime1 = 0; // 分
        var theTime2 = 0; // 小时
        // alert(theTime);
        if (theTime > 60) {
          theTime1 = parseInt(theTime / 60);
          theTime = parseInt(theTime % 60);
          // alert(theTime1+"-"+theTime);
          if (theTime1 > 60) {
            theTime2 = parseInt(theTime1 / 60);
            theTime1 = parseInt(theTime1 % 60);
          }
        }
        var result = "" + parseInt(theTime) + "秒";
        if (theTime1 > 0) {
          result = "" + parseInt(theTime1) + "分" + result;
        }
        if (theTime2 > 0) {
          result = "" + parseInt(theTime2) + "小时" + result;
        }
        return result;

      }
    }
  ],

}
export default config
