indexSea.vue 21.4 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
      <el-form-item :label="$t('运输方式')" prop="transportType">
        <el-select v-model="queryParams.transportType" :placeholder="$t('请选择运输方式')" clearable size="small">
          <el-option v-for="dict in transportTypes" :key="dict.value" :label="$l(dict, 'label')" :value="dict.value" />
huhaiqing's avatar
huhaiqing committed
9 10 11
        </el-select>
      </el-form-item>

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

huhaiqing's avatar
huhaiqing committed
24
      <el-form-item :label="$t('始发地')" prop="startWarehouseId">
huhaiqing's avatar
huhaiqing committed
25
        <el-select v-model="queryParams.startWarehouseId" :placeholder="$t('请选择始发地')" clearable>
26
          <el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :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

huhaiqing's avatar
huhaiqing committed
30
      <el-form-item :label="$t('目的地')" prop="destWarehouseId">
huhaiqing's avatar
huhaiqing committed
31
        <el-select v-model="queryParams.destWarehouseId" :placeholder="$t('请选择目的地')" clearable>
32
          <el-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :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
      <el-form-item label="" prop="dateType">
huhaiqing's avatar
huhaiqing committed
37 38
        <el-select v-model="queryParams.dateType" :placeholder="$t('请选择时间类型')" clearable size="small">
          <el-option v-for="item in dateTypes" :key="item.value" :label="$l(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="" prop="dateRangeCreateTime">
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="$t('开始日期')" :end-placeholder="$t('结束日期')" clearable />
wh's avatar
wh committed
44
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
45

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

52 53
      <el-form-item :label="$t('国家')" prop="countryId">
        <el-select v-model="queryParams.countryId" :placeholder="$t('请选择国家')" clearable size="small">
54
          <el-option v-for="item in countryList" :key="item.id" :label="$l(item, 'title')" :value="item.id">
huhaiqing's avatar
huhaiqing committed
55
          </el-option>
wanglianghe's avatar
wanglianghe committed
56 57 58
        </el-select>
      </el-form-item>

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

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
zhoutong's avatar
zhoutong committed
68
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['shipment:box:create']">{{$t('出货安排')}}
wh's avatar
wh committed
69
        </el-button>
wh's avatar
wh committed
70 71
      </el-col>
      <el-col :span="1.5">
zhoutong's avatar
zhoutong committed
72
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" v-hasPermi="['shipment:box:export']">{{$t('导出')}}
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
      <el-table-column :label="$t('自编号')" align="center" prop="selfNo">
huhaiqing's avatar
huhaiqing committed
81
        <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 86
      <el-table-column :label="$t('柜号')" align="center" prop="cubNo" />
      <el-table-column :label="$t('柜型')" align="center" prop="cabinetId">
wanglianghe's avatar
wanglianghe committed
87 88
        <template slot-scope="scope">
          <span>{{ getCabinetName(scope.row.cabinetId) }}</span>
wh's avatar
wh committed
89 90
        </template>
      </el-table-column>
huhaiqing's avatar
huhaiqing committed
91
      <el-table-column :label="$t('运输方式')" 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
      <el-table-column :label="$t('方数(预装/已装)')" align="center" prop="">
huhaiqing's avatar
huhaiqing committed
98 99
        <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
      <el-table-column :label="$t('重量(预装/已装)')" align="center" prop="weight">
huhaiqing's avatar
huhaiqing committed
103 104 105 106 107
        <template slot-scope="{row}">
          {{row.boxStatistics.weight}}/{{row.boxStatistics.loadWeight}}
        </template>
      </el-table-column>

huhaiqing's avatar
huhaiqing committed
108
      <el-table-column :label="$t('状态')" align="center" prop="shipmentStatusText" />
huhaiqing's avatar
huhaiqing committed
109

huhaiqing's avatar
huhaiqing committed
110
      <el-table-column :label="$t('日期')" 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="$t('操作')" align="center" class-name="small-padding fixed-width" width="200px">
wh's avatar
wh committed
116
        <template slot-scope="scope">
117
          <el-dropdown trigger="click" v-hasPermi="['shipment:box:action:sea','shipment:box:action:error','shipment:box:action:cost','shipment:box:action:editLadingBill']" @command="(command)=>handleCommand(scope.row, command)" style="marginRight:10px;">
118
            <el-button type="primary">
huhaiqing's avatar
huhaiqing committed
119
              {{$t('操作')}}<i class="el-icon-arrow-down el-icon--right"></i>
120 121
            </el-button>
            <el-dropdown-menu slot="dropdown">
