indexSea.vue 23.1 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>

59 60 61 62 63 64 65 66
      <el-form-item :label="$t('提单制作')" prop="ladingBillStatus">
        <el-select v-model="queryParams.ladingBillStatus" :placeholder="$t('请选择提单制作状态')" clearable size="small">
          <el-option v-for="(item,index) in ladingBillStatusData" :key="index" :label="item" :value="index">
          </el-option>
        </el-select>
      </el-form-item>


wh's avatar
wh committed
67
      <el-form-item>
huhaiqing's avatar
huhaiqing committed
68 69
        <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
70 71 72 73 74 75
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
zhoutong's avatar
zhoutong committed
76
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['shipment:box:create']">{{$t('出货安排')}}
wh's avatar
wh committed
77
        </el-button>
wh's avatar
wh committed
78 79
      </el-col>
      <el-col :span="1.5">
zhoutong's avatar
zhoutong committed
80
        <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
81
        </el-button>
wh's avatar
wh committed
82 83 84 85 86 87
      </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
88
      <el-table-column :label="$t('自编号')" align="center" prop="selfNo">
huhaiqing's avatar
huhaiqing committed
89
        <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
90
          <a href="javascript:void(0)" @click="handleCommand(scope.row, 'detail')">{{ scope.row.selfNo }}</a>
huhaiqing's avatar
huhaiqing committed
91 92
        </template>
      </el-table-column>
huhaiqing's avatar
huhaiqing committed
93 94
      <el-table-column :label="$t('柜号')" align="center" prop="cubNo" />
      <el-table-column :label="$t('柜型')" align="center" prop="cabinetId">
wanglianghe's avatar
wanglianghe committed
95 96
        <template slot-scope="scope">
          <span>{{ getCabinetName(scope.row.cabinetId) }}</span>
wh's avatar
wh committed
97 98
        </template>
      </el-table-column>
huhaiqing's avatar
huhaiqing committed
99
      <el-table-column :label="$t('运输方式')" align="center" prop="transportType">
wh's avatar
wh committed
100
        <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
101
          <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="scope.row.transportType" />
wh's avatar
wh committed
102 103
        </template>
      </el-table-column>
wanglianghe's avatar
wanglianghe committed
104

huhaiqing's avatar
huhaiqing committed
105
      <el-table-column :label="$t('方数(预装/已装)')" align="center" prop="">
huhaiqing's avatar
huhaiqing committed
106 107
        <template slot-scope="{row}">
          {{row.boxStatistics.volume}}/{{row.boxStatistics.loadVolume}}
wanglianghe's avatar
wanglianghe committed
108 109
        </template>
      </el-table-column>
huhaiqing's avatar
huhaiqing committed
110
      <el-table-column :label="$t('重量(预装/已装)')" align="center" prop="weight">
huhaiqing's avatar
huhaiqing committed
111 112 113 114 115
        <template slot-scope="{row}">
          {{row.boxStatistics.weight}}/{{row.boxStatistics.loadWeight}}
        </template>
      </el-table-column>

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

118 119 120 121 122 123 124
      <el-table-column :label="$t('提单状态')" align="center" prop="ladingBillStatus" width="180">
        <template slot-scope="scope">
          <span>{{ ladingBillStatusData[scope.row.ladingBillStatus] }}</span>
        </template>
      </el-table-column>


huhaiqing's avatar
huhaiqing committed
125
      <el-table-column :label="$t('日期')" align="center" prop="createTime" width="180">
huhaiqing's avatar
huhaiqing committed
126
        <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
127
          <span>{{ new Date(scope.row.createTime).format('yyyy-MM-dd hh:mm:ss') }}</span>
huhaiqing's avatar
huhaiqing committed
128
        </template>
wh's avatar
wh committed
129
      </el-table-column>
huhaiqing's avatar
huhaiqing committed
130
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width" width="200px">
wh's avatar
wh committed
131
        <template slot-scope="scope">
132
          <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;">
133
            <el-button type="primary">
huhaiqing's avatar
huhaiqing committed
134
              {{$t('操作')}}<i class="el-icon-arrow-down el-icon--right"></i>
135 136
            </el-button>
            <el-dropdown-menu slot="dropdown">
zhoutong's avatar
zhoutong committed
137
              <el-dropdown-item :disabled="scope.row.prStatus>21" command="edit" v-hasPermi="['shipment:box:update']">{{$t('编辑')}}</el-dropdown-item>
138 139 140
              <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
141
              <!-- <el-dropdown-item command="delete">{{$t('删除')}}</el-dropdown-item> -->
