preinstall.vue 21.5 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
    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
huhaiqing's avatar
huhaiqing committed
5 6
      <el-form-item label="入仓时间" prop="rucangtime">
        <el-date-picker v-model="queryParams.rucangtime" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
huhaiiqng's avatar
huhaiiqng committed
7 8 9 10 11 12
      </el-form-item>
      <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>
        </el-select>
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
13 14
      <el-form-item label="目的地" prop="destWarehouseIdList">
        <el-select v-model="queryParams.destWarehouseIdList" placeholder="请选择目的地" multiple>
huhaiiqng's avatar
huhaiiqng committed
15 16 17
          <el-option v-for="item in importWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
        </el-select>
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
18 19
      <el-form-item label="状态" prop="orderStatus">
        <el-select v-model="queryParams.orderStatus" placeholder="请选择状态" clearable size="small">
huhaiiqng's avatar
huhaiiqng committed
20 21 22
          <el-option v-for="item in stateOps" :label="item.label" :value="item.value" :key="item.value"></el-option>
        </el-select>
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
23 24
      <el-form-item label="备案" prop="productRecord">
        <el-select v-model="queryParams.productRecord" placeholder="请选择备案" clearable size="small">
huhaiiqng's avatar
huhaiiqng committed
25 26 27
          <el-option v-for="item in filingOps" :label="item.label" :value="item.value" :key="item.value"></el-option>
        </el-select>
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
28 29
      <el-form-item label="报关方式" prop="customsType">
        <el-select v-model="queryParams.customsType" placeholder="请选择报关方式" clearable size="small">
huhaiiqng's avatar
huhaiiqng committed
30 31 32
          <el-option v-for="item in declarationMethodOps" :label="item.label" :value="item.value" :key="item.value"></el-option>
        </el-select>
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
33
      <el-form-item label="订单号" prop="toBePreOrderNo">
huhaiiqng's avatar
huhaiiqng committed
34 35
        <el-input v-model="queryParams.orderNo" placeholder="请输入订单号码" clearable />
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
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>
huhaiqing's avatar
huhaiqing committed
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>
huhaiqing's avatar
huhaiqing committed
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>
huhaiqing's avatar
huhaiqing committed
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>
huhaiqing's avatar
huhaiqing committed
50 51
        <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>
huhaiiqng's avatar
huhaiiqng committed
52 53 54 55 56 57
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

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

    <!-- 表格 -->
huhaiqing's avatar
huhaiqing committed
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>
huhaiqing's avatar
huhaiqing committed
74
          <p>无返回</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>
huhaiqing's avatar
huhaiqing committed
92
              <p>无返回</p>
huhaiiqng's avatar
huhaiiqng committed
93 94 95
            </div>
            <div class="red-label">
              <p>可预装方数:</p>
huhaiqing's avatar
huhaiqing committed
96
              <p>无返回</p>
huhaiiqng's avatar
huhaiiqng committed
97 98 99
            </div>
            <div class="red-label">
              <p>重量:</p>
huhaiqing's avatar
huhaiqing committed
100
              <p>无返回</p>
huhaiiqng's avatar
huhaiiqng committed
101 102
            </div>
            <div class="table-button">
