Blame view

HHECS.Web/src/views/basicData/location.vue 23.6 KB
1
<template>
王硕 authored
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  <el-container style="padding: 20px">
    <el-aside>
      <el-card :style="{ height: asideHeight }">
        <el-form label-width="80px">
          <el-form-item label="库位编号">
            <el-input
              v-model="locationCode"
              placeholder="请输入库位编号"
            ></el-input>
          </el-form-item>
          <el-form-item label="关联库位">
            <el-input
              v-model="associatedLocation"
              placeholder="请输入关联库位"
            ></el-input>
          </el-form-item>
          <el-form-item label="容器编码">
            <el-input
              v-model="containerCode"
              placeholder="请输入容器编码"
            ></el-input>
          </el-form-item>
          <el-form-item label="区域">
            <el-input v-model="area" placeholder="请输入区域"></el-input>
          </el-form-item>
          <el-form-item label="库位状态">
            <el-select v-model="locationStatus" placeholder="请选择库位状态">
              <el-option label="正常" value="normal"></el-option>
              <el-option label="禁用" value="disabled"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="仓库编码">
            <el-select v-model="warehouseCode" placeholder="请选择仓库编码">
              <el-option
                v-for="item in warehouseList"
                :key="item.code"
                :label="item.code"
                :value="item.code"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="容器状态">
            <el-select v-model="containerStatus" placeholder="请选择容器状态">
王硕 authored
45
              <el-option label="全部" value=""></el-option>
王硕 authored
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
              <el-option label="有容器" value="available"></el-option>
              <el-option label="无容器" value="unavailable"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-row>
              <el-col :span="8">
                <el-button type="primary" size="small" @click="handleQuery"
                  >查询</el-button
                >
              </el-col>
              <el-col :span="8">
                <el-button type="success" size="small" @click="handleAdd"
                  >新增</el-button
                >
              </el-col>
            </el-row>
            <el-row style="margin-top: 5px">
              <el-col :span="8">
                <el-button type="warning" size="small" @click="handleEdit"
                  >编辑</el-button
                >
              </el-col>
              <el-col :span="8">
                <el-button type="danger" size="small" @click="handleDelete"
                  >删除</el-button
                >
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8" :offset="2">
                <el-button type="success" size="small" @click="handleQuery"
                  >更改状态</el-button
                >
              </el-col>
            </el-row>
          </el-form-item>

          <el-form-item>
            <div style="margin-left: -80px">
              <el-card :style="{ width: '205px', margin: '0 auto' }">
                <template #header>
                  <div class="card-header">
王硕 authored
89
                    <span>容器维护</span>
王硕 authored
90
91
92
93
                  </div>
                </template>
                <el-form-item label="容器号">
                  <el-input
王硕 authored
94
                    v-model="containerNumber"
王硕 authored
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
                    placeholder="请输入容器号"
                  ></el-input>
                </el-form-item>
                <el-row style="display: flex">
                  <el-col style="padding-left: 16px">
                    <el-button
                      type="danger"
                      size="small"
                      @click="handleContainerDelete"
                      >删除</el-button
                    >
                  </el-col>
                  <el-col>
                    <el-button
                      type="warning"
                      size="small"
                      @click="handleContainerEdit"
                      >写入容器</el-button
                    >
                  </el-col>
                </el-row>
              </el-card>
            </div>
          </el-form-item>
        </el-form>
      </el-card>
    </el-aside>
