indexSea.vue 16.6 KB
Newer Older
wh's avatar
wh committed
1
<template>
huhaiqing's avatar
huhaiqing committed
2
  <div class="app-container shipping-sea">
wh's avatar
wh committed
3 4 5

    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
huhaiqing's avatar
huhaiqing committed
6 7 8 9 10 11
      <el-form-item label="运输方式" prop="transportType">
        <el-select v-model="queryParams.transportType" placeholder="请选择运输方式" clearable size="small">
          <el-option v-for="dict in transportTypes" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>

wanglianghe's avatar
wanglianghe committed
12
      <el-form-item label="自编号" prop="selfNo">
huhaiqing's avatar
huhaiqing committed
13
        <el-input v-model="queryParams.selfNo" placeholder="请输入自编号" clearable @keyup.enter.native="handleQuery" />
wh's avatar
wh committed
14
      </el-form-item>
wh's avatar
wh committed
15
      <el-form-item label="柜号" prop="cubNo">
huhaiqing's avatar
huhaiqing committed
16
        <el-input v-model="queryParams.cubNo" placeholder="请输入柜号" clearable @keyup.enter.native="handleQuery" />
wh's avatar
wh committed
17
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
18 19 20
      <el-form-item label="柜型" prop="cabinetId">
        <el-select v-model="queryParams.cabinetId" placeholder="请选择柜型">
          <el-option v-for="item in cabinetList" :label="item.name" :value="item.name" :key="item.id"></el-option>
wh's avatar
wh committed
21 22
        </el-select>
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
23 24 25

      <el-form-item label="始发地" prop="startWarehouseId">
        <el-select v-model="queryParams.startWarehouseId" placeholder="请选择始发地">
26
          <el-option v-for="item in exportWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
wh's avatar
wh committed
27
        </el-select>
wh's avatar
wh committed
28
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
29 30 31

      <el-form-item label="目的地" prop="destWarehouseId">
        <el-select v-model="queryParams.destWarehouseId" placeholder="请选择目的地">
32
          <el-option v-for="item in importWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
wh's avatar
wh committed
33
        </el-select>
wh's avatar
wh committed
34
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
35 36 37 38

      <el-form-item label="" prop="date">
        <el-select v-model="queryParams.dateType" placeholder="请选择时间类型" clearable size="small">
          <el-option v-for="item in dateTypes" :key="item.value" :label="item.label" :value="item.value" />
wh's avatar
wh committed
39
        </el-select>
wh's avatar
wh committed
40
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
41 42

      <el-form-item label="">
huhaiqing's avatar
huhaiqing committed
43
        <el-date-picker v-model="queryParams.dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
wh's avatar
wh committed
44
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
45 46 47

      <el-form-item label="状态" prop="boxStatus">
        <el-select v-model="queryParams.boxStatus" placeholder="请选择状态" clearable size="small">
huhaiqing's avatar
huhaiqing committed
48
          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BOX_SHIPMENT_STATUS)" :key="dict.value" :label="dict.label" :value="dict.value" />
wanglianghe's avatar
wanglianghe committed
49 50
        </el-select>
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
51

huhaiqing's avatar
huhaiqing committed
52 53 54 55
      <el-form-item label="国家">
        <el-select v-model="queryParams.countryId" placeholder="请选择国家">
          <el-option v-for="item in countryList" :key="item.id" :label="item.titleZh" :value="item.id">
          </el-option>
wanglianghe's avatar
wanglianghe committed
56 57 58
        </el-select>
      </el-form-item>

wh's avatar
wh committed
59 60 61 62 63 64 65 66 67
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
huhaiqing's avatar
huhaiqing committed
68
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['shipment:box:create']">出货安排
wh's avatar
wh committed
69
        </el-button>
wh's avatar
wh committed
70 71
      </el-col>
      <el-col :span="1.5">
huhaiqing's avatar
huhaiqing committed
72
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" v-hasPermi="['shipment:box:export']">导出
wh's avatar
wh committed
73
        </el-button>
wh's avatar
wh committed
74 75 76 77 78 79
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
huhaiqing's avatar
huhaiqing committed
80 81
      <el-table-column label="自编号" align="center" prop="selfNo">
        <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
82
          <a href="javascript:void(0)" @click="handleCommand(scope.row, 'detail')">{{ scope.row.selfNo }}</a>
