preinstall.vue 39.7 KB
Newer Older
zhoutong's avatar
zhoutong 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
<template>
  <div class="preinstall">
    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
      <el-form-item :label="$t('入仓时间')" prop="rucangtime">
        <el-date-picker v-model="queryParams.rucangtime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" range-separator="-" start-:placeholder="$t('开始日期')" end-:placeholder="$t('结束日期')" />
      </el-form-item>
      <el-form-item :label="$t('始发地')" prop="startWarehouseId">
        <el-select v-model="queryParams.startWarehouseId" :placeholder="$t('请选择始发地')" clearable size="small">
          <el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('目的地')" prop="destWarehouseIdList">
        <el-select v-model="queryParams.destWarehouseIdList" :placeholder="$t('请选择目的地')" multiple clearable>
          <el-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('状态')" prop="orderStatus">
        <el-select v-model="queryParams.orderStatus" :placeholder="$t('请选择状态')" clearable size="small">
          <el-option v-for="item in stateOps" :label="$l(item, 'label')" :value="item.value" :key="item.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('备案')" prop="productRecord">
        <el-select v-model="queryParams.productRecord" :placeholder="$t('请选择备案')" clearable size="small">
          <el-option v-for="item in filingOps" :label="$l(item, 'label')" :value="item.value" :key="item.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('报关方式')" prop="customsType">
        <el-select v-model="queryParams.customsType" :placeholder="$t('请选择报关方式')" clearable size="small">
          <el-option v-for="item in declarationMethodOps" :label="$l(item, 'label')" :value="item.value" :key="item.value"></el-option>
        </el-select>
      </el-form-item>
zhoutong's avatar
zhoutong committed
33 34
      <el-form-item :label="$t('待分拣订单')" prop="toBePreOrderNo">
        <el-input v-model="queryParams.toBePreOrderNo" :placeholder="$t('请输入待分拣订单')" clearable />
zhoutong's avatar
zhoutong committed
35
      </el-form-item>
zhoutong's avatar
zhoutong committed
36 37
      <el-form-item :label="$t('已分拣单号')" prop="preOrderNo">
        <el-input v-model="queryParams.preOrderNo" :placeholder="$t('请输入已分拣单号')" clearable />
zhoutong's avatar
zhoutong committed
38 39 40 41
      </el-form-item>
      <el-form-item :label="$t('品名')" prop="itemName">
        <el-input v-model="queryParams.itemName" :placeholder="$t('请输入品名')" clearable />
      </el-form-item>
42
      <el-form-item :label="$t('泡货比')" prop="weightRatioMax">
zhoutong's avatar
zhoutong committed
43 44 45 46 47 48
        <el-input v-model="queryParams.weightRatioMax" :placeholder="$t('请输入 大')" clearable />
      </el-form-item>
      <el-form-item label="" prop="weightRatioMin">
        <el-input v-model="queryParams.weightRatioMin" :placeholder="$t('请输入 小')" clearable />
      </el-form-item>

49 50
      <el-form-item :label="$t('出货渠道')" prop="channelId">
        <el-select v-model="queryParams.channelId" :placeholder="$t('请选择出货渠道')" @change="selectChannel">
51 52 53 54 55 56
          <el-option v-for="item in channelList" :label="$l(item, 'name')" :value="item.channelId" :key="item.channelId"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item :label="$t('特性')" prop="attrId">
        <el-select v-model="queryParams.attrId" :placeholder="$t('特性')">
57
          <el-option v-for="item in attrIdList" :label="item.label" :value="item.value" :key="item.value"></el-option>
58 59 60
        </el-select>
      </el-form-item>

61
      <el-form-item prop="airShipment">
62 63
        <el-checkbox v-model="queryParams.airShipment" :true-label="4" @change="changeAirShipment">{{$t('已完成备货')}}</el-checkbox>
        <!-- <el-radio v-model="queryParams.airShipment" :label="4">{{$t('已完成备货')}}</el-radio> -->
64 65
      </el-form-item>

zhoutong's avatar
zhoutong committed
66
      <el-form-item>
zhoutong's avatar
zhoutong committed
67 68
        <el-button type="primary" icon="el-icon-search" @click="handleQuery('pre')">{{$t('搜索已分拣订单')}}</el-button>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery('toBePre')">{{$t('搜索待分拣订单')}}</el-button>
zhoutong's avatar
zhoutong committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
        <el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="handleQuery('toBePre')"></right-toolbar>
    </el-row>

    <!-- 表格 -->
    <el-card style="margin-top: 15px" class="preinstall-card">
      <el-row class="preinstall-title">
        <div>
          <p>{{$t('自编号')}}</p>
          <p>{{shipmentObj.selfNo}}</p>
        </div>
85
        <!--<div>
zhoutong's avatar
zhoutong committed
86 87
          <p>{{$t('柜号')}}</p>
          <p>{{shipmentObj.cubNo}}</p>
88 89
        </div>-->
        <!--<div>
zhoutong's avatar
zhoutong committed
90 91
          <p>{{$t('容量')}}</p>
          <p>{{calcCapacity}}</p>
92
        </div>-->
zhoutong's avatar
zhoutong committed
93 94 95 96 97 98 99 100 101
        <div>
          <p>{{$t('始发地')}}</p>
          <p>{{importCityName(shipmentObj.startWarehouseId)}}</p>
        </div>
        <div>
          <p>{{$t('目的地')}}</p>
          <p>{{importCityName(shipmentObj.destWarehouseId)}}</p>
        </div>
      </el-row>
