
export const setUpdateForm = (self, title) => {

  return [
    { name: 'shipbillIds', hidden: true, label: 'shipbillIds' },
    {
      name: 'deliverySignTime',
      label: '签到时间',
      type: 'date',
      format: 'YYYY-MM-DD HH:mm',
      labelCol: { span: 8 },
      wrapperCol: { span: 16 },
      value: self.moment().format('YYYY-MM-DD HH:mm'),
    },
    {
      name: 'deliveryTime',
      label: '送达时间',
      type: 'date',
      format: 'YYYY-MM-DD HH:mm',
      required: true,
      labelCol: { span: 8 },
      wrapperCol: { span: 16 },
      // value: self.moment().format('YYYY-MM-DD HH:mm'),
    },
    {
      name: 'deliverySignPerson',
      label: '签收人',
      type: 'input',
      labelCol: { span: 8 },
      wrapperCol: { span: 16 },
    },
    {
      name: 'deliveryStatus',
      label: '配送状态',
      type: 'select',
      required: true,
      value: 30,
      get options() {
        return self.options.DELIVERY_STATUS
      },
      labelCol: { span: 8 },
      wrapperCol: { span: 16 },
    },

    // {
    //   name: 'vehicleDeviceName',
    //   label: '设备号',
    //   placeholder: ' ',
    //   readOnly: true,
    //   subName: ['vehicleDeviceId', 'vehicleDeviceCode'],
    //   type: 'input',
    //   labelCol: { span: 8 },
    //   wrapperCol: { span: 16 }
    // },
    {
      hidden: true,
      name: "containerId",
      type: 'input'
    },
    {
      hidden: true,
      name: "containerCode",
      type: 'input'
    },
    // YD1000057394
    {
      name: 'containerName',
      label: '容器号',
      placeholder: ' ',
      type: 'input',
      readOnly: true,
      disabled:true,
      // get disabled() {
      //   return !self.currentData.showDeliveryTemperature
      // },
      get hidden() {
        //系统参数 容器
        return !( self.RELATION_THIRD_SYSTEM.includes('3'))
      },
      labelCol: { span: 8 },
      wrapperCol: { span: 16 },
    },
    {
      name: 'deliveryTemperature',
      label: '所有容器-送达温度',
      type: 'number',
      unit: '°c',
      get hidden() {
        //业务规则策略
        return !self.currentData.showDeliveryTemperature||self.currentData?.temperatureVOList.length===0
       },
      labelCol: { span: 8 },
      wrapperCol: { span: 16 },
      on: {
        change(value, form) {
         self.currentData?.temperatureVOList?.forEach(item => {
            item.temperature = value
          })
        }
      }
    },

    {
      itemHeight: 'auto',
      span: 24,
      labelCol: { span: 0 },
      wrapperCol: { span: 24  },
      scopedSlots: { customRender: 'temperatureVOList' },
    },
    {
      name: 'temperatureVOList',
      hidden: true,
      type: 'txt',
      value: [],
    },
    {
      name: 'deliveryFailureReason',
      label: '配送失败原因',
      type: 'select',
      hidden: true,
      get options() {
        return self.options.DELIVERY_FAILURE_REASON
      },
      labelCol: { span: 8 },
      wrapperCol: { span: 16 },
    },

    {
      name: 'deliveryStrandedReason',
      label: '送达滞留原因',
      type: 'select',
      hidden: true,
      labelCol: { span: 8 },
      wrapperCol: { span: 16 },
      get options() {
        return self.options.DELIVERY_STRANDED_REASON
      },
    },


    // {
    //   itemHeight: 'auto',
    //   span: 24,
    //   labelCol: { span: 0 },
    //   wrapperCol: { span: 24 },
    //   scopedSlots: { customRender: 'temperatureVOList' },
    // },
    {
      name: 'showDeliveryTemperature',
      label: '是否显示送达温度',
      hidden: true,
      type: 'txt',

    },
    {
      name: 'deliveryMemo',
      span: 24,
      labelCol: { span: 4 },
      wrapperCol: { span: 20 },
      label: '备注',
      type: 'textarea',
    },
    {
      name: 'goodsPhoto',
      itemHeight: 'auto',
      label: '货物图片',
      span: 24,
      labelCol: { span: 4 },
      wrapperCol: { span: 20 },
      scopedSlots: { customRender: 'photo' },
      value: '',
    },
    {
      name: 'receiptPhoto',
      itemHeight: 'auto',
      label: '回单照片',
      span: 24,
      labelCol: { span: 4 },
      wrapperCol: { span: 20 },
      scopedSlots: { customRender: 'photo2' },
      value: '',
    }
  ]
}

