preinstall.vue 26.1 KB
Newer Older
huhaiiqng's avatar
huhaiiqng committed
1
<template>
huhaiqing's avatar
huhaiqing committed
2
  <div class="preinstall">
huhaiiqng's avatar
huhaiiqng committed
3
    <!-- 搜索工作栏 -->
4 5
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
      <el-form-item label="入仓时间" prop="rucangtime">
huhaiqing's avatar
huhaiqing committed
6
        <el-date-picker v-model="queryParams.rucangtime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
huhaiiqng's avatar
huhaiiqng committed
7
      </el-form-item>
8 9 10
      <el-form-item label="始发地" prop="startWarehouseId">
        <el-select v-model="queryParams.startWarehouseId" placeholder="请选择始发地" clearable size="small">
          <el-option v-for="item in exportWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
huhaiiqng's avatar
huhaiiqng committed
11 12
        </el-select>
      </el-form-item>
13 14 15
      <el-form-item label="目的地" prop="destWarehouseIdList">
        <el-select v-model="queryParams.destWarehouseIdList" placeholder="请选择目的地" multiple clearable>
          <el-option v-for="item in importWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
huhaiiqng's avatar
huhaiiqng committed
16 17
        </el-select>
      </el-form-item>
18 19 20
      <el-form-item label="状态" prop="orderStatus">
        <el-select v-model="queryParams.orderStatus" placeholder="请选择状态" clearable size="small">
          <el-option v-for="item in stateOps" :label="item.label" :value="item.value" :key="item.value"></el-option>
huhaiiqng's avatar
huhaiiqng committed
21 22
        </el-select>
      </el-form-item>
23 24 25
      <el-form-item label="备案" prop="productRecord">
        <el-select v-model="queryParams.productRecord" placeholder="请选择备案" clearable size="small">
          <el-option v-for="item in filingOps" :label="item.label" :value="item.value" :key="item.value"></el-option>
huhaiiqng's avatar
huhaiiqng committed
26 27
        </el-select>
      </el-form-item>
28 29 30
      <el-form-item label="报关方式" prop="customsType">
        <el-select v-model="queryParams.customsType" placeholder="请选择报关方式" clearable size="small">
          <el-option v-for="item in declarationMethodOps" :label="item.label" :value="item.value" :key="item.value"></el-option>
huhaiiqng's avatar
huhaiiqng committed
31 32
        </el-select>
      </el-form-item>
33 34
      <el-form-item label="订单号" prop="toBePreOrderNo">
        <el-input v-model="queryParams.toBePreOrderNo" placeholder="请输入订单号码" clearable />
huhaiiqng's avatar
huhaiiqng committed
35
      </el-form-item>
36 37
      <el-form-item label="已预装单号" prop="preOrderNo">
        <el-input v-model="queryParams.preOrderNo" placeholder="请输入已预装单号" clearable />
huhaiiqng's avatar
huhaiiqng committed
38
      </el-form-item>
39 40
      <el-form-item label="品名" prop="itemName">
        <el-input v-model="queryParams.itemName" placeholder="请输入品名" clearable />
huhaiiqng's avatar
huhaiiqng committed
41
      </el-form-item>
42 43
      <el-form-item label="重货比" prop="weightRatioMax">
        <el-input v-model="queryParams.weightRatioMax" placeholder="请输入 大" clearable />
huhaiiqng's avatar
huhaiiqng committed
44
      </el-form-item>
45 46
      <el-form-item label="" prop="weightRatioMin">
        <el-input v-model="queryParams.weightRatioMin" placeholder="请输入 小" clearable />
huhaiiqng's avatar
huhaiiqng committed
47 48 49
      </el-form-item>

      <el-form-item>
50 51 52
        <el-button type="primary" icon="el-icon-search" @click="handleQuery('pre')">搜索已预装订单</el-button>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery('toBePre')">搜索待预装订单</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
huhaiiqng's avatar
huhaiiqng committed
53 54 55 56 57
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10">
58
      <right-toolbar :showSearch.sync="showSearch" @queryTable="handleQuery('toBePre')"></right-toolbar>
huhaiiqng's avatar
huhaiiqng committed
59 60 61
    </el-row>

    <!-- 表格 -->
62
    <el-card style="margin-top: 15px" class="preinstall-card">