zhoutong's avatar
zhoutong committed
122
              <el-dropdown-item :disabled="scope.row.prStatus>21" command="edit" v-hasPermi="['shipment:box:update']">{{$t('编辑')}}</el-dropdown-item>
123 124 125
              <el-dropdown-item  command="sea" v-hasPermi="['shipment:box:action:sea']">{{$t('操作-海运')}}</el-dropdown-item>
              <el-dropdown-item command="error" v-hasPermi="['shipment:box:action:error']">{{$t('异常登记')}}</el-dropdown-item>
              <el-dropdown-item command="cost" v-hasPermi="['shipment:box:action:cost']">{{$t('费用登记')}}</el-dropdown-item>
huhaiqing's avatar
huhaiqing committed
126
              <!-- <el-dropdown-item command="delete">{{$t('删除')}}</el-dropdown-item> -->
127
              <el-dropdown-item :disabled="scope.row.ldStatus<46" command="editLadingBill" v-hasPermi="['shipment:box:action:editLadingBill']">{{$t('编辑提货单')}}</el-dropdown-item>
128 129
            </el-dropdown-menu>
          </el-dropdown>
130
          <el-dropdown trigger="click" @command="(command)=>handleCommand(scope.row, command)" v-hasPermi="['shipment:box:download:downloadPreloadGoodsList','shipment:box:download:downloadLoadGoodsList','shipment:box:download:downloadReceivableList','shipment:box:download:downloadAgentListFiles','shipment:box:download:downloadSoncapFiles','shipment:box:download:zipDownload','shipment:box:download:downloadLadingCopy']">
huhaiqing's avatar
huhaiqing committed
131
            <el-button type="primary">
132
              {{$t('下载')}}<i class="el-icon-arrow-down el-icon--right"></i>
huhaiqing's avatar
huhaiqing committed
133 134
            </el-button>
            <el-dropdown-menu slot="dropdown">
