Kaynağa Gözat

案件批量录入接口联调

Your Name 2 yıl önce
ebeveyn
işleme
8b735d148d

+ 11
- 2
src/api/caseAccess/caseEntry.js Dosyayı Görüntüle

@@ -4,8 +4,8 @@ import request from '@/utils/request'
4 4
 export function caseApply(data) {
5 5
   return request({
6 6
     url: '/caseApplication/list',
7
-    method: 'post',
8
-    data: data
7
+    method: 'get',
8
+    params: data
9 9
   })
10 10
 }
11 11
 
@@ -49,3 +49,12 @@ export function submitCaseApply(data) {
49 49
     data: data
50 50
   })
51 51
 }
52
+
53
+// 下载模板
54
+export function importTemplate(data) {
55
+  return request({
56
+    url: '/caseApplication/importTemplate',
57
+    method: 'post',
58
+    data: data
59
+  })
60
+}

+ 37
- 3
src/views/caseAccessAll/caseEntry.vue Dosyayı Görüntüle

@@ -152,9 +152,11 @@
152 152
       :initpaymentArr1="initpaymentArr1"
153 153
     ></caseentryDialog>
154 154
     <!-- 批量申请弹框 openbatch-->
155
-    <!-- <batchDialog
155
+    <batchDialog
156 156
     :openbatch="openbatch"
157
-    ></batchDialog> -->
157
+    @cancelBatch="cancelBatch"
158
+    :getcaseApply="getcaseApply"
159
+    ></batchDialog>
158 160
   </div>
159 161
 </template>
160 162
 