huhaiiqng's avatar
huhaiiqng committed
63 64 65
      <el-row class="preinstall-title">
        <div>
          <p>自编号:</p>
huhaiqing's avatar
huhaiqing committed
66
          <p>{{shipmentObj.selfNo}}</p>
huhaiiqng's avatar
huhaiiqng committed
67 68 69
        </div>
        <div>
          <p>柜号:</p>
huhaiqing's avatar
huhaiqing committed
70
          <p>{{shipmentObj.cubNo}}</p>
huhaiiqng's avatar
huhaiiqng committed
71 72 73
        </div>
        <div>
          <p>容量:</p>
74
          <p>{{calcCapacity}}</p>
huhaiiqng's avatar
huhaiiqng committed
75 76 77
        </div>
        <div>
          <p>始发地:</p>
huhaiqing's avatar
huhaiqing committed
78
          <p>{{importCityName(shipmentObj.startWarehouseId)}}</p>
huhaiiqng's avatar
huhaiiqng committed
79 80 81
        </div>
        <div>
          <p>目的地:</p>
huhaiqing's avatar
huhaiqing committed
82
          <p>{{importCityName(shipmentObj.destWarehouseId)}}</p>
huhaiiqng's avatar
huhaiiqng committed
83 84 85 86 87 88 89 90 91
        </div>
      </el-row>
      <el-row class="preinstall-table">
        <!-- 已预装订单 -->
        <el-col :span="12">
          <el-row class="preinstall-title">
            <div class="table-label">已预装订单</div>
            <div>
              <p>总计:</p>
92
              <p>{{getTotlContent(preList.loadStatistics)}}</p>
huhaiiqng's avatar
huhaiiqng committed
93 94 95
            </div>
            <div class="red-label">
              <p>可预装方数:</p>
96
              <p>{{preList.remainVolume}}</p>
huhaiiqng's avatar
huhaiiqng committed
97 98 99
            </div>
            <div class="red-label">
              <p>重量:</p>
100
              <p>{{preList.remainWeight}}kg</p>
huhaiiqng's avatar
huhaiiqng committed
101 102
            </div>
            <div class="table-button">
103
              <el-button type="success" size="small" @click="addPart">增加</el-button>
huhaiiqng's avatar
huhaiiqng committed
104 105
            </div>
          </el-row>
huhaiqing's avatar
huhaiqing committed
106
          <el-scrollbar style="height:calc(100% - 43px)">
107
            <el-row v-for="(part, index) in preList.sectionGoodList" :key="index" class="pre-part">
huhaiqing's avatar
huhaiqing committed
108 109 110
              <el-row class="preinstall-title">
                <div class="pre-part-info">
                  <p>{{index+1}}部分</p>
huhaiqing's avatar
huhaiqing committed
111
                  <p>{{getTotlContent(part.secStatistics)}}</p>
huhaiqing's avatar
huhaiqing committed
112 113
                </div>
                <div class="table-button">
114 115 116
                  <el-button type="danger" size="small" @click="deletePart(part)">删除部分</el-button>
                  <el-button type="danger" size="small" @click="deleteOrder('selected', part)">删除订单</el-button>
                  <el-button type="primary" size="small" @click="foldTable(index, part)">{{part.fold ? '展开' : '收起'}}</el-button>
huhaiqing's avatar
huhaiqing committed
117 118
                </div>
              </el-row>
huhaiqing's avatar
huhaiqing committed
119 120
              <el-collapse-transition>
                <div v-show="!part.fold">
121 122
                  <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" />
huhaiqing's avatar
huhaiqing committed
123 124 125 126 127 128 129 130 131 132
                    <el-table-column label="订单号" 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 ? '(外部仓)' : ''}}
                        </div>
                      </template>
                    </el-table-column>
133 134
                    <el-table-column label="目的地" align="center" prop="destWarehouseName" width="120" />
                    <el-table-column label="入仓时间" align="center" prop="rucangTime" width="120">
huhaiqing's avatar
huhaiqing committed
135 136 137 138
                      <template slot-scope="scope">
                        {{formatDate(scope.row.rucangTime)}}
                      </template>
                    </el-table-column>
139 140 141
                    <el-table-column label="品名" align="center" prop="prodTitleZh" width="120" />
                    <el-table-column label="箱数" align="center" prop="num" />
                    <el-table-column label="体积/重量/重货比" align="center" width="140" prop="volumeWeight">