huhaiqing's avatar
huhaiqing committed
83 84
        </template>
      </el-table-column>
huhaiqing's avatar
huhaiqing committed
85
      <el-table-column label="柜号" align="center" prop="cubNo" />
wanglianghe's avatar
wanglianghe committed
86 87 88
      <el-table-column label="柜型" align="center" prop="cabinetId">
        <template slot-scope="scope">
          <span>{{ getCabinetName(scope.row.cabinetId) }}</span>
wh's avatar
wh committed
89 90
        </template>
      </el-table-column>
wanglianghe's avatar
wanglianghe committed
91
      <el-table-column label="运输方式" align="center" prop="transportType">
wh's avatar
wh committed
92
        <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
93
          <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="scope.row.transportType" />
wh's avatar
wh committed
94 95
        </template>
      </el-table-column>
wanglianghe's avatar
wanglianghe committed
96

huhaiqing's avatar
huhaiqing committed
97 98 99
      <el-table-column label="方数(预装/已装)" align="center" prop="">
        <template slot-scope="{row}">
          {{row.boxStatistics.volume}}/{{row.boxStatistics.loadVolume}}
wanglianghe's avatar
wanglianghe committed
100 101
        </template>
      </el-table-column>
huhaiqing's avatar
huhaiqing committed
102 103 104 105 106 107 108
      <el-table-column label="重量(预装/已装)" align="center" prop="weight">
        <template slot-scope="{row}">
          {{row.boxStatistics.weight}}/{{row.boxStatistics.loadWeight}}
        </template>
      </el-table-column>

      <el-table-column label="状态" align="center" prop="shipmentStatusText" />
huhaiqing's avatar
huhaiqing committed
109

wanglianghe's avatar
wanglianghe committed
110
      <el-table-column label="日期" align="center" prop="createTime" width="180">
huhaiqing's avatar
huhaiqing committed
111
        <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
112
          <span>{{ new Date(scope.row.createTime).format('yyyy-MM-dd hh:mm:ss') }}</span>
huhaiqing's avatar
huhaiqing committed
113
        </template>
wh's avatar
wh committed
114
      </el-table-column>
huhaiqing's avatar
huhaiqing committed
115
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200px">
wh's avatar
wh committed
116
        <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
117
          <el-dropdown trigger="click" @command="(command)=>handleCommand(scope.row, command)" style="marginRight:10px;">
118 119 120 121 122 123 124 125 126
            <el-button type="primary">
              操作<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command="edit">编辑</el-dropdown-item>
              <el-dropdown-item command="sea">操作-海运</el-dropdown-item>
              <el-dropdown-item command="error">异常登记</el-dropdown-item>
              <el-dropdown-item command="cost">费用登记</el-dropdown-item>
              <el-dropdown-item command="delete">删除</el-dropdown-item>
zhoutong's avatar
zhoutong committed
127
              <el-dropdown-item v-if="scope.row.ldStatus==47" command="editLadingBill">编辑提货单</el-dropdown-item>
128 129
            </el-dropdown-menu>
          </el-dropdown>
huhaiqing's avatar
huhaiqing committed
130
          <el-dropdown trigger="click" @command="(command)=>handleCommand(scope.row, command)">
huhaiqing's avatar
huhaiqing committed
131 132 133 134
            <el-button type="primary">
              下载<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
huhaiqing's avatar
huhaiqing committed
135 136 137
              <el-dropdown-item command="downloadPreloadGoodsList">预装单</el-dropdown-item>
              <el-dropdown-item command="downloadLoadGoodsList">已装单</el-dropdown-item>
              <el-dropdown-item command="downloadReceivableList">应收汇总表</el-dropdown-item>
138 139
              <el-dropdown-item command="downloadAgentListFiles">agent list</el-dropdown-item>
              <el-dropdown-item command="downloadSoncapFiles">soncap</el-dropdown-item>
140 141
              <el-dropdown-item command="zipDownload">提货单</el-dropdown-item>
              <el-dropdown-item command="downloadLadingCopy">提单Copy</el-dropdown-item>
huhaiqing's avatar
huhaiqing committed
142 143
            </el-dropdown-menu>
          </el-dropdown>