王硕 authored
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
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
288
289
290
291
292
293
294
295
296
297
298
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
    <el-dialog
      title="新增"
      :visible.sync="dialogFormVisible"
      width="30%"
      center
    >
      <el-tabs v-model="activeTab">
        <el-tab-pane label="单个新增" name="single">
          <el-form :model="form" label-width="100px">
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="前缀">
                  <el-input v-model="form.prefix" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item label="连接符">
                  <el-input
                    v-model="form.connector"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="PLC行索引1">
                  <el-input
                    v-model="form.plcRowIndex1"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="PLC行索引2">
                  <el-input
                    v-model="form.plcRowIndex2"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="堆垛机标记">
                  <el-select
                    v-model="form.srmCode"
                    placeholder="请选择堆垛机标记"
                  >
                    <el-option label="标记1" value="1"></el-option>
                    <el-option label="标记2" value="2"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="巷道">
                  <el-input
                    v-model="form.roadway"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="行数">
                  <el-input
                    v-model="form.rowCount"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="列数">
                  <el-input
                    v-model="form.columnCount"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="层数">
                  <el-input
                    v-model="form.layerCount"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>

                <el-form-item label="库位类型">
                  <el-select
                    v-model="form.locationType"
                    placeholder="请选择库位类型"
                  >
                    <el-option label="类型1" value="1"></el-option>
                    <el-option label="类型2" value="2"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="区域">
                  <el-input v-model="form.area" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item label="仓库">
                  <el-select v-model="form.warehouse" placeholder="请选择仓库">
                    <el-option label="仓库1" value="1"></el-option>
                    <el-option label="仓库2" value="2"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="批量新增" name="batch">
          <el-form :model="batchForm" label-width="100px">
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="前缀">
                  <el-input
                    v-model="batchForm.prefix"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="连接符">
                  <el-input
                    v-model="batchForm.connector"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="PLC行索引1">
                  <el-input
                    v-model="batchForm.plcRowIndex1"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="PLC行索引2">
                  <el-input
                    v-model="batchForm.plcRowIndex2"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="堆垛机标记">
                  <el-select
                    v-model="batchForm.srmCode"
                    placeholder="请选择堆垛机标记"
                  >
                    <el-option label="标记1" value="1"></el-option>
                    <el-option label="标记2" value="2"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="巷道">
                  <el-input
                    v-model="batchForm.roadway"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="行数">
                  <el-row :gutter="12">
                    <el-col :span="11" style="padding-left: 0">
                      <el-input
                        v-model="batchForm.rowCount"
                        autocomplete="off"
                      ></el-input>
                    </el-col>
                    <el-col :span="11" style="padding-left: 0">
                      <el-input
                        v-model="batchForm.rowCount2"
                        autocomplete="off"
                      ></el-input>
                    </el-col>
                  </el-row>
                </el-form-item>
                <el-form-item label="列数">
                  <el-row :gutter="12">
                    <el-col :span="11" style="padding-left: 0">
                      <el-input
                        v-model="batchForm.columnCount"
                        autocomplete="off"
                      ></el-input>
                    </el-col>
                    <el-col :span="11" style="padding-left: 0">
                      <el-input
                        v-model="batchForm.columnCount2"
                        autocomplete="off"
                      ></el-input>
                    </el-col>
                  </el-row>
                </el-form-item>
                <el-form-item label="层数">
                  <el-row :gutter="12">
                    <el-col :span="11" style="padding-left: 0">
                      <el-input
                        v-model="batchForm.layerCount"
                        autocomplete="off"
                      ></el-input>
                    </el-col>
                    <el-col :span="11" style="padding-left: 0">
                      <el-input
                        v-model="batchForm.layerCount2"
                        autocomplete="off"
                      ></el-input>
                    </el-col>
                  </el-row>
                </el-form-item>

                <el-form-item label="库位类型">
                  <el-select
                    v-model="batchForm.locationType"
                    placeholder="请选择库位类型"
                  >
                    <el-option label="类型1" value="1"></el-option>
                    <el-option label="类型2" value="2"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="区域">
                  <el-input
                    v-model="batchForm.area"
                    autocomplete="off"
                  ></el-input>
                </el-form-item>
                <el-form-item label="仓库">
                  <el-select v-model="form.warehouse" placeholder="请选择仓库">
                    <el-option label="仓库1" value="1"></el-option>
                    <el-option label="仓库2" value="2"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
      </el-tabs>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="handleAddData">确 定</el-button>
      </span>
    </el-dialog>
