indexAir.vue 13.3 KB
Newer Older
wh's avatar
wh 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">
wanglianghe's avatar
wanglianghe committed
6 7
      <el-form-item label="自编号" prop="selfNo">
        <el-input v-model="queryParams.selfNo" placeholder="请输入自编号" clearable @keyup.enter.native="handleQuery"/>
wh's avatar
wh committed
8
      </el-form-item>
wh's avatar
wh committed
9 10
      <el-form-item label="柜号" prop="cubNo">
        <el-input v-model="queryParams.cubNo" placeholder="请输入柜号" clearable @keyup.enter.native="handleQuery"/>
wh's avatar
wh committed
11
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
12 13 14

      <el-form-item label="始发地" prop="startWarehouseId">
        <el-select v-model="queryParams.startWarehouseId" placeholder="请选择始发地">
15
          <el-option v-for="item in exportWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
wh's avatar
wh committed
16
        </el-select>
wh's avatar
wh committed
17
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
18 19 20

      <el-form-item label="目的地" prop="destWarehouseId">
        <el-select v-model="queryParams.destWarehouseId" placeholder="请选择目的地">
21 22 23 24 25 26 27 28
          <el-option v-for="item in importWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="状态" prop="boxStatus">
        <el-select v-model="queryParams.boxStatus" placeholder="请选择状态" clearable size="small">
          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BOX_SHIPMENT_STATUS)"
                     :key="dict.value" :label="dict.label" :value="dict.value"/>
wh's avatar
wh committed
29
        </el-select>
wh's avatar
wh committed
30
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
31 32 33 34

      <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
35
        </el-select>
wh's avatar
wh committed
36
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
37 38

      <el-form-item label="">
huhaiqing's avatar
huhaiqing committed
39 40
        <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
41
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
42

wh's avatar
wh committed
43 44 45 46 47 48 49 50 51 52
      <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">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
wanglianghe's avatar
wanglianghe committed
53
                   v-hasPermi="['shipment:box:create']">出货安排
wh's avatar
wh committed
54
        </el-button>
wh's avatar
wh committed
55 56
      </el-col>
      <el-col :span="1.5">
wh's avatar
wh committed
57 58 59 60
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                   :loading="exportLoading"
                   v-hasPermi="['shipment:box:export']">导出
        </el-button>
wh's avatar
wh committed
61 62 63 64 65 66
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
wanglianghe's avatar
wanglianghe committed
67
      <el-table-column label="自编号" align="center" prop="selfNo"/>
wh's avatar
wh committed
68
      <el-table-column label="柜号" align="center" prop="cubNo"/>
wanglianghe's avatar
wanglianghe committed
69 70 71 72 73

      <el-table-column label="出货渠道" align="center" prop="shippingChannelId">
        <template slot-scope="scope">
          <span>{{ getShipChannelName(scope.row.shippingChannelId) }}</span>
        </template>
wh's avatar
wh committed
74
      </el-table-column>
wanglianghe's avatar
wanglianghe committed
75 76 77 78 79 80 81 82 83

      <el-table-column label="方数(预装/已装)" align="center" prop="squareNumber"/>
      <el-table-column label="重量(预装/已装)" align="center" prop="weight"/>

      <el-table-column label="状态" align="center" prop="boxStatus">
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.BOX_SHIPMENT_STATUS" :value="scope.row.boxStatus"/>
        </template>
      </el-table-column>
huhaiqing's avatar
huhaiqing committed
84

wanglianghe's avatar
wanglianghe committed
85
      <el-table-column label="日期" align="center" prop="createTime" width="180">
wh's avatar
wh committed
86
      <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
87
        <span>{{ new Date(scope.row.createTime).format('yyyy-MM-dd hh:mm:ss') }}</span>
wh's avatar
wh committed
88 89
      </template>
      </el-table-column>
wh's avatar
wh committed
90 91
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
92 93
          <!-- <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)"
                     v-hasPermi="['shipment:box:query']">查看</el-button>
wh's avatar
wh committed
94
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
wh's avatar
wh committed
95
                     v-hasPermi="['shipment:box:update']">修改</el-button>
