Blame view

ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue 23.6 KB
李泰瑜 authored
1
2
3
4
5
6
7
8
<template>
  <div class="container-div">
    <div class="row">
      <div class="col-sm-12 select-info">
        <form id="container-form">
          <div class="select-list">
            <ul id="select_info">
              <li>
李泰瑜 authored
9
10
                <a-select
                  show-search
谭毅彬 authored
11
                  placeholder="请选择库区"
李泰瑜 authored
12
13
                  option-filter-prop="children"
                  v-model="zoneCode"
李泰瑜 authored
14
                  @change="refresh"
李泰瑜 authored
15
                  style="width: 200px">
谭毅彬 authored
16
                  <a-select-option selected="0" id="zoneCode" v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }}
李泰瑜 authored
17
18
                  </a-select-option>
                </a-select>
李泰瑜 authored
19
              </li>
谭毅彬 authored
20
              <li>第
21
                <select id="editable-num" name="num" style="width: 70px" />
李泰瑜 authored
22
23
              </li>
              <li>
李泰瑜 authored
24
                <select id="editable-select" name="col" @click="show" style="width: 70px">
李泰瑜 authored
25
26
27
28
29
30
                  <option value="row" selected>行</option>
                  <option value="line">列</option>
                  <option value="layer">层</option>
                </select>
              </li>
              <li>
李泰瑜 authored
31
                <a-button type="primary" @click="Search()" icon="search">查询</a-button>
李泰瑜 authored
32
33
34
35
36
37
38
39
40
              </li>
            </ul>
          </div>
        </form>
      </div>
      <div class="col-sm-12 select-info">
        <form id="receiptHeader-form">
          <div class="select-list">
            <ul id="img_list" style="">
41
42
43
44
45
46
47
48
49
50
51
52
              <li>空柜空闲:<img src="~@/assets/icon/grid_rest.png"></li>
              <li>空盘空闲:<img src="~@/assets/icon/grid_empty.png"></li>
              <li>半盘空闲:<img src="~@/assets/icon/grid_half.png"></li>
              <li>整盘空闲:<img src="~@/assets/icon/grid_all.png"></li>
              <li>空柜锁定:<img src="~@/assets/icon/grid_emp_lock.png"></li>
              <li>空盘锁定:<img src="~@/assets/icon/grid_empty_lock.png"></li>
              <li>半盘锁定:<img src="~@/assets/icon/grid_half_lock.png"></li>
              <li>整盘锁定:<img src="~@/assets/icon/grid_all_lock.png"></li>
              <li>空柜禁用:<img src="~@/assets/icon/grid_emp_waing.png"></li>
              <li>空盘禁用:<img src="~@/assets/icon/grid_empty_waring.png"></li>
              <li>半盘禁用:<img src="~@/assets/icon/grid_half_waring.png"></li>
              <li>整盘禁用:<img src="~@/assets/icon/ContainerDisabled.png"></li>
李泰瑜 authored
53
              <li>
54
                <span style="font-size: 12px">库位统计情况:</span>
李泰瑜 authored
55
                <input style="width: 400px;  font-size: 12px" type="text" id="zone" disabled/>
李泰瑜 authored
56
              </li>
李泰瑜 authored
57
58
            </ul>
            <br><br>
李泰瑜 authored
59
60
61
            <ul id="info_list">
              <li><span>库位:</span><input type="text" id="code" disabled/></li>
              <li><span>容器编码:</span><input type="text" id="containerCode" disabled/></li>
62
              <li><span>物料信息:<select id="material" style="width: auto"><option>无</option></select></span></li>
李泰瑜 authored
63
64
65
66
            </ul>
          </div>
        </form>
      </div>
李泰瑜 authored
67
李泰瑜 authored
68
      <div class="col-sm-12 select-info">
谭毅彬 authored
69
        <div id="borderCol" style="overflow-y: auto;white-space:nowrap" v-show="showPrise">
李泰瑜 authored
70
71
72
          <div class="location" id="location">
          </div>
        </div>
73
        <a-spin tip="库位视图生成中..." :spinning="spinning">
李泰瑜 authored
74
          <a-skeleton active :loading="loading" :paragraph="{ rows: 5 }"/>
75
        </a-spin>
李泰瑜 authored
76
      </div>
李泰瑜 authored
77
78
李泰瑜 authored
79
80
81
    </div>
  </div>