zhoutong's avatar
zhoutong committed
102 103 104 105 106 107 108 109 110 111
      <el-row class="preinstall-title">
        <div>
          <p>{{$t('出货渠道')}}</p>
          <p>{{getShipChannelName(shipmentObj.channelRespVO.channelId)}}</p>
        </div>
        <div>
          <p>{{$t('可出特性')}}</p>
          <p>{{shipmentObj.channelRespVO.attrNameList?shipmentObj.channelRespVO.attrNameList.toString():''}}</p>
        </div>
      </el-row>
zhoutong's avatar
zhoutong committed
112
      <el-row class="preinstall-table">
zhoutong's avatar
zhoutong committed
113
        <!-- 已分拣订单 -->
zhoutong's avatar
zhoutong committed
114 115
        <el-col :span="12">
          <el-row class="preinstall-title">
zhoutong's avatar
zhoutong committed
116
            <div class="table-label">{{$t('已分拣订单')}}</div>
zhoutong's avatar
zhoutong committed
117 118 119 120
            <div>
              <p>{{$t('总计')}}</p>
              <p>{{getTotlContent(preList.loadStatistics)}}</p>
            </div>
121
            <!--<div class="red-label">
zhoutong's avatar
zhoutong committed
122
              <p>{{$t('可分拣方数')}}</p>
zhoutong's avatar
zhoutong committed
123
              <p>{{preList.remainVolume}}</p>
124
            </div>
zhoutong's avatar
zhoutong committed
125 126
            <div class="red-label">
              <p>{{$t('重量')}}</p>
127
              <p>{{preList.remainWeight || 0}}kg</p>
128
            </div-->
129
            <div v-if="false" class="table-button">
zhoutong's avatar
zhoutong committed
130 131 132 133 134 135
              <el-button type="success" size="small" @click="addPart" :disabled="isAudit">{{$t('增加')}}</el-button>
            </div>
          </el-row>
          <el-scrollbar style="height:calc(100% - 43px)">
            <el-row v-for="(part, index) in preList.sectionGoodList" :key="index" class="pre-part">
              <el-row class="preinstall-title">
136
                <div v-if="false" class="pre-part-info">
zhoutong's avatar
zhoutong committed
137 138 139 140
                  <p>{{$t('第{index}部分', {index: index+1})}}</p>
                  <p>{{getTotlContent(part.secStatistics)}}</p>
                </div>
                <div class="table-button">
141
                  <el-button v-if="false" type="danger" size="small" @click="deletePart(part)" :disabled="isAudit">{{$t('删除部分')}}</el-button>
zhoutong's avatar
zhoutong committed
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
                  <el-button type="danger" size="small" @click="deleteOrder('selected', part)" :disabled="isAudit">{{$t('删除订单')}}</el-button>
                  <el-button type="primary" size="small" @click="foldTable(index, part)">{{part.fold ? $t('展开') : $t('收起')}}</el-button>
                </div>
              </el-row>
              <el-collapse-transition>
                <div v-show="!part.fold">
                  <el-table v-loading="preLoading" border :data="part.sectionGoodsList" @select="(selection)=>checkboxSelect(selection, part)" @select-all="(selection)=>checkboxSelect(selection, part)">
                    <el-table-column type="selection" align="center" width="55" fixed="left" />
                    <el-table-column :label="$t('序号')" align="center" prop="tidanNum" width="50" />
                    <el-table-column :label="$t('订单号')" align="center" prop="orderNo" width="120">
                      <template slot-scope="scope">
                        <div>
                          {{scope.row.orderNo}}
                        </div>
                        <div style="color:blue;fontWeight:bold;">
                          {{ scope.row.isExternalWarehouse === 1 ? '(' +$t('外部仓')+')' : ''}}
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column :label="$t('目的地')" align="center" prop="destWarehouseName" width="120" />
                    <el-table-column :label="$t('入仓时间')" align="center" prop="rucangTime" width="120">
                      <template slot-scope="scope">
                        {{formatDate(scope.row.rucangTime)}}
                      </template>
                    </el-table-column>
                    <el-table-column :label="$t('品名')" align="center" prop="" width="120">
                      <template slot-scope="{row}">
                        {{$l(row,'prodTitle')}}
                      </template>
                    </el-table-column>
172 173
                    <el-table-column :label="$t('箱数')" align="center" prop="warehouseInInfoVO.cartonsNum">
                      <template slot-scope="scope">
174 175 176 177 178
                    <el-button v-if="scope.row.mixStatus == 1" type="text" @click="seeBox(scope.row.orderId,scope.row.orderItemId)">{{scope.row.warehouseInInfoVO.cartonsNum}}{{$t('(混箱)')}}</el-button>
                    <template v-else>
                      {{scope.row.warehouseInInfoVO.cartonsNum}}
                    </template>
                  </template>
179
                    </el-table-column>
180
                    <el-table-column :label="$t('体积') + '/' + $t('重量') + '/' + $t('泡货比')" align="center" width="140" prop="volumeWeight">