135 136 137 138 139 140 141
              <el-dropdown-item command="downloadPreloadGoodsList" v-hasPermi="['shipment:box:download:downloadPreloadGoodsList']">{{$t('预装单')}}</el-dropdown-item>
              <el-dropdown-item command="downloadLoadGoodsList" v-hasPermi="['shipment:box:download:downloadLoadGoodsList']">{{$t('已装单')}}</el-dropdown-item>
              <el-dropdown-item command="downloadReceivableList" v-hasPermi="['shipment:box:download:downloadReceivableList']">{{$t('应收汇总表')}}</el-dropdown-item>
              <el-dropdown-item command="downloadAgentListFiles" v-hasPermi="['shipment:box:download:downloadAgentListFiles']">agent list</el-dropdown-item>
              <el-dropdown-item command="downloadSoncapFiles" v-hasPermi="['shipment:box:download:downloadSoncapFiles']">soncap</el-dropdown-item>
              <el-dropdown-item command="zipDownload" v-hasPermi="['shipment:box:download:zipDownload']">{{$t('提货单')}}</el-dropdown-item>
              <el-dropdown-item command="downloadLadingCopy" v-hasPermi="['shipment:box:download:downloadLadingCopy']">{{$t('提单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>
    <!-- 分页组件 -->
148
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows" @pagination="getList" />
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
      <template v-if="dialogCfg.dialogType === 'error'">
159
        <regError v-if="dialogCfg.open" @closeDialog="closeDialog" :shipmentObj="currRow" :allUsers="allUsers" />
160 161
      </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>
164 165
      <template v-if="dialogCfg.dialogType === 'notice'">
        <div class="notice-dialog">
166
          <div class="notice-title">{{$t('您有{cnt}个待处理出货操作,请尽快前往处理', {cnt: noticeList.length})}}</div>
167
          <el-table :data="noticeList" height="500px" border>
huhaiqing's avatar
huhaiqing committed
168
            <el-table-column :label="$t('自编号')" align="center" prop="selfNo" />
huhaiqing's avatar
huhaiqing committed
169
            <el-table-column :label="$t('类型')" align="center">
170 171 172 173
              <template slot-scope="scope">
                <dict-tag :type="DICT_TYPE.BOX_SHIPPING_NOTICE_TYPE" :value="String(scope.row.noticeType)" />
              </template>
            </el-table-column>
huhaiqing's avatar
huhaiqing committed
174
            <el-table-column :label="$t('预计时间')" align="center">
175 176 177 178
              <template slot-scope="scope">
                {{formatDate(scope.row.createTime)}}
              </template>
            </el-table-column>
huhaiqing's avatar
huhaiqing committed
179
            <el-table-column :label="$t('操作')" align="center" width="80">
180
              <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
181
                <el-button type="text" @click="handleCommand(scope.row, 'handle')">{{$t('处理')}}</el-button>
182 183 184 185
              </template>
            </el-table-column>
          </el-table>
          <el-row class="operate-button">
186
            <el-button type="primary" @click="closeDialog">{{$t('关闭窗口')}}</el-button>
187 188 189 190
          </el-row>
        </div>

      </template>
wh's avatar
wh committed
191 192 193 194 195
    </el-dialog>
  </div>
</template>

<script>
196 197 198 199 200
import {
  deletebox,
  getbox,
  getboxPage,
  exportboxExcel,
201
  getNoticeList,
202
} from "@/api/ecw/box";
203 204 205 206 207
import {
  downloadFile,
  downloadFileByUrl,
  formatDate,
} from "./shippingSea/utils";
huhaiqing's avatar
huhaiqing committed
208 209
import { getCabinetPage } from "@/api/ecw/cabinet";
import { getWarehouseList } from "@/api/ecw/warehouse";
huhaiqing's avatar
huhaiqing committed
210
import { getListTree } from "@/api/ecw/region";
huhaiqing's avatar
huhaiqing committed
211 212 213
import costForm from "./costForm.vue";
import regError from "./regError.vue";
import editForm from "./editForm.vue";
huhaiqing's avatar
huhaiqing committed
214
import ladingBill from "./ladingBill/index.vue";
huhaiqing's avatar
huhaiqing committed
215
import { listUser } from "@/api/system/user";
huhaiqing's avatar
huhaiqing committed
216 217

export default {
huhaiqing's avatar
huhaiqing committed
218
  name: "EcwBoxIndexsea",
huhaiqing's avatar
huhaiqing committed
219 220 221 222
  components: {
    costForm,
    regError,
    editForm,
223
    ladingBill,
huhaiqing's avatar
huhaiqing committed
224 225 226 227
  },
  data() {
    return {
      dateTypes: [
228 229 230 231 232
        { value: "1", label: this.$t("预装时间") },
        { value: "2", label: this.$t("装柜时间") },
        { value: "3", label: this.$t("起运时间") },
        { value: "4", label: this.$t("到港时间") },
        { value: "5", label: this.$t("清关时间") },
wanglianghe's avatar
wanglianghe committed
233
        { value: "6", label: this.$t("卸柜时间") },
huhaiqing's avatar
huhaiqing committed
234 235 236 237 238 239 240 241 242 243 244 245 246
      ],
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 出货列表
      list: [],
      // 弹出层标题
      // 弹出类型
247 248 249 250 251 252
      dialogCfg: {
        title: "",
        dialogType: "",
        width: "600px",
        // 是否显示弹出层
        open: false,
huhaiqing's avatar
huhaiqing committed
253
        fullscreen: false,
254
      },
huhaiqing's avatar
huhaiqing committed
255 256 257 258 259
      // 当前行
      currRow: {},
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
huhaiqing's avatar
huhaiqing committed
260
        page: 1,
261
        rows: 10,
huhaiqing's avatar
huhaiqing committed
262 263 264 265
      },
      cabinetList: [],
      warehouseList: [],
      transportTypes: [],
266
      // 国家信息列表
huhaiqing's avatar
huhaiqing committed
267
      countryList: [],
268 269
      // 通知列表
      noticeList: [],
huhaiqing's avatar
huhaiqing committed
270
      allUsers: [],
huhaiqing's avatar
huhaiqing committed
271 272 273 274 275 276 277
    };
  },
  computed: {
    exportWarehouseList() {
      return this.warehouseList.filter(
        (item) => item.tradeType == "2" || item.type == "3"
      );
278
    },
huhaiqing's avatar
huhaiqing committed
279 280 281 282
    importWarehouseList() {
      return this.warehouseList.filter(
        (item) => item.tradeType == "1" || item.type == "3"
      );
wh's avatar
wh committed
283
    },
huhaiqing's avatar
huhaiqing committed
284 285 286 287 288 289
    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
290 291
          }
        }
huhaiqing's avatar
huhaiqing committed
292
      };
wh's avatar
wh committed
293
    },
huhaiqing's avatar
huhaiqing committed
294 295 296 297 298 299 300 301 302 303
  },
  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
304
    this.getCountryList();
305
    this.queryNotice();
huhaiqing's avatar
huhaiqing committed
306 307 308 309 310
    // 用户
    listUser({ pageNo: "1", pageSize: "10000" }).then((res) => {
      const { data } = res;
      this.allUsers = data.list ?? [];
    });
