...
|
...
|
@@ -4,12 +4,21 @@ |
4
|
4
|
<el-descriptions-item label="任务ID:">{{
|
5
|
5
|
detailData.id
|
6
|
6
|
}}</el-descriptions-item>
|
7
|
|
- <el-descriptions-item label="任务名称:">
|
8
|
|
- <el-input
|
9
|
|
- style="width: 200px"
|
10
|
|
- v-model="taskName"
|
11
|
|
- placeholder="请输入任务名称"
|
12
|
|
- />
|
|
7
|
+ <el-descriptions-item label="">
|
|
8
|
+ <el-form
|
|
9
|
+ class="taskForm"
|
|
10
|
+ :model="taskForm"
|
|
11
|
+ :rules="taskRules"
|
|
12
|
+ ref="taskFormRef"
|
|
13
|
+ >
|
|
14
|
+ <el-form-item label="任务名称:" prop="taskName">
|
|
15
|
+ <el-input
|
|
16
|
+ style="width: 200px"
|
|
17
|
+ v-model="taskForm.taskName"
|
|
18
|
+ placeholder="请输入任务名称"
|
|
19
|
+ />
|
|
20
|
+ </el-form-item>
|
|
21
|
+ </el-form>
|
13
|
22
|
</el-descriptions-item>
|
14
|
23
|
<el-descriptions-item label="对应营业厅:">{{
|
15
|
24
|
detailData.businessName
|
...
|
...
|
@@ -196,16 +205,29 @@ |
196
|
205
|
<el-row>
|
197
|
206
|
<el-col :span="24">
|
198
|
207
|
<el-form-item label="对应营业厅:" prop="businessName">
|
199
|
|
- <el-input
|
200
|
|
- v-model="form.businessName"
|
201
|
|
- placeholder="请输入对应营业厅"
|
202
|
|
- disabled
|
203
|
|
- />
|
|
208
|
+ <div style="width: 100%; display: flex">
|
|
209
|
+ <el-input
|
|
210
|
+ v-model="form.businessName"
|
|
211
|
+ placeholder="请查询对应营业厅"
|
|
212
|
+ disabled
|
|
213
|
+ />
|
|
214
|
+ <el-button
|
|
215
|
+ type="primary"
|
|
216
|
+ :loading="searchBusinessLoading"
|
|
217
|
+ @click="searchBusiness"
|
|
218
|
+ style="margin-left: 10px"
|
|
219
|
+ >查询营业厅</el-button
|
|
220
|
+ >
|
|
221
|
+ </div>
|
204
|
222
|
</el-form-item>
|
205
|
223
|
</el-col>
|
206
|
224
|
<el-col :span="24">
|
207
|
225
|
<el-form-item label="条码" prop="barcode">
|
208
|
|
- <el-input v-model="form.barcode" placeholder="请输入条码" />
|
|
226
|
+ <el-input
|
|
227
|
+ v-model="form.barcode"
|
|
228
|
+ placeholder="请输入条码"
|
|
229
|
+ @change="handleBarcodeChange"
|
|
230
|
+ />
|
209
|
231
|
</el-form-item>
|
210
|
232
|
</el-col>
|
211
|
233
|
<el-col :span="24">
|
...
|
...
|
@@ -291,6 +313,7 @@ import { |
291
|
313
|
scanTaskdetal,
|
292
|
314
|
editScanSpec,
|
293
|
315
|
editScanTask,
|
|
316
|
+ searchBusinessInfo,
|
294
|
317
|
} from "@/api/system/scan";
|
295
|
318
|
import { ElLoading } from "element-plus";
|
296
|
319
|
import { da, fa } from "element-plus/es/locales.mjs";
|
...
|
...
|
@@ -343,7 +366,7 @@ const data = reactive({ |
343
|
366
|
},
|
344
|
367
|
rules: {
|
345
|
368
|
businessName: [
|
346
|
|
- { required: true, message: "请输入对应营业厅", trigger: "blur" },
|
|
369
|
+ { required: true, message: "请查询对应营业厅", trigger: "blur" },
|
347
|
370
|
],
|
348
|
371
|
barcode: [{ required: true, message: "请输入条码", trigger: "blur" }],
|
349
|
372
|
deviceTypeId: [{ required: true, message: "请选择类型", trigger: "blur" }],
|
...
|
...
|
@@ -355,14 +378,21 @@ const data = reactive({ |
355
|
378
|
},
|
356
|
379
|
],
|
357
|
380
|
},
|
|
381
|
+ taskForm: {
|
|
382
|
+ taskName: undefined,
|
|
383
|
+ },
|
|
384
|
+ taskRules: {
|
|
385
|
+ taskName: [{ required: true, message: "请输入任务名称", trigger: "blur" }],
|
|
386
|
+ },
|
358
|
387
|
});
|
359
|
388
|
|
360
|
|
-const { queryParams, form, rules } = toRefs(data);
|
|
389
|
+const { queryParams, form, rules, taskForm, taskRules } = toRefs(data);
|
361
|
390
|
|
362
|
391
|
const open = ref(false);
|
363
|
392
|
const title = ref("");
|
364
|
393
|
const deviceTypeList = ref([]);
|
365
|
|
-const taskName = ref([]);
|
|
394
|
+
|
|
395
|
+const searchBusinessLoading = ref(false);
|
366
|
396
|
|
367
|
397
|
const getDeviceTypeList = () => {
|
368
|
398
|
deviceTypeQueryList(
|
...
|
...
|
@@ -373,6 +403,35 @@ const getDeviceTypeList = () => { |
373
|
403
|
});
|
374
|
404
|
};
|
375
|
405
|
|
|
406
|
+const handleBarcodeChange = () => {
|
|
407
|
+ form.value.businessName = undefined;
|
|
408
|
+ form.value.businessId = undefined;
|
|
409
|
+};
|
|
410
|
+
|
|
411
|
+const searchBusiness = () => {
|
|
412
|
+ proxy.$refs["userRef"].clearValidate();
|
|
413
|
+ proxy.$refs["userRef"].validateField("barcode", (valid) => {
|
|
414
|
+ console.log(valid, "1111");
|
|
415
|
+
|
|
416
|
+ if (valid) {
|
|
417
|
+ searchBusinessLoading.value = true;
|
|
418
|
+ searchBusinessInfo({
|
|
419
|
+ number: form.value.barcode,
|
|
420
|
+ })
|
|
421
|
+ .then((res) => {
|
|
422
|
+ console.log(res, 111);
|
|
423
|
+ if (res.data) {
|
|
424
|
+ form.value.businessName = res.data.name;
|
|
425
|
+ form.value.businessId = res.data.id;
|
|
426
|
+ }
|
|
427
|
+ })
|
|
428
|
+ .finally(() => {
|
|
429
|
+ searchBusinessLoading.value = false;
|
|
430
|
+ });
|
|
431
|
+ }
|
|
432
|
+ });
|
|
433
|
+};
|
|
434
|
+
|
376
|
435
|
function submitForm() {
|
377
|
436
|
proxy.$refs["userRef"].validate((valid) => {
|
378
|
437
|
if (valid) {
|
...
|
...
|
@@ -382,56 +441,22 @@ function submitForm() { |
382
|
441
|
// getList();
|
383
|
442
|
// });
|
384
|
443
|
|
385
|
|
- const localStoreTableData = localStorage.getItem("localStoreTableData")
|
386
|
|
- ? JSON.parse(localStorage.getItem("localStoreTableData"))
|
387
|
|
- : [];
|
|
444
|
+ if (
|
|
445
|
+ dataList.value.length == 0 ||
|
|
446
|
+ form.value.businessId === dataList.value[0].businessId
|
|
447
|
+ ) {
|
|
448
|
+ const localStoreTableData = localStorage.getItem("localStoreTableData")
|
|
449
|
+ ? JSON.parse(localStorage.getItem("localStoreTableData"))
|
|
450
|
+ : [];
|
388
|
451
|
|
389
|
|
- const target = localStoreTableData.find(
|
390
|
|
- (item) => item.id === form.value.id
|
391
|
|
- );
|
392
|
|
- if (target) {
|
393
|
|
- target.barcode = form.value.barcode;
|
394
|
|
- target.deviceTypeName = form.value.deviceTypeName;
|
395
|
|
- target.deviceTypeId = form.value.deviceTypeId;
|
396
|
|
- target.quantity = form.value.quantity;
|
397
|
|
- localStorage.setItem(
|
398
|
|
- "localStoreTableData",
|
399
|
|
- JSON.stringify(localStoreTableData)
|
400
|
|
- );
|
401
|
|
- open.value = false;
|
402
|
|
- proxy.$modal.msgSuccess("扫码录入成功!");
|
403
|
|
- getList();
|
404
|
|
- } else {
|
405
|
|
- const editTarget = dataList.value.find(
|
|
452
|
+ const target = localStoreTableData.find(
|
406
|
453
|
(item) => item.id === form.value.id
|
407
|
454
|
);
|
408
|
|
- console.log(1111);
|
409
|
|
- if (editTarget) {
|
410
|
|
- editScanSpec({
|
411
|
|
- id: form.value.id,
|
412
|
|
- scanTaskId: proxy.$route.query.scanTaskId,
|
413
|
|
- businessId: form.value.businessId,
|
414
|
|
- deviceTypeId: form.value.deviceTypeId,
|
415
|
|
- barcode: form.value.barcode,
|
416
|
|
- quantity: form.value.quantity,
|
417
|
|
- }).then((res) => {
|
418
|
|
- open.value = false;
|
419
|
|
- proxy.$modal.msgSuccess("编辑成功!");
|
420
|
|
- getList();
|
421
|
|
- });
|
422
|
|
- } else {
|
423
|
|
- localStoreTableData.push({
|
424
|
|
- id: new Date().getTime(),
|
425
|
|
- barcode: form.value.barcode,
|
426
|
|
- deviceTypeName: deviceTypeList.value.find(
|
427
|
|
- (item) => item.id === form.value.deviceTypeId
|
428
|
|
- ).name,
|
429
|
|
- deviceTypeId: form.value.deviceTypeId,
|
430
|
|
- quantity: form.value.quantity,
|
431
|
|
- businessId: form.value.businessId,
|
432
|
|
- businessName: form.value.businessName,
|
433
|
|
- status: "WAITING",
|
434
|
|
- });
|
|
455
|
+ if (target) {
|
|
456
|
+ target.barcode = form.value.barcode;
|
|
457
|
+ target.deviceTypeName = form.value.deviceTypeName;
|
|
458
|
+ target.deviceTypeId = form.value.deviceTypeId;
|
|
459
|
+ target.quantity = form.value.quantity;
|
435
|
460
|
localStorage.setItem(
|
436
|
461
|
"localStoreTableData",
|
437
|
462
|
JSON.stringify(localStoreTableData)
|
...
|
...
|
@@ -439,7 +464,50 @@ function submitForm() { |
439
|
464
|
open.value = false;
|
440
|
465
|
proxy.$modal.msgSuccess("扫码录入成功!");
|
441
|
466
|
getList();
|
|
467
|
+ } else {
|
|
468
|
+ const editTarget = dataList.value.find(
|
|
469
|
+ (item) => item.id === form.value.id
|
|
470
|
+ );
|
|
471
|
+ console.log(1111);
|
|
472
|
+ if (editTarget) {
|
|
473
|
+ editScanSpec({
|
|
474
|
+ id: form.value.id,
|
|
475
|
+ scanTaskId: proxy.$route.query.scanTaskId,
|
|
476
|
+ businessId: form.value.businessId,
|
|
477
|
+ deviceTypeId: form.value.deviceTypeId,
|
|
478
|
+ barcode: form.value.barcode,
|
|
479
|
+ quantity: form.value.quantity,
|
|
480
|
+ }).then((res) => {
|
|
481
|
+ open.value = false;
|
|
482
|
+ proxy.$modal.msgSuccess("编辑成功!");
|
|
483
|
+ getList();
|
|
484
|
+ });
|
|
485
|
+ } else {
|
|
486
|
+ localStoreTableData.push({
|
|
487
|
+ id: new Date().getTime(),
|
|
488
|
+ barcode: form.value.barcode,
|
|
489
|
+ deviceTypeName: deviceTypeList.value.find(
|
|
490
|
+ (item) => item.id === form.value.deviceTypeId
|
|
491
|
+ ).name,
|
|
492
|
+ deviceTypeId: form.value.deviceTypeId,
|
|
493
|
+ quantity: form.value.quantity,
|
|
494
|
+ businessId: form.value.businessId,
|
|
495
|
+ businessName: form.value.businessName,
|
|
496
|
+ status: "WAITING",
|
|
497
|
+ });
|
|
498
|
+ localStorage.setItem(
|
|
499
|
+ "localStoreTableData",
|
|
500
|
+ JSON.stringify(localStoreTableData)
|
|
501
|
+ );
|
|
502
|
+ open.value = false;
|
|
503
|
+ proxy.$modal.msgSuccess("扫码录入成功!");
|
|
504
|
+ getList();
|
|
505
|
+ }
|
442
|
506
|
}
|
|
507
|
+ } else {
|
|
508
|
+ proxy.$modal.msgError(
|
|
509
|
+ "营业厅不一致,请检查输入条码,并重新查询对应营业厅!"
|
|
510
|
+ );
|
443
|
511
|
}
|
444
|
512
|
}
|
445
|
513
|
});
|
...
|
...
|
@@ -463,12 +531,15 @@ const timer = ref(null); |
463
|
531
|
|
464
|
532
|
const downloadLoadingInstance = ref("");
|
465
|
533
|
function handleAdd() {
|
466
|
|
- downloadLoadingInstance.value = ElLoading.service({
|
467
|
|
- text: "正在连接设备中...,请稍候",
|
468
|
|
- background: "rgba(0, 0, 0, 0.7)",
|
469
|
|
- });
|
|
534
|
+ // downloadLoadingInstance.value = ElLoading.service({
|
|
535
|
+ // text: "正在连接设备中...,请稍候",
|
|
536
|
+ // background: "rgba(0, 0, 0, 0.7)",
|
|
537
|
+ // });
|
470
|
538
|
|
471
|
|
- scanCodeCallback(scanCodeCallback);
|
|
539
|
+ // scanCodeCallback(scanCodeCallback);
|
|
540
|
+ reset();
|
|
541
|
+ open.value = true;
|
|
542
|
+ title.value = "扫码录入";
|
472
|
543
|
}
|
473
|
544
|
|
474
|
545
|
// 递归调用接口,直至设备有所返回
|
...
|
...
|
@@ -489,7 +560,7 @@ const scanCodeCallback = (callback) => { |
489
|
560
|
reset();
|
490
|
561
|
open.value = true;
|
491
|
562
|
title.value = "扫码录入";
|
492
|
|
- form.value.name = taskName.value;
|
|
563
|
+ form.value.name = taskForm.value.taskName;
|
493
|
564
|
form.value.businessId = data.businessId;
|
494
|
565
|
form.value.businessName = data.businessName;
|
495
|
566
|
form.value.barcode = data.barcode;
|
...
|
...
|
@@ -523,65 +594,72 @@ const goBack = () => { |
523
|
594
|
|
524
|
595
|
const taskLoading = ref(false);
|
525
|
596
|
const confirmAddTask = () => {
|
526
|
|
- const localStoreTableData = localStorage.getItem("localStoreTableData")
|
527
|
|
- ? JSON.parse(localStorage.getItem("localStoreTableData"))
|
528
|
|
- : [];
|
|
597
|
+ proxy.$refs["taskFormRef"].validate((valid) => {
|
|
598
|
+ if (valid) {
|
|
599
|
+ const localStoreTableData = localStorage.getItem("localStoreTableData")
|
|
600
|
+ ? JSON.parse(localStorage.getItem("localStoreTableData"))
|
|
601
|
+ : [];
|
529
|
602
|
|
530
|
|
- if (localStoreTableData.length == 0 && dataList.value.length == 0) {
|
531
|
|
- proxy.$modal.msgError("请先点击扫码!");
|
532
|
|
- return;
|
533
|
|
- }
|
534
|
|
- const data = {
|
535
|
|
- name: taskName.value,
|
536
|
|
- businessId: dataList.value[0].businessId,
|
537
|
|
- specList: localStoreTableData.map((item) => ({
|
538
|
|
- businessId: item.businessId,
|
539
|
|
- deviceTypeId: item.deviceTypeId,
|
540
|
|
- barcode: item.barcode,
|
541
|
|
- quantity: item.quantity,
|
542
|
|
- })),
|
543
|
|
- };
|
544
|
|
- if (proxy.$route.query.scanTaskId) {
|
545
|
|
- data.id = detailData.value.id;
|
546
|
|
- data.name = taskName.value;
|
547
|
|
- data.businessId = detailData.value.businessId;
|
548
|
|
- data.specList = data.specList.concat(
|
549
|
|
- dataList.value
|
550
|
|
- .filter(
|
551
|
|
- (filterItem) => localStoreTableData.map(local=>local.id).indexOf(filterItem.id) == -1
|
552
|
|
- )
|
553
|
|
- .map((item) => ({
|
554
|
|
- id:item.id,
|
|
603
|
+ if (localStoreTableData.length == 0 && dataList.value.length == 0) {
|
|
604
|
+ proxy.$modal.msgError("请先点击扫码!");
|
|
605
|
+ return;
|
|
606
|
+ }
|
|
607
|
+ const data = {
|
|
608
|
+ name: taskForm.value.taskName,
|
|
609
|
+ businessId: dataList.value[0].businessId,
|
|
610
|
+ specList: localStoreTableData.map((item) => ({
|
555
|
611
|
businessId: item.businessId,
|
556
|
612
|
deviceTypeId: item.deviceTypeId,
|
557
|
613
|
barcode: item.barcode,
|
558
|
614
|
quantity: item.quantity,
|
559
|
|
- }))
|
560
|
|
- );
|
561
|
|
- taskLoading.value = true;
|
562
|
|
- editScanTask(data)
|
563
|
|
- .then((response) => {
|
564
|
|
- proxy.$modal.msgSuccess("编辑任务成功!");
|
565
|
|
- open.value = false;
|
566
|
|
- localStorage.removeItem("localStoreTableData");
|
567
|
|
- goBack();
|
568
|
|
- })
|
569
|
|
- .finally(() => {
|
570
|
|
- taskLoading.value = false;
|
571
|
|
- });
|
572
|
|
- } else {
|
573
|
|
- taskLoading.value = true;
|
574
|
|
- addScanTask(data)
|
575
|
|
- .then((response) => {
|
576
|
|
- proxy.$modal.msgSuccess("新增任务成功!");
|
577
|
|
- open.value = false;
|
578
|
|
- localStorage.removeItem("localStoreTableData");
|
579
|
|
- goBack();
|
580
|
|
- })
|
581
|
|
- .finally(() => {
|
582
|
|
- taskLoading.value = false;
|
583
|
|
- });
|
584
|
|
- }
|
|
615
|
+ })),
|
|
616
|
+ };
|
|
617
|
+ if (proxy.$route.query.scanTaskId) {
|
|
618
|
+ data.id = detailData.value.id;
|
|
619
|
+ data.name = taskForm.value.taskName;
|
|
620
|
+ data.businessId = detailData.value.businessId;
|
|
621
|
+ data.specList = data.specList.concat(
|
|
622
|
+ dataList.value
|
|
623
|
+ .filter(
|
|
624
|
+ (filterItem) =>
|
|
625
|
+ localStoreTableData
|
|
626
|
+ .map((local) => local.id)
|
|
627
|
+ .indexOf(filterItem.id) == -1
|
|
628
|
+ )
|
|
629
|
+ .map((item) => ({
|
|
630
|
+ id: item.id,
|
|
631
|
+ businessId: item.businessId,
|
|
632
|
+ deviceTypeId: item.deviceTypeId,
|
|
633
|
+ barcode: item.barcode,
|
|
634
|
+ quantity: item.quantity,
|
|
635
|
+ }))
|
|
636
|
+ );
|
|
637
|
+ taskLoading.value = true;
|
|
638
|
+ editScanTask(data)
|
|
639
|
+ .then((response) => {
|
|
640
|
+ proxy.$modal.msgSuccess("编辑任务成功!");
|
|
641
|
+ open.value = false;
|
|
642
|
+ localStorage.removeItem("localStoreTableData");
|
|
643
|
+ goBack();
|
|
644
|
+ })
|
|
645
|
+ .finally(() => {
|
|
646
|
+ taskLoading.value = false;
|
|
647
|
+ });
|
|
648
|
+ } else {
|
|
649
|
+ taskLoading.value = true;
|
|
650
|
+ addScanTask(data)
|
|
651
|
+ .then((response) => {
|
|
652
|
+ proxy.$modal.msgSuccess("新增任务成功!");
|
|
653
|
+ open.value = false;
|
|
654
|
+ localStorage.removeItem("localStoreTableData");
|
|
655
|
+ goBack();
|
|
656
|
+ })
|
|
657
|
+ .finally(() => {
|
|
658
|
+ taskLoading.value = false;
|
|
659
|
+ });
|
|
660
|
+ }
|
|
661
|
+ }
|
|
662
|
+ });
|
585
|
663
|
};
|
586
|
664
|
|
587
|
665
|
// Query list
|
...
|
...
|
@@ -653,7 +731,7 @@ const detailData = ref({}); |
653
|
731
|
const getDetail = () => {
|
654
|
732
|
scanTaskdetal(proxy.$route.query.scanTaskId).then((res) => {
|
655
|
733
|
detailData.value = res.data;
|
656
|
|
- taskName.value = detailData.value.name;
|
|
734
|
+ taskForm.value.taskName = detailData.value.name;
|
657
|
735
|
});
|
658
|
736
|
};
|
659
|
737
|
|
...
|
...
|
|