zhoutong's avatar
zhoutong committed
181 182 183 184 185 186 187 188 189 190 191 192 193
                      <template slot-scope="scope">
                        <p v-if="scope.row.warehouseInInfoVO.volume">{{getTotlContent(scope.row.warehouseInInfoVO,['volume'])}}</p>
                        <p v-if="scope.row.warehouseInInfoVO.weight">{{getTotlContent(scope.row.warehouseInInfoVO,['weight'])}}</p>
                        <p>{{getRatioMax(scope.row.warehouseInInfoVO)}}</p>
                      </template>
                    </el-table-column>
                    <el-table-column :label="$t('报关方式')" align="center" prop="customsType" width="120">
                      <template slot-scope="scope">
                        <div :class="scope.row.customsType !== 1 ? 'custom_type_red' : ''">
                          <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="scope.row.customsType" />
                        </div>
                      </template>
                    </el-table-column>
zhoutong's avatar
zhoutong committed
194 195
                    <el-table-column :label="$t('特性')" align="center" prop="attrNameList" width="120">
                      <template slot-scope="scope">
zhoutong's avatar
zhoutong committed
196
                        {{scope.row.warehouseInAttrNameList?scope.row.warehouseInAttrNameList.toString():""}}
zhoutong's avatar
zhoutong committed
197 198
                      </template>
                    </el-table-column>
zhoutong's avatar
zhoutong committed
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
                    <el-table-column :label="$t('备案')" align="center" prop="productRecord" width="100">
                      <template slot-scope="{row}">
                        <template v-if="row.brandName">{{row.brandName}}</template>
                        <dict-tag v-else :type="DICT_TYPE.ECW_IS_BRAND" :value="row.feeType" />
                      </template>
                    </el-table-column>
                    <el-table-column :label="$t('操作')" align="center" width="160" class-name="small-padding fixed-width" fixed="right">
                      <template slot-scope="scope">
                        <el-dropdown trigger="click" @command="(command)=>handleGoods('single',scope.row,command)" :disabled="isAudit">
                          <el-button type="primary" size="small" icon="el-icon-edit-outline" circle :disabled="isAudit"></el-button>
                          <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item :command="bPart" v-for="(bPart, index) in preList.sectionGoodList" :key="bPart.id" v-show="bPart.id !== part.id">
                              {{$t('第{index}部分', {index: index+1})}}
                            </el-dropdown-item>
                          </el-dropdown-menu>
                        </el-dropdown>
                        <el-button type="danger" size="small" icon="el-icon-minus" circle style="margin-left:10px;" @click="deleteOrder('row',scope.row)" :disabled="isAudit"></el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                </div>
              </el-collapse-transition>
            </el-row>
          </el-scrollbar>
        </el-col>
zhoutong's avatar
zhoutong committed
224
        <!-- 待分拣订单 -->
zhoutong's avatar
zhoutong committed
225 226
        <el-col :span="12">
          <el-row class="preinstall-title">
zhoutong's avatar
zhoutong committed
227
            <div class="table-label red-label">{{$t('待分拣订单')}}</div>
zhoutong's avatar
zhoutong committed
228 229
            <div class="preinstall-title preinstalled">
              <div class="red-label">
zhoutong's avatar
zhoutong committed
230
                <p>{{$t('筛选后待分拣数量')}}</p>
zhoutong's avatar
zhoutong committed
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
                <p>{{getTotlContent(unloadStatistics,['num'])}}</p>
              </div>
              <div class="red-label">
                <p>{{$t('方数')}}</p>
                <p>{{getTotlContent(unloadStatistics,['volume'])}}</p>
              </div>
              <div class="red-label">
                <p>{{$t('重量')}}</p>
                <p>{{getTotlContent(unloadStatistics,['weight'])}}</p>
              </div>
            </div>
          </el-row>
          <el-pagination background layout="prev, pager, next" :current-page="pageParam.pageNo" :page-size="pageParam.pageSize" :total="total" @current-change="pageChange" v-show="total > 0"></el-pagination>
          <el-scrollbar style="height:calc(100% - 75px)">
            <el-row v-for="(item, index) in toBePreList" :key="index" class="tobePre-row">
              <el-row class="preinstall-title order-title">
                <div>
                  <p>{{item.orderNo}}</p>
                </div>
                <div>
                  <p>{{$t('发往')}}</p>
                  <p>{{item.destWarehouseName}}</p>
                </div>
                <div>
                  <p :class="item.customsType !== 1 ? 'custom_type_red' : ''">
                    <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="item.customsType" />
                  </p>
                </div>
                <div>
                  <p>{{$t('入仓时间')}}</p>
                  <p>{{formatDate(item.rucangTime)}}</p>
                </div>
zhoutong's avatar
zhoutong committed
263 264 265 266
                <div>
                  <p>{{$t('出货渠道')}}</p>
                  <p>{{getShipChannelName(item.channelId)}}</p>
                </div>
zhoutong's avatar
zhoutong committed
267
                <div>
268
                  <p>{{$t('泡货比')}}</p>
zhoutong's avatar
zhoutong committed
269 270 271 272 273 274 275
                  <p>{{item.weightRatio}}</p>
                </div>
                <div v-if="item.isExternalWarehouse === 1" style="color:blue;fontWeight:bold;">
                  <p>{{$t('外部仓')}}</p>
                </div>
                <div class="table-button">
                  <el-button v-if="item.relateOrderList" type="primary" size="small" style="margin-right: 20px;" @click="getRelationOrder(item)">{{$t('关联订单')}}</el-button>
276
                  <el-button v-if="preList.sectionGoodList&&item.airShipment==4" type="success" size="small" :disabled="isAudit" @click="handleGoods('all',item,preList.sectionGoodList[0])">{{$t('分拣')}}</el-button>
