index.vue 11.8 KB
Newer Older
zhoutong's avatar
zhoutong committed
1 2
<template>
  <div>
zhoutong's avatar
zhoutong committed
3 4 5 6 7
    <el-row type="flex" style="margin-top: 15px; margin-bottom: 15px" justify="center">
      <el-col :xs="24" :sm="24" :md="24" :lg="20" :xl="22">
        <el-card>
          <el-descriptions :column="4" border>
            <el-descriptions-item :label="$t('自编号')">
zhoutong's avatar
zhoutong committed
8
              {{ shipmentObj.selfNo }}
zhoutong's avatar
zhoutong committed
9 10 11 12 13
            </el-descriptions-item>
            <el-descriptions-item :label="$t('运输方式')">
              <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="shipmentObj.transportType" />
            </el-descriptions-item>
            <el-descriptions-item :label="$t('始发地')">
zhoutong's avatar
zhoutong committed
14
              {{ getCityName(shipmentObj.startWarehouseId) }}
zhoutong's avatar
zhoutong committed
15 16
            </el-descriptions-item>
            <el-descriptions-item :label="$t('目的地')">
zhoutong's avatar
zhoutong committed
17
              {{ getCityName(shipmentObj.destWarehouseId) }}
zhoutong's avatar
zhoutong committed
18 19 20 21 22 23
            </el-descriptions-item>
          </el-descriptions>
        </el-card>

        <el-row style="margin-top: 15px">
          <el-row>
zhoutong's avatar
zhoutong committed
24 25 26
            <el-button
              size="small"
              type="primary"
27
              :disabled="shipmentObj.approvaling"
zhoutong's avatar
zhoutong committed
28 29
              @click="
                addMergedialogVisible = true
30
                isMergeEdit = false
zhoutong's avatar
zhoutong committed
31 32 33 34 35
                addMergeForm = {}
                mergeTitle = $t('新建合包箱号')
              "
              >{{ $t('新建合包箱号') }}</el-button
            >
zhoutong's avatar
zhoutong committed
36
            <el-button class="ml-10" @click="pack">{{$t('补单')}}</el-button>
zhoutong's avatar
zhoutong committed
37 38
          </el-row>
          <el-row style="margin-top: 5px">
zhoutong's avatar
zhoutong committed
39
            <el-table border :data="pagList" max-height="600px">
zhoutong's avatar
zhoutong committed
40
              <el-table-column align="center" :label="$t('序号')" width="50" type="index" />
zhoutong's avatar
zhoutong committed
41
              <el-table-column :label="$t('箱号')" align="center" prop="pkgNum" />
zhoutong's avatar
zhoutong committed
42
              <el-table-column :label="$t('尺寸')" align="center">
zhoutong's avatar
zhoutong committed
43
                <template slot-scope="scope"> {{ scope.row.pkgLength }}*{{ scope.row.pkgWidth }}*{{ scope.row.pkgHight }} </template>
zhoutong's avatar
zhoutong committed
44
              </el-table-column>
zhoutong's avatar
zhoutong committed
45
              <el-table-column :label="$t('订单数')" align="center" prop="orderCount" />
46
              <el-table-column :label="$t('箱数')" align="center" prop="sumNum" />
zhoutong's avatar
zhoutong committed
47
              <el-table-column :label="$t('入仓体积')" align="center" prop="sumVolume" />
zhoutong's avatar
zhoutong committed
48 49
              <el-table-column :label="$t('入仓重量')" align="center" prop="sumWeight" />
              <el-table-column :label="$t('入仓数量(个)')" align="center" prop="sumQuantity" />
zhoutong's avatar
zhoutong committed
50 51
              <el-table-column :label="$t('状态')" align="center" prop="tallyStatus">
                <template slot-scope="scope">
zhoutong's avatar
zhoutong committed
52
                  {{ statusData[scope.row.status] }}
zhoutong's avatar
zhoutong committed
53 54
                </template>
              </el-table-column>
zhoutong's avatar
zhoutong committed
55
              <el-table-column :label="$t('创建时间')" align="center" width="200px">
zhoutong's avatar
zhoutong committed
56
                <template slot-scope="scope">
zhoutong's avatar
zhoutong committed
57
                  {{ formatDate(scope.row.createTime, 'YYYY-MM-DD HH:mm:ss') }}
zhoutong's avatar
zhoutong committed
58 59
                </template>
              </el-table-column>
zhoutong's avatar
zhoutong committed
60
              <el-table-column :label="$t('操作')" align="center" width="260" class-name="small-padding fixed-width" fixed="right">