wh's avatar
wh committed
144 145 146 147
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
huhaiqing's avatar
huhaiqing committed
148
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.pageSize" @pagination="getList" @current-change="pageChange" />
wh's avatar
wh committed
149 150

    <!-- 对话框(添加 / 修改) -->
huhaiqing's avatar
huhaiqing committed
151
    <el-dialog :title="dialogCfg.title" :visible.sync="dialogCfg.open" :width="dialogCfg.width" :fullscreen="dialogCfg.fullscreen" append-to-body class="shippingSea-dialog">
152 153
      <template v-if="dialogCfg.dialogType === 'edit' || dialogCfg.dialogType === 'add'">
        <editForm v-if="dialogCfg.open" @closeDialog="closeDialog" :shipmentObj="currRow" :warehouseList="warehouseList" :transportTypes="transportTypes" :cabinetList="cabinetList" />
154
      </template>
155 156
      <template v-if="dialogCfg.dialogType === 'cost'">
        <costForm v-if="dialogCfg.open" @closeDialog="closeDialog" :shipmentObj="currRow" />
157
      </template>
158 159 160 161
      <template v-if="dialogCfg.dialogType === 'error'">
        <regError v-if="dialogCfg.open" @closeDialog="closeDialog" :shipmentObj="currRow" />
      </template>
      <template v-if="dialogCfg.dialogType === 'editLadingBill'">
huhaiqing's avatar
huhaiqing committed
162
        <ladingBill v-if="dialogCfg.open" @closeDialog="closeDialog" :shipmentObj="currRow" :getCabinetName="getCabinetName" />
huhaiqing's avatar
huhaiqing committed
163
      </template>
wh's avatar
wh committed
164 165 166 167 168
    </el-dialog>
  </div>
</template>

<script>
169 170 171 172 173 174 175 176 177
import {
  deletebox,
  getbox,
  getboxPage,
  exportboxExcel,
  downloadAgentListFiles,
  downloadSoncapFiles,
} from "@/api/ecw/box";
import { downloadFile, downloadFileByUrl } from "./shippingSea/utils";
huhaiqing's avatar
huhaiqing committed
178 179
import { getCabinetPage } from "@/api/ecw/cabinet";
import { getWarehouseList } from "@/api/ecw/warehouse";
huhaiqing's avatar
huhaiqing committed
180
import { getListTree } from "@/api/ecw/region";
huhaiqing's avatar
huhaiqing committed
181 182 183
import costForm from "./costForm.vue";
import regError from "./regError.vue";
import editForm from "./editForm.vue";
huhaiqing's avatar
huhaiqing committed
184
import ladingBill from "./ladingBill/index.vue";
huhaiqing's avatar
huhaiqing committed
185 186 187 188 189 190 191