@@ -172,7 +174,7 @@ export default {
172 174
   dicts: ["sys_identity_type"],
173 175
   components: {
174 176
     caseentryDialog,
175
-    // batchDialog
177
+    batchDialog
176 178
   },
177 179
   data() {
178 180
     return {
@@ -211,6 +213,9 @@ export default {
211 213
     cancel() {
212 214
       this.visible = false;
213 215
     },
216
+    cancelBatch() {
217
+      this.openbatch = false
218
+    },
214 219
     /** 查询登录日志列表 */
215 220
     getcaseApply() {
216 221
       this.loading = true;
@@ -236,6 +241,35 @@ export default {
236 241
     // 立案申请
237 242
     filingApplication() {
238 243
       this.form = {};
244
+        this.paymentArr = [
245
+        {
246
+          identityType: 1,
247
+          name: "",
248
+          identityNum: "",
249
+          contactTelphone: "",
250
+          workAddress: "",
251
+          workTelphone: "",
252
+          contactAddress: "",
253
+          nameAgent: "",
254
+          contactTelphoneAgent: "",
255
+          contactAddressAgent: "",
256
+        },
257
+      ];
258
+        this.paymentArr1 = [
259
+        {
260
+          identityType: 2,
261
+          name: "",
262
+          identityNum: "",
263
+          contactTelphone: "",
264
+          workAddress: "",
265
+          workTelphone: "",
266
+          contactAddress: "",
267
+          nameAgent: "",
268
+          contactTelphoneAgent: "",
269
+          contactAddressAgent: "",
270
+        },
271
+      ]
272
+
239 273
       this.visible = true;
240 274
       this.dialogtitle = "立案申请";
241 275
       this.flag = "2"

+ 108
- 24
src/views/caseAccessAll/components/batchDialog.vue Dosyayı Görüntüle

@@ -2,44 +2,52 @@
2 2
   <div>
3 3
     <!-- 立案申请弹框 -->
4 4
     <el-dialog
5
-      :title="dialogtitle"
6
-      :visible.sync="openbatch"
7
-      width="800px"
5
+      title="批量立案"
6
+      :visible="openbatch"
7
+      width="600px"
8 8
       append-to-body
9
+      @close="cancel"
9 10
     >
10 11
       <el-form ref="form" :model="form" :rules="rules" label-width="150px">
11
-        <!-- <el-row> -->
12
+        <el-row>
12 13
           <!-- <el-col :span="16">
13 14
             <el-form-item label="申请人姓名:" prop="applyName">
14 15
               <el-input v-model="form.jobName" placeholder="请输入姓名" />
15 16
             </el-form-item>
16
-          </el-col>
17
+          </el-col>-->
17 18
           <el-col :span="8">
18
-            <el-button type="primary" @click="downloadTemplate"
19
-              >下载模板</el-button
20
-            >
21
-          </el-col> -->
19
+            <div class="download" style="margin-bottom: 20px">
20
+              <span> 下载: </span>
21
+              <a href="#">
22
+                <el-button class="uploadlink" @click="downloadTemplate">批量导入模板</el-button>
23
+              </a>
24
+            </div>
25
+          </el-col>
22 26
           <!-- <el-col :span="12">
23 27
             <el-form-item label="立案申请书:" prop="applybook"> </el-form-item>
24 28
           </el-col>
25 29
           <el-col :span="12"> </el-col> -->
26
-        <!-- </el-row> -->
30
+        </el-row>
27 31
         <el-row>
28 32
           <el-form-item :span="24" label="批量立案信息上传:" prop="upload">
29 33
             <el-upload
30 34
               class="upload-demo"
31
-              action="https://jsonplaceholder.typicode.com/posts/"
32
-              :on-preview="handlePreview"
33
-              :on-remove="handleRemove"
34
-              :before-remove="beforeRemove"
35
-              multiple
36
-              :limit="3"
37
-              :on-exceed="handleExceed"
38
-              :file-list="fileList"
35
+              ref="uploadbatch"
36
+              :limit="1"
37
+              accept=".xlsx, .xls"
38
+              :headers="upload.headers"
39
+              :action="upload.url + '?updateSupport=' + upload.updateSupport"
40
+              :disabled="upload.isUploading"
41
+              :on-progress="handleFileUploadProgress"
42
+              :on-success="handleFileSuccess"
43
+              :auto-upload="false"
44
+              drag
39 45
             >
40
-              <el-button size="small" type="primary">点击上传</el-button>
46
+            <i class="el-icon-upload"></i>
47
+            <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
48
+              <!-- <el-button size="small" type="primary">点击上传</el-button> -->
41 49
               <div slot="tip" class="el-upload__tip">
42
-                只能上传文件,且不超过500kb
50
+                只接收.xlsx, .xls格式文件
43 51
               </div>
44 52
             </el-upload>
45 53
           </el-form-item>
@@ -54,22 +62,98 @@
54 62
 </template>
55 63
 
56 64
 <script>
65
+import { importTemplate } from "@/api/caseAccess/caseEntry";
66
+import { getToken } from "@/utils/auth";
57 67
 export default {
68
+  props: ["openbatch","getcaseApply"],
58 69
   data() {
59 70
     return {
60
-      key: value,
71
+      //   key: value,
72
+      form: {},
73
+      fileList: [],
74
+      rules: {
75
+        upload: [
76
+          { required: true, message: "批量立案文件不能为空", trigger: "blur" },
77
+        ],
78
+      },
79
+      // 案件批量导入
80
+      upload: {
81
+        // 是否显示弹出层(用户导入)
82
+        open: false,
83
+        // 弹出层标题(用户导入)
84
+        title: "",
85
+        // 是否禁用上传
86
+        isUploading: false,
87
+        // 是否更新已经存在的用户数据
88
+        updateSupport: 0,
89
+        // 设置上传的请求头部
90
+        headers: { Authorization: "Bearer " + getToken() },
91
+        // 上传的地址
92
+        url: process.env.VUE_APP_BASE_API + "/caseApplication/importData",
93
+      },
61 94
     };
62 95
   },
63 96
   methods: {
64
-    // 提交立案申请
65
-    submitForm() {},
97
+    // 批量提交立案申请
98
+    submitForm() {
99
+        this.$refs.uploadbatch.submit();
100
+    },
66 101
     // 取消
67 102
     cancel() {
68
-      this.openbatch = false;
103
+      //   this.openbatch = false;
104
+      this.$emit("cancelBatch");
105
+    },
106
+    handleRemove(file, fileList) {},
107
+    handlePreview(file) {},
108
+    handleExceed(files, fileList) {
109
+      this.$message.warning(
110
+        `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
111
+          files.length + fileList.length
112
+        } 个文件`
113
+      );
114
+    },
115
+    beforeRemove(file, fileList) {
116
+      return this.$confirm(`确定移除 ${file.name}?`);
117
+    },
118
+    // 下载模板 importTemplate
119
+    downloadTemplate() {
120
+    //   console.log("下载模板");
121
+      this.download(
122
+        "caseApplication/importTemplate",
123
+        {},
124
+        `case_batch_${new Date().getTime()}.xlsx`
125
+      );
126
+    },
127
+    // 文件上传中处理
128
+    handleFileUploadProgress(event, file, fileList) {
129
+      this.upload.isUploading = true;
130
+    },
131
+    // 文件上传成功处理
132
+    handleFileSuccess(response, file, fileList) {
133
+    //   this.upload.open = false;
134
+      this.$emit("cancelBatch");
135
+      this.upload.isUploading = false;
136
+      this.$refs.uploadbatch.clearFiles();
137
+      this.$alert(
138
+        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
139
+          response.msg +
140
+          "</div>",
141
+        "导入结果",
142
+        { dangerouslyUseHTMLString: true }
143
+      );
144
+      this.getcaseApply();
69 145
     },
70 146
   },
71 147
 };
72 148
 </script>
73 149
 
74 150
 <style lang="scss" scoped>
151
+.download {
152
+  a {
153
+    .uploadlink{
154
+        border: none;
155
+        color: #2092c7;
156
+    }
157
+  }
158
+}
75 159
 </style>

+ 37
- 63
src/views/caseAccessAll/components/caseentryDialog.vue Dosyayı Görüntüle

@@ -375,12 +375,17 @@
375 375
 
376 376
 <script>
377 377
 import moment from "moment"; //导入文件
378
-import {
379
-  addCaseApply,
380
-  editCaseApply,
381
-} from "@/api/caseAccess/caseEntry";
378
+import { addCaseApply, editCaseApply } from "@/api/caseAccess/caseEntry";
382 379
 export default {
383
-  props: ["visible", "dialogtitle", "form", "getcaseApply", "flag","initpaymentArr","initpaymentArr1"],
380
+  props: [
381
+    "visible",
382
+    "dialogtitle",
383
+    "form",
384
+    "getcaseApply",
385
+    "flag",
386
+    "initpaymentArr",
387
+    "initpaymentArr1",
388
+  ],
384 389
   data() {
385 390
     return {
386 391
       formData: this.form,
@@ -395,8 +400,9 @@ export default {
395 400
           {
396 401
             required: true,
397 402
             message: "案件标的不能为空",
398
-            trigger: "blur",
403
+            trigger: ["change", "blur"],
399 404
           },
405
+          // { type: "Number", message: "案件标的必须为数字值" },
400 406
         ],
401 407
         loanStartDate: [
402 408
           {
@@ -432,6 +438,7 @@ export default {
432 438
             message: "申请人主张欠本金不能为空",
433 439
             trigger: "blur",
434 440
           },
441
+          // { type: 'number', message: '申请人主张欠本金必须为数字值'}
435 442
         ],
436 443
         claimInterestOwed: [
437 444
           {
@@ -439,6 +446,7 @@ export default {
439 446
             message: "申请人主张欠利息不能为空",
440 447
             trigger: "blur",
441 448
           },
449
+          // { type: 'number', message: '申请人主张欠利息必须为数字值'}
442 450
         ],
443 451
         Overduedays: [
444 452
           {
@@ -446,6 +454,7 @@ export default {
446 454
             message: "逾期天数不能为空",
447 455
             trigger: "blur",
448 456
           },
457
+          // { type: 'number', message: '逾期天数必须为数字值'}
449 458
         ],
450 459
         claimLiquidDamag: [
451 460
           {
@@ -453,9 +462,10 @@ export default {
453 462
             message: "申请人主张违约金不能为空",
454 463
             trigger: "blur",
455 464
           },
465
+          // { type: 'number', message: '申请人主张违约金必须为数字值'}
456 466
         ],
457 467
       },
458
-      rules2: {
468
+      rulesmain: {
459 469
         name: [
460 470
           {
461 471
             required: true,
@@ -476,6 +486,11 @@ export default {
476 486
             message: "联系电话不能为空",
477 487
             trigger: "blur",
478 488
           },
489
+          {
490
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
491
+            message: "请输入正确的手机号码",
492
+            trigger: "blur",
493
+          },
479 494
         ],
480 495
         workAddress: [
481 496
           {
@@ -490,6 +505,11 @@ export default {
490 505
             message: "单位电话不能为空",
491 506
             trigger: "blur",
492 507
           },
508
+          {
509
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
510
+            message: "请输入正确的手机号码",
511
+            trigger: "blur",
512
+          },
493 513
         ],
494 514
         contactAddress: [
495 515
           {
@@ -518,6 +538,11 @@ export default {
518 538
             message: "联系电话不能为空",
519 539
             trigger: "blur",
520 540
           },
541
+          {
542
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
543
+            message: "请输入正确的手机号码",
544
+            trigger: "blur",
545
+          },
521 546
         ],
522 547
         contactAddressAgent: [
523 548
           {
@@ -559,44 +584,13 @@ export default {
559 584
     };
560 585
   },
561 586
   watch: {
562
-    initpaymentArr: {
587
+    visible: {
563 588
       handler(val) {
564 589
         if (val) {
565 590
           this.formData = this.form;
566 591
           if (this.flag == "1" || this.flag == "0") {
567
-            // this.getInfo(this.formData);
568
-            this.paymentArr = this.initpaymentArr
569
-            this.paymentArr1 = this.initpaymentArr1
570
-          }
571
-          if(this.flag == "2") {
572
-            this.paymentArr = [
573
-        {
574
-          identityType: 1,
575
-          name: "",
576
-          identityNum: "",
577
-          contactTelphone: "",
578
-          workAddress: "",
579
-          workTelphone: "",
580
-          contactAddress: "",
581
-          nameAgent: "",
582
-          contactTelphoneAgent: "",
583
-          contactAddressAgent: "",
584
-        },
585
-      ]
586
-            this.paymentArr1 = [
587
-        {
588
-          identityType: 2,
589
-          name: "",
590
-          identityNum: "",
591
-          contactTelphone: "",
592
-          workAddress: "",
593
-          workTelphone: "",
594
-          contactAddress: "",
595
-          nameAgent: "",
596
-          contactTelphoneAgent: "",
597
-          contactAddressAgent: "",
598
-        },
599
-      ]
592
+            this.paymentArr = this.initpaymentArr;
593
+            this.paymentArr1 = this.initpaymentArr1;
600 594
           }
601 595
         }
602 596
       },
@@ -604,10 +598,8 @@ export default {
604 598
     },
605 599
   },
606 600
   methods: {
607
-    handleRemove(file, fileList) {
608
-    },
609
-    handlePreview(file) {
610
-    },
601
+    handleRemove(file, fileList) {},
602
+    handlePreview(file) {},
611 603
     handleExceed(files, fileList) {
612 604
       this.$message.warning(
613 605
         `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
@@ -652,25 +644,7 @@ export default {
652 644
         contactTelphoneAgent: "",
653 645
         contactAddressAgent: "",
654 646
       });
655
-      
656 647
     },
657
-    // // 查找主体信息数据
658
-    // getInfo(row) {
659
-    //   const id = row.id;
660
-    //   selectCaseApply({ id }).then((res) => {
661
-    //     this.visible = true;
662
-    //     this.formData = res.data;
663
-    //     this.paymentArr = [];
664
-    //     this.paymentArr1 = [];
665
-    //     res.data.caseAffiliates.forEach((item) => {
666
-    //       if (item.identityType == 1) {
667
-    //         this.paymentArr.push(item);
668
-    //       } else {
669
-    //         this.paymentArr1.push(item);
670
-    //       }
671
-    //     });
672
-    //   });
673
-    // },
674 648
     // 删除申请人主体信息
675 649
     deleteData(index) {
676 650
       this.paymentArr.splice(index, 1);