huhaiqing's avatar
huhaiqing committed
142
                      <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
143 144
                        <p v-if="scope.row.volume">{{getTotlContent(scope.row,['volume'])}}</p>
                        <p v-if="scope.row.weight">{{getTotlContent(scope.row,['weight'])}}</p>
huhaiqing's avatar
huhaiqing committed
145 146
                      </template>
                    </el-table-column>
147
                    <el-table-column label="报关方式" align="center" prop="customsType" width="120">
huhaiqing's avatar
huhaiqing committed
148
                      <template slot-scope="scope">
149
                        <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="scope.row.customsType" />
huhaiqing's avatar
huhaiqing committed
150 151
                      </template>
                    </el-table-column>
152
                    <el-table-column label="备案" align="center" prop="productRecord" width="100">
huhaiqing's avatar
huhaiqing committed
153
                      <template slot-scope="scope">
154
                        <dict-tag :type="DICT_TYPE.BOX_SHIPPING_BRAND_TYPE" :value="scope.row.productRecord" />
huhaiqing's avatar
huhaiqing committed
155 156
                      </template>
                    </el-table-column>
157
                    <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width" fixed="right">
huhaiqing's avatar
huhaiqing committed
158
                      <template slot-scope="scope">
159 160
                        <el-dropdown trigger="click" @command="(command)=>handleGoods('singele',scope.row,command)">
                          <el-button type="primary" size="small" icon="el-icon-edit-outline" circle></el-button>
huhaiqing's avatar
huhaiqing committed
161
                          <el-dropdown-menu slot="dropdown">
162
                            <el-dropdown-item :command="bPart" v-for="(bPart, index) in preList.sectionGoodList" :key="bPart.id" v-show="bPart.id !== part.id">{{index+1}}部分</el-dropdown-item>
huhaiqing's avatar
huhaiqing committed
163 164
                          </el-dropdown-menu>
                        </el-dropdown>
165
                        <el-button type="danger" size="small" icon="el-icon-minus" circle style="margin-left:10px;" @click="deleteOrder('row',scope.row)"></el-button>
huhaiqing's avatar
huhaiqing committed
166 167 168 169 170
                      </template>
                    </el-table-column>
                  </el-table>
                </div>
              </el-collapse-transition>
huhaiqing's avatar
huhaiqing committed
171 172
            </el-row>
          </el-scrollbar>
huhaiiqng's avatar
huhaiiqng committed
173 174 175 176
        </el-col>
        <!-- 待预装订单 -->
        <el-col :span="12">
          <el-row class="preinstall-title">
huhaiqing's avatar
huhaiqing committed
177
            <div class="table-label red-label">待预装订单</div>
huhaiiqng's avatar
huhaiiqng committed
178 179 180
            <div class="preinstall-title preinstalled">
              <div class="red-label">
                <p>筛选后待预装数量:</p>
huhaiqing's avatar
huhaiqing committed
181
                <p>{{getTotlContent(unloadStatistics,['num'])}}</p>
huhaiiqng's avatar
huhaiiqng committed
182 183 184
              </div>
              <div class="red-label">
                <p>方数:</p>
huhaiqing's avatar
huhaiqing committed
185
                <p>{{getTotlContent(unloadStatistics,['volume'])}}</p>
huhaiiqng's avatar
huhaiiqng committed
186 187 188
              </div>
              <div class="red-label">
                <p>重量:</p>
huhaiqing's avatar
huhaiqing committed
189
                <p>{{getTotlContent(unloadStatistics,['weight'])}}</p>
huhaiiqng's avatar
huhaiiqng committed
190 191 192
              </div>
            </div>
          </el-row>
193
          <el-pagination background layout="prev, pager, next" :page-size="pageParam.pageSize" :total="total" @current-change="pageChange" v-show="total > 0"></el-pagination>
huhaiqing's avatar
huhaiqing committed
194
          <el-scrollbar style="height:calc(100% - 75px)">
195
            <el-row v-for="(item, index) in toBePreList" :key="index" class="tobePre-row">
huhaiqing's avatar
huhaiqing committed
196 197 198 199 200 201 202 203 204
              <el-row class="preinstall-title order-title">
                <div>
                  <p>{{item.orderNo}}</p>
                </div>
                <div>
                  <p>发往:</p>
                  <p>{{item.destWarehouseName}}</p>
                </div>
                <div>
