const baseUrl = '/api/eis-xty-master-wz'

const config = function (that) {
  return {
    remoteUrl: {
      url: baseUrl + '/api/v1/print/task/page',
      headers: {
        'Content-Type': 'application/JSON',
      },
      method: 'post',
    },
    items: [
      {
        span: 6,
        type: 'input',
        name: 'itemId',
        label: '商品编码',
        value: '',
      },
      //   {
      //     span: 6,
      //     type: 'date',
      //     name: 'label',
      //     label: '标签码',
      //     value: ''
      //   },
      {
        span: 6,
        type: 'input',
        name: 'orderNo',
        label: '订单编号',
        value: '',
      },
      {
        span: 6,
        type: 'input',
        name: 'wholeNo',
        label: '整件标签号',
        value: '',
      },

      {
        span: 6,
        label: '开始时间',
        type: 'date',
        name: 'startTime',
        placeholder: '请输入开始日期',
        value: '',
        format: 'YYYY-MM-DD',
        showTime: true,
      },

      {
        span: 6,
        label: '结束时间',
        type: 'date',
        name: 'endTime',
        placeholder: '请输入开始日期',
        value: '',
        format: 'YYYY-MM-DD',
        showTime: true,
      },
      //   {
      //     span: 8,
      //     type: 'select',
      //     name: 'areaType',
      //     label: '出库任务单类型编号',
      //     value: '',
      //     options: [
      //       { label: '区域', value: 10 },
      //       { label: '接驳口', value: 20 }
      //     ]
      //   },
      //   {
      //     type: 'row',
      //     label: '创建时间',
      //     list: [
      //       {
      //         type: 'date',
      //         name: 'startTime',
      //         placeholder: '请输入开始日期',
      //         value: '',
      //         format: 'YYYY-MM-DD HH:mm:ss',
      //         showTime: true,
      //         style: 'padding-right:5px;'
      //       },
      //       {
      //         type: 'date',
      //         name: 'endTime',
      //         placeholder: '请输入结束日期',
      //         format: 'YYYY-MM-DD hh:mm:ss',
      //         value: ''
      //       }
      //     ]
      //   },

      {
        span: 6,
        type: 'buttonGroup',
        style: { textAlign: 'left' },
        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,
        hidden: true,
        title: 'id',
      },
      {
        title: '商品名称',
        dataIndex: 'chineseName',
        ellipsis: true,
        align: 'center',
        width: 150,
        key: 'chineseName',
        // customRender(text) {
        //   text == 10 && (text = '区域')
        //   text == 20 && (text = '接驳口')
        //   return text
        // }
      },
      //   {
      //     title: '标签码',
      //     dataIndex: 'label',
      //     ellipsis: true,
      //     align: 'center',
      //     width: 150,
      //     key: 'label'
      //   },
      {
        title: '当前第X箱：1/2',
        key: 'countCase',
        width: 150,
        ellipsis: true,
        dataIndex: 'countCase',
        align: 'center',
      },

      {
        title: '商品编码',
        dataIndex: 'goodsCode',
        align: 'center',
        ellipsis: true,
        width: 150,
        key: 'goodsCode',
        // customRender(text) {
        //   text == 0 && (text = '不索取')
        //   text == 1 && (text = '索取')
        //   return text
        // }
      },
      {
        title: '批号',
        key: 'lotId',
        width: 150,
        ellipsis: true,
        dataIndex: 'lotId',
        align: 'center',
      },
      {
        title: '订单编号',
        key: 'orderNo',
        width: 150,
        ellipsis: true,
        dataIndex: 'orderNo',
        align: 'center',
      },

      {
        title: '业主',
        key: 'ownerId',
        width: 150,
        ellipsis: true,
        dataIndex: 'ownerId',
        align: 'center',
      },
      {
        title: '包裹号',
        key: 'packageNo',
        width: 150,
        ellipsis: true,
        dataIndex: 'packageNo',
        align: 'center',
      },

      {
        title: '打印任务包id',
        key: 'packageTaskId',
        width: 150,
        ellipsis: true,
        dataIndex: 'packageTaskId',
        align: 'center',
      },
      {
        title: '打印次数',
        key: 'printCount',
        width: 80,
        ellipsis: true,
        dataIndex: 'printCount',
        align: 'center',
      },
      {
        title: '打印内容',
        key: 'printData',
        width: 80,
        ellipsis: true,
        dataIndex: 'printData',
        align: 'center',
      },

      {
        title: '打印方案',
        key: 'printSolution',
        width: 80,
        ellipsis: true,
        dataIndex: 'printSolution',
        align: 'center',
      },
      {
        title: '数量',
        key: 'qty',
        width: 100,
        ellipsis: true,
        dataIndex: 'qty',
        align: 'center',
      },
      {
        title: '异常状态',
        key: 'status',
        width: 150,
        ellipsis: true,
        // hidden: true,
        dataIndex: 'status',
        align: 'center',
      },
      {
        title: '整件标签号',
        key: 'wholeNo',
        width: 150,
        // hidden: true,
        ellipsis: true,
        dataIndex: 'wholeNo',
        align: 'center',
      },

      {
        title: '最后一次打印的错误消息',
        key: 'errorMsg',
        width: 150,
        ellipsis: true,
        dataIndex: 'errorMsg',
        align: 'center',
      },
      {
        title: '创建时间',
        key: 'createTime',
        width: 150,
        ellipsis: true,
        dataIndex: 'createTime',
        align: 'center',
      },

      //   {
      //     title: '状态',
      //     key: 'spsLocationNo',
      //     width: 150,
      //     ellipsis: true,
      //     dataIndex: 'spsLocationNo',
      //     scopedSlots: { customRender: 'spsLocationNo' },
      //     align: 'center'
      //   }

      //   {
      //     title: '操作',
      //     key: 'operation',
      //     width: 150,
      //     align: 'center',
      //     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: '',
      },
    ],
  }
}

export default config
