indexFutureBox.vue 19.3 KB
Newer Older
TIAN.DESHENG's avatar
TIAN.DESHENG committed
1 2 3 4 5
<template>
  <div class="app-container">

    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
6 7
      <el-form-item :label="$t('运输方式')" prop="transportType">
        <!-- <el-select v-model="queryParams.transportType" :placeholder="$t('请选择运输方式')" clearable size="small">
TIAN.DESHENG's avatar
TIAN.DESHENG committed
8
          <el-option v-for="dict in transportTypes" :key="dict.value" :label="dict.label" :value="dict.value" />
9
        </el-select> -->
dragondean@qq.com's avatar
dragondean@qq.com committed
10
        <dict-selector :type="DICT_TYPE.TRANSPORT_TYPE" v-model="queryParams.transportType" clearable/>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
11
      </el-form-item>
12 13 14
      <el-form-item :label="$t('始发仓')" prop="startWarehouseId">
        <el-select v-model="queryParams.startWarehouseId" :placeholder="$t('请选择始发地')" clearable>
          <el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
15 16 17
        </el-select>
      </el-form-item>

18 19 20
      <el-form-item :label="$t('目的仓')" prop="destWarehouseId">
        <el-select v-model="queryParams.destWarehouseId" :placeholder="$t('请选择目的地')" clearable>
          <el-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
21 22
        </el-select>
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
23

TIAN.DESHENG's avatar
TIAN.DESHENG committed
24
      <el-form-item>
25 26
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
27 28 29 30 31 32 33
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
34
                   v-hasPermi="['ecw:future-box:create']">{{$t('新建计划')}}</el-button>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
35
      </el-col>
dragondean@qq.com's avatar
dragondean@qq.com committed
36
      <!-- <el-col :span="1.5">
TIAN.DESHENG's avatar
TIAN.DESHENG committed
37
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
38
                   v-hasPermi="['ecw:future-box:export']">{{$t('导出')}}</el-button>
dragondean@qq.com's avatar
dragondean@qq.com committed
39
      </el-col> -->