</template>
李泰瑜 authored
82
李泰瑜 authored
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<script>
var prefix = "/location/locationMonitor";
var grid_row;
var grid_line;
var grid_layer;
var list_info;
var grid_num_1 = 0;
var grid_num_2 = 0;
var grid_num_3 = 0;
var grid_num_4 = 0;
var grid_num_5 = 0;
var grid_num_6 = 0;
var grid_num_7 = 0;
var grid_num_8 = 0;
var grid_num_9 = 0;
var grid_num_10 = 0;
var grid_num_11 = 0;
var grid_num_12 = 0;
var currentContainerCode;
var currentLocationCode = 0;
var currentMaterialCode = 0;
李泰瑜 authored
104
李泰瑜 authored
105
106
import huahengUI from '../../../assets/css/huahengUI.css'
import $ from '../../../assets/js/jquery-1.11.1.min'
107
108
109
110
111
112
113
114
115
116
117
118
119
import grid_rest from '@/assets/icon/grid_rest.png'
import grid_empty from '@/assets/icon/grid_empty.png'
import grid_half from '@/assets/icon/grid_half.png'
import grid_all from '@/assets/icon/grid_all.png'
import grid_emp_waing from '@/assets/icon/grid_emp_waing.png'
import grid_empty_waring from '@/assets/icon/grid_empty_waring.png'
import grid_half_waring from '@/assets/icon/grid_half_waring.png'
import grid_all_waring from '@/assets/icon/ContainerDisabled.png'
import grid_emp_lock from '@/assets/icon/grid_emp_lock.png'
import grid_empty_lock from '@/assets/icon/grid_empty_lock.png'
import grid_half_lock from '@/assets/icon/grid_half_lock.png'
import grid_all_lock from '@/assets/icon/grid_all_lock.png'
import rel_empty from '@/assets/icon/rel_empty.png'
李泰瑜 authored
120
121
import Vue from 'vue'
import {ACCESS_TOKEN} from "@/store/mutation-types"
李泰瑜 authored
122
import {getZoneList} from '@/api/api'
李泰瑜 authored
123
124
125
126
127
128
129
130
131
132
133