zhoutong's avatar
zhoutong committed
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
                </div>
              </el-row>
              <el-table v-loading="toBePreLoading" :data="item.boxOrderItemList" border show-summary :summary-method="getSummaries">
                <el-table-column type="index" align="center" :label="$t('序号')" width="50" />
                <el-table-column :label="$t('品名')" align="center" prop="">
                  <template slot-scope="{row}">
                    {{$l(row,'prodTitle')}}
                  </template>
                </el-table-column>
                <el-table-column :label="$t('备案')" align="center" prop="feeType">
                  <template slot-scope="{row}">
                    <template>{{row.brandName}}</template>{{ $t('(') }}
                    <dict-tag :type="DICT_TYPE.BRAND_CUSTOMER_CHARGING_MODEL" :value="row.feeType" />{{ $t('') }}
                  </template>
                </el-table-column>
292 293
                <el-table-column :label="$t('箱数')" align="center" prop="warehouseInInfoVO.cartonsNum">
                  <template slot-scope="scope">
294
                    <el-button v-if="scope.row.mixStatus == 1" type="text" @click="seeBox(scope.row.orderId,scope.row.orderItemId)">{{scope.row.warehouseInInfoVO.cartonsNum}}{{$t('(混箱)')}}</el-button>
295 296 297 298 299
                    <template v-else>
                      {{scope.row.warehouseInInfoVO.cartonsNum}}
                    </template>
                  </template>
                </el-table-column>
zhoutong's avatar
zhoutong committed
300 301 302 303 304 305 306 307 308 309 310 311 312
                <el-table-column :label="$t('体积') +'/' + $t('重量')" align="center" prop="volumeWeight">
                  <template slot-scope="scope">
                    <p v-if="scope.row.warehouseInInfoVO && scope.row.warehouseInInfoVO.volume">{{getTotlContent(scope.row.warehouseInInfoVO,['volume'])}}</p>
                    <p v-if="scope.row.warehouseInInfoVO && scope.row.warehouseInInfoVO.weight">{{getTotlContent(scope.row.warehouseInInfoVO,['weight'])}}</p>
                  </template>
                </el-table-column>
                <el-table-column :label="$t('报关方式')" align="center" prop="">
                  <div :class="item.customsType !== 1 ? 'custom_type_red' : ''">
                    <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="item.customsType" />
                  </div>
                </el-table-column>
                <el-table-column :label="$t('包装类型')" align="center" prop="">
                  <template slot-scope="scope">
313
                    <span v-for="(unit,index) in scope.row.warehouseInInfoVO && scope.row.warehouseInInfoVO.units.split(',')" :key="index">
zhoutong's avatar
zhoutong committed
314
                      <dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" :value="unit" /><span v-if="index<scope.row.warehouseInInfoVO.units.split(',').length-1">, </span>
315
                    </span>
zhoutong's avatar
zhoutong committed
316 317 318 319 320 321
                  </template>
                </el-table-column>
                <el-table-column :label="$t('材质')" align="center" prop="material">{{ $t('') }}<template slot-scope="scope">
                    <dict-tag :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" :value="scope.row.material" />
                  </template>
                </el-table-column>
322
                <el-table-column :label="$t('特性')" align="center" prop="warehouseInAttrNameList" width="120">
zhoutong's avatar
zhoutong committed
323
                  <template slot-scope="scope">
324
                    {{scope.row.warehouseInAttrNameList?scope.row.warehouseInAttrNameList.toString():""}}
zhoutong's avatar
zhoutong committed
325 326
                  </template>
                </el-table-column>
zhoutong's avatar
zhoutong committed
327 328 329
                <!-- <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
                  <template slot-scope="scope">
                    <el-dropdown trigger="click" @command="(command)=>handleGoods('single',scope.row,command)">
zhoutong's avatar
zhoutong committed
330
                      <el-button type="primary" size="small">{{$t('分拣')}}</el-button>
zhoutong's avatar
zhoutong committed
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item :command="part" v-for="(part, index) in preList" :key="part.id">{{index+1}}部分</el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                  </template>
                </el-table-column> -->
              </el-table>
            </el-row>
          </el-scrollbar>
        </el-col>
      </el-row>
    </el-card>

    <!-- 操作员 -->
    <el-row style="margin-top: 15px" v-show="!isAudit">
      <el-row>
        <el-form ref="operatorForm" :model="operatorData" size="small" :inline="true" label-width="120px" :rules="rules">
          <el-form-item :label="$t('目的地操作员')" prop="noticeUser">
            <userSelect v-model="operatorData.noticeUser" :placeholder="$t('请选择目的地操作员')" :allUsers="this.$attrs.allUsers" size="small" />
          </el-form-item>
        </el-form>
      </el-row>
    </el-row>

    <!-- 审核流程 -->
    <el-row class="process-area">
      <div class="process">
        <div>{{$t('审批流程')}}</div>
zhoutong's avatar
zhoutong committed
359
        <work-flow xmlkey="shipment_order_sorting" v-model="selectedUsers"></work-flow>