zhoutong's avatar
zhoutong committed
61
                <template slot-scope="scope">
62 63
                  <el-button :disabled="shipmentObj.approvaling" v-if="scope.row.status == 1" type="text" size="small" @click="editMerge(scope.row)">{{ $t('编辑') }}</el-button>
                  <el-button :disabled="shipmentObj.approvaling" type="text" size="small" @click="pkgPage(scope.row)">{{ $t('装箱') }}</el-button>
zhoutong's avatar
zhoutong committed
64
                  <el-button v-if="scope.row.status != 2" type="text" size="small" @click="deleteMerge(scope.row.id)">{{ $t('删除') }}</el-button>
zhoutong's avatar
zhoutong committed
65
                  <el-button type="text" size="small" @click="printTag(scope.row.id)">{{ $t('打印标签') }}</el-button>
zhoutong's avatar
zhoutong committed
66 67 68
                </template>
              </el-table-column>
            </el-table>
zhoutong's avatar
zhoutong committed
69 70
            <!-- 分页组件 -->
            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows" @pagination="getList" />
zhoutong's avatar
zhoutong committed
71 72
          </el-row>
        </el-row>
zhoutong's avatar
zhoutong committed
73 74
        <!-- 新增合包箱 -->
        <el-dialog :title="mergeTitle" :visible.sync="addMergedialogVisible" width="700px" :modal-append-to-body="false" append-to-body>
zhoutong's avatar
zhoutong committed
75
          <el-form ref="addMergeForm" :model="addMergeForm" label-width="100px">
zhoutong's avatar
zhoutong committed
76 77
            <el-form-item :label="$t('箱号')" prop="pkgNum">
              {{ !isMergeEdit ? '自动生成' : addMergeForm.pkgNum }}
zhoutong's avatar
zhoutong committed
78
            </el-form-item>
zhoutong's avatar
zhoutong committed
79 80
            <el-form-item v-if="!isMergeEdit" :label="$t('数量')" prop="num" :rules="[{ required: true, message: this.$t('数量不能为空'), trigger: 'blur' }]">
              <el-input-number v-model="addMergeForm.num" :controls="false" :min="1" :precision="0" />
zhoutong's avatar
zhoutong committed
81
            </el-form-item>
zhoutong's avatar
zhoutong committed
82 83
            <el-row>
              <el-col :span="8">
zhoutong's avatar
zhoutong committed
84 85
                <el-form-item :label="$t('长')" prop="pkgLength" :rules="[{ validator: validatorPositiveNumber, message: $t('格式错误'), trigger: 'blur'}]">
                  <el-input v-model="addMergeForm.pkgLength" style="width: 100px" />
zhoutong's avatar
zhoutong committed
86 87 88
                </el-form-item>
              </el-col>
              <el-col :span="8">
zhoutong's avatar
zhoutong committed
89 90
                <el-form-item :label="$t('宽')" prop="pkgWidth" :rules="[{ validator: validatorPositiveNumber, message: $t('格式错误'), trigger: 'blur'}]">
                  <el-input v-model="addMergeForm.pkgWidth" style="width: 100px" />
zhoutong's avatar
zhoutong committed
91 92 93
                </el-form-item>
              </el-col>
              <el-col :span="8">
zhoutong's avatar
zhoutong committed
94 95
                <el-form-item :label="$t('高')" prop="pkgHight" :rules="[{ validator: validatorPositiveNumber, message: $t('格式错误'), trigger: 'blur'}]">
                  <el-input v-model="addMergeForm.pkgHight" style="width: 100px" />
zhoutong's avatar
zhoutong committed
96 97 98
                </el-form-item>
              </el-col>
            </el-row>
zhoutong's avatar
zhoutong committed
99
          </el-form>
zhoutong's avatar
zhoutong committed
100 101 102 103 104 105
          <div style="text-align: center">
            <el-button size="small" type="primary" @click="addMerge">{{ $t('确定') }}</el-button>
            <el-button size="small" type="primary" @click="addMergedialogVisible = false">{{ $t('取消') }}</el-button>
          </div>
        </el-dialog>
        <!-- 装箱 -->
zhoutong's avatar
zhoutong committed
106
        <el-dialog :title="pkgPageTitle" :visible.sync="pkgPagedialogVisible" :fullscreen="true" :modal-append-to-body="false" append-to-body @close="pkgPageType=0">