142
              <el-dropdown-item :disabled="scope.row.ldStatus<46" command="editLadingBill" v-hasPermi="['shipment:box:action:editLadingBill']">{{$t('编辑提货单')}}</el-dropdown-item>
143 144
            </el-dropdown-menu>
          </el-dropdown>
145
          <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
146
            <el-button type="primary">
147
              {{$t('下载')}}<i class="el-icon-arrow-down el-icon--right"></i>
huhaiqing's avatar
huhaiqing committed
148 149
            </el-button>
            <el-dropdown-menu slot="dropdown">
150 151 152 153 154 155 156
              <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
157 158
            </el-dropdown-menu>
          </el-dropdown>
wh's avatar
wh committed
159 160 161 162
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
163
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows" @pagination="getList" />
wh's avatar
wh committed
164 165

    <!-- 对话框(添加 / 修改) -->
huhaiqing's avatar
huhaiqing committed
166
    <el-dialog :title="dialogCfg.title" :visible.sync="dialogCfg.open" :width="dialogCfg.width" :fullscreen="dialogCfg.fullscreen" append-to-body class="shippingSea-dialog">
167 168
      <template v-if="dialogCfg.dialogType === 'edit' || dialogCfg.dialogType === 'add'">
        <editForm v-if="dialogCfg.open" @closeDialog="closeDialog" :shipmentObj="currRow" :warehouseList="warehouseList" :transportTypes="transportTypes" :cabinetList="cabinetList" />
169
      </template>
170 171
      <template v-if="dialogCfg.dialogType === 'cost'">
        <costForm v-if="dialogCfg.open" @closeDialog="closeDialog" :shipmentObj="currRow" />
172
      </template>
173
      <template v-if="dialogCfg.dialogType === 'error'">
174
        <regError v-if="dialogCfg.open" @closeDialog="closeDialog" :shipmentObj="currRow" :allUsers="allUsers" />
175 176
      </template>
      <template v-if="dialogCfg.dialogType === 'editLadingBill'">
huhaiqing's avatar
huhaiqing committed
177
        <ladingBill v-if="dialogCfg.open" @closeDialog="closeDialog" :shipmentObj="currRow" :getCabinetName="getCabinetName" />
huhaiqing's avatar
huhaiqing committed
178
      </template>
179 180
      <template v-if="dialogCfg.dialogType === 'notice'">
        <div class="notice-dialog">
181
          <div class="notice-title">{{$t('您有{cnt}个待处理出货操作,请尽快前往处理', {cnt: noticeList.length})}}</div>
182
          <el-table :data="noticeList" height="500px" border>
huhaiqing's avatar
huhaiqing committed
183
            <el-table-column :label="$t('自编号')" align="center" prop="selfNo" />
huhaiqing's avatar
huhaiqing committed
184
            <el-table-column :label="$t('类型')" align="center">
185 186 187 188
              <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
189
            <el-table-column :label="$t('预计时间')" align="center">
190 191 192 193
              <template slot-scope="scope">
                {{formatDate(scope.row.createTime)}}
              </template>
            </el-table-column>
huhaiqing's avatar
huhaiqing committed
194
            <el-table-column :label="$t('操作')" align="center" width="80">
195
              <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
196
                <el-button type="text" @click="handleCommand(scope.row, 'handle')">{{$t('处理')}}</el-button>
197 198 199 200
              </template>
            </el-table-column>
          </el-table>
          <el-row class="operate-button">
201
            <el-button type="primary" @click="closeDialog">{{$t('关闭窗口')}}</el-button>
202 203 204 205
          </el-row>
        </div>

      </template>
wh's avatar
wh committed
206 207 208 209 210
    </el-dialog>
  </div>
</template>

<script>
211
import {
212 213 214 215 216
  deletebox,
  getbox,
  getboxPage,
  exportboxExcel,
  getNoticeList, dealCustomsSplitNotify, exportPreloadGoodsList, zipDownload,
217
} from "@/api/ecw/box";
218 219 220 221 222
import {
  downloadFile,
  downloadFileByUrl,
  formatDate,
} from "./shippingSea/utils";
huhaiqing's avatar
huhaiqing committed
223 224
import { getCabinetPage } from "@/api/ecw/cabinet";
import { getWarehouseList } from "@/api/ecw/warehouse";
huhaiqing's avatar
huhaiqing committed
225
import { getListTree } from "@/api/ecw/region";
huhaiqing's avatar
huhaiqing committed
226 227 228
import costForm from "./costForm.vue";
import regError from "./regError.vue";
import editForm from "./editForm.vue";
huhaiqing's avatar
huhaiqing committed
229
import ladingBill from "./ladingBill/index.vue";
huhaiqing's avatar
huhaiqing committed
230
import { listUser } from "@/api/system/user";
huhaiqing's avatar
huhaiqing committed
231 232

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