王硕 authored
337
338
339
340
341
342
    <el-main>
      <el-card>
        <el-table
          :data="tableData"
          style="width: 100%"
          :height="TableHeight"
王硕 authored
343
344
          border
          highlight-current-row
王硕 authored
345
346
347
348
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55"></el-table-column>
王硕 authored
349
350
          <el-table-column prop="code" label="库位编码"></el-table-column>
          <el-table-column prop="linkCode" label="关联库位"></el-table-column>
王硕 authored
351
352
353
354
          <el-table-column
            prop="containerCode"
            label="容器编码"
          ></el-table-column>
王硕 authored
355
356
357
358
          <el-table-column
            prop="locationTypeCode"
            label="类型"
          ></el-table-column>
王硕 authored
359
360
361
362
          <el-table-column prop="row" label="行"></el-table-column>
          <el-table-column prop="column" label="列"></el-table-column>
          <el-table-column prop="layer" label="层"></el-table-column>
          <el-table-column
王硕 authored
363
364
365
366
367
368
            prop="destinationArea"
            label="区域"
          ></el-table-column>
          <el-table-column prop="roadway" label="巷道"></el-table-column>
          <el-table-column
            prop="sRMCode"
王硕 authored
369
            label="堆垛机标记"
王硕 authored
370
            width="120"
王硕 authored
371
372
          ></el-table-column>
          <el-table-column
王硕 authored
373
            prop="rowIndex1"
王硕 authored
374
            label="下位排索引1"
王硕 authored
375
            width="120"
王硕 authored
376
377
          ></el-table-column>
          <el-table-column
王硕 authored
378
            prop="rowIndex2"
王硕 authored
379
            label="下位排索引2"
王硕 authored
380
            width="120"
王硕 authored
381
          ></el-table-column>
王硕 authored
382
          <el-table-column prop="statusDesc" label="状态"></el-table-column>
王硕 authored
383
384
385
386
387
388
389
390
          <el-table-column prop="warehouse" label="仓库"></el-table-column>
        </el-table>
        <el-pagination
          style="margin-top: 15px"
          align="center"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
王硕 authored
391
          :page-sizes="[20, 50, 100]"
王硕 authored
392
393
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
王硕 authored
394
          :total="total"
王硕 authored
395
396
397
398
        />
      </el-card>
    </el-main>
  </el-container>
399
400
401
</template>