107 108 109 110 111 112
          <div class="flex">
            <el-radio-group v-model="pkgPageType">
              <el-radio-button :label="1">{{ $t('未装箱列表') }}</el-radio-button>
              <el-radio-button :label="2">{{ $t('已装箱列表') }}</el-radio-button>
            </el-radio-group>
          </div>
zhoutong's avatar
zhoutong committed
113
          <un-pkg-page v-if="pkgPageType == 1" :pkgData="pkgData" :shipmentObj="shipmentObj" @reload="getList" />
114
          <pkg-page v-if="pkgPageType == 2" :pkgData="pkgData" :shipmentObj="shipmentObj" @closeDialog="closeDialog" @reload="getList" />
zhoutong's avatar
zhoutong committed
115 116
        </el-dialog>
        <!-- 打印标签 -->
zhoutong's avatar
zhoutong committed
117
        <el-dialog :title="$t('集运封箱标签')" :visible.sync="printdialogVisible" width="350px" :modal-append-to-body="false" append-to-body>
zhoutong's avatar
zhoutong committed
118
          <print-tag v-if="printdialogVisible" :tagData="tagData" />
zhoutong's avatar
zhoutong committed
119 120 121
        </el-dialog>

        <el-row style="margin-top: 15px" class="operate-button">
122
          <el-button :disabled="shipmentObj.approvaling" size="small" type="primary" @click="finish">{{ $t('完成') }}</el-button>
zhoutong's avatar
zhoutong committed
123
          <el-button size="small" @click="$emit('closeDialog')">{{ $t('取消') }}</el-button>
zhoutong's avatar
zhoutong committed
124 125 126
        </el-row>
      </el-col>
    </el-row>
127 128 129 130 131 132 133 134

    <supplement-order
      v-if="showPackDialog"
      :shipmentObj="shipmentObj"
      :warehouseList="$attrs.warehouseList"
      @close="showPackDialog=false"
      @supplementFinish="onSupplementFinish"
    ></supplement-order>
zhoutong's avatar
zhoutong committed
135 136 137 138
  </div>
</template>