zhoutong's avatar
zhoutong committed
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
      </div>
      <div v-show="isAudit">
        <el-button type="primary" @click="jumpReviewDetail">{{$t('审核中')}}</el-button>
        <el-button plain type="primary" @click="canclAudit">{{$t('取消审核')}}</el-button>
        <el-button plain type="primary" @click="closeDialog">{{$t('返回')}}</el-button>
      </div>
      <div v-show="!isAudit">
        <el-button type="primary" @click="onSubmit">{{$t('提交申请')}}</el-button>
      </div>
    </el-row>
    <!-- 关联订单弹窗 -->
    <el-dialog :title="relationOrderListDialog.title" :visible.sync="relationOrderListDialog.visible" width="30%" append-to-body>
      <el-card>
        <div v-html="relationOrderListDialog.data"></div>
      </el-card>
      <el-row style="margin-top: 10px;text-align: center;">
        <el-button type="primary" @click="relationOrderListDialog.visible = false">{{$t('关闭窗口')}}</el-button>
      </el-row>
    </el-dialog>
379 380 381 382 383 384 385 386 387 388
    <el-dialog :title="$t('箱明细')" :visible.sync="boxShow" :before-close="closeBox" :close-on-click-modal="false" append-to-body width="1024px">
      <el-form v-if="boxShow">
        <WarehouseRecordDetailItem
          v-for="(item, index) in boxData"
          :key="index" v-model="boxData[index]"
          :index="index" :attr-list="attrList"
          :readonly="true"
        />
      </el-form>
    </el-dialog>
zhoutong's avatar
zhoutong committed
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405

  </div>
</template>

<script>
import { DICT_TYPE } from "@/utils/dict";
import {
  secGoodsList,
  createSection,
  deleteSection,
  deleteGoods,
  changeSection,
  approvalCreate,
  approvalCancel,
  loadRelationOrder,
  getAllRelateOrderList
} from "@/api/ecw/boxSea";
zhoutong's avatar
zhoutong committed
406
import { createGoods, preloadPage } from "@/api/ecw/boxAir"
407 408
import {getProductAttrList} from '@/api/ecw/productAttr'
import { getOrderWarehouseIn } from '@/api/ecw/order'
zhoutong's avatar
zhoutong committed
409
import { getChannelList } from "@/api/ecw/channel";
zhoutong's avatar
zhoutong committed
410 411 412 413 414 415 416 417 418 419 420
import userSelect from "./common/userSelect.vue";
import {
  formatDate,
  getTotlContent,
  serviceMsg,
  getCapacity,
  toReviewDetail,
} from "../utils";
import dayjs from "dayjs";
import WorkFlow from "@/components/WorkFlow";
import Decimal from "decimal.js";
421
import WarehouseRecordDetailItem from "@/views/ecw/order/warehousing/components/WarehouseRecordDetailItem.vue";
zhoutong's avatar
zhoutong committed
422 423

/**
zhoutong's avatar
zhoutong committed
424
 * 分拣
zhoutong's avatar
zhoutong committed
425 426 427 428
 */