huhaiqing's avatar
huhaiqing committed
452 453 454 455 456 457 458 459 460
      switch (command) {
        case "sea":
          this.$router.push("/boxSea/shippingSea/" + row.id);
          break;

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

huhaiqing's avatar
huhaiqing committed
461 462 463 464 465 466 467 468
        case "delete":
          this.handleDelete(row);
          break;

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

469 470
        case "editLadingBill":
          const cabinetLabel = this.getCabinetName(row.cabinetId);
huhaiqing's avatar
huhaiqing committed
471 472 473 474 475 476 477 478
          const title = this.$t(
            "查看提单 {selfNo} 柜号:{cubNo} 柜型:{cabinetLabel}",
            {
              selfNo: row.selfNo,
              cubNo: row.cubNo,
              cabinetLabel: cabinetLabel,
            }
          );
479
          this.$set(this.dialogCfg, "title", title);
huhaiqing's avatar
huhaiqing committed
480
          this.$set(this.dialogCfg, "fullscreen", true);
huhaiqing's avatar
huhaiqing committed
481 482 483
          break;

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

huhaiqing's avatar
huhaiqing committed
487
        case "error":
488
          this.$set(this.dialogCfg, "title", this.$t("异常登记"));
huhaiqing's avatar
huhaiqing committed
489
          break;
huhaiqing's avatar
huhaiqing committed
490 491

        case "downloadPreloadGoodsList":
492 493 494 495 496 497
          // downloadFile(
          //   command,
          //   { shipmentId: row.id },
          //   this.$t("预装单") + `(${row.selfNo}).xlsx`,
          //   "xlsx"
          // );
498
          this.exportExcel(exportPreloadGoodsList, { shipmentId: row.id }, this.$t("预装单") + `(${row.selfNo}).xlsx`)
huhaiqing's avatar
huhaiqing committed
499 500 501 502 503
          break;
        case "downloadLoadGoodsList":
          downloadFile(
            command,
            { shipmentId: row.id },
huhaiqing's avatar
huhaiqing committed
504
            this.$t("已装单") + `(${row.selfNo}).xlsx`,
huhaiqing's avatar
huhaiqing committed
505 506 507 508 509 510 511
            "xlsx"
          );
          break;
        case "downloadReceivableList":
          downloadFile(
            command,
            { shipmentId: row.id },
huhaiqing's avatar
huhaiqing committed
512
            this.$t("应收汇总表") + `(${row.selfNo}).xlsx`,
huhaiqing's avatar
huhaiqing committed
513 514 515
            "xlsx"
          );
          break;
516
        case "zipDownload":
517
         /* downloadFile(
518 519
            command,
            { shipmentId: row.id },
520
            this.$t("提货单") + `(${row.selfNo}).zip`,
521
            "zip"
522 523
          );*/
          this.exportExcel(zipDownload, { shipmentId: row.id }, this.$t("提货单") + `(${row.selfNo}).zip`)
524
          break;
525
        case "downloadAgentListFiles":
526
        case "downloadSoncapFiles":
527 528
        case "downloadLadingCopy":
          downloadFileByUrl(command, { shipmentId: row.id });
529
          break;
huhaiqing's avatar
huhaiqing committed
530 531 532 533 534 535 536 537
        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);
          }
538 539 540
          if([9].includes(noticeType)){
            await dealCustomsSplitNotify(row.notifyId)
          }
huhaiqing's avatar
huhaiqing committed
541 542
          this.closeDialog();
          break;
huhaiqing's avatar
huhaiqing committed
543
      }
544

huhaiqing's avatar
huhaiqing committed
545 546 547 548 549
      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
550
      }
huhaiqing's avatar
huhaiqing committed
551
    },
552 553 554 555 556 557 558 559 560 561 562 563 564 565
    // 通用导出函数
    exportExcel(func, params, fileName = null){
      this.exportLoading = true;
      func(params).then(res => {
        console.log({res})
        if(!fileName){
          fileName = this.$t('订单')
        }
        this.$message.success(this.$t('已加入导出队列,请稍后在下载日志中下载'))
        // this.$download.excel(res, fileName + '.xls');
      }).finally(() => {
        this.exportLoading = false
      })
    },
huhaiqing's avatar
huhaiqing committed
566 567 568 569 570
    /* 分页 */
    pageChange(page) {
      this.pageParam.page = page;
      this.getList();
    },
huhaiqing's avatar
huhaiqing committed
571 572 573
  },
};
</script>
574 575 576 577 578 579 580 581 582 583 584 585 586 587

<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>