export default {
  name: "locationStatus",
  zoneCode: "",
  data() {
    return {
      spinning: true,
      loading: true,
      showPrise: false,
      // loading:true,
      zoneCode: '',
谭毅彬 authored
134
      zoneList: [],
李泰瑜 authored
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
      model: {},
      locationContent: ''
    }
  },


  created() {
    let _this = this
    _this.loadFrom()
    window.gridMsg = _this.gridMsg
    window.Mclose = _this.Mclose
    window.lays = _this.lays
  },

  mounted() {
谭毅彬 authored
150
151
152
153
154
155
156
    // 监听浏览器宽度的改变
    const resizeObserver = new ResizeObserver(entries => {
      for (let entry of entries) {
        this.changeMargin();
      }
    });
    resizeObserver.observe(document.querySelector('.location'));
李泰瑜 authored
157
158
159
  },
  methods: {
    loadFrom() {
李泰瑜 authored
160
      getZoneList().then((res) => {
李泰瑜 authored
161
        if (res.success) {
谭毅彬 authored
162
163
164
          this.zoneList = res.result;
          if (this.zoneList.length > 0) {
            this.zoneCode = this.zoneList[0].code;
李泰瑜 authored
165
166
167
168
169
            let _this = this;
            this.resetAjax(this.zoneCode);
          }
        }
      })
谭毅彬 authored
170
    },
李泰瑜 authored
171
172
173
174
175
    refresh: function () {
      $.ajax({
        url: window._CONFIG['domianURL'] + prefix + "/getAllLocation",
        type: "post",
        data: {
谭毅彬 authored
176
          zoneCode: this.zoneCode
李泰瑜 authored
177
178
179
180
181
182
183
184
185
186
187
188
189
        },
        headers: {
          "X-Access-Token": Vue.ls.get(ACCESS_TOKEN)
        },
        success: function (res) {
          grid_row = res.result.maxRow;
          grid_line = res.result.maxLine;
          grid_layer = res.result.maxLayer;
        }
      });
      let num = $("#editable-select").val();
      $("#editable-num").children().remove();
      if (num === "row") {
190
        for (let i = 1; i <= grid_row; i++) {
李泰瑜 authored
191
192
193
194
195
196
197
198
199
200
201
          $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
        }
      } else if (num === "line") {
        for (let i = 1; i <= grid_line; i++) {
          $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
        }
      } else if (num === "layer") {
        for (let i = 1; i <= grid_layer; i++) {
          $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
        }
      }
李泰瑜 authored
202
谭毅彬 authored
203
      let zoneCode = $("#zoneCode").val();
李泰瑜 authored
204
205
      this.resetAjax(this.zoneCode);
      // this.show();
李泰瑜 authored
206
    },
李泰瑜 authored
207
208
209
210
211
212
    show: function () {
      //库位类型和行列层选择
      $("#editable-select").change(function () {
        let num = $("#editable-select").val();
        $("#editable-num").children().remove();
        if (num === "row") {
213
          for (let i = 1; i <= grid_row; i++) {
李泰瑜 authored
214
            $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
李泰瑜 authored
215
          }
李泰瑜 authored
216
217
218
        } else if (num === "line") {
          for (let i = 1; i <= grid_line; i++) {
            $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
李泰瑜 authored
219
          }
李泰瑜 authored
220
221
222
        } else if (num === "layer") {
          for (let i = 1; i <= grid_layer; i++) {
            $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
李泰瑜 authored
223
224
          }
        }
李泰瑜 authored
225
      });
李泰瑜 authored
226
李泰瑜 authored
227
      $("#zoneCode").change(function () {
谭毅彬 authored
228
        let zoneCode = $("#zoneCode").val();
李泰瑜 authored
229
230
231
        this.resetAjax(this.zoneCode);
      });
    },
李泰瑜 authored
232
李泰瑜 authored
233
234
235
236
237
238
239
240
241
    //边框高度
    border() {
      let box_height = $("#borderCol").offset().top;
      let window_height = $(window).height() - 20;
      $("#borderCol").css({"height": window_height - box_height});
    },

    //格子宽度
    changeMargin() {
242
243
244
245
      let box_width = 0;
      if (document.getElementById("location") != null) {
        box_width = document.getElementById("location").offsetWidth;
      }
李泰瑜 authored
246
247
248
249
250
251
252
253
254
255
256
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
282
283
284
285
286
287
      box_width = box_width - 80;
      let num = $("#editable-select").val();
      let grid_width;
      if (num === "layer" || num === "row") {
        grid_width = box_width / grid_line;
      } else if (num === "line") {
        grid_width = box_width / grid_row;
      }
      if (grid_width >= 50) {
        $(".grid").css({"width": "50px", "height": "50px"});
      } else if (grid_width <= 20) {
        $(".grid").css({"width": "20px", "height": "20px"});
      } else {
        $(".grid").css({"width": grid_width, "height": grid_width});
      }
    },

    //tips信息
    lays(x) {
      let $j = $(x);
      let row = $j.attr("data-i");
      let line = $j.attr("data-j");
      let layers = $j.attr("data-k");

      row = parseInt(row);
      line = parseInt(line);
      layers = parseInt(layers);
      if (list_info) {
        for (let i = 0; i < list_info.length; i++) {
          if (list_info[i].row === row && list_info[i].icolumn === line && list_info[i].layer === layers) {
            let str_info = '';
            let container_code = '';
            let list_qty = 0;
            if (list_info[i].containerCode) {
              container_code = "\n容器编码:" + list_info[i].containerCode + "";
              if (list_info[i].materialName) {
                for (let j = 0; j < list_info[i].materialName.length; j++) {
                  let list_batch = list_info[i].batch[j] === null ? "无" : list_info[i].batch[j] === "" ? "无" : list_info[i].batch[j];
                  list_qty += list_info[i].qty[j];
                  if (j == list_info[i].materialName.length - 1) {
                    str_info = str_info + "\n批次:" + list_batch + ",物料名称:" + list_info[i].materialName[j] + ",物料编码:" + list_info[i].materialCode[j] +
                      ",数量:" + list_qty + ""
李泰瑜 authored
288
                  }
李泰瑜 authored
289
290
李泰瑜 authored
291
292
293
                }
              }
            }
李泰瑜 authored
294
295
296
297
            let code = list_info[i].code === null ? "无" : list_info[i].code;
            $("[data-i='" + row + "']" + "[data-j='" + line + "']" + "[data-k='" + layers + "']").attr({"title": "第" + row + "行,第" + line + "列,第" + layers + "层\n库位:" + code + container_code + str_info});
            // Vue.prototype.$Jnotification.success({message: '系统提示', description: "第"+row+"行,第"+line+"列,第"+ layers +"层<br>库位:"+ code + container_code + str_info, duration: 4})
李泰瑜 authored
298
          }
李泰瑜 authored
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
        }
      } else {
        return ""
      }
    },


    //关闭tips
    Mclose(x) {
      //关闭
      // Vue.prototype.$Jnotification.error({message: '系统提示', description: "鼠标拿走了", duration: 4})
    },

    //库位信息请求和状态显示
    ajaxGrid(x, info) {
      let _this = this
      // let load=layer.msg('加载中', {icon: 16,shade: 0.4,time: false});
      $.ajax({
        url: window._CONFIG['domianURL'] + prefix + "/getLocationInfo",
        type: "post",
        headers: {
          "X-Access-Token": Vue.ls.get(ACCESS_TOKEN)
        },
        data: info,
        success: function (res) {
          if (res.code === 200 || res.result) {
            grid_num_1 = 0;
            grid_num_2 = 0;
            grid_num_3 = 0;
            grid_num_4 = 0;
            grid_num_5 = 0;
            grid_num_6 = 0;
            grid_num_7 = 0;
            grid_num_8 = 0;
            grid_num_9 = 0;
            grid_num_10 = 0;
            grid_num_11 = 0;
            grid_num_12 = 0;
            if (x === "row") {
              for (let i = 0; i < res.result.length; i++) {
                let index = res.result[i].icolumn + ((res.result[i].layer - 1) * grid_line);
                index = index - 1;
                _this.resShow(res, index, i);
李泰瑜 authored
342
              }
李泰瑜 authored
343
344
345
346
347
348
349
              _this.clearLocation(grid_line, grid_layer);
              // layer.close(load);
            } else if (x === "line") {
              for (let i = 0; i < res.result.length; i++) {
                let index = res.result[i].row + ((res.result[i].layer - 1) * grid_row);
                index = index - 1;
                _this.resShow(res, index, i);
李泰瑜 authored
350
              }
李泰瑜 authored
351
352
353
354
355
356
357
              _this.clearLocation(grid_row, grid_layer);
              // layer.close(load);
            } else if (x === "layer") {
              for (let i = 0; i < res.result.length; i++) {
                let index = res.result[i].icolumn + ((res.result[i].row - 1) * grid_line);
                index = index - 1;
                _this.resShow(res, index, i);
李泰瑜 authored
358
              }
李泰瑜 authored
359
              _this.clearLocation(grid_line, grid_row);
李泰瑜 authored
360
361
              // layer.close(load);
            }
李泰瑜 authored
362
363
364
365
366
367
          } else if (res.code !== 200) {
            // layer.close(load);
            // layer.open({
            //   title: '错误',
            //   content: res.msg
            // });
李泰瑜 authored
368
          }
李泰瑜 authored
369
370
371
372
          list_info = res.result;
        },
        error: function (req, msg) {
          console.log(msg);
李泰瑜 authored
373
        }
李泰瑜 authored
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
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
427
428
429
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
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
      })
    },
    //库位请求的结果显示
    resShow(res, index, i) {
      // if (res.result[i].deleted === false) {
      var row = res.result[i].row;
      var jColumn = res.result[i].icolumn;
      var kLayer = res.result[i].layer;
      if (res.result[i].locationAttribute === "1") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_rest,
          "isTrue": 1
        });
        grid_num_1 = grid_num_1 + 1;
      } else if (res.result[i].locationAttribute === "2") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_empty,
          "isTrue": 1
        });
        grid_num_2 = grid_num_2 + 1;
      } else if (res.result[i].locationAttribute === "3") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_half,
          "isTrue": 1
        });
        grid_num_3 = grid_num_3 + 1;
      } else if (res.result[i].locationAttribute === "4") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_all,
          "isTrue": 1
        });
        grid_num_4 = grid_num_4 + 1;
      } else if (res.result[i].locationAttribute === "5") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_emp_lock,
          "isTrue": 1
        });
        grid_num_5 = grid_num_5 + 1;
      } else if (res.result[i].locationAttribute === "6") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_empty_lock,
          "isTrue": 1
        });
        grid_num_6 = grid_num_6 + 1;
      } else if (res.result[i].locationAttribute === "7") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_half_lock,
          "isTrue": 1
        });
        grid_num_7 = grid_num_7 + 1;
      } else if (res.result[i].locationAttribute === "8") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_all_lock,
          "isTrue": 1
        });
        grid_num_8 = grid_num_8 + 1;
      } else if (res.result[i].locationAttribute === "9") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_emp_waing,
          "isTrue": 1
        });
        grid_num_9 = grid_num_9 + 1;
      } else if (res.result[i].locationAttribute === "10") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_empty_waring,
          "isTrue": 1
        });
        grid_num_10 = grid_num_10 + 1;
      } else if (res.result[i].locationAttribute === "11") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_half_waring,
          "isTrue": 1
        });
        grid_num_11 = grid_num_11 + 1;
      } else if (res.result[i].locationAttribute === "12") {
        $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
          "src": grid_all_waring,
          "isTrue": 1
        });
        grid_num_12 = grid_num_12 + 1;
      }

    },

    //清除将数据库中没有的库位
    clearLocation(x, y) {
      for (let j = 0; j < x * y; j++) {
        let sta = $(".grid").eq(j).attr("isTrue");
        if (sta !== "1") {
          $(".grid").eq(j).attr({"src": rel_empty, "onmouseover": "", "onclick": ""});
        }
      }
      this.spinning = false;
      this.showPrise = true;
      this.loading = false;
    },

    //点击显示当前库位信息
    gridMsg(msg) {
      let $j = $(msg);
      let row = $j.attr("data-i");
      let line = $j.attr("data-j");
      let layers = $j.attr("data-k");

      row = parseInt(row);
      line = parseInt(line);
      layers = parseInt(layers);
      if (list_info) {//缓存查询
        for (let i = 0; i < list_info.length; i++) {
          if (list_info[i].row === row && list_info[i].icolumn === line && list_info[i].layer === layers) {
            if (list_info[i].materialName) {
              let list_batch = '';
              let list_qty = 0;
              $("#material").children().remove();
              for (let j = 0; j < list_info[i].materialName.length; j++) {
                list_batch = list_info[i].batch[j] === null ? "无" : list_info[i].batch[j] === "" ? "无" : list_info[i].batch[j];
                list_qty += list_info[i].qty[j];
                let str_info = "批次:" + list_batch + "/ 物料名称:" + list_info[i].materialName[j] + "/ 物料编码:" + list_info[i].materialCode[j] +
                  "/ 数量:" + list_qty + "";
                if (j == list_info[i].materialName.length - 1) {
                  $("#material").append("<option>" + str_info + "</option>");
李泰瑜 authored
495
                }
李泰瑜 authored
496
                currentMaterialCode = list_info[i].materialCode[j]
李泰瑜 authored
497
              }
李泰瑜 authored
498
499
500
            } else {
              $("#material").children().remove();
              $("#material").append("<option>无</option>");
李泰瑜 authored
501
            }
李泰瑜 authored
502
503
504
505
            $("#code").val(list_info[i].code);
            $("#containerCode").val(list_info[i].containerCode === "" ? "无" : list_info[i].containerCode);
            currentContainerCode = $("#containerCode").val()
            currentLocationCode = $("#code").val()
李泰瑜 authored
506
          }
李泰瑜 authored
507
508
509
510
511
512
513
        }
      } else {
        return ""
      }
    },

    //页面初始化请求