huhaiqing's avatar
huhaiqing committed
205
                  <p>
206
                    <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="item.customsType" />
huhaiqing's avatar
huhaiqing committed
207
                  </p>
huhaiqing's avatar
huhaiqing committed
208 209 210
                </div>
                <div>
                  <p>入仓时间:</p>
211
                  <p>{{formatDate(item.rucangTime)}}</p>
huhaiqing's avatar
huhaiqing committed
212 213 214 215 216
                </div>
                <div>
                  <p>重货比:</p>
                  <p>{{item.weightRatio}}</p>
                </div>
217
                <div v-if="item.isExternalWarehouse === 1" style="color:blue;fontWeight:bold;">
218 219
                  <p>外部仓</p>
                </div>
huhaiqing's avatar
huhaiqing committed
220
                <div class="table-button">
221 222
                  <el-dropdown trigger="click" @command="(command)=>handleGoods('all',item,command)">
                    <el-button type="success" size="small">预装全部</el-button>
huhaiqing's avatar
huhaiqing committed
223
                    <el-dropdown-menu slot="dropdown">
224
                      <el-dropdown-item :command="part" v-for="(part, index) in preList.sectionGoodList" :key="part.id">第{{index+1}}部分</el-dropdown-item>
huhaiqing's avatar
huhaiqing committed
225 226 227 228
                    </el-dropdown-menu>
                  </el-dropdown>
                </div>
              </el-row>
229 230 231 232
              <el-table v-loading="toBePreLoading" :data="item.boxOrderItemList" border show-summary :summary-method="getSummaries">
                <el-table-column type="index" align="center" label="序号" width="50" />
                <el-table-column label="品名" align="center" prop="prodTitleZh" />
                <el-table-column label="备案" align="center" prop="brandType">
huhaiqing's avatar
huhaiqing committed
233
                  <template slot-scope="scope">
234
                    <dict-tag :type="DICT_TYPE.BOX_SHIPPING_BRAND_TYPE" :value="scope.row.brandType" />
huhaiqing's avatar
huhaiqing committed
235 236
                  </template>
                </el-table-column>
237 238
                <el-table-column label="箱数" align="center" prop="num" />
                <el-table-column label="体积/重量" align="center" prop="volumeWeight">
huhaiqing's avatar
huhaiqing committed
239
                  <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
240 241
                    <p v-if="scope.row.volume">{{getTotlContent(scope.row,['volume'])}}</p>
                    <p v-if="scope.row.weight">{{getTotlContent(scope.row,['weight'])}}</p>
huhaiqing's avatar
huhaiqing committed
242 243
                  </template>
                </el-table-column>
244 245
                <el-table-column label="报关方式" align="center" prop="">
                  <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="item.customsType" />
246
                </el-table-column>
247
                <el-table-column label="包装类型" align="center" prop="">
248
                  <template slot-scope="scope">
249
                    <dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" :value="scope.row.unit" />
250 251
                  </template>
                </el-table-column>
252
                <el-table-column label="材质" align="center" prop="material">
huhaiqing's avatar
huhaiqing committed
253
                  <template slot-scope="scope">
254
                    <dict-tag :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" :value="scope.row.material" />
huhaiqing's avatar
huhaiqing committed
255 256
                  </template>
                </el-table-column>
257
                <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
huhaiqing's avatar
huhaiqing committed
258 259 260 261 262 263 264 265
                  <template slot-scope="scope">
                    <el-dropdown trigger="click" @command="(command)=>handleGoods('singele',scope.row,command)">
                      <el-button type="primary" size="small">预装</el-button>
                      <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>
266
                </el-table-column> -->
huhaiqing's avatar
huhaiqing committed
267
              </el-table>
huhaiiqng's avatar
huhaiiqng committed
268
            </el-row>
huhaiqing's avatar
huhaiqing committed
269
          </el-scrollbar>
huhaiiqng's avatar
huhaiiqng committed
270 271 272 273 274
        </el-col>
      </el-row>
    </el-card>

    <!-- 操作员 -->
275
    <el-row style="margin-top: 15px" v-show="!isAudit">
huhaiiqng's avatar
huhaiiqng committed
276
      <el-row>
