const baseUrl = '/api/service-ai-eis-business-center-eistest/'
const config = function (that) {
  return {
    remoteUrl: {
      url: baseUrl + '/outSplitStg/get-out-split-stg',
      headers: {
        'Content-Type': 'application/JSON',
      },
      method: 'post',
    },
    items: [
      {
        span: 8,
        type: 'input',
        name: 'strategyName',
        label: '策略名称',
        value: '',
      },
      {
        span: 8,
        type: 'input',
        name: 'strategyTypeNo',
        label: '策略类型编码',
        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: 'strategyName',
        key: 'strategyName',
        align: 'center',
        title: '策略名称',
      },
      {
        title: '策略类型编码',
        dataIndex: 'strategyTypeNo',
        align: 'center',
        key: 'strategyTypeNo',
        customRender(text) {
          //   text == 10 && (text = '区域')
          //   text == 20 && (text = '接驳口')
          return text
        },
      },
      //   {
      //     title: '创建时间',
      //     dataIndex: 'createTime',
      //     ellipsis: true,
      //     align: 'center',
      //     key: 'createTime'
      //   },
      //   {
      //     title: '起点区域配置',
      //     key: 'StartingArea',
      //     ellipsis: true,
      //     scopedSlots: { customRender: 'StartingArea' },
      //     dataIndex: 'StartingArea',
      //     align: 'center'
      //   },
      //   {
      //     title: '终点区域配置',
      //     dataIndex: 'EndinggArea',
      //     align: 'center',
      //     ellipsis: true,
      //     scopedSlots: { customRender: 'EndinggArea' },
      //     key: 'EndinggArea'
      //     // customRender(text) {
      //     //   text == 0 && (text = '不索取')
      //     //   text == 1 && (text = '索取')
      //     //   return text
      //     // }
      //   },

      {
        title: '操作',
        key: 'operation',
        scopedSlots: { customRender: 'operation' },
        // fixed: 'right',
        align: 'center',
      },
    ],
    Modelitems: [
      {
        span: 24,
        type: 'input',
        name: 'strategyName',
        required: true,
        label: '容器任务单类型编号',
        value: '',
      },
      {
        span: 24,
        type: 'input',
        name: 'id',
        hidden: true,
        label: 'id',
        value: '',
      },

      {
        span: 24,
        type: 'input',
        name: 'strategyTypeNo',
        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: 'input',
        name: 'areaType',
        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