huhaiqing's avatar
huhaiqing committed
311 312
  },
  methods: {
313 314
    formatDate,
    queryNotice() {
huhaiqing's avatar
huhaiqing committed
315 316 317
      getNoticeList({
        transportTypeList: this.transportTypes.map((item) => item.value),
      }).then((res) => {
318 319 320
        const { data } = res;
        this.noticeList = data ?? [];
        if (data.length) {
321
          this.$set(this.dialogCfg, "title", this.$t("出货操作提醒"));
322 323 324 325 326 327
          this.$set(this.dialogCfg, "dialogType", "notice");
          this.$set(this.dialogCfg, "width", "650px");
          this.$set(this.dialogCfg, "open", true);
        }
      });
    },
huhaiqing's avatar
huhaiqing committed
328 329 330 331 332 333
    /* 国家 */
    getCountryList() {
      getListTree({ treeType: 1 }).then((response) => {
        this.countryList = response.data;
      });
    },
huhaiqing's avatar
huhaiqing committed
334 335 336 337 338 339 340 341 342 343 344 345
    /** 查询列表 */
    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
346
      });
huhaiqing's avatar
huhaiqing committed
347 348 349
    },
    /** 搜索按钮操作 */
    handleQuery() {
huhaiqing's avatar
huhaiqing committed
350
      this.queryParams.page = 1;
wh's avatar
wh committed
351
      this.getList();
wh's avatar
wh committed
352
    },