export default {
  name: "indexSea",
  components: {
    costForm,
    regError,
    editForm,
192
    ladingBill,
huhaiqing's avatar
huhaiqing committed
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
  },
  data() {
    return {
      dateTypes: [
        { value: "1", label: "预装时间" },
        { value: "2", label: "装柜时间" },
        { value: "3", label: "起运时间" },
        { value: "4", label: "到港时间" },
        { value: "5", label: "清关时间" },
        { value: "6", label: "提货时间" },
      ],
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 出货列表
      list: [],
      // 弹出层标题
      // 弹出类型
216 217 218 219 220 221
      dialogCfg: {
        title: "",
        dialogType: "",
        width: "600px",
        // 是否显示弹出层
        open: false,
huhaiqing's avatar
huhaiqing committed
222
        fullscreen: false,
223
      },
huhaiqing's avatar
huhaiqing committed
224 225 226 227 228
      // 当前行
      currRow: {},
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
huhaiqing's avatar
huhaiqing committed
229
        page: 1,
huhaiqing's avatar
huhaiqing committed
230 231 232 233 234
        pageSize: 10,
      },
      cabinetList: [],
      warehouseList: [],
      transportTypes: [],
huhaiqing's avatar
huhaiqing committed
235 236
      //国家信息列表
      countryList: [],
huhaiqing's avatar
huhaiqing committed
237 238 239 240 241 242 243
    };
  },
  computed: {
    exportWarehouseList() {
      return this.warehouseList.filter(
        (item) => item.tradeType == "2" || item.type == "3"
      );
244
    },
huhaiqing's avatar
huhaiqing committed
245 246 247 248
    importWarehouseList() {
      return this.warehouseList.filter(
        (item) => item.tradeType == "1" || item.type == "3"
      );
wh's avatar
wh committed
249
    },
huhaiqing's avatar
huhaiqing committed
250 251 252 253 254 255
    getCabinetName() {
      return (cabinetId) => {
        for (let index in this.cabinetList) {
          let cabinetItem = this.cabinetList[index];
          if (cabinetItem.id == cabinetId) {
            return cabinetItem.name;
wanglianghe's avatar
wanglianghe committed
256 257
          }
        }
huhaiqing's avatar
huhaiqing committed
258
      };
wh's avatar
wh committed
259
    },
huhaiqing's avatar
huhaiqing committed
260 261 262 263 264 265 266 267 268 269
  },
  created() {
    this.transportTypes = this.getDictDatas(
      this.DICT_TYPE.ECW_TRANSPORT_TYPE
    ).filter((item) => item.value == "1" || item.value == "2");
    getWarehouseList().then((res) => (this.warehouseList = res.data));
    getCabinetPage(null).then((response) => {
      this.cabinetList = response.data.list;
    });
    this.getList();
huhaiqing's avatar
huhaiqing committed
270
    this.getCountryList();
huhaiqing's avatar
huhaiqing committed
271 272
  },
  methods: {
huhaiqing's avatar
huhaiqing committed
273 274 275 276 277 278
    /* 国家 */
    getCountryList() {
      getListTree({ treeType: 1 }).then((response) => {
        this.countryList = response.data;
      });
    },
huhaiqing's avatar
huhaiqing committed
279 280 281 282 283 284 285 286 287 288 289 290
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = { ...this.queryParams };
      params.transportTypeList = ["1", "2"];
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
      // 执行查询
      getboxPage(params).then((response) => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
wh's avatar
wh committed
291
      });
huhaiqing's avatar
huhaiqing committed
292 293 294
    },
    /** 搜索按钮操作 */
    handleQuery() {
huhaiqing's avatar
huhaiqing committed
295
      this.queryParams.page = 1;
wh's avatar
wh committed
296
      this.getList();
wh's avatar
wh committed
297
    },
huhaiqing's avatar
huhaiqing committed
298 299 300 301 302 303 304 305
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
306 307 308
      this.$set(this.dialogCfg, "title", "添加出货");
      this.$set(this.dialogCfg, "dialogType", "add");
      this.$set(this.dialogCfg, "width", "600px");
huhaiqing's avatar
huhaiqing committed
309 310
      this.$set(this.dialogCfg, "fullscreen", false);
      this.$set(this.dialogCfg, "open", true);
311 312 313
      this.currRow = {
        transportType: "1",
      };
