unPkgPage.vue 5.38 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
<template>
  <div>
    <el-row style="margin-top: 25px">
      <el-row>
        <el-button size="small" type="primary" @click="createBatch">{{ $t('批量装箱') }}</el-button>
      </el-row>
      <el-row style="margin-top: 5px">
        <el-table border :data="pagList" max-height="600px" @select="checkboxSelect" @select-all="checkboxSelect">
          <el-table-column type="selection" align="center" width="55" fixed="left" />
          <el-table-column align="center" :label="$t('序号')" width="50" type="index" />
          <el-table-column :label="$t('订单号')" align="center" prop="orderNo">
            <template slot-scope="scope">
              {{ scope.row.orderNo }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('商品信息')" width="250px" align="center">
            <template slot-scope="{ row }">
              <div v-for="item in row.orderItemDOS" :key="item.orderItemId">
                {{ $l(item, 'prodTitle') }}
              </div>
            </template>
          </el-table-column>
          <el-table-column :label="$t('备案')" align="center">
            <template slot-scope="{ row }">
              <dict-tag :type="DICT_TYPE.PRODUCT_RECORD_ATTRIBUTE" :value="row.productRecord" />
            </template>
          </el-table-column>
          <el-table-column :label="$t('箱数')" align="center" prop="sumNum">
            <template slot-scope="scope">
             {{ scope.row.sumNum }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('纸箱尺寸')" align="center">
            <template slot-scope="{ row }">
              <div v-for="item in row.orderItemDOS" :key="item.orderItemId">
                {{ item.warehouseInInfoVO?item.warehouseInInfoVO.boxGauge:'' }}
              </div>
            </template>
          </el-table-column>
          <el-table-column :label="$t('体积')" align="center" prop="sumVolume" />
          <el-table-column :label="$t('重量')" align="center" prop="sumWeight" />
          <el-table-column :label="$t('数量(个)')" align="center" prop="sumQuantity" />
          <el-table-column :label="$t('储位')" align="center" prop="positionNo" width="250px">
            <template slot-scope="{ row }">
              <div v-for="item in row.orderItemDOS" :key="item.orderItemId">
                {{ (item.warehouseInInfoVO&&item.warehouseInInfoVO.orderLocationMergeVOSet)?notset(getpositionNo(item.warehouseInInfoVO.orderLocationMergeVOSet)):'' }}
              </div>
            </template>
          </el-table-column>
          <el-table-column :label="$t('理货时间')" align="center">
            <template slot-scope="scope">
              {{ formatDate(scope.row.tallyTime, 'YYYY-MM-DD HH:mm:ss') }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('操作')" align="center" width="160" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button type="text" size="small" @click="addPkg(scope.row)">{{ $t('装箱') }}</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows" @pagination="getList" />
      </el-row>
    </el-row>
  </div>
</template>

<script>
import { getUnPkgPage, createPkgOrder, createBatchPkgOrder } from '@/api/ecw/boxAir'
import { formatDate, serviceMsg } from '../../utils'
export default {
  props: {
    pkgData: Object,
    shipmentObj: Object,
  },
  data() {
    return {
      pagList: [],
      // 查询参数
      queryParams: {
        page: 1,
        rows: 10,
        shipmentId: this.shipmentObj.id,
      },
      total: 0,
      // 勾选行
      selectedRows: []
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      getUnPkgPage(this.queryParams).then((res) => {
        this.pagList = res.data.list || []
        this.total = res.data.total
      })
    },
    // 格式化日期
    formatDate,
    //去重
    notset(string) {
      if (!string) return string
      let arr = string.split(',')
      arr = arr.filter((item, index) => {
        return arr.indexOf(item) == index
      })
      return arr.toString()
    },
    getpositionNo(arr){
      if(!arr) return arr
      let data = []
      arr.forEach(item=>{
        data.push(item.areaName+item.locationName)
      })
      return data.toString()
    },
    addPkg(row) {
      let data = {
        pkgId: this.pkgData.id,
        orderId: row.orderId,
        orderItemId: row.orderItemId
      }
      createPkgOrder(data).then(() => {
        this.$message.success(this.$t('装箱成功'))
        this.getList()
        this.$emit('reload')
      })
    },
    // 选中
    checkboxSelect(selection) {
      this.selectedRows = selection
    },
    createBatch() {
      if (this.selectedRows.length === 0) {
        this.$message.error(this.$t('请选择需要装箱的订单'))
        return
      }
      let data = []
      this.selectedRows.forEach((item) => {
        let json = {
          pkgId: this.pkgData.id,
          orderId: item.orderId,
          orderItemId: item.orderItemId
        }
        data.push(json)
      })
      createBatchPkgOrder(data).then(() => {
        this.$message.success(this.$t('装箱成功'))
        this.getList()
      })
    }
  }
}
</script>

<style>
</style>