277 278 279
        <el-form ref="operatorForm" :model="operatorData" size="small" :inline="true" label-width="120px" :rules="rules">
          <el-form-item label="目的地操作员" prop="noticeUser">
            <userSelect v-model="operatorData.noticeUser" placeholder="请选择目的地操作员" :allUsers="this.$attrs.allUsers" size="small" />
huhaiiqng's avatar
huhaiiqng committed
280 281 282 283
          </el-form-item>
        </el-form>
      </el-row>
    </el-row>
huhaiqing's avatar
huhaiqing committed
284 285

    <!-- 审核流程 -->
huhaiqing's avatar
huhaiqing committed
286
    <el-row class="process-area">
huhaiqing's avatar
huhaiqing committed
287 288
      <div class="process">
        <div>审批流程</div>
289
        <work-flow xmlkey="shipment_preassemble" v-model="selectedUsers"></work-flow>
huhaiqing's avatar
huhaiqing committed
290
      </div>
huhaiqing's avatar
huhaiqing committed
291
      <div v-show="isAudit">
292
        <el-button type="primary" @click="jumpReviewDetail">审核中</el-button>
293 294
        <el-button plain type="primary" @click="canclAudit">取消审核</el-button>
        <el-button plain type="primary" @click="closeDialog">返回</el-button>
huhaiqing's avatar
huhaiqing committed
295
      </div>
huhaiqing's avatar
huhaiqing committed
296 297 298
      <div v-show="!isAudit">
        <el-button type="primary" @click="onSubmit">提交申请</el-button>
      </div>
huhaiqing's avatar
huhaiqing committed
299
    </el-row>
huhaiqing's avatar
huhaiqing committed
300

huhaiiqng's avatar
huhaiiqng committed
301 302 303 304 305
  </div>
</template>

<script>
import { DICT_TYPE } from "@/utils/dict";
huhaiqing's avatar
huhaiqing committed
306 307 308 309 310 311 312
import {
  secGoodsList,
  preloadPage,
  createSection,
  deleteSection,
  createGoods,
  deleteGoods,
huhaiqing's avatar
huhaiqing committed
313
  approvalCreate,
huhaiqing's avatar
huhaiqing committed
314
  approvalCancel,
huhaiqing's avatar
huhaiqing committed
315
} from "@/api/ecw/boxSea";
huhaiqing's avatar
huhaiqing committed
316
import userSelect from "./common/userSelect.vue";
317 318 319 320 321 322 323
import {
  formatDate,
  getTotlContent,
  serviceMsg,
  getCapacity,
  toReviewDetail,
} from "../utils";
huhaiqing's avatar
huhaiqing committed
324
import dayjs from "dayjs";
huhaiqing's avatar
huhaiqing committed
325
import WorkFlow from "@/components/WorkFlow";
huhaiiqng's avatar
huhaiiqng committed
326

huhaiqing's avatar
huhaiqing committed
327 328 329
/**
 * 预装
 */