TIAN.DESHENG's avatar
TIAN.DESHENG committed
40 41 42 43 44
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
45 46 47 48 49 50 51 52 53 54 55 56
      <el-table-column :label="$t('序号')" align="center" prop="id" />
      <el-table-column :label="$t('始发地')" align="center" prop="startWarehouse">
        <template slot-scope="{row}">
          {{getExportWarehouseName(row.startWarehouseId)}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('目的地')" align="center" prop="destWarehouse" >
        <template slot-scope="{row}">
          {{getImportWarehouseName(row.destWarehouseId)}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('运输方式')" align="center" prop="transportType">
TIAN.DESHENG's avatar
TIAN.DESHENG committed
57 58 59 60
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="scope.row.transportType" />
        </template>
      </el-table-column>
61 62 63 64 65
      <el-table-column :label="$t('出货渠道')" align="center" prop="shippingChannelId">
        <template slot-scope="{row}">
          {{getShipChannelName(row.shippingChannelId)}}
        </template>
      </el-table-column>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
66
      <el-table-column :label="$t('待入仓订单方数')" align="center" prop="readyWarehousingNumber">
67 68 69 70
        <template slot-scope="{row}">
          {{row.readyWarehousingNumber  || 0}}
        </template>
      </el-table-column>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
71
      <el-table-column :label="$t('已入仓订单方数')" align="center" prop="warehousedNumber">
72 73 74 75
        <template slot-scope="{row}">
          {{row.warehousedNumber  || 0}}
        </template>
      </el-table-column>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
76 77
       <el-table-column :label="$t('异常订单方数')" align="center" prop="exceptionNumber">
        <template slot-scope="{row}">
TIAN.DESHENG's avatar
TIAN.DESHENG committed
78
          {{row.exceptionNumber || 0}}
TIAN.DESHENG's avatar
TIAN.DESHENG committed
79 80 81 82 83 84 85 86
        </template>
      </el-table-column>
      <el-table-column :label="$t('待排单订单方数')" align="center" prop="warehousingNumber">
        <template slot-scope="{row}">
          {{row.warehousingNumber  || 0}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('自单代报订单方数')" align="center" prop="orderReportNumber" >
87
        <template slot-scope="{row}">
TIAN.DESHENG's avatar
TIAN.DESHENG committed
88
          {{row.orderReportNumber  || 0}}
89 90 91 92 93 94 95 96
        </template>
      </el-table-column>
      <el-table-column :label="$t('已装柜方数')" align="center" prop="loadingNumber" >
        <template slot-scope="{row}">
          {{row.loadingNumber  || 0}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('创建时间')" align="center" prop="createTime" width="180">
TIAN.DESHENG's avatar
TIAN.DESHENG committed
97 98 99 100
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
101 102
      <el-table-column :label="$t('未来天数')" align="center" prop="futureNumber" />
      <el-table-column :label="$t('计划货柜')" align="center" prop="gpNumber">
TIAN.DESHENG's avatar
TIAN.DESHENG committed
103
        <template slot-scope="{row}">
104 105
          <div>{{row.gpNumber}}个40GP</div>
          <div>{{row.hqNumber}}个40HQ</div>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
106 107
        </template>
      </el-table-column>
108 109 110 111
      <el-table-column :label="$t('未来计划方数')" align="center" prop="futurePlanNumber" />
      <el-table-column :label="$t('未来实际方数')" align="center" prop="actualNumber" />
      <el-table-column :label="$t('创建人')" align="center" prop="createName" />
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
TIAN.DESHENG's avatar
TIAN.DESHENG committed
112 113
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
114
                     v-hasPermi="['ecw:future-box:update']">{{$t('编辑')}}</el-button>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
115
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
116
                     v-hasPermi="['ecw:future-box:delete']">{{$t('删除')}}</el-button>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
117 118 119 120 121 122 123 124 125
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>

    <!-- 对话框(添加 / 修改) -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
huhaiqing's avatar
huhaiqing committed
126
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
127 128 129
         <el-form-item :label="$t('始发地')" prop="startWarehouseId">
          <el-select v-model="form.startWarehouseId" :placeholder="$t('请选择始发地')">
            <el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
130 131 132
          </el-select>
        </el-form-item>

133 134 135
        <el-form-item :label="$t('目的地')" prop="destWarehouseId">
          <el-select v-model="form.destWarehouseId" :placeholder="$t('请选择目的地')">
            <el-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
136 137
          </el-select>
        </el-form-item>
138
        <el-form-item :label="$t('运输方式')" prop="transportType">
139
          <dict-selector :type="DICT_TYPE.TRANSPORT_TYPE" v-model="form.transportType" form-type="radio" />
TIAN.DESHENG's avatar
TIAN.DESHENG committed
140
        </el-form-item>
141 142
        <el-form-item :label="$t('出货渠道')" prop="shippingChannelId" v-if="form.transportType == 3 || form.transportType == 4">
          <el-select v-model="form.shippingChannelId" :placeholder="$t('请选择出货渠道')">
143
            <el-option v-for="item in channelList" :label="$l(item, 'name')" :value="item.channelId" :key="item.channelId"></el-option>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
144 145
          </el-select>
        </el-form-item>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
146
        <el-form-item :label="$t('待入仓订单方数')">
147
          {{form.readyWarehousingNumber}} m³
TIAN.DESHENG's avatar
TIAN.DESHENG committed
148
        </el-form-item>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
149
        <el-form-item :label="$t('已入仓订单方数')">
150
          {{form.warehousedNumber}} m³
TIAN.DESHENG's avatar
TIAN.DESHENG committed
151
        </el-form-item>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
152 153 154 155
        <el-form-item :label="$t('异常订单方数')">
          {{form.exceptionNumber}} m³
        </el-form-item>
        <el-form-item :label="$t('待排单订单方数')">
156
          {{form.warehousingNumber}} m³
TIAN.DESHENG's avatar
TIAN.DESHENG committed
157
        </el-form-item>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
158 159 160
        <el-form-item :label="$t('自单代报订单方数')">
          {{form.orderReportNumber}} m³
        </el-form-item>
161
        <el-form-item :label="$t('已装柜方数')">
162
          {{form.loadingNumber}} m³
TIAN.DESHENG's avatar
TIAN.DESHENG committed
163
        </el-form-item>
huhaiqing's avatar
huhaiqing committed
164

165 166
        <el-form-item label="">
          <div>
167
            {{$t('未来')}} <el-input v-model="form.futureNumber" class="w-100"></el-input> {{$t('天货柜数')}}
168 169 170 171 172 173
          </div>
          <div class="mt-10">
            <el-input v-model="form.gpNumber" class="w-100" /> &times; 40GP
            <el-input v-model="form.hqNumber" class="w-100 ml-10" /> &times; 40HQ
          </div>
          <div class="mt-10">
174 175 176

            {{$t('未来{futureNumber}天计划方数',{futureNumber: form.futureNumber})}}:
            <el-input v-model="form.futurePlanNumber" class="w-100"></el-input>
177 178
          </div>
          <div class="mt-10">
179 180
            {{$t('未来{futureNumber}天实际方数',{futureNumber: form.futureNumber})}}:
            <el-input v-model="form.actualNumber" class="w-100"></el-input>
181
          </div>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
182 183 184
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
185 186
        <el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button>
        <el-button @click="cancel">{{$t('取消')}}</el-button>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
187 188 189 190 191 192
      </div>
    </el-dialog>
  </div>
</template>

<script>
TIAN.DESHENG's avatar
TIAN.DESHENG committed
193
import { createFutureBox, updateFutureBox, deleteFutureBox, getFutureBox, getFutureBoxPage, exportFutureBoxExcel, getBoxedVolume, getToBeWareHousedVolume,getWareHousedVolume,getExceptionVolume, getOrderReportVolume,getWarehousingVolume} from "@/api/ecw/futureBox";
TIAN.DESHENG's avatar
TIAN.DESHENG committed
194 195 196
import {getCabinetPage} from "@/api/ecw/cabinet";
import { getChannelList } from '@/api/ecw/channel';
import { getWarehouseList } from "@/api/ecw/warehouse"
197
import {getTradeCityList} from '@/api/ecw/region'
dragondean@qq.com's avatar
dragondean@qq.com committed
198
import Decimal from 'decimal.js'
TIAN.DESHENG's avatar
TIAN.DESHENG committed
199
export default {
huhaiqing's avatar
huhaiqing committed
200
  name: "indexFutureBox",
TIAN.DESHENG's avatar
TIAN.DESHENG committed
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
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 预定舱计划列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        startWarehouseId: null,
        destWarehouseId: null,
        transportType: null,
        readyWarehousingNumber: null,
        warehousedNumber: null,
        warehousingNumber: null,
TIAN.DESHENG's avatar
TIAN.DESHENG committed
230
        exceptionNumber: null,
TIAN.DESHENG's avatar
TIAN.DESHENG committed
231
        loadingNumber: null,
TIAN.DESHENG's avatar
TIAN.DESHENG committed
232
        orderReportNumber: null,
TIAN.DESHENG's avatar
TIAN.DESHENG committed
233 234 235 236 237 238 239 240 241
        futureNumber: null,
        gpNumber: null,
        hqNumber: null,
        futurePlanNumber: null,
        actualNumber: null,
        shippingChannelId: null,
        status: null,
      },
      // 表单参数
242
      form: {
huhaiqing's avatar
huhaiqing committed
243

244
      },
TIAN.DESHENG's avatar
TIAN.DESHENG committed
245 246
      // 表单校验
      rules: {
247
      },
huhaiqing's avatar
huhaiqing committed
248 249
      warehouseList: [],
      channelList: [],
250
      /* tradeCityList: [] */
TIAN.DESHENG's avatar
TIAN.DESHENG committed
251 252 253
    };
  },
  computed: {
254 255 256
    channels(){
      return this.$store.getters.channels
    },
TIAN.DESHENG's avatar
TIAN.DESHENG committed
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
    exportWarehouseList() {
      return this.warehouseList.filter(
        (item) => item.tradeType == "2" || item.type == "3"
      );
    },
    importWarehouseList() {
      return this.warehouseList.filter(
        (item) => item.tradeType == "1" || item.type == "3"
      );
    },
    getCabinetName() {
      return (cabinetId) => {
        for (let index in this.cabinetList) {
          let cabinetItem = this.cabinetList[index];
          if (cabinetItem.id == cabinetId) {
            return cabinetItem.name;
          }
        }
      };
    },
    getShipChannelName() {
        return shippingChannelId => {
          for (let index in this.channelList) {
            let channelItem = this.channelList[index];
            if (channelItem.channelId == shippingChannelId) {
282
              return this.$l(channelItem, 'name');
TIAN.DESHENG's avatar
TIAN.DESHENG committed
283 284 285 286
            }
          }
          return '/'
        }
287 288 289 290 291 292 293 294 295 296 297
    },
    getExportWarehouseName(){
      return id => {
        let warehouse = this.exportWarehouseList.find(item => item.id == id)
        return this.$l(warehouse, 'title')
      }
    },
    getImportWarehouseName(){
      return id => {
        let warehouse = this.importWarehouseList.find(item => item.id == id)
        return this.$l(warehouse, 'title')
huhaiqing's avatar
huhaiqing committed
298
      }
TIAN.DESHENG's avatar
TIAN.DESHENG committed
299
    }
300 301 302 303 304 305
    /* importCityList(){
      return this.tradeCityList.filter(item => item.type == 1 || item.tye == 3)
    },
    exportCityList(){
      return this.tradeCityList.filter(item => item.type == 2 || item.type == 3)
    } */
TIAN.DESHENG's avatar
TIAN.DESHENG committed
306 307
  },
  created() {
308 309 310 311
    /* getTradeCityList().then(res => {
      this.tradeCityList = res.data
    }) */

huhaiqing's avatar
huhaiqing committed
312 313
    // 查询渠道
    getChannelList().then((res) => (this.channelList = res.data));
314
    /* this.transportTypes = this.getDictDatas(
TIAN.DESHENG's avatar
TIAN.DESHENG committed
315
      this.DICT_TYPE.ECW_TRANSPORT_TYPE
316 317
    ).filter((item) => item.value == "1" || item.value == "2"); */

TIAN.DESHENG's avatar
TIAN.DESHENG committed
318 319 320 321 322 323
    getWarehouseList().then((res) => (this.warehouseList = res.data));
    getCabinetPage(null).then((response) => {
      this.cabinetList = response.data.list;
    });
    this.getList();
  },
324
  watch:{
dragondean@qq.com's avatar
dragondean@qq.com committed
325 326 327 328 329 330 331 332 333 334 335 336
    'form.transportType'(){
      this.getVolume()
    },
    'form.startWarehouseId'(){
      this.getVolume()
    },
    'form.destWarehouseId'(){
      this.getVolume()
    },
    'form.shippingChannelId'(){
      this.getVolume()
    },
TIAN.DESHENG's avatar
TIAN.DESHENG committed
337
    //'form.warehousedNumber'(){
dragondean@qq.com's avatar
dragondean@qq.com committed
338
      //在仓 = 已入仓-已封柜
TIAN.DESHENG's avatar
TIAN.DESHENG committed
339 340
      //this.$set(this.form, 'warehousingNumber', Decimal(this.form.warehousedNumber).minus(this.form.loadingNumber))
    //},
dragondean@qq.com's avatar
dragondean@qq.com committed
341
    /* 2023-05-06 微信群@郑屹反馈确认,由接口计算,前端无需处理
dragondean@qq.com's avatar
dragondean@qq.com committed
342 343 344
    'form.loadingNumber'(){
      //在仓 = 已入仓-已封柜
      this.$set(this.form, 'warehousingNumber',  Decimal(this.form.warehousedNumber).minus(this.form.loadingNumber))
dragondean@qq.com's avatar
dragondean@qq.com committed
345
    }*/
dragondean@qq.com's avatar
dragondean@qq.com committed
346 347 348 349 350 351 352 353 354 355 356 357 358 359
  },
  methods: {
    getVolume(){
      if(!this.form.transportType || !this.form.startWarehouseId || !this.form.destWarehouseId){
        return this.setDefaultVolume()
      }
      // 空运需要选择渠道
      if((this.form.transportType == 3 || this.form.transportType == 4) && !this.form.shippingChannelId){
        return this.setDefaultVolume()
      }
      let data = {
        transportId: this.form.transportType,
        departureId: this.form.startWarehouseId,
        objectiveId: this.form.destWarehouseId
360
      }
361 362 363 364
      // 空运才需要渠道
      if(data.transportId == 4){
        data.channelId = this.form.shippingChannelId
      }
365
      // 获得已封柜方数
dragondean@qq.com's avatar
dragondean@qq.com committed
366
      getBoxedVolume(data).then(res => {
367 368 369
        this.$set(this.form, 'loadingNumber', res.data || 0)
      })
      // 获得待入仓方数
dragondean@qq.com's avatar
dragondean@qq.com committed
370
      getToBeWareHousedVolume(data).then(res => {
371 372 373
        this.$set(this.form, 'readyWarehousingNumber', res.data || 0)
      })
      // 获得已入仓方数
dragondean@qq.com's avatar
dragondean@qq.com committed
374
      getWareHousedVolume(data).then(res => {
375 376
        this.$set(this.form, 'warehousedNumber', res.data || 0)
      })
TIAN.DESHENG's avatar
TIAN.DESHENG committed
377 378 379 380 381 382 383 384
       // 获得异常订单方数
      getExceptionVolume(data).then(res => {
        this.$set(this.form, 'exceptionNumber', res.data || 0)
      })
      // 获得自单代报订单方数
      getOrderReportVolume(data).then(res => {
        this.$set(this.form, 'orderReportNumber', res.data || 0)
      })
TIAN.DESHENG's avatar
TIAN.DESHENG committed
385 386 387 388 389

      // 获得待排单订单方数
      getWarehousingVolume(data).then(res => {
        this.$set(this.form, 'warehousingNumber', res.data || 0)
      })
390
    },
dragondean@qq.com's avatar
dragondean@qq.com committed
391 392 393 394 395
    setDefaultVolume(){
      this.$set(this.form, 'loadingNumber', 0)
      this.$set(this.form, 'readyWarehousingNumber', 0)
      this.$set(this.form, 'warehousedNumber', 0)
      this.$set(this.form, 'warehousingNumber', 0)
TIAN.DESHENG's avatar
TIAN.DESHENG committed
396 397
      this.$set(this.form, 'exceptionNumber',0)
      this.$set(this.form,'orderReportNumber',0)
398
    },
TIAN.DESHENG's avatar
TIAN.DESHENG committed
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = {...this.queryParams};
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
      // 执行查询
      getFutureBoxPage(params).then(response => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 取消按钮 */
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        startWarehouseId: undefined,
        destWarehouseId: undefined,
        transportType: undefined,
        readyWarehousingNumber: undefined,
        warehousedNumber: undefined,
        warehousingNumber: undefined,
TIAN.DESHENG's avatar
TIAN.DESHENG committed
427
        exceptionNumber: undefined,
TIAN.DESHENG's avatar
TIAN.DESHENG committed
428
        loadingNumber: undefined,
TIAN.DESHENG's avatar
TIAN.DESHENG committed
429
        orderReportNumber: undefined,
TIAN.DESHENG's avatar
TIAN.DESHENG committed
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
        futureNumber: undefined,
        gpNumber: undefined,
        hqNumber: undefined,
        futurePlanNumber: undefined,
        actualNumber: undefined,
        shippingChannelId: undefined,
        status: undefined,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
455
      this.title = this.$t("添加预定舱计划");
TIAN.DESHENG's avatar
TIAN.DESHENG committed
456 457 458 459 460 461 462 463
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
      getFutureBox(id).then(response => {
        this.form = response.data;
        this.open = true;
464
        this.title = this.$t("修改预定舱计划");
TIAN.DESHENG's avatar
TIAN.DESHENG committed
465 466 467 468 469 470 471 472 473 474 475
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (!valid) {
          return;
        }
        // 修改的提交
        if (this.form.id != null) {
          updateFutureBox(this.form).then(response => {
476
            this.$modal.msgSuccess(this.$t("修改成功"));
TIAN.DESHENG's avatar
TIAN.DESHENG committed
477 478 479 480 481 482 483
            this.open = false;
            this.getList();
          });
          return;
        }
        // 添加的提交
        createFutureBox(this.form).then(response => {
484
          this.$modal.msgSuccess(this.$t("新增成功"));
TIAN.DESHENG's avatar
TIAN.DESHENG committed
485 486 487 488 489 490 491 492
          this.open = false;
          this.getList();
        });
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id;
493
      this.$modal.confirm(this.$t('是否确认删除预定舱计划编号为{id}的数据项?', {id})).then(function() {
TIAN.DESHENG's avatar
TIAN.DESHENG committed
494 495 496
          return deleteFutureBox(id);
        }).then(() => {
          this.getList();
497
          this.$modal.msgSuccess(this.$t("删除成功"));
TIAN.DESHENG's avatar
TIAN.DESHENG committed
498 499 500 501 502 503 504 505 506 507
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = {...this.queryParams};
      params.pageNo = undefined;
      params.pageSize = undefined;
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
      // 执行导出
508
      this.$modal.confirm(this.$t('是否确认导出所有预定舱计划数据项?')).then(() => {
TIAN.DESHENG's avatar
TIAN.DESHENG committed
509 510 511 512 513 514 515 516 517 518
          this.exportLoading = true;
          return exportFutureBoxExcel(params);
        }).then(response => {
          this.$download.excel(response, '${table.classComment}.xls');
          this.exportLoading = false;
        }).catch(() => {});
    }
  }
};
</script>