export const setUpdateGrid = (self, title) => {
  let editPcs = []
  if (title) {
    editPcs.push({
      dataIndex: 'editPcs',
      title: title,
      width: 120,
      scopedSlots: { customRender: 'editPcs' },
    })
  }
  return [
    {
      dataIndex: 'itemCode',
      title: '商品编码',
      width: 120,
    },
    {
      dataIndex: 'itemName',
      title: '商品名称',
      width: 120,
    },
    {
      dataIndex: 'itemCategoryName',
      title: '商品品类',
      width: 120,
    },
    {
      dataIndex: 'packTypeName',
      title: '包装类型',
      width: 120,
    },
    {
      dataIndex: 'cargoThermosphereName',
      title: '货物温层',
      width: 120,
    },
    {
      dataIndex: 'deliveryPcs',
      title: '实际发货件数',
      width: 120,
    },
    ...editPcs,
    {
      dataIndex: 'weight',
      title: '重量',
      width: 120,
    },
    {
      dataIndex: 'volume',
      title: '体积',
      width: 120,
    },
    {
      dataIndex: 'memo',
      title: '备注',
      width: 120,
    },
    {
      dataIndex: 'temperatureCtlUpperLimit',
      title: '温控区间（下限）',
      width: 120,
    },
    {
      dataIndex: 'temperatureCtlLowerLimit',
      title: '温控区间（上限）',
      width: 120,
    },
    {
      dataIndex: 'branchName',
      title: '默认存放仓库',
      width: 120,
    },
    {
      dataIndex: 'inventoryPcs',
      title: '库存件数',
      width: 120,
    },
    {
      dataIndex: 'stagingLocation',
      title: '暂存位',
      width: 120,
    },
  ]
}



// dtoList:[
//   {
//   applyPcsEnable:"[integer] 输入申请数量 数据字典PROCESS_ENABLE：0否 10是"
//   applyPcsSelect:"[integer] 申请数量是否勾选 0否 1是"
//   colorTagBgdColor:"[string] 颜色标记 底纹背景颜色"
//   colorTagFontColor:"[string] 颜色标记 字体颜色"
//   colorTagSelect:"[integer] 颜色标记是否选择 0否 1是"
//   deliveryDirection:"[integer] 配送方向 数据字典LINE_DIRECTION：10正向 20逆向"
//   deliveryDirectionSelect:"[integer] 配送方向是否选择 0否 1是"
//   deliveryMethodSelect:"[integer] 配送方式是否勾选 0否 1是"
//   deliveryMethodType:"[integer] 配送方式 数据字典DELIVERY_METHOD_TYPE：1配送 2自提"
//   deliveryTemperatureEnable:"[integer] 输入送达温度 数据字典PROCESS_ENABLE：0否 10是"
//   deliveryTemperatureSelect:"[integer] 输入送达温度是否选择 0否 1是"
//   departureTemperatureEnable:"[integer] 输入启运温度 数据字典PROCESS_ENABLE：0否 10是"
//   departureTemperatureSelect:"[integer] 输入启运温度是否选择 0否 1是"
//   id:"[integer] 主键"
//   inventoryCheckEnable:"[integer] 库存校验 数据字典PROCESS_ENABLE：0否 10是"
//   inventoryCheckSelect:"[integer] 库存校验是否选择 0否 1是"
//   name:"[string] 业务规则策略名称"
//   pricePcdMatchType:"[integer] 数据字典PRICE_TBL_PCD_MATCH_TYPE 1.省市区精确匹配 2.省市区向上匹配 3.省市区向上匹配,未匹配到忽略省市区 4.忽略省市区作为匹配条件"
//   pricePcdMatchTypeSelect:"[integer] 价格表省市区匹配方式是否勾选 0否 1是"
//   recordTagSelect:"[integer] 记录标记是否选择 0否 1是"
//   recordTagWord:"[string] 记录标记语"
//   rtnOrderDeadline:"[integer] 回单期限"
//   rtnOrderDeadlineSelect:"[integer] 回单期限是否选择 0否 1是"
//   rtnOrderPaperEnable:"[integer] 正本回单 0否 1是"
//   rtnOrderPaperSelect:"[integer] 正本回单是否选择 0否 1是"
//   rtnOrderPicEnable:"[integer] 回单图片 0否 1是"
//   rtnOrderPicSelect:"[integer] 回单图片是否选择 0否 1是"
//   }