<script>
zhoutong's avatar
zhoutong committed
139
import { getMergePkgList, createMergePkg, updateMergePkg, deleteMergePkg, getMergeTagById, finishMergePkg } from '@/api/ecw/boxAir'
zhoutong's avatar
zhoutong committed
140 141 142
import { formatDate, serviceMsg } from '../../utils'
import unPkgPage from './unPkgPage.vue'
import PkgPage from './pkgPage.vue'
zhoutong's avatar
zhoutong committed
143
import printTag from './printTag.vue'
144
import SupplementOrder from "./supplementOrder.vue";
zhoutong's avatar
zhoutong committed
145
export default {
zhoutong's avatar
zhoutong committed
146
  components: {
147
    SupplementOrder,
zhoutong's avatar
zhoutong committed
148
    unPkgPage,
zhoutong's avatar
zhoutong committed
149 150
    PkgPage,
    printTag
zhoutong's avatar
zhoutong committed
151
  },
zhoutong's avatar
zhoutong committed
152
  data() {
zhoutong's avatar
zhoutong committed
153 154 155 156 157 158 159 160
    let validatorPositiveNumber = (rule, value, callback) => {
        if(!value || value == '')return callback();
        if (!value) return callback(new Error('请输入数字'))
        if (!Number(value)) return callback(new Error('请输入有效数字'))
        let reg = /((^[1-9]\d*)|^0)(\.\d*){0,1}$/;
        if (!reg.test(value)) return callback(new Error('请输入有效数字'));
        callback();
    }
zhoutong's avatar
zhoutong committed
161
    return {
zhoutong's avatar
zhoutong committed
162
      validatorPositiveNumber,
zhoutong's avatar
zhoutong committed
163 164 165 166 167 168 169 170
      pagList: [],
      statusData: ['', '未装箱', '装箱中', '已封箱'],
      // 查询参数
      queryParams: {
        page: 1,
        rows: 10,
        shipmentId: this.$attrs.shipmentObj.id
      },
zhoutong's avatar
zhoutong committed
171
      total: 0,
zhoutong's avatar
zhoutong committed
172
      // 出货信息
zhoutong's avatar
zhoutong committed
173 174
      shipmentObj: this.$attrs.shipmentObj,
      addMergedialogVisible: false,
175 176 177 178 179
      addMergeForm: {
        pkgLength: null,
        pkgWidth: null,
        pkgHight: null,
      },
zhoutong's avatar
zhoutong committed
180 181 182 183
      mergeTitle: '',
      isMergeEdit: false,
      pkgPageType: 1,
      pkgPageTitle: '',
zhoutong's avatar
zhoutong committed
184 185 186
      pkgPagedialogVisible: false,
      pkgData: {},
      printdialogVisible: false,
187 188 189
      tagData: {},
      // 是否显示补单弹层
      showPackDialog: false
zhoutong's avatar
zhoutong committed
190 191 192
    }
  },
  created() {
zhoutong's avatar
zhoutong committed
193
    this.getList()
zhoutong's avatar
zhoutong committed
194
  },
zhoutong's avatar
zhoutong committed
195
  computed: {
zhoutong's avatar
zhoutong committed
196
    /* 获取仓库 */
zhoutong's avatar
zhoutong committed
197 198
    getCityName() {
      return (id) => {
zhoutong's avatar
zhoutong committed
199 200 201 202
        let arr = this.$attrs.warehouseList.filter((item) => item.id == id)
        return arr.length > 0 ? this.$l(arr[0], 'title') : this.$t('')
      }
    }
zhoutong's avatar
zhoutong committed
203 204
  },
  methods: {
zhoutong's avatar
zhoutong committed
205 206 207 208
    formatDate,
    getList() {
      getMergePkgList(this.queryParams).then((res) => {
        this.pagList = res.data.list
zhoutong's avatar
zhoutong committed
209
        this.total = res.data.total
zhoutong's avatar
zhoutong committed
210 211 212 213 214 215 216
      })
    },
    editMerge(row) {
      this.mergeTitle = this.$t('编辑合包箱号')
      this.isMergeEdit = true
      this.addMergedialogVisible = true
      this.addMergeForm.pkgNum = row.pkgNum
217 218 219
      this.addMergeForm.pkgLength = +row.pkgLength
      this.addMergeForm.pkgWidth = +row.pkgWidth
      this.addMergeForm.pkgHight = +row.pkgHight
zhoutong's avatar
zhoutong committed
220
      this.addMergeForm.id = row.id
zhoutong's avatar
zhoutong committed
221 222 223 224 225 226 227
    },
    addMerge() {
      this.$refs['addMergeForm'].validate((valid) => {
        if (!valid) {
          return
        }
        this.addMergeForm.shipmentId = this.$attrs.shipmentObj.id
zhoutong's avatar
zhoutong committed
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
        if (!this.addMergeForm.id) {
          createMergePkg(this.addMergeForm).then((res) => {
            serviceMsg(res, this).then(() => {
              this.addMergedialogVisible = false
              this.getList()
            })
          })
        } else {
          updateMergePkg(this.addMergeForm).then((res) => {
            serviceMsg(res, this).then(() => {
              this.addMergedialogVisible = false
              this.getList()
            })
          })
        }
zhoutong's avatar
zhoutong committed
243
      })
zhoutong's avatar
zhoutong committed
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
    },
    deleteMerge(id) {
      this.$modal
        .confirm(this.$t('是否确认删除?'))
        .then(function () {
          return deleteMergePkg(id)
        })
        .then(() => {
          this.getList()
          this.$modal.msgSuccess(this.$t('删除成功'))
        })
        .catch(() => {})
    },
    pkgPage(row) {
      this.pkgPagedialogVisible = true
zhoutong's avatar
zhoutong committed
259 260 261 262 263 264 265 266 267 268 269 270 271
      this.pkgPageType=1
      this.pkgPageTitle = this.$t('合包箱号: ') + row.pkgNum
      this.pkgData = row
    },
    printTag(id) {
      getMergeTagById(id).then(res=>{
        this.tagData = res.data
        this.printdialogVisible = true
      })
    },
    closeDialog() {
      this.getList()
      this.pkgPagedialogVisible = false
zhoutong's avatar
zhoutong committed
272
    },
zhoutong's avatar
zhoutong committed
273 274 275 276 277 278
    finish() {
      finishMergePkg(this.$attrs.shipmentObj.id).then((res) => {
        serviceMsg(res, this).then(() => {
          this.$emit("closeDialog", "submit");
        });
      });
279 280 281 282 283 284 285 286
    },
    // 补单
    pack(){
      this.showPackDialog=true
    },
    // 提交补单
    onSupplementFinish(){
      this.showPackDialog = false
zhoutong's avatar
zhoutong committed
287
    }
zhoutong's avatar
zhoutong committed
288 289 290 291 292
  }
}
</script>

<style>
293
</style>