谭毅彬 authored
514
    resetAjax(zoneCode) {
李泰瑜 authored
515
516
517
518
519
      var _this = this;
      $.ajax({
        url: window._CONFIG['domianURL'] + prefix + "/getAllLocation",
        type: "post",
        data: {
谭毅彬 authored
520
          zoneCode: zoneCode
李泰瑜 authored
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
        },
        headers: {
          "X-Access-Token": Vue.ls.get(ACCESS_TOKEN)
        },
        success: function (res) {
          grid_row = res.result.maxRow;
          grid_line = res.result.maxLine;
          grid_layer = res.result.maxLayer;
          //初始格子
          $("#location").children().remove();
          for (let i = 1; i <= grid_layer; i++) {
            // var index=i+1;<span style='margin-top:30px'>第"+ index +"行</span>
            $(".location").append("<br>");
            for (let j = 1; j <= grid_line; j++) {
              // $(".location").append("<img data-i='1' data-j="+j+" data-k="+ i +" class='grid'>");
              $(".location").append("<img v-html data-i='1' data-j=" + j + " data-k=" + i + " class='grid' onmouseove='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
李泰瑜 authored
537
            }
李泰瑜 authored
538
539
540
541
          }
          let num = $("#editable-select").val();
          $("#editable-num").children().remove();
          if (num === "row") {
542
            for (let i = 1; i <= grid_row; i++) {
李泰瑜 authored
543
              $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
李泰瑜 authored
544
            }
李泰瑜 authored
545
546
547
          } else if (num === "line") {
            for (let i = 1; i <= grid_line; i++) {
              $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
李泰瑜 authored
548
            }
李泰瑜 authored
549
550
551
          } else if (num === "layer") {
            for (let i = 1; i <= grid_layer; i++) {
              $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
李泰瑜 authored
552
553
            }
          }
李泰瑜 authored
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
          _this.Search();
        }
      });
    },
    //搜索平面库位
    Search() {
      this.spinning = true;
      this.showPrise = false;
      this.loading = true;
      let index = $("#editable-select").val();
      let num = $("#editable-num").val();
      let zoneCode = "";

      $("#code").val("");
      $("#containerCode").val("");
      $("#material").children().remove();
      $("#material").append("<option>无</option>");
      let data;
      this.seachZone();
      if (index === "row") {
谭毅彬 authored
574
        data = {zoneCode: this.zoneCode, row: num};
李泰瑜 authored
575
576
577
578
579
        $("#location").children().remove();
        for (let i = grid_layer; i > 0; i--) {
          $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + i + "层</span>");
          for (let j = 1; j <= grid_line; j++) {
            $(".location").append("<img data-i=" + num + " data-j=" + j + " data-k=" + i + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
李泰瑜 authored
580
581
          }
        }
谭毅彬 authored
582
        // this.changeMargin();
李泰瑜 authored
583
584
        this.ajaxGrid(index, data);
      } else if (index === "line") {
谭毅彬 authored
585
        data = {zoneCode: this.zoneCode, line: num};
李泰瑜 authored
586
587
588
589
590
        $("#location").children().remove();
        for (let k = grid_layer; k > 0; k--) {
          $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + k + "层</span>");
          for (let l = 1; l <= grid_row; l++) {
            $(".location").append("<img data-i=" + l + " data-j=" + num + " data-k=" + k + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
李泰瑜 authored
591
592
          }
        }
谭毅彬 authored
593
        // this.changeMargin();
李泰瑜 authored
594
595
        this.ajaxGrid(index, data);
      } else if (index === "layer") {
谭毅彬 authored
596
        data = {zoneCode: this.zoneCode, layer: num};
李泰瑜 authored
597
598
599
600
601
        $("#location").children().remove();
        for (let m = 1; m <= grid_row; m++) {
          $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + m + "行</span>");
          for (let n = 1; n <= grid_line; n++) {
            $(".location").append("<img data-i=" + m + " data-j=" + n + " data-k=" + num + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
李泰瑜 authored
602
603
          }
        }
谭毅彬 authored
604
        // this.changeMargin();
李泰瑜 authored
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
        this.ajaxGrid(index, data);
      }
    },
    seachZone() {
      let _this = this

      $.ajax({
        url: window._CONFIG['domianURL'] + prefix + "/getStatus",
        data: {
          zoneCode: _this.zoneCode
        },
        headers: {
          "X-Access-Token": Vue.ls.get(ACCESS_TOKEN)
        },
        success: function (response) {
          if (response.code == 200) {
            $("#zone").val("库位总数:" + response.result.location + ", 空闲库位:" + response.result.emptyLocation +
              ", 空托盘库位:" + response.result.haveContainLocation + ", 有货库位:" + response.result.haveInventoryLocation)
          } else {
            alert(response.message)
李泰瑜 authored
625
          }
李泰瑜 authored
626
627
628
629
630
631
        },
        error: function () {
          alert("未知的错误")
        }
      })
    },
李泰瑜 authored
632
  }
李泰瑜 authored
633
}
李泰瑜 authored
634
635
636
637
</script>

<style scoped>
</style>