wh's avatar
wh committed
96
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
97 98 99 100 101 102 103 104 105 106 107 108 109
                     v-hasPermi="['shipment:box:delete']">删除</el-button> -->
          <el-dropdown trigger="click" @command="(command)=>handleCommand(scope.row, command)">
            <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="air">操作-空运</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>
            </el-dropdown-menu>
          </el-dropdown>
wh's avatar
wh committed
110 111 112 113 114 115 116 117
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>

    <!-- 对话框(添加 / 修改) -->
wanglianghe's avatar
wanglianghe committed
118
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
wh's avatar
wh committed
119
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
wanglianghe's avatar
wanglianghe committed
120 121


122
        <el-form-item label="出货渠道" prop="shippingChannelId">
wanglianghe's avatar
wanglianghe committed
123 124
          <el-select v-model="form.shippingChannelId" placeholder="请选择出货渠道">
            <el-option v-for="item in channelList" :label="item.nameZh" :value="item.channelId" :key="item.channelId"></el-option>
wh's avatar
wh committed
125 126
          </el-select>
        </el-form-item>
wanglianghe's avatar
wanglianghe committed
127 128 129

        <el-form-item label="始发地" prop="startWarehouseId">
          <el-select v-model="form.startWarehouseId" placeholder="请选择始发地">
130
            <el-option v-for="item in exportWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
wh's avatar
wh committed
131
          </el-select>
wh's avatar
wh committed
132
        </el-form-item>
wanglianghe's avatar
wanglianghe committed
133 134 135

        <el-form-item label="目的地" prop="destWarehouseId">
          <el-select v-model="form.destWarehouseId" placeholder="请选择目的地">
136
            <el-option v-for="item in importWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
wh's avatar
wh committed
137
          </el-select>
wh's avatar
wh committed
138
        </el-form-item>
huhaiqing's avatar
huhaiqing committed
139

wh's avatar
wh committed
140 141 142 143 144 145 146 147 148 149
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
wh's avatar
wh committed
150
  import {createbox, updatebox, deletebox, getbox, getboxPage, exportboxExcel} from "@/api/ecw/box";
wanglianghe's avatar
wanglianghe committed
151
  import { getChannelList } from '@/api/ecw/channel';
152
  import { getWarehouseList } from "@/api/ecw/warehouse"
wh's avatar
wh committed
153