export default {
  name: "preinstall",
  inheritAttrs: false,
429
  components: { userSelect, WorkFlow, WarehouseRecordDetailItem },
zhoutong's avatar
zhoutong committed
430 431 432 433 434 435 436
  data() {
    return {
      // 状态
      stateOps: [
        { value: "1", label: this.$t("拆单") },
        { value: "2", label: this.$t("关联单") },
      ],
zhoutong's avatar
zhoutong committed
437 438
      // 渠道
      channelList: [],
zhoutong's avatar
zhoutong committed
439 440 441 442 443 444
      // 备案
      filingOps: this.getDictDatas(DICT_TYPE.BRAND_CUSTOMER_CHARGING_MODEL),
      // 报关方式
      declarationMethodOps: this.getDictDatas(DICT_TYPE.ECW_CUSTOMS_TYPE),
      // 查询标识
      type: "",
zhoutong's avatar
zhoutong committed
445
      // 已分拣 遮罩层
zhoutong's avatar
zhoutong committed
446 447 448 449 450 451 452 453 454
      preLoading: false,
      preList: {
        sectionGoodList: [],
        remainWeight: 0,
        remainVolume: 0,
      },
      // 选中行
      selectedRows: {},

zhoutong's avatar
zhoutong committed
455
      // 待分拣
zhoutong's avatar
zhoutong committed
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
      toBePreLoading: false,
      toBePreList: [],
      total: 0,
      unloadStatistics: {},

      // 显示搜索条件
      showSearch: true,

      // 查询参数
      queryParams: {},
      pageParam: { pageNo: 1, pageSize: 10 },
      // 目的地操作员
      operatorData: {},
      // 校验
      rules: {
        noticeUser: [
          {
            required: true,
            message: this.$t("目的地操作员必填"),
            trigger: "change",
          },
        ],
      },
      // 出货信息
      shipmentObj: this.$attrs.shipmentObj,
      // 抄送人数组
      selectedUsers: [],
zhoutong's avatar
zhoutong committed
483
      // 智慧分拣
zhoutong's avatar
zhoutong committed
484 485 486 487 488 489 490
      smartInstall: 1,
      //关联订单
      relationOrderListDialog: {
        title: '',
        visible: false,
        data: []
      },
491 492 493 494
      // 特性列表
      attrList: [],
      boxShow:false,
      boxData: []
zhoutong's avatar
zhoutong committed
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520

    };
  },
  computed: {
    /** 始发地 */
    exportWarehouseList() {
      return this.$attrs.warehouseList.filter(
        (item) => item.tradeType == "2" || item.type == "3"
      );
    },
    /** 目的地 */
    importWarehouseList() {
      return this.$attrs.warehouseList.filter(
        (item) => item.tradeType == "1" || item.type == "3"
      );
    },
    /* 是否审核中 */
    isAudit() {
      const { currNode, shipmentObj } = this.$attrs;
      return shipmentObj[currNode.keyName] === 23;
    },
    /* 容量 */
    calcCapacity() {
      const { cabinetRespVO } = this.$attrs.shipmentObj;
      return getCapacity(cabinetRespVO);
    },
zhoutong's avatar
zhoutong committed
521 522 523 524 525 526 527 528 529 530
    /* 渠道 */
    getShipChannelName() {
      return (shippingChannelId) => {
        for (const channelItem of this.channelList) {
          if (channelItem.channelId == shippingChannelId) {
            return this.$l(channelItem, "name");
          }
        }
      };
    },
531 532 533
    /** 特性 */
    attrIdList() {
      let data = []
534 535
      if(this.queryParams.channelId){
        let attrs = this.channelList.find(item=>this.queryParams.channelId == item.channelId)
536
        if(attrs){
537 538 539 540 541 542 543 544 545
          let attrId = attrs.attrId.split(',')
          attrId.forEach((item,index)=>{
            data.push(
              {
                value: item,
                label: attrs.attrNameList[index]
              }
            )
          })
546 547 548 549
        }
      }
      return data
    }
zhoutong's avatar
zhoutong committed
550 551
  },
  created() {
zhoutong's avatar
zhoutong committed
552
    // 查询待分拣
zhoutong's avatar
zhoutong committed
553 554 555
    this.handleQuery("toBePre");
    this.handleQuery("pre");
    this.smartInstall = 0;
zhoutong's avatar
zhoutong committed
556
    // 查询渠道
557
    getChannelList().then((res) => (this.channelList = res.data));
zhoutong's avatar
zhoutong committed
558 559 560 561
  },
  methods: {
    formatDate,
    getTotlContent,
562 563 564
    selectChannel(){
      this.$set(this.queryParams,'attrId',null)
    },
zhoutong's avatar
zhoutong committed
565 566 567 568 569 570 571 572 573
    /* 获取城市 */
    importCityName(id) {
      var arr = this.$attrs.warehouseList.filter((item) => item.id == id);
      return arr.length > 0 ? this.$l(arr[0], "title") : this.$t("");
    },
    /* 选中行 */
    checkboxSelect(selection, part) {
      this.selectedRows[part.id] = selection;
    },
574 575 576 577
    /* 已备货 */
    changeAirShipment() {
      this.getPreLoad();
    },
zhoutong's avatar
zhoutong committed
578
    /* 查询已分拣 */
zhoutong's avatar
zhoutong committed
579 580 581 582
    getSecGoods() {
      this.preLoading = true;
      // 处理查询参数
      let params = this.getParams();
zhoutong's avatar
zhoutong committed
583
      // 已分拣单号
zhoutong's avatar
zhoutong committed
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604
      params.orderNo = params.preOrderNo;
      params.shipmentId = this.shipmentObj.id;
      params.smartInstall = this.smartInstall;
      secGoodsList(params).then((res) => {
        if (res.data) {
          res.data.sectionGoodList.map((data) => {
            if (data.sectionGoodsList) {
              data.sectionGoodsList.map((data1) => {
                data1.warehouseInInfoVO = data1.warehouseInInfo
                  ? JSON.parse(data1.warehouseInInfo)
                  : {};
                return data1;
              });
            }
            return data;
          });
        }
        this.preList = res.data;
        this.preLoading = false;
      });
    },
zhoutong's avatar
zhoutong committed
605
    /* 查询待分拣 */
zhoutong's avatar
zhoutong committed
606 607 608 609 610 611 612
    getPreLoad() {
      this.toBePreLoading = true;
      // 处理查询参数
      let params = this.getParams();
      // 订单号
      params.orderNo = params.toBePreOrderNo;
      params.transportType = this.shipmentObj.transportType;
zhoutong's avatar
zhoutong committed
613
      params.shipmentId = this.shipmentObj.id;
zhoutong's avatar
zhoutong committed
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632
      preloadPage({ ...params, ...this.pageParam }).then((res) => {
        const { data } = res;
        this.toBePreList = data.dataList?.list ?? [];
        this.total = data.dataList?.total ?? 0;
        this.unloadStatistics = data.unloadStatistics ?? {};
        this.toBePreLoading = false;
        if(this.toBePreList.length == 0&&this.total!=0){
          --this.pageParam.pageNo
          this.getPreLoad()
        }
      });
    },
    /**查看关联订单 */
    getRelationOrder(item) {
      getAllRelateOrderList({orderId:item.orderId,orderNo:item.orderNo}).then(res=>{
        this.relationOrderListDialog.title = item.orderNo+'关联订单'
        this.relationOrderListDialog.visible = true
        this.relationOrderListDialog.data = res.msg.replace(/\n/g,'<br>')
      })
633

zhoutong's avatar
zhoutong committed
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648
    },
    /** 搜索按钮操作 */
    handleQuery(type) {
      this.pageParam.pageNo = 1;
      if (type === "pre") {
        this.getSecGoods();
      } else {
        this.getPreLoad();
      }
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {};
      this.$refs["queryForm"].resetFields();
    },
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667
    closeBox(){
      this.boxData = []
      this.boxShow = false
    },
    seeBox(orderId,orderItemId){
      getOrderWarehouseIn(orderId).then(async(res) => {
        let orderwarehouseList = res.data
        var warehouseItem = orderwarehouseList.find(item => item.orderItemId == orderItemId)
        warehouseItem.orderWarehouseInBackItemDoList.forEach(item=>{
          if(item.orderWarehouseInDetailsVOList){
            item.orderWarehouseInDetailsVOList.forEach(w=>{
              this.boxData.push(w)
            })
          }
        })
        this.attrList = (await getProductAttrList()).data
        this.boxShow = true
      })
    },
zhoutong's avatar
zhoutong committed
668 669 670 671 672 673 674 675
    /** 提交 */
    onSubmit() {
      this.$refs["operatorForm"].validate((valid, errors) => {
        if (!valid) {
          return this.$showFormValidateErrors(errors);
        }
        approvalCreate({
          ...this.operatorData,
zhoutong's avatar
zhoutong committed
676
          applyReason: this.$t("分拣审核"),
zhoutong's avatar
zhoutong committed
677
          approvalStatus: 0,
678
          approvalType: 13, // 分拣
zhoutong's avatar
zhoutong committed
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730
          copyUserId: this.selectedUsers,
          shipmentId: this.$attrs.shipmentObj.id,
        }).then((res) => {
          serviceMsg(res, this).then(() => {
            this.$emit("closeDialog", "submit");
          });
        });
      });
    },
    /* 统计列 */
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (column.property === "brandType") {
          sums[index] = this.$t("合计");
          return;
        }
        if (column.property === "num") {
          sums[index] = new Decimal(
            this.calcSum(column.property, data)
          ).toNumber();
        }
        if (column.property === "volumeWeight") {
          let volume = this.calcSum("volume", data);
          let weight = this.calcSum("weight", data);
          volume = volume === 0 ? volume : new Decimal(volume).toFixed(2);
          weight = weight === 0 ? weight : new Decimal(weight).toFixed(2);
          sums[index] = getTotlContent({ volume, weight }, [
            "volume",
            "weight",
          ]);
          sums[index] = sums[index].replace(" ", "\n");
        }
      });
      return sums;
    },
    /* 计算总和 */
    calcSum(key, data) {
      const values = data?.map((item) => Number(item[key])) ?? [];
      if (!values.every((value) => isNaN(value))) {
        return values.reduce((prev, curr) => {
          const value = Number(curr);
          if (!isNaN(value)) {
            return prev + curr;
          } else {
            return prev;
          }
        }, 0);
      }
      return 0;
    },