huhaiqing's avatar
huhaiqing committed
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
          <el-scrollbar style="height:calc(100% - 43px)">
            <el-row v-for="(part, index) in preList" :key="index" class="pre-part">
              <el-row class="preinstall-title">
                <div class="pre-part-info">
                  <p>{{index+1}}部分</p>
                  <p>
                    <span>{{part.secStatistics ? part.secStatistics.num : 0}}</span>
                    <span>{{part.secStatistics ? part.secStatistics.volume : 0}}</span>
                    <span>{{part.secStatistics ? part.secStatistics.weight : 0}}kg</span>
                  </p>
                </div>
                <div class="table-button">
                  <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>
                </div>
              </el-row>
              <el-table v-loading="preLoading" border :data="part.sectionGoodsList" v-show="!part.fold" @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="订单号" align="center" prop="orderId" width="120" />
                <el-table-column label="目的地" align="center" prop="destWarehouseName" width="120" />
                <el-table-column label="入仓时间" align="center" prop="rucangtime" width="120" />
                <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">
                  <template slot-scope="scope">
                    <p v-if="scope.row.volume">{{scope.row.volume}}</p>
                    <p v-if="scope.row.weight">{{scope.row.weight}}kg</p>
                  </template>
                </el-table-column>
                <el-table-column label="报关方式" align="center" prop="customsType" width="120">
                  <template slot-scope="scope">
                    <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="scope.row.customsType" />
                  </template>
                </el-table-column>
                <el-table-column label="备案" align="center" prop="productRecord" width="100">
                  <template slot-scope="scope">
                    <dict-tag :type="DICT_TYPE.PRODUCT_RECORD_ATTRIBUTE" :value="scope.row.productRecord" />
                  </template>
                </el-table-column>
                <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width" fixed="right">
                  <template slot-scope="scope">
                    <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>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item :command="bPart" v-for="(bPart, index) in preList" :key="bPart.id" v-show="bPart.id !== part.id">{{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)"></el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-row>
          </el-scrollbar>
huhaiiqng's avatar
huhaiiqng committed
160 161 162 163
        </el-col>
        <!-- 待预装订单 -->
        <el-col :span="12">
          <el-row class="preinstall-title">
huhaiqing's avatar
huhaiqing committed
164
            <div class="table-label red-label">待预装订单</div>
huhaiiqng's avatar
huhaiiqng committed
165 166 167
            <div class="preinstall-title preinstalled">
              <div class="red-label">
                <p>筛选后待预装数量:</p>
huhaiqing's avatar
huhaiqing committed
168
                <p>无返回</p>
huhaiiqng's avatar
huhaiiqng committed
169 170 171
              </div>
              <div class="red-label">
                <p>方数:</p>
huhaiqing's avatar
huhaiqing committed
172
                <p>无返回</p>
huhaiiqng's avatar
huhaiiqng committed
173 174 175
              </div>
              <div class="red-label">
                <p>重量:</p>
huhaiqing's avatar
huhaiqing committed
176
                <p>无返回</p>
huhaiiqng's avatar
huhaiiqng committed
177 178 179
              </div>
            </div>
          </el-row>
huhaiqing's avatar
huhaiqing committed
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 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 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
          <el-scrollbar style="height:calc(100% - 40px)">
            <el-pagination background layout="prev, pager, next" :page-size="pageParam.pageSize" :total="total" @current-change="pageChange" v-show="total > 0"></el-pagination>
            <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>发往:</p>
                  <p>{{item.destWarehouseName}}</p>
                </div>
                <div>
                  <p>{{item.warehouseType}}</p>
                </div>
                <div>
                  <p>入仓时间:</p>
                  <p>{{item.rucangtime}}</p>
                </div>
                <div>
                  <p>重货比:</p>
                  <p>{{item.weightRatio}}</p>
                </div>
                <div class="table-button">
                  <el-dropdown trigger="click" @command="(command)=>handleGoods('all',item,command)">
                    <el-button type="success" 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>
                </div>
              </el-row>
              <el-table v-loading="toBePreLoading" :data="item.orderItemList" 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">
                  <template slot-scope="scope">
                    <dict-tag :type="DICT_TYPE.PRODUCT_RECORD_ATTRIBUTE" :value="scope.row.brandType" />
                  </template>
                </el-table-column>
                <el-table-column label="箱数" align="center" prop="num" />
                <el-table-column label="体积/重量" align="center" prop="volumeWeight">
                  <template slot-scope="scope">
                    <p v-if="scope.row.volume">{{scope.row.volume}}</p>
                    <p v-if="scope.row.weight">{{scope.row.weight}}kg</p>
                  </template>
                </el-table-column>
                <el-table-column label="报关方式" align="center" prop="" />
                <el-table-column label="包装类型" align="center" prop="" />
                <el-table-column label="材质" align="center" prop="material" />
                <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                  <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>
                </el-table-column>
              </el-table>
huhaiiqng's avatar
huhaiiqng committed
240
            </el-row>
huhaiqing's avatar
huhaiqing committed
241
          </el-scrollbar>
huhaiiqng's avatar
huhaiiqng committed
242 243 244 245 246 247 248 249
        </el-col>
      </el-row>
    </el-card>

    <!-- 操作员 -->
    <el-row style="margin-top: 15px">
      <el-row>
        <el-form ref="operatorForm" :model="operatorData" size="small" :inline="true" label-width="120px" :rules="rules">
huhaiqing's avatar
huhaiqing committed
250 251
          <el-form-item label="目的地操作员" prop="noticeUser">
            <userSelect v-model="operatorData.noticeUser" placeholder="请选择目的地操作员" :allUsers="this.$attrs.allUsers" size="small" />
huhaiiqng's avatar
huhaiiqng committed
252 253 254 255 256 257 258 259 260 261 262 263
          </el-form-item>
        </el-form>
      </el-row>
      <el-row style="margin-top: 10px">
        <el-button type="primary" @click="onSubmit">提交申请</el-button>
      </el-row>
    </el-row>
  </div>
</template>

<script>
import { DICT_TYPE } from "@/utils/dict";
huhaiqing's avatar
huhaiqing committed
264 265 266 267 268 269 270 271
import {
  secGoodsList,
  preloadPage,
  createSection,
  deleteSection,
  serviceMsg,
  createGoods,
  deleteGoods,
huhaiqing's avatar
huhaiqing committed
272
  approvalCreate,
huhaiqing's avatar
huhaiqing committed
273
} from "@/api/ecw/boxSea";
huhaiqing's avatar
huhaiqing committed
274
import userSelect from "./common/userSelect.vue";
huhaiiqng's avatar
huhaiiqng committed
275

huhaiqing's avatar
huhaiqing committed
276 277 278
/**
 * 预装
 */
huhaiiqng's avatar
huhaiiqng committed
279 280
export default {
  name: "preinstall",
huhaiqing's avatar
huhaiqing committed
281
  inheritAttrs: false,
huhaiqing's avatar
huhaiqing committed
282
  components: { userSelect },
huhaiiqng's avatar
huhaiiqng committed
283 284 285 286 287 288 289 290 291 292 293
  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
294 295 296 297 298 299 300 301 302 303 304 305 306
      // 查询标识
      type: "",
      // 已预装 遮罩层
      preLoading: false,
      preList: [],
      // 选中行
      selectedRows: {},

      // 待预装
      toBePreLoading: false,
      toBePreList: [],
      total: 0,

huhaiiqng's avatar
huhaiiqng committed
307 308
      // 显示搜索条件
      showSearch: true,
huhaiqing's avatar
huhaiqing committed
309

huhaiiqng's avatar
huhaiiqng committed
310
      // 查询参数
huhaiqing's avatar
huhaiqing committed
311 312
      queryParams: {},
      pageParam: { pageNo: 1, pageSize: 5 },
huhaiiqng's avatar
huhaiiqng committed
313
      // 目的地操作员
huhaiqing's avatar
huhaiqing committed
314
      operatorData: {},
huhaiqing's avatar
huhaiqing committed
315
      // 校验
huhaiiqng's avatar
huhaiiqng committed
316
      rules: {
huhaiqing's avatar
huhaiqing committed
317
        noticeUser: [{ required: true, message: "必填", trigger: "change" }],
huhaiiqng's avatar
huhaiiqng committed
318
      },
huhaiqing's avatar
huhaiqing committed
319 320
      // 出货信息
      shipmentObj: this.$attrs.shipmentObj,
huhaiiqng's avatar
huhaiiqng committed
321 322 323
    };
  },
  computed: {
huhaiqing's avatar
huhaiqing committed
324
    /** 始发地 */
huhaiiqng's avatar
huhaiiqng committed
325
    exportWarehouseList() {
huhaiqing's avatar
huhaiqing committed
326
      return this.$attrs.warehouseList.filter(
huhaiiqng's avatar
huhaiiqng committed
327 328 329
        (item) => item.tradeType == "2" || item.type == "3"
      );
    },
huhaiqing's avatar
huhaiqing committed
330
    /** 目的地 */
huhaiiqng's avatar
huhaiiqng committed
331
    importWarehouseList() {
huhaiqing's avatar
huhaiqing committed
332
      return this.$attrs.warehouseList.filter(
huhaiiqng's avatar
huhaiiqng committed
333 334 335 336 337
        (item) => item.tradeType == "1" || item.type == "3"
      );
    },
  },
  created() {
huhaiqing's avatar
huhaiqing committed
338
    // 查询待预装
huhaiqing's avatar
huhaiqing committed
339
    this.handleQuery("toBePre");
huhaiiqng's avatar
huhaiiqng committed
340 341
  },
  methods: {
huhaiqing's avatar
huhaiqing committed
342 343
    /* 获取城市 */
    importCityName(id) {
huhaiqing's avatar
huhaiqing committed
344
      var arr = this.$attrs.warehouseList.filter((item) => item.id == id);
huhaiqing's avatar
huhaiqing committed
345 346 347 348 349 350 351 352 353
      return arr.length > 0 ? arr[0].titleZh : "";
    },
    /* 选中行 */
    checkboxSelect(selection, part) {
      this.selectedRows[part.id] = selection;
    },
    /* 查询已预装 */
    getSecGoods() {
      this.preLoading = true;
huhaiiqng's avatar
huhaiiqng committed
354 355
      // 处理查询参数
      let params = { ...this.queryParams };
huhaiqing's avatar
huhaiqing committed
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
      // 已预装单号
      params.orderNo = params.preOrderNo;
      params.shipmentId = this.shipmentObj.id;
      secGoodsList(params).then((res) => {
        this.preList = res.data;
        this.preLoading = false;
      });
    },
    /* 查询待预装 */
    getPreLoad() {
      this.toBePreLoading = true;
      // 处理查询参数
      let params = { ...this.queryParams };
      // 订单号
      params.orderNo = params.toBePreOrderNo;
      preloadPage({ ...params, ...this.pageParam }).then((res) => {
        this.toBePreList = res.data.list;
        this.total = res.data.total;
        this.toBePreLoading = false;
huhaiiqng's avatar
huhaiiqng committed
375 376 377
      });
    },
    /** 搜索按钮操作 */
huhaiqing's avatar
huhaiqing committed
378 379 380 381 382 383 384
    handleQuery(type) {
      this.pageParam.pageNo = 1;
      if (type === "pre") {
        this.getSecGoods();
      } else {
        this.getPreLoad();
      }
huhaiiqng's avatar
huhaiiqng committed
385 386 387 388 389 390 391 392 393
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
    },
    /** 提交 */
    onSubmit() {
      this.$refs["operatorForm"].validate((valid) => {
        if (valid) {
huhaiqing's avatar
huhaiqing committed
394 395 396 397 398 399 400 401 402 403
          approvalCreate({
            ...this.operatorData,
            shipmentId: this.$attrs.shipmentObj.id,
            approvalStatus: 0,
            approvalType: 1,
          }).then((res) => {
            serviceMsg(res, this).then(() => {
              this.$emit("closeDialog", "submit");
            });
          });
huhaiiqng's avatar
huhaiiqng committed
404 405 406
        }
      });
    },
huhaiqing's avatar
huhaiqing committed
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 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 483 484 485 486 487 488 489 490 491 492 493 494 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 521
    /* 统计列 */
    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);
          sums[index] = `${volume ?? 0}m³ ${weight ?? 0}kg`;
        }
      });

      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) {
      this.queryParams.page = page;
      this.getPreLoad();
    },
    /* 折叠 */
    foldTable(index, part) {
      part.fold = !part.fold;
      this.$set(this.preList, index, part);
    },
    /* 增加部分 */
    addPart() {
      createSection({ shipmentId: this.shipmentObj.id }).then((res) => {
        serviceMsg(res, this).then(() => {
          this.getSecGoods();
        });
      });
    },
    /* 删除部分 */
    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") {
        params.orderItemIdList = item.orderItemList.map(
          (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") {
        const rows = this.selectedRows[data.id] ?? [];
        if (!rows.length) {
          this.$message.warning("请选择订单");
          return;
        }
        ids = rows.map((item) => item.orderItemId);
      }

      if (type === "row") {
        ids.push(data.orderItemId);
      }

      deleteGoods(ids).then((res) => {
        serviceMsg(res, this).then(() => {
          this.queryAllData();
        });
      });
    },
    /* 查询所有数据 */
    queryAllData() {
      this.getSecGoods();
      this.pageParam.pageNo = 1;
      this.getPreLoad();
    },
huhaiiqng's avatar
huhaiiqng committed
522 523 524 525
  },
};
</script>

huhaiqing's avatar
huhaiqing committed
526
<style lang="scss">
huhaiiqng's avatar
huhaiiqng committed
527
.preinstall {
huhaiqing's avatar
huhaiqing committed
528 529 530
  display: flex;
  flex-direction: column;

huhaiiqng's avatar
huhaiiqng committed
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560
  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
561 562
      font-size: 16px;
      font-weight: bolder;
huhaiiqng's avatar
huhaiiqng committed
563 564 565 566 567 568 569 570 571 572 573 574 575
    }
    .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
576
    height: calc(100% - 30px);
huhaiiqng's avatar
huhaiiqng committed
577 578 579 580 581 582 583 584
    > div {
      border: 1px solid #e6ebf5;
      padding: 10px 0px;
    }
    > div:first-child {
      margin-right: 10px;
    }
  }
huhaiqing's avatar
huhaiqing committed
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611

  .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 {
    .el-card__body {
      height: 100%;

      .tobePre-row {
        margin-top: 10px;
      }
    }
  }
huhaiiqng's avatar
huhaiiqng committed
612 613
}
</style>