huhaiqing's avatar
huhaiqing committed
314 315 316 317 318 319
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      const id = row.id;
      getbox(id).then((response) => {
        this.currRow = response.data;
320 321 322
        this.$set(this.dialogCfg, "title", "修改出货");
        this.$set(this.dialogCfg, "dialogType", "edit");
        this.$set(this.dialogCfg, "width", "600px");
huhaiqing's avatar
huhaiqing committed
323
        this.$set(this.dialogCfg, "open", true);
huhaiqing's avatar
huhaiqing committed
324 325 326 327 328
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      this.$modal
huhaiqing's avatar
huhaiqing committed
329
        .confirm(`是否确认删除出货编号为 ${row.selfNo} 的数据项?`)
huhaiqing's avatar
huhaiqing committed
330
        .then(function () {
huhaiqing's avatar
huhaiqing committed
331
          return deletebox(row.id);
huhaiqing's avatar
huhaiqing committed
332 333
        })
        .then(() => {
wh's avatar
wh committed
334 335
          this.getList();
          this.$modal.msgSuccess("删除成功");
huhaiqing's avatar
huhaiqing committed
336 337 338 339 340 341 342
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = { ...this.queryParams };
huhaiqing's avatar
huhaiqing committed
343
      params.page = undefined;
huhaiqing's avatar
huhaiqing committed
344 345 346 347 348 349
      params.pageSize = undefined;
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
      // 执行导出
      this.$modal
        .confirm("是否确认导出所有出货数据项?")
        .then(() => {
wh's avatar
wh committed
350
          this.exportLoading = true;
wh's avatar
wh committed
351
          return exportboxExcel(params);
huhaiqing's avatar
huhaiqing committed
352 353
        })
        .then((response) => {
huhaiqing's avatar
huhaiqing committed
354
          this.$download.excel(response, "海运管理.xls");
wh's avatar
wh committed
355
          this.exportLoading = false;
huhaiqing's avatar
huhaiqing committed
356 357 358 359 360
        })
        .catch(() => {});
    },
    /* 关闭弹窗 */
    closeDialog(type) {
361
      this.$set(this.dialogCfg, "open", false);
huhaiqing's avatar
huhaiqing committed
362 363 364 365 366 367
      if (type === "add" || type === "edit") {
        this.getList();
      }
    },
    /** 查看按钮操作 */
    handleCommand(row, command) {
huhaiqing's avatar
huhaiqing committed
368 369
      this.$set(this.dialogCfg, "fullscreen", false);

huhaiqing's avatar
huhaiqing committed
370 371 372 373 374 375 376 377 378
      switch (command) {
        case "sea":
          this.$router.push("/boxSea/shippingSea/" + row.id);
          break;

        case "edit":
          this.handleUpdate(row);
          break;

huhaiqing's avatar
huhaiqing committed
379 380 381 382 383 384 385 386
        case "delete":
          this.handleDelete(row);
          break;

        case "detail":
          this.$router.push("/boxSea/query/" + row.id);
          break;

387 388
        case "editLadingBill":
          const cabinetLabel = this.getCabinetName(row.cabinetId);
huhaiqing's avatar
huhaiqing committed
389 390 391
          const title = `查看提单 ${row.selfNo ?? ""} 柜号:${
            row.cubNo ?? ""
          } 柜型:${cabinetLabel}`;
392
          this.$set(this.dialogCfg, "title", title);
huhaiqing's avatar
huhaiqing committed
393
          this.$set(this.dialogCfg, "fullscreen", true);
huhaiqing's avatar
huhaiqing committed
394 395 396
          break;

        case "cost":
397
          this.$set(this.dialogCfg, "title", "费用登记");
huhaiqing's avatar
huhaiqing committed
398
          break;
399

huhaiqing's avatar
huhaiqing committed
400
        case "error":
401
          this.$set(this.dialogCfg, "title", "异常登记");
huhaiqing's avatar
huhaiqing committed
402
          break;
huhaiqing's avatar
huhaiqing committed
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427

        case "downloadPreloadGoodsList":
          downloadFile(
            command,
            { shipmentId: row.id },
            `预装单(${row.selfNo}).xlsx`,
            "xlsx"
          );
          break;
        case "downloadLoadGoodsList":
          downloadFile(
            command,
            { shipmentId: row.id },
            `已装单(${row.selfNo}).xlsx`,
            "xlsx"
          );
          break;
        case "downloadReceivableList":
          downloadFile(
            command,
            { shipmentId: row.id },
            `应收汇总表(${row.selfNo}).xlsx`,
            "xlsx"
          );
          break;
428
        case "zipDownload":
429 430 431
          downloadFile(
            command,
            { shipmentId: row.id },
432 433
            `提货单(${row.selfNo}).zip`,
            "zip"
434 435
          );
          break;
436
        case "downloadAgentListFiles":
437
        case "downloadSoncapFiles":
438 439
        case "downloadLadingCopy":
          downloadFileByUrl(command, { shipmentId: row.id });
440
          break;
huhaiqing's avatar
huhaiqing committed
441
      }
442

huhaiqing's avatar
huhaiqing committed
443 444 445 446 447
      if (["editLadingBill", "cost", "error"].includes(command)) {
        this.currRow = row;
        this.$set(this.dialogCfg, "dialogType", command);
        this.$set(this.dialogCfg, "width", "600px");
        this.$set(this.dialogCfg, "open", true);
huhaiqing's avatar
huhaiqing committed
448
      }
huhaiqing's avatar
huhaiqing committed
449
    },
huhaiqing's avatar
huhaiqing committed
450 451 452 453 454
    /* 分页 */
    pageChange(page) {
      this.pageParam.page = page;
      this.getList();
    },
huhaiqing's avatar
huhaiqing committed
455 456 457
  },
};
</script>