huhaiiqng's avatar
huhaiiqng committed
330 331
export default {
  name: "preinstall",
huhaiqing's avatar
huhaiqing committed
332
  inheritAttrs: false,
huhaiqing's avatar
huhaiqing committed
333
  components: { userSelect, WorkFlow },
huhaiiqng's avatar
huhaiiqng committed
334 335 336 337 338 339 340 341 342 343 344
  data() {
    return {
      // 状态
      stateOps: [
        { value: "1", label: "拆单" },
        { value: "2", label: "关联单" },
      ],
      // 备案
      filingOps: this.getDictDatas(DICT_TYPE.COMMISSION_PRODUCT_APPROVAL),
      // 报关方式
      declarationMethodOps: this.getDictDatas(DICT_TYPE.ECW_CUSTOMS_TYPE),
huhaiqing's avatar
huhaiqing committed
345 346 347 348
      // 查询标识
      type: "",
      // 已预装 遮罩层
      preLoading: false,
349 350 351 352 353
      preList: {
        sectionGoodList: [],
        remainWeight: 0,
        remainVolume: 0,
      },
huhaiqing's avatar
huhaiqing committed
354 355 356 357 358 359 360
      // 选中行
      selectedRows: {},

      // 待预装
      toBePreLoading: false,
      toBePreList: [],
      total: 0,
361
      unloadStatistics: {},
huhaiqing's avatar
huhaiqing committed
362

huhaiiqng's avatar
huhaiiqng committed
363 364
      // 显示搜索条件
      showSearch: true,
huhaiqing's avatar
huhaiqing committed
365

huhaiiqng's avatar
huhaiiqng committed
366
      // 查询参数
huhaiqing's avatar
huhaiqing committed
367
      queryParams: {},
huhaiqing's avatar
huhaiqing committed
368
      pageParam: { pageNo: 1, pageSize: 10 },
huhaiiqng's avatar
huhaiiqng committed
369
      // 目的地操作员
huhaiqing's avatar
huhaiqing committed
370
      operatorData: {},
huhaiqing's avatar
huhaiqing committed
371
      // 校验
huhaiiqng's avatar
huhaiiqng committed
372
      rules: {
373
        noticeUser: [{ required: true, message: "目的地操作员必填", trigger: "change" }],
huhaiiqng's avatar
huhaiiqng committed
374
      },
huhaiqing's avatar
huhaiqing committed
375 376
      // 出货信息
      shipmentObj: this.$attrs.shipmentObj,
huhaiqing's avatar
huhaiqing committed
377
      // 抄送人数组
huhaiqing's avatar
huhaiqing committed
378
      selectedUsers: [],
huhaiiqng's avatar
huhaiiqng committed
379 380 381
    };
  },
  computed: {
huhaiqing's avatar
huhaiqing committed
382
    /** 始发地 */
huhaiiqng's avatar
huhaiiqng committed
383
    exportWarehouseList() {
huhaiqing's avatar
huhaiqing committed
384
      return this.$attrs.warehouseList.filter(
huhaiiqng's avatar
huhaiiqng committed
385 386 387
        (item) => item.tradeType == "2" || item.type == "3"
      );
    },
huhaiqing's avatar
huhaiqing committed
388
    /** 目的地 */
huhaiiqng's avatar
huhaiiqng committed
389
    importWarehouseList() {
huhaiqing's avatar
huhaiqing committed
390
      return this.$attrs.warehouseList.filter(
huhaiiqng's avatar
huhaiiqng committed
391 392 393
        (item) => item.tradeType == "1" || item.type == "3"
      );
    },
huhaiqing's avatar
huhaiqing committed
394 395 396 397 398
    /* 是否审核中 */
    isAudit() {
      const { currNode, shipmentObj } = this.$attrs;
      return shipmentObj[currNode.keyName] === 23;
    },
399 400 401 402 403
    /* 容量 */
    calcCapacity() {
      const { cabinetRespVO } = this.$attrs.shipmentObj;
      return getCapacity(cabinetRespVO);
    },
huhaiiqng's avatar
huhaiiqng committed
404 405
  },
  created() {
huhaiqing's avatar
huhaiqing committed
406
    // 查询待预装
huhaiqing's avatar
huhaiqing committed
407
    this.handleQuery("toBePre");
408
    this.handleQuery("pre");
huhaiiqng's avatar
huhaiiqng committed
409 410
  },
  methods: {
411
    formatDate,
huhaiqing's avatar
huhaiqing committed
412
    getTotlContent,
huhaiqing's avatar
huhaiqing committed
413 414
    /* 获取城市 */
    importCityName(id) {
huhaiqing's avatar
huhaiqing committed
415
      var arr = this.$attrs.warehouseList.filter((item) => item.id == id);
huhaiqing's avatar
huhaiqing committed
416 417 418 419 420 421 422 423 424
      return arr.length > 0 ? arr[0].titleZh : "";
    },
    /* 选中行 */
    checkboxSelect(selection, part) {
      this.selectedRows[part.id] = selection;
    },
    /* 查询已预装 */
    getSecGoods() {
      this.preLoading = true;
huhaiiqng's avatar
huhaiiqng committed
425
      // 处理查询参数
426
      let params = this.getParams();
huhaiqing's avatar
huhaiqing committed
427 428 429 430 431 432 433 434 435 436 437 438
      // 已预装单号
      params.orderNo = params.preOrderNo;
      params.shipmentId = this.shipmentObj.id;
      secGoodsList(params).then((res) => {
        this.preList = res.data;
        this.preLoading = false;
      });
    },
    /* 查询待预装 */
    getPreLoad() {
      this.toBePreLoading = true;
      // 处理查询参数
439
      let params = this.getParams();
huhaiqing's avatar
huhaiqing committed
440 441 442
      // 订单号
      params.orderNo = params.toBePreOrderNo;
      preloadPage({ ...params, ...this.pageParam }).then((res) => {
443 444 445 446
        const { data } = res;
        this.toBePreList = data.dataList?.list ?? [];
        this.total = data.dataList?.total ?? 0;
        this.unloadStatistics = data.unloadStatistics ?? {};
huhaiqing's avatar
huhaiqing committed
447
        this.toBePreLoading = false;
huhaiiqng's avatar
huhaiiqng committed
448 449 450
      });
    },
    /** 搜索按钮操作 */
huhaiqing's avatar
huhaiqing committed
451 452 453 454 455 456 457
    handleQuery(type) {
      this.pageParam.pageNo = 1;
      if (type === "pre") {
        this.getSecGoods();
      } else {
        this.getPreLoad();
      }
huhaiiqng's avatar
huhaiiqng committed
458 459 460 461 462 463 464
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
    },
    /** 提交 */
    onSubmit() {
465 466 467
      this.$refs["operatorForm"].validate((valid, errors) => {
        if (!valid) {
          return this.$showFormValidateErrors(errors);
huhaiiqng's avatar
huhaiiqng committed
468
        }
469 470 471 472 473 474 475 476 477 478 479 480
        approvalCreate({
          ...this.operatorData,
          applyReason: "预装审核",
          approvalStatus: 0,
          approvalType: 1, // 预装
          copyUserId: this.selectedUsers,
          shipmentId: this.$attrs.shipmentObj.id,
        }).then((res) => {
          serviceMsg(res, this).then(() => {
            this.$emit("closeDialog", "submit");
          });
        });
huhaiiqng's avatar
huhaiiqng committed
481 482
      });
    },
huhaiqing's avatar
huhaiqing committed
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
    /* 统计列 */
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (column.property === "brandType") {
          sums[index] = "合计";
          return;
        }
        if (column.property === "num") {
          sums[index] = this.calcSum(column.property, data) ?? 0;
        }
        if (column.property === "volumeWeight") {
          const volume = this.calcSum("volume", data);
          const weight = this.calcSum("weight", data);
huhaiqing's avatar
huhaiqing committed
498 499 500 501
          sums[index] = getTotlContent({ volume, weight }, [
            "volume",
            "weight",
          ]);
huhaiqing's avatar
huhaiqing committed
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
        }
      });

      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);
      }
    },
    /* 待预装订单分页 */
    pageChange(page) {
huhaiqing's avatar
huhaiqing committed
523
      this.pageParam.pageNo = page;
huhaiqing's avatar
huhaiqing committed
524 525 526 527 528
      this.getPreLoad();
    },
    /* 折叠 */
    foldTable(index, part) {
      part.fold = !part.fold;
529
      this.$set(this.preList.sectionGoodList, index, part);
huhaiqing's avatar
huhaiqing committed
530 531 532
    },
    /* 增加部分 */
    addPart() {
huhaiqing's avatar
huhaiqing committed
533 534 535 536 537 538 539
      createSection({ shipmentId: this.shipmentObj.id, isCover: 0 }).then(
        (res) => {
          serviceMsg(res, this).then(() => {
            this.getSecGoods();
          });
        }
      );
huhaiqing's avatar
huhaiqing committed
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
    },
    /* 删除部分 */
    deletePart(part) {
      this.$confirm("确认删除该部分及其已预装订单?", "提示", {
        type: "warning",
      })
        .then((_) => {
          deleteSection(part.id).then((res) => {
            serviceMsg(res, this).then(() => {
              this.getSecGoods();
            });
          });
        })
        .catch((_) => {});
    },
    /** 预装 */
    handleGoods(type, item, part) {
      let params = {
        secId: part.id,
        shipmentId: this.shipmentObj.id,
        orderId: item.orderId,
      };
      if (type === "all") {
huhaiqing's avatar
huhaiqing committed
563
        params.orderItemIdList = item.boxOrderItemList.map(
huhaiqing's avatar
huhaiqing committed
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
          (data) => data.orderItemId
        );
      } else {
        params.orderItemIdList = [item.orderItemId];
      }
      createGoods(params).then((res) => {
        serviceMsg(res, this).then(() => {
          this.queryAllData();
        });
      });
    },
    /* 删除订单 */
    deleteOrder(type, data) {
      let ids = [];
      if (type === "selected") {
579
        // 根据parid 构建的对象
huhaiqing's avatar
huhaiqing committed
580 581
        const rows = this.selectedRows[data.id] ?? [];
        if (!rows.length) {
582
          this.$message.error("请选择订单");
huhaiqing's avatar
huhaiqing committed
583 584
          return;
        }
585
        ids = rows.map((item) => item.id);
huhaiqing's avatar
huhaiqing committed
586 587 588
      }

      if (type === "row") {
589
        ids.push(data.id);
huhaiqing's avatar
huhaiqing committed
590 591 592 593 594 595 596 597 598 599 600 601 602 603
      }

      deleteGoods(ids).then((res) => {
        serviceMsg(res, this).then(() => {
          this.queryAllData();
        });
      });
    },
    /* 查询所有数据 */
    queryAllData() {
      this.getSecGoods();
      this.pageParam.pageNo = 1;
      this.getPreLoad();
    },