<script>
王硕 authored
402
403
404
405
406
407
408
409
import {
  GetPageLocations,
  CreateLocation,
  CreateLocations,
  DeleteLocations,
  DeleteContainerCodes,
  WriteContainerCode,
} from "@/api/basicData/location";
410
export default {
王硕 authored
411
  name: "location",
412
413
  data() {
    return {
王硕 authored
414
      containerNumber: "",
王硕 authored
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
      // 修改仓库编码为库位编号
      locationCode: "",
      // 新增关联库位
      associatedLocation: "",
      // 新增容器编码
      containerCode: "",
      // 新增区域
      area: "",
      // 新增库位状态
      locationStatus: "",
      // 新增选中的仓库编码
      warehouseCode: "",
      // 新增仓库列表
      warehouseList: [
        { code: "WH001", name: "主仓库" },
        { code: "WH002", name: "分仓库" },
        { code: "WH003", name: "临时仓库" },
      ],
      currentPage: 1,
      total: 0,
王硕 authored
435
      pageSize: 20,
王硕 authored
436
      selectedItems: [],
王硕 authored
437
      tableData: [],
王硕 authored
438
      // 新增容器状态
王硕 authored
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
      containerStatus: "",
      dialogFormVisible: false,
      activeTab: "single", // 默认激活的标签页
      form: {
        prefix: "",
        connector: "",
        plcRowIndex1: 0,
        plcRowIndex2: 0,
        srmCode: "",
        roadway: 0,
        rowCount: 0,
        columnCount: 0,
        layerCount: 0,
        locationType: "",
        area: "",
        warehouse: "",
      },
      batchForm: {
        prefix: "",
        connector: "",
        plcRowIndex1: "",
        plcRowIndex2: "",
        srmCode: "",
        roadway: "",
        rowCount: "",
        rowCount2: "",
        columnCount: "",
        columnCount2: "",
        layerCount: "",
        layerCount2: "",
        locationType: "",
        area: "",
        warehouse: "",
      },
王硕 authored
473
474
475
476
477
478
479
480
481
    };
  },
  computed: {
    TableHeight() {
      return `calc(100vh - 220px )`;
    },
    asideHeight() {
      return `calc(100vh - 150px)`;
    },
王硕 authored
482
483
484
    currentUserName() {
      return this.$store.state.user.name;
    },
485
486
  },
  methods: {
王硕 authored
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
    handleSelectionChange(val) {
      this.selectedItems = val;
      // console.log("选中的行数据:", this.selectedItems);
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.currentPage = 1;
      this.handleQuery();
    },

    handleCurrentChange(val) {
      this.currentPage = val;
      this.handleQuery();
    },
    handleQuery() {
王硕 authored
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
      const requestData = {
        pageNumber: this.currentPage,
        perPageCount: this.pageSize,
        queryConfig: {
          code: this.locationCode.trim(),
          linkCode: this.associatedLocation.trim(),
          warehouseCode: this.warehouseCode.trim(),
          containerCode: this.containerCode.trim(),
          destinationArea: this.area.trim(),
        },
      };
      GetPageLocations(requestData).then((res) => {
        if (res.code == "Success" && res.data) {
          this.tableData = res.data.data || res.data;
          this.total = res.data.totalCount || res.data.data.length;
        }
      });
王硕 authored
519
520
    },
    handleAdd() {
王硕 authored
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
      this.dialogFormVisible = true;
      this.form = {
        prefix: "",
        connector: "",
        plcRowIndex1: 0,
        plcRowIndex2: 0,
        srmCode: "",
        roadway: 0,
        rowCount: 0,
        columnCount: 0,
        layerCount: 0,
        locationType: "",
        area: "",
        warehouse: "",
      };
      this.batchForm = {
        prefix: "",
        connector: "",
        plcRowIndex1: 0,
        plcRowIndex2: 0,
        srmCode: "",
        roadway: 0,
        rowCount: 0,
        rowCount2: 0,
        columnCount: 0,
        columnCount2: 0,
        layerCount: 0,
        layerCount2: 0,
        locationType: "",
        area: "",
        warehouse: "",
      };
    },
    handleAddData() {
      if (this.activeTab === "single") {
        const requestData = {
          prefix: this.form.prefix,
          rowIndex: this.form.rowCount,
          columnIndex: this.form.columnCount,
          layerIndex: this.form.layerCount,
          rowIndex1: this.form.plcRowIndex1,
          rowIndex2: this.form.plcRowIndex2,
          srmCode: this.form.srmCode,
          type: this.form.locationType,
          connector: this.form.connector,
          roadway: this.form.roadway,
          destinationArea: this.form.area,
          warehouseCode: this.form.warehouse,
          userCode: this.currentUserName,
        };
        CreateLocation(requestData).then((res) => {
          if (res.code === "Success") {
            this.$message.success("新增成功");
            this.dialogFormVisible = false;
            this.handleQuery();
          } else {
            this.$message.error(res.message);
          }
        });
      } else if (this.activeTab === "batch") {
        const batcheDatas = {
          prefix: this.batchForm.prefix,
          rowBeginIndex: this.batchForm.rowCount,
          rowEndIndex: this.batchForm.rowCount2,
          columnBeginIndex: this.batchForm.columnCount,
          columnEndIndex: this.batchForm.columnCount2,
          layerBeginIndex: this.batchForm.layerCount,
          layerEndIndex: this.batchForm.layerCount2,
          rowIndex1: this.batchForm.plcRowIndex1,
          rowIndex2: this.batchForm.plcRowIndex2,
          srmCode: this.batchForm.srmCode,
          type: this.batchForm.locationType,
          hightType: "",
          connector: this.batchForm.connector,
          roadway: this.batchForm.roadway,
          destinationArea: this.batchForm.area,
          warehouseCode: this.batchForm.warehouse,
          userCode: this.currentUserName,
        };
        CreateLocations(batcheDatas).then((res) => {
          if (res.code === "Success") {
            this.$message.success("批量新增成功");
            this.dialogFormVisible = false;
            this.handleQuery();
          } else {
            this.$message.error("批量新增失败");
          }
        });
        console.log("批量新增数据:", batcheDatas);
      }
王硕 authored
611
612
613
614
615
    },
    handleEdit() {
      // 编辑逻辑
    },
    handleDelete() {
王硕 authored
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
      console.log(this.selectedItems);
      if (this.selectedItems.length === 0) {
        this.$alert("请至少选择一条数据", "提示", {
          confirmButtonText: "确定",
        });
        return;
      }
      this.$confirm("确定要删除选中的数据吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          const codes = this.selectedItems.map((item) => item.code);
          DeleteLocations(codes).then((res) => {
            if (res.code === "Success") {
              this.$message.success("删除成功");
              this.handleQuery();
            }
          });
        })
        .catch(() => {
          this.$message.info("已取消删除");
        });
王硕 authored
640
641
642
    },
    // 新增容器删除方法
    handleContainerDelete() {
王硕 authored
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
      //   if (this.containerNumber === "") {
      //     this.$message.error("请输入容器编码");
      //     return;
      //   }

      const requestData = [
        {
          code: this.containerNumber,
          linkCode: this.associatedLocation.trim(),
          status: 0,
          userCode: this.currentUserName,
          warehouseCode: this.warehouseCode,
          containerCode: this.containerNumber,
          destinationArea: this.area,
          isContainerCode: true,
          notContainerCode: false,
        },
      ];
      DeleteContainerCodes(requestData).then((res) => {
        if (res.code === "Success") {
          this.$message.success("删除成功");
          this.handleQuery();
        }
      });
王硕 authored
667
668
669
    },
    // 新增容器编辑方法
    handleContainerEdit() {
王硕 authored
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
      if (this.containerNumber === "") {
        this.$message.error("请输入容器编码");
        return;
      }
      const ronqidata = {
        code: this.containerNumber,
        linkCode: this.associatedLocation.trim(),
        status: 0,
        userCode: this.currentUserName,
        warehouseCode: this.warehouseCode,
        containerCode: this.containerNumber,
        destinationArea: this.area,
        isContainerCode: true,
        notContainerCode: false,
      };
      WriteContainerCode(ronqidata).then((res) => {
        if (res.code === "Success") {
          this.$message.success("编辑成功");
          this.handleQuery();
        } else {
          this.$message.error(res.message);
        }
      });
王硕 authored
693
694
695
    },
  },
};
696
697
698
</script>

<style scoped>
王硕 authored
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
.el-card__body,
.el-main {
  padding: 0 10px 0 10px;
}
::v-deep.el-table thead {
  color: #101010;
  font-weight: 600;
}
.card-header {
  height: 21px;
  text-align: center;
}
.el-card__header {
  padding: 2px 20px !important;
}
.el-form-item {
  margin-bottom: 18px;
}
王硕 authored
717
718
719
.el-table__body tr.current-row {
  background-color: #f0f9eb; /* 自定义高亮背景色 */
}
720
/* 样式定义 */
王硕 authored
721
</style>