zhoutong's avatar
zhoutong committed
731
    /* 待分拣订单分页 */
zhoutong's avatar
zhoutong committed
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753
    pageChange(page) {
      this.pageParam.pageNo = page;
      this.getPreLoad();
    },
    /* 折叠 */
    foldTable(index, part) {
      part.fold = !part.fold;
      this.$set(this.preList.sectionGoodList, index, part);
    },
    /* 增加部分 */
    addPart() {
      createSection({ shipmentId: this.shipmentObj.id, isCover: 0 }).then(
        (res) => {
          serviceMsg(res, this).then(() => {
            this.getSecGoods();
          });
        }
      );
    },
    /* 删除部分 */
    deletePart(part) {
      this.$confirm(
zhoutong's avatar
zhoutong committed
754
        this.$t("确认删除该部分及其已分拣订单?"),
zhoutong's avatar
zhoutong committed
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
        this.$t("提示"),
        {
          type: "warning",
        }
      )
        .then((_) => {
          let params = {
            id: part.id,
            deleteType: 2
          };
          deleteSection(params).then((res) => {
            serviceMsg(res, this).then(() => {
              this.queryAllData();
            });
          });
        })
        .catch((_) => {});
    },
zhoutong's avatar
zhoutong committed
773
    /** 分拣 */