huhaiqing's avatar
huhaiqing committed
353 354
    /** 重置按钮操作 */
    resetQuery() {
355
      this.queryParams = {};
huhaiqing's avatar
huhaiqing committed
356 357 358 359
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
360 361 362
    resetForm() {
      this.$refs["queryForm"].resetFields();
    },
huhaiqing's avatar
huhaiqing committed
363 364
    /** 新增按钮操作 */
    handleAdd() {
365
      this.$set(this.dialogCfg, "title", this.$t("添加出货"));
366 367
      this.$set(this.dialogCfg, "dialogType", "add");
      this.$set(this.dialogCfg, "width", "600px");
huhaiqing's avatar
huhaiqing committed
368 369
      this.$set(this.dialogCfg, "fullscreen", false);
      this.$set(this.dialogCfg, "open", true);
370 371 372
      this.currRow = {
        transportType: "1",
      };
huhaiqing's avatar
huhaiqing committed
373 374 375 376 377 378
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      const id = row.id;
      getbox(id).then((response) => {
        this.currRow = response.data;
379
        this.$set(this.dialogCfg, "title", this.$t("修改出货"));
380 381
        this.$set(this.dialogCfg, "dialogType", "edit");
        this.$set(this.dialogCfg, "width", "600px");
huhaiqing's avatar
huhaiqing committed
382
        this.$set(this.dialogCfg, "open", true);
huhaiqing's avatar
huhaiqing committed
383 384 385 386 387
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      this.$modal
huhaiqing's avatar
huhaiqing committed
388 389 390
        .confirm(
          this.$t("是否确认删除出货编号为 {no} 的数据项?", { no: row.selfNo })
        )
huhaiqing's avatar
huhaiqing committed
391
        .then(function () {
huhaiqing's avatar
huhaiqing committed
392
          return deletebox(row.id);
huhaiqing's avatar
huhaiqing committed
393 394
        })
        .then(() => {
wh's avatar
wh committed
395
          this.getList();
396
          this.$modal.msgSuccess(this.$t("删除成功"));
huhaiqing's avatar
huhaiqing committed
397 398 399 400 401 402 403
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = { ...this.queryParams };
huhaiqing's avatar
huhaiqing committed
404
      params.page = undefined;
huhaiqing's avatar
huhaiqing committed
405
      params.pageSize = undefined;
huhaiqing's avatar
huhaiqing committed
406
      params.transportTypeList = ["1", "2"];
huhaiqing's avatar
huhaiqing committed
407 408 409
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
      // 执行导出
      this.$modal
410
        .confirm(this.$t("是否确认导出所有出货数据项?"))
huhaiqing's avatar
huhaiqing committed
411
        .then(() => {
wh's avatar
wh committed
412
          this.exportLoading = true;
wh's avatar
wh committed
413
          return exportboxExcel(params);
huhaiqing's avatar
huhaiqing committed
414 415
        })
        .then((response) => {
416
          this.$download.excel(response, this.$t("海运管理") + ".xls");
wh's avatar
wh committed
417
          this.exportLoading = false;
huhaiqing's avatar
huhaiqing committed
418 419 420 421 422
        })
        .catch(() => {});
    },
    /* 关闭弹窗 */
    closeDialog(type) {
423
      this.$set(this.dialogCfg, "open", false);
huhaiqing's avatar
huhaiqing committed
424 425 426 427 428 429
      if (type === "add" || type === "edit") {
        this.getList();
      }
    },
    /** 查看按钮操作 */
    handleCommand(row, command) {
huhaiqing's avatar
huhaiqing committed
430 431
      this.$set(this.dialogCfg, "fullscreen", false);

huhaiqing's avatar
huhaiqing committed
432 433 434 435 436 437 438 439 440
      switch (command) {
        case "sea":
          this.$router.push("/boxSea/shippingSea/" + row.id);
          break;

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

huhaiqing's avatar
huhaiqing committed
441 442 443 444 445 446 447 448
        case "delete":
          this.handleDelete(row);
          break;

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

449 450
        case "editLadingBill":
          const cabinetLabel = this.getCabinetName(row.cabinetId);
huhaiqing's avatar
huhaiqing committed
451 452 453 454 455 456 457 458
          const title = this.$t(
            "查看提单 {selfNo} 柜号:{cubNo} 柜型:{cabinetLabel}",
            {
              selfNo: row.selfNo,
              cubNo: row.cubNo,
              cabinetLabel: cabinetLabel,
            }
          );
459
          this.$set(this.dialogCfg, "title", title);
huhaiqing's avatar
huhaiqing committed
460
          this.$set(this.dialogCfg, "fullscreen", true);
huhaiqing's avatar
huhaiqing committed
461 462 463
          break;

        case "cost":
464
          this.$set(this.dialogCfg, "title", this.$t("费用登记"));
huhaiqing's avatar
huhaiqing committed
465
          break;
466

huhaiqing's avatar
huhaiqing committed
467
        case "error":
468
          this.$set(this.dialogCfg, "title", this.$t("异常登记"));
huhaiqing's avatar
huhaiqing committed
469
          break;
huhaiqing's avatar
huhaiqing committed
470 471 472 473 474

        case "downloadPreloadGoodsList":
          downloadFile(
            command,
            { shipmentId: row.id },
huhaiqing's avatar
huhaiqing committed
475
            this.$t("预装单") + `(${row.selfNo}).xlsx`,
huhaiqing's avatar
huhaiqing committed
476 477 478 479 480 481 482
            "xlsx"
          );
          break;
        case "downloadLoadGoodsList":
          downloadFile(
            command,
            { shipmentId: row.id },
huhaiqing's avatar
huhaiqing committed
483
            this.$t("已装单") + `(${row.selfNo}).xlsx`,
huhaiqing's avatar
huhaiqing committed
484 485 486 487 488 489 490
            "xlsx"
          );
          break;
        case "downloadReceivableList":
          downloadFile(
            command,
            { shipmentId: row.id },
huhaiqing's avatar
huhaiqing committed
491
            this.$t("应收汇总表") + `(${row.selfNo}).xlsx`,
huhaiqing's avatar
huhaiqing committed
492 493 494
            "xlsx"
          );
          break;
495
        case "zipDownload":
496 497 498
          downloadFile(
            command,
            { shipmentId: row.id },
499
            this.$t("提货单") + `(${row.selfNo}).zip`,
500
            "zip"
501 502
          );
          break;
503
        case "downloadAgentListFiles":
504
        case "downloadSoncapFiles":
505 506
        case "downloadLadingCopy":
          downloadFileByUrl(command, { shipmentId: row.id });
507
          break;
huhaiqing's avatar
huhaiqing committed
508 509 510 511 512 513 514 515 516 517
        case "handle":
          const { noticeType } = row;
          if ([1, 2, 3, 4, 8].includes(noticeType)) {
            this.$router.push("/boxSea/shippingSea/" + row.id);
          }
          if ([5, 6, 7].includes(noticeType)) {
            this.$router.push("/boxSea/query/" + row.id);
          }
          this.closeDialog();
          break;
huhaiqing's avatar
huhaiqing committed
518
      }
519

huhaiqing's avatar
huhaiqing committed
520 521 522 523 524
      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
525
      }
huhaiqing's avatar
huhaiqing committed
526
    },
huhaiqing's avatar
huhaiqing committed
527 528 529 530 531
    /* 分页 */
    pageChange(page) {
      this.pageParam.page = page;
      this.getList();
    },
huhaiqing's avatar
huhaiqing committed
532 533 534
  },
};
</script>
535 536 537 538 539 540 541 542 543 544 545 546 547 548

<style lang="scss" scoped>
.notice-dialog {
  ::v-deep .notice-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
  }
  ::v-deep .operate-button {
    margin-top: 10px;
    text-align: center;
  }
}
</style>