huhaiqing's avatar
huhaiqing committed
604
    /* 获取参数 */
605 606 607 608
    getParams() {
      const { rucangtime = [] } = this.queryParams;
      return {
        ...this.queryParams,
609
        ...this.$attrs.params,
huhaiqing's avatar
huhaiqing committed
610 611 612 613 614 615
        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],
616 617
      };
    },
huhaiqing's avatar
huhaiqing committed
618 619 620 621 622 623 624 625 626
    /* 关闭弹框 */
    closeDialog() {
      this.$emit("closeDialog");
    },
    /* 取消审核 */
    canclAudit() {
      const { currNode, shipmentObj } = this.$attrs;
      const { voName } = currNode;
      approvalCancel({
huhaiqing's avatar
huhaiqing committed
627
        applyReason: "取消审核",
huhaiqing's avatar
huhaiqing committed
628 629 630 631 632 633 634 635
        id: shipmentObj[voName].id,
        shipmentId: shipmentObj.id,
      }).then((res) => {
        serviceMsg(res, this).then(() => {
          this.$emit("closeDialog", "submit");
        });
      });
    },
636 637 638 639 640
    jumpReviewDetail() {
      const { currNode, shipmentObj } = this.$attrs;
      toReviewDetail.apply(this, [shipmentObj[currNode.voName].bpmProcessId]);
      this.$emit("closeDialog");
    },
