var base = '/api/service-ai-eis-business-center-eistest'
const config = function (that) {
  return {
    remoteUrl: {
      url: base + '/containertaskreport/getcontainertaskreport',
      headers: {
        'Content-Type': 'application/JSON',
      },
      method: 'post',
    },
    items: [
      {
        span: 8,
        type: 'input',
        name: 'upperSystemTaskId',
        label: '上游系统任务单ID',
        value: '',
      },
      {
        span: 8,
        type: 'input',
        name: 'typeNo',
        label: '容器任务单类型编号',
        value: '',
        options: [
          { label: '区域', value: 10 },
          { label: '接驳口', value: 20 },
        ],
      },
      //   {
      //     span: 8,
      //     type: 'select',
      //     name: 'status',
      //     label: '任务单状态',
      //     value: '',
      //     options: [
      //       { label: '未开始', value: 0 },
      //       { label: '进行中', value: 1 },
      //       { label: '已完成', value: 2 },
      //       { label: '已暂停', value: 3 },
      //       { label: '已取消', value: 4 }
      //     ]
      //   },

      {
        span: 8,
        label: '创建时间',
        type: 'date',
        name: 'createTimeFrom',
        placeholder: '请输入开始日期',
        value: '',
        format: 'YYYY-MM-DD HH:mm:ss',
        showTime: true,
        style: 'padding-right:5px;',
      },
      {
        span: 8,
        label: '结束时间',
        type: 'date',
        name: 'createTimeTo',
        placeholder: '请输入结束日期',
        format: 'YYYY-MM-DD hh:mm:ss',
        value: '',
      },

      {
        span: 24,
        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: 'id',
        key: 'id',
        align: 'center',
        width: 150,
        ellipsis: true,
        title: 'id',
      },
      {
        title: '上游系统任务单ID',
        dataIndex: 'upperSystemTaskId',
        ellipsis: true,
        align: 'center',
        width: 150,
        key: 'upperSystemTaskId',
        // customRender(text) {
        //   text == 10 && (text = '区域')
        //   text == 20 && (text = '接驳口')
        //   return text
        // }
      },
      {
        title: '容器任务单类型编号',
        dataIndex: 'typeNo',
        ellipsis: true,
        align: 'center',
        width: 150,
        key: 'typeNo',
      },
      //   {
      //     title: '任务单状态',
      //     key: 'status',
      //     width: 150,
      //     ellipsis: true,
      //     dataIndex: 'status',
      //     align: 'center',
      //     customRender(text) {
      //       text == 0 && (text = '未开始')
      //       text == 1 && (text = '进行中')
      //       text == 2 && (text = '已完成')
      //       text == 3 && (text = '已暂停')
      //       text == 4 && (text = '已取消')

      //       return text
      //     }
      //   },
      //   {
      //     title: '优先级',
      //     dataIndex: 'priority',
      //     align: 'center',
      //     ellipsis: true,
      //     width: 150,
      //     key: 'priority'
      //     // customRender(text) {
      //     //   text == 0 && (text = '不索取')
      //     //   text == 1 && (text = '索取')
      //     //   return text
      //     // }
      //   },
      {
        title: '创建时间',
        key: 'createTime',
        width: 150,
        ellipsis: true,
        dataIndex: 'createTime',
        align: 'center',
      },
      //   {
      //     title: '创建时间',
      //     dataIndex: 'taskFinishTime',
      //     align: 'center',
      //     width: 150,
      //     key: 'taskFinishTime'
      //   },
      {
        title: '回告时间',
        width: 150,
        dataIndex: 'reportTime',
        align: 'center',
        key: 'reportTime',
      },
      //   {
      //     title: '任务数',
      //     dataIndex: 'detailCount',
      //     width: 150,
      //     align: 'center',
      //     key: 'detailCount'
      //   }

      //   {
      //     title: '操作',
      //     key: 'operation',
      //     scopedSlots: { customRender: 'operation' },
      //     align: 'center'
      //   }
    ],
    Modelitems: [
      {
        span: 24,
        type: 'input',
        name: 'areaNo',
        required: true,
        label: '区域编号',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'id',
        hidden: true,
        label: 'id',
        value: '',
      },
      {
        span: 24,
        type: 'select',
        name: 'areaType',
        required: true,
        label: '区域类别',
        options: [
          { label: '区域', value: 10 },
          { label: '接驳口', value: 20 },
        ],
        on: {
          change(value, label, options, vnode) {
            console.log(arguments)
            if (value == 20) {
              that.config.Modelitems = that.config.Modelitemsupdate
              //   vnode.fieldsStore.fields
            } else if (value == 10) {
              that.config.Modelitems = that.config.Modelitemsupdate1
            }
            // console.log(that.$refs.model.form.fieldsStore)
            console.log(that.config.Modelitems)
          },
        },
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'gcsLocationNo',
        hidden: true,
        required: true,
        label: 'GCS点位',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'mcsLocationNo',
        hidden: true,
        required: true,
        label: 'MCS点位',
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'rcsLocationNo',
        hidden: true,
        required: true,
        label: 'RCS点位',
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'layer',
        required: true,
        label: '层',
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'x',
        hidden: true,
        required: true,
        label: 'X轴',
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'y',
        hidden: true,
        required: true,
        label: 'Y轴',
        value: '',
      },
      //   {
      //     title: '下游WCS系统',
      //     dataIndex: 'deviceSystem',
      //     align: 'center',
      //     ellipsis: true,
      //     key: 'deviceSystem'
      //   },
      {
        span: 24,
        type: 'input',
        name: 'deviceSystem',
        required: true,
        label: '下游WCS系统',
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'maxHeight',
        required: true,
        label: '高度限制',
        value: '',
      },

      {
        span: 24,
        type: 'number',
        name: 'maxCount',
        required: true,
        label: '最大容器数',
        value: '',
      },

      {
        span: 24,
        type: 'select',
        required: true,
        name: 'policy',
        label: '分配货位策略',
        value: 0,
        options: [
          {
            value: 0,
            label: '否',
          },
          {
            value: 1,
            label: '是',
          },
        ],
      },
      {
        span: 24,
        type: 'input',
        name: 'gcsArea',
        required: true,
        label: '跨层区域',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'wmsAreaNo',
        required: true,
        label: 'WMS接口区域',
        value: '',
      },

      {
        span: 24,
        type: 'textarea',
        name: 'remark',
        required: true,
        label: '备注',
        value: '',
      },
    ],
    details: {
      currentArea: '当前节点区域',
      nextArea: '下个节点区域',
      routeTaskState: '任务状态',
      routeExecuteState: '执行状态',
      currentLocation: '当前节点点位',
      nextLocation: '下个节点点位',
      deviceTask_id: '设备任务ID',
      deviceNo: '执行设备编号',
      arriveTime: '到位时间',
      errorMsg: '错误消息',
      updateTime: '修改时间',
    },
    Modelitemsupdate1: [
      {
        span: 24,
        type: 'input',
        name: 'areaNo',
        required: true,
        label: '区域编号',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'id',
        hidden: true,
        label: 'id',
        value: '',
      },
      {
        span: 24,
        type: 'select',
        name: 'areaType',
        required: true,
        label: '区域类别',
        options: [
          { label: '区域', value: 10 },
          { label: '接驳口', value: 20 },
        ],
        on: {
          change(value, label, options) {
            console.log(arguments)
            if (value == 10) {
              //区域
              that.config.Modelitems = that.config.Modelitemsupdate1
            } else if (value == 20) {
              //接驳口
              that.config.Modelitems = that.config.Modelitemsupdate
            }
          },
        },
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'layer',
        required: true,
        label: '层',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'maxHeight',
        required: true,
        label: '高度限制',
        value: '',
      },

      {
        span: 24,
        type: 'number',
        name: 'maxCount',
        required: true,
        label: '最大容器数',
        value: '',
      },

      {
        span: 24,
        type: 'select',
        required: true,
        name: 'policy',
        label: '分配货位策略',
        value: 0,
        options: [
          {
            value: 0,
            label: '否',
          },
          {
            value: 1,
            label: '是',
          },
        ],
      },
      {
        span: 24,
        type: 'input',
        name: 'gcsArea',
        required: true,
        label: '跨层区域',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'wmsAreaNo',
        required: true,
        label: 'WMS接口区域',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'deviceSystem',
        required: true,
        label: '下游WCS系统',
        value: '',
      },
      {
        span: 24,
        type: 'textarea',
        name: 'remark',
        required: true,
        label: '备注',
        value: '',
      },
    ],
    Modelitemsupdate: [
      {
        span: 24,
        type: 'input',
        name: 'areaNo',
        required: true,
        label: '区域编号',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'id',
        hidden: true,
        label: 'id',
        value: '',
      },
      {
        span: 24,
        type: 'select',
        name: 'areaType',
        label: '区域类别',
        options: [
          { label: '区域', value: 10 },
          { label: '接驳口', value: 20 },
        ],
        on: {
          change(value, label, options) {
            console.log(arguments)
            if (value == 10) {
              that.config.Modelitems = that.config.Modelitemsupdate1
            } else if (value == 20) {
              that.config.Modelitems = that.config.Modelitemsupdate
            }
          },
        },
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'gcsLocationNo',
        required: true,
        label: 'GCS点位',
        // rules: [
        //   {
        //     validator: function(rule, value, callback) {
        //       //   console.log(rule, value, callback)
        //       const pwdRegex = new RegExp(/[\u4E00-\u9FA5]/g)
        //       console.log(pwdRegex.test(value))
        //       if (pwdRegex.test(value)) {
        //         console.log(1122)
        //         callback(new Error('不能含有中文'))
        //       } else {
        //         callback()
        //       }
        //     },
        //     required: true
        //   }
        // ],
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'mcsLocationNo',
        required: true,
        label: 'MCS点位',
        // rules: [
        //   {
        //     validator: function(rule, value, callback) {
        //       //   console.log(rule, value, callback)
        //       const pwdRegex = new RegExp(/[\u4E00-\u9FA5]/g)
        //       console.log(pwdRegex.test(value))
        //       if (pwdRegex.test(value)) {
        //         console.log(1122)
        //         callback(new Error('不能含有中文'))
        //       } else {
        //         callback()
        //       }
        //     },
        //     required: true
        //   }
        // ],
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'rcsLocationNo',
        required: true,
        label: 'RCS点位',
        // rules: [
        //   {
        //     validator: function(rule, value, callback) {
        //       //   console.log(rule, value, callback)
        //       const pwdRegex = new RegExp(/[\u4E00-\u9FA5]/g)
        //       console.log(pwdRegex.test(value))
        //       if (pwdRegex.test(value)) {
        //         console.log(1122)
        //         callback(new Error('不能含有中文'))
        //       } else {
        //         callback()
        //       }
        //     },
        //     required: true
        //   }
        // ],
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'layer',
        required: true,
        label: '层',
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'x',
        required: true,
        label: 'X轴',
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'y',
        required: true,
        label: 'Y轴',
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'maxHeight',
        required: true,
        label: '高度限制',
        value: '',
      },

      {
        span: 24,
        type: 'number',
        name: 'maxCount',
        required: true,
        label: '最大容器数',
        value: '',
      },

      {
        span: 24,
        type: 'select',
        required: true,
        name: 'policy',
        label: '分配货位策略',
        value: 0,
        options: [
          {
            value: 0,
            label: '否',
          },
          {
            value: 1,
            label: '是',
          },
        ],
      },
      {
        span: 24,
        type: 'input',
        name: 'gcsArea',
        required: true,
        label: '跨层区域',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'wmsAreaNo',
        required: true,
        label: 'WMS接口区域',
        value: '',
      },
      {
        span: 24,
        type: 'textarea',
        name: 'remark',
        required: true,
        label: '备注',
        value: '',
      },
    ],
  }
}

export default config