wh's avatar
wh committed
154 155 156 157 158
  export default {
    name: "box",
    components: {},
    data() {
      return {
wanglianghe's avatar
wanglianghe committed
159
        dateTypes:[
160
          {value:'1', label:'分拣时间'},
wanglianghe's avatar
wanglianghe committed
161 162 163 164 165 166 167 168
          {value:'2', label:'装柜时间'},
          {value:'3', label:'起运时间'},
          {value:'4', label:'到港时间'},
          {value:'5', label:'清关时间'},
          {value:'6', label:'提货时间'},
        ],


wh's avatar
wh committed
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
        // 遮罩层
        loading: true,
        // 导出遮罩层
        exportLoading: false,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 出货列表
        list: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        dateRangeCreateTime: [],
        // 查询参数
        queryParams: {
          pageNo: 1,
          pageSize: 10,
          id: null,
wanglianghe's avatar
wanglianghe committed
189
          selfNo: null,
wh's avatar
wh committed
190
          cubNo: null,
wanglianghe's avatar
wanglianghe committed
191 192 193 194 195
          cabinetId: null,
          boxStatus: null,
          startWarehouseId: null,
          destWarehouseId: null,
          transportType: null,
wh's avatar
wh committed
196
        },
wanglianghe's avatar
wanglianghe committed
197
        channelList:[],
198
        warehouseList: [],
wh's avatar
wh committed
199 200 201
        // 表单参数
        form: {},
        // 表单校验
wanglianghe's avatar
wanglianghe committed
202
        rules: {
203
          shippingChannelId: [{ required: true, message: "出货渠道不能为空", trigger: "blur" }],
wanglianghe's avatar
wanglianghe committed
204 205 206 207
          startWarehouseId: [{ required: true, message: "始发地不能为空", trigger: "blur" }],
          destWarehouseId: [{ required: true, message: "目的地不能为空", trigger: "blur" }],

        }
wh's avatar
wh committed
208 209
      };
    },
wh's avatar
wh committed
210
    computed: {
211 212
      exportWarehouseList() {
        return this.warehouseList.filter(item => item.tradeType == '2' || item.type == '3')
wh's avatar
wh committed
213
      },
214 215
      importWarehouseList() {
        return this.warehouseList.filter(item => item.tradeType == '1' || item.type == '3')
wh's avatar
wh committed
216
      },
wanglianghe's avatar
wanglianghe committed
217 218 219 220 221 222 223 224 225 226 227 228 229

      getShipChannelName() {
        return shippingChannelId => {
          for (let index in this.channelList) {
            let channelItem = this.channelList[index];
            if (channelItem.channelId == shippingChannelId) {
              return channelItem.nameZh;
            }
          }
          return '/'
        }
      }

wh's avatar
wh committed
230
    },
wh's avatar
wh committed
231
    created() {
232
      getWarehouseList().then(res => this.warehouseList = res.data);
wh's avatar
wh committed
233
      this.getList();
wanglianghe's avatar
wanglianghe committed
234
      this.getChannelList();
wh's avatar
wh committed
235
    },
wh's avatar
wh committed
236
    methods: {
wanglianghe's avatar
wanglianghe committed
237 238 239 240
      getChannelList(){
        getChannelList().then(res => this.channelList = res.data)
      },

wh's avatar
wh committed
241 242 243 244 245
      /** 查询列表 */
      getList() {
        this.loading = true;
        // 处理查询参数
        let params = {...this.queryParams};
246
        params.transportType = 3;
wh's avatar
wh committed
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
        this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
        // 执行查询
        getboxPage(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,
wanglianghe's avatar
wanglianghe committed
264 265 266 267
          cabinetId: undefined,
          startWarehouseId: undefined,
          destWarehouseId: undefined,
          transportType: undefined,
wh's avatar
wh committed
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNo = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.dateRangeCreateTime = [];
        this.resetForm("queryForm");
        this.handleQuery();
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.open = true;
        this.title = "添加出货";
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        const id = row.id;
        getbox(id).then(response => {
          this.form = response.data;
          this.open = true;
          this.title = "修改出货";
        });
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["form"].validate(valid => {
          if (!valid) {
            return;
          }
wanglianghe's avatar
wanglianghe committed
304

305
          this.form.transportType = 3;
wanglianghe's avatar
wanglianghe committed
306

wh's avatar
wh committed
307 308 309 310 311 312 313 314 315 316 317 318
          // 修改的提交
          if (this.form.id != null) {
            updatebox(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
            return;
          }
          // 添加的提交
          createbox(this.form).then(response => {
            this.$modal.msgSuccess("新增成功");
wh's avatar
wh committed
319 320 321 322
            this.open = false;
            this.getList();
          });
        });
wh's avatar
wh committed
323 324 325 326 327
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const id = row.id;
        this.$modal.confirm('是否确认删除出货编号为"' + id + '"的数据项?').then(function () {
wh's avatar
wh committed
328
          return deletebox(id);
wh's avatar
wh committed
329 330 331
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
wh's avatar
wh committed
332 333 334 335 336 337 338 339 340 341 342 343
        }).catch(() => {
        });
      },
      /** 导出按钮操作 */
      handleExport() {
        // 处理查询参数
        let params = {...this.queryParams};
        params.pageNo = undefined;
        params.pageSize = undefined;
        this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
        // 执行导出
        this.$modal.confirm('是否确认导出所有出货数据项?').then(() => {
wh's avatar
wh committed
344
          this.exportLoading = true;
wh's avatar
wh committed
345
          return exportboxExcel(params);
wh's avatar
wh committed
346 347 348
        }).then(response => {
          this.$download.excel(response, '${table.classComment}.xls');
          this.exportLoading = false;
wh's avatar
wh committed
349 350
        }).catch(() => {
        });
351 352 353 354 355 356 357
      },
      /** 查看按钮操作 */
      handleCommand(row, command) {
        switch (command) {
          case 'sea':
            this.$router.push('/box/shippingSea/' + row.id)
            break;
358 359 360 361 362 363 364 365

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

          case 'delete':
            this.handleDelete(row);
            break;
366 367
        }
      },
wh's avatar
wh committed
368
    }
wh's avatar
wh committed
369
  };
wh's avatar
wh committed
370
</script>