huhaiqing's avatar
huhaiqing committed
641
  },
huhaiiqng's avatar
huhaiiqng committed
642 643 644
};
</script>

huhaiqing's avatar
huhaiqing committed
645
<style lang="scss">
huhaiiqng's avatar
huhaiiqng committed
646
.preinstall {
huhaiqing's avatar
huhaiqing committed
647 648 649
  display: flex;
  flex-direction: column;

huhaiiqng's avatar
huhaiiqng committed
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679
  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 {
huhaiqing's avatar
huhaiqing committed
680 681
      font-size: 16px;
      font-weight: bolder;
huhaiiqng's avatar
huhaiiqng committed
682 683 684 685 686 687 688 689 690 691 692 693 694
    }
    .red-label {
      color: red;
    }
    .table-button {
      flex: 1;
      margin: 0;
      display: flex;
      justify-content: flex-end;
    }
  }
  .preinstall-table {
    display: flex;
huhaiqing's avatar
huhaiqing committed
695
    height: calc(100% - 30px);
huhaiiqng's avatar
huhaiiqng committed
696 697 698 699 700 701 702 703
    > div {
      border: 1px solid #e6ebf5;
      padding: 10px 0px;
    }
    > div:first-child {
      margin-right: 10px;
    }
  }
huhaiqing's avatar
huhaiqing committed
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722

  .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 {
huhaiqing's avatar
huhaiqing committed
723
    min-height: 550px;
huhaiqing's avatar
huhaiqing committed
724 725 726 727 728 729 730 731
    .el-card__body {
      height: 100%;

      .tobePre-row {
        margin-top: 10px;
      }
    }
  }
huhaiqing's avatar
huhaiqing committed
732 733 734 735 736 737 738 739 740 741 742 743 744 745

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