zhoutong's avatar
zhoutong committed
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827
    handleGoods(type, item, part) {
      if (type === "all") {
        let params = {
          secId: part.id,
          shipmentId: this.shipmentObj.id,
          orderId: item.orderId,
          orderItemIdList: item.boxOrderItemList.map(
            (data) => data.orderItemId
          ),
        };

        createGoods(params)
          .then((res) => {
            const { data } = res;
            if (data.relationMsg) {
              const msg = data.relationMsg.replaceAll(",", "");
              this.$confirm(msg, this.$t("提示"), {
                dangerouslyUseHTMLString: true,
                type: "warning",
              })
                .then((_) => {
                  loadRelationOrder(data).then((res) => {
                    serviceMsg(res, this).then(() => {
                      this.queryAllData();
                    });
                  });
                })
                .catch((_) => {
                  this.queryAllData();
                });
            } else {
              serviceMsg(res, this).then(() => {
                this.queryAllData();
              });
            }
          })
          .catch((res) => {
            if (res.code === 555) {
              const msg = res.msg && res.msg.replaceAll(",", "");
              this.$confirm(msg, this.$t("提示"), {
                dangerouslyUseHTMLString: true,
                type: "warning",
              })
                .then((_) => {
                  createGoods({ ...params, relationStatus: 1 }).then((res) => {
                    serviceMsg(res, this).then(() => {
                      this.queryAllData();
                    });
                  });
                })
                .catch((_) => {
                  this.queryAllData();
                });
            }
828

zhoutong's avatar
zhoutong committed
829
            if (res.code === 566) {
zhoutong's avatar
zhoutong committed
830
              this.$confirm(res.msg+this.$t('是否需要一起分拣?'), this.$t("提示"), {
zhoutong's avatar
zhoutong committed
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066
                dangerouslyUseHTMLString: true,
                type: "warning",
              })
                .then((_) => {
                  createGoods({ ...params, relationStatus: 2 }).then((res) => {
                    serviceMsg(res, this).then(() => {
                      this.queryAllData();
                    });
                  });
                })
                .catch((_) => {
                  this.queryAllData();
                });
            }
          });
      } else {
        let params = {
          secId: part.id,
          id: item.id,
        };
        changeSection(params).then((res) => {
          serviceMsg(res, this).then(() => {
            this.queryAllData();
          });
        });
      }
    },
    /* 删除订单 */
    deleteOrder(type, data) {
      let ids = [];
      if (type === "selected") {
        // 根据parid 构建的对象
        const rows = this.selectedRows[data.id] ?? [];
        if (!rows.length) {
          this.$message.error(this.$t("请选择订单"));
          return;
        }
        ids = rows.map((item) => item.id);
      }

      if (type === "row") {
        ids.push(data.id);
      }
      let param = {
        ids: ids.join(",")
      }
      deleteGoods(param).then((res) => {
        serviceMsg(res, this).then(() => {
          this.queryAllData();
        });
      }).catch((res) => {
        if (res.code === 666) {
              this.$confirm("<div style='max-height:500px;overflow:auto'>"+res.msg+this.$t('是否需要一起移出?')+"</div>", this.$t("提示"), {
                dangerouslyUseHTMLString: true,
                distinguishCancelAndClose: true,
                confirmButtonText: '确定移出',
                cancelButtonText: '仅移出当前订单'
              })
                .then((_) => {
                  deleteGoods({ ...param, deleteType: 2 }).then((res) => {
                    serviceMsg(res, this).then(() => {
                      this.queryAllData();
                    });
                  });
                })
                .catch(action  => {
                  if(action =='cancel'){
                    deleteGoods({ ...param, deleteType: 1 }).then((res) => {
                      serviceMsg(res, this).then(() => {
                        this.queryAllData();
                      });
                    });
                  }
                });
            }
      });
    },
    /* 查询所有数据 */
    queryAllData() {
      this.getSecGoods();
      this.getPreLoad();
    },
    /* 获取参数 */
    getParams() {
      const { rucangtime = [] } = this.queryParams;
      return {
        ...this.queryParams,
        ...this.$attrs.params,
        rucangTimeStart: rucangtime[0]
          ? dayjs(rucangtime[0]).format("YYYY-MM-DD 00:00:00")
          : rucangtime[0],
        rucangTimeEnd: rucangtime[1]
          ? dayjs(rucangtime[1]).format("YYYY-MM-DD 23:59:59")
          : rucangtime[1],
      };
    },
    /* 关闭弹框 */
    closeDialog() {
      this.$emit("closeDialog");
    },
    /* 取消审核 */
    canclAudit() {
      const { currNode, shipmentObj } = this.$attrs;
      const { voName } = currNode;
      approvalCancel({
        applyReason: this.$t("取消审核"),
        id: shipmentObj[voName].id,
        shipmentId: shipmentObj.id,
      }).then((res) => {
        serviceMsg(res, this).then(() => {
          this.$emit("closeDialog", "submit");
        });
      });
    },
    jumpReviewDetail() {
      const { currNode, shipmentObj } = this.$attrs;
      toReviewDetail.apply(this, [shipmentObj[currNode.voName].bpmProcessId]);
      this.$emit("closeDialog");
    },
    getRatioMax(row) {
      let volume = row.volume ?? 0;
      let weight = row.weight ?? 0;
      return Decimal.div(weight, volume).toFixed(2);
    },
  },
};
</script>

<style lang="scss">
.preinstall {
  display: flex;
  flex-direction: column;

  p {
    margin: 0;
  }
  .preinstall-title {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 10px;

    &.preinstalled {
      flex: 1;
      display: flex;
      justify-content: flex-end;
      > div {
        display: flex;
      }
    }

    &.order-title {
      margin-bottom: 0px;
      background-color: #e6ebf5;
      height: 45px;
    }

    > div {
      display: flex;
      margin-right: 10px;
    }

    .table-label {
      font-size: 16px;
      font-weight: bolder;
    }
    .red-label {
      color: red;
    }
    .table-button {
      flex: 1;
      margin: 0;
      display: flex;
      justify-content: flex-end;
    }
  }
  .preinstall-table {
    display: flex;
    height: calc(100% - 30px);
    > div {
      border: 1px solid #e6ebf5;
      padding: 10px 0px;
    }
    > div:first-child {
      margin-right: 10px;
    }
  }

  .pre-part {
    margin-bottom: 10px;
    margin-right: 10px;
    .pre-part-info {
      font-weight: bolder;
      > p:first-child {
        color: #13ce66;
        margin-right: 10px;
      }
      > p:last-child {
        > span {
          margin-right: 5px;
        }
      }
    }
  }

  .preinstall-card {
    min-height: 800px;
    .el-card__body {
      height: 100%;

      .tobePre-row {
        margin-top: 10px;
        .el-table {
          .cell {
            white-space: pre-line;
          }
        }
      }
    }
  }

  .process-area {
    margin-top: 15px;
    padding-bottom: 30px;
    .process {
      display: flex;
      flex-direction: column;
      > :first-child {
        color: #606266;
        font-weight: bolder;
        font-size: 16px;
      }
    }
  }
}
</style>