@liuqiongqiong/vue-pages 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1070 +1,892 @@
1
- <template>
2
- <div class="app-container">
3
- <div class="filter-container">
4
- <el-form
5
- ref="listQuery"
6
- :inline="true"
7
- :model="listQuery"
8
- class="demo-form-inline"
9
- >
10
- <el-form-item label="姓名" prop="name">
11
- <el-select
12
- v-model="listQuery.name"
13
- style="width: 100%"
14
- clearable
15
- filterable
16
- size="small"
17
- class="filter-item"
18
- placeholder="请选择姓名"
19
- >
20
- <el-option
21
- v-for="(item, index) in renyuanxinxi"
22
- :key="index"
23
- :label="item.name"
24
- :value="item.name"
25
- />
26
- </el-select>
27
- </el-form-item>
28
- <el-form-item label="性别" prop="sex">
29
- <el-select
30
- v-model="listQuery.sex"
31
- size="small"
32
- placeholder="请选择性别"
33
- >
34
- <el-option
35
- v-for="(item, index) in [
36
- { label: '男', value: '1' },
37
- { label: '女', value: '2' },
38
- ]"
39
- :key="index"
40
- :label="item.label"
41
- :value="item.value"
42
- />
43
- </el-select>
44
- </el-form-item>
45
- <el-form-item>
46
- <el-button size="small" type="primary" @click="onSubmit"
47
- >查询</el-button
48
- >
49
- </el-form-item>
50
- <el-form-item>
51
- <el-button size="small" type="warning" @click="resetting('listQuery')"
52
- >重置</el-button
53
- >
54
- </el-form-item>
55
- <el-form-item>
56
- <el-button size="small" type="success" @click="add">新增</el-button>
57
- </el-form-item>
58
- <el-form-item>
59
- <el-button
60
- size="small"
61
- type="primary"
62
- @click="dialogVisibleExp = true"
63
- >导出</el-button
64
- >
65
- </el-form-item>
66
- <el-form-item>
67
- <el-button size="small" type="primary" @click="synchronization"
68
- >护工同步</el-button
69
- >
70
- </el-form-item>
71
- </el-form>
72
- </div>
73
- <el-table border height="65vh" :data="list" style="width: 100%">
74
- <!-- @sort-change="sortChange" -->
75
- <el-table-column :label="'姓名'" prop="id" align="center">
76
- <template slot-scope="{ row }">
77
- <span>{{ row.name }}</span>
78
- </template>
79
- </el-table-column>
80
- <el-table-column :label="'性别'" align="center">
81
- <template slot-scope="{ row }">
82
- <span>{{ row.sex }}</span>
83
- </template>
84
- </el-table-column>
85
- <el-table-column :label="'手机号码'" align="center">
86
- <template slot-scope="{ row }">
87
- <span>{{ row.phoneNumber }}</span>
88
- <!-- <el-tag>{{ row.type | typeFilter }}</el-tag> -->
89
- </template>
90
- </el-table-column>
91
- <el-table-column :label="'身份证号'" align="center">
92
- <template slot-scope="{ row }">
93
- <span>{{ row.idCode }}</span>
94
- <!-- <span style="color:red;">{{ row.reviewer }}</span> -->
95
- </template>
96
- </el-table-column>
97
- <el-table-column :label="'居住地'" align="center">
98
- <template slot-scope="{ row }">
99
- <span>{{ row.address }}</span>
100
- <!-- <svg-icon v-for="n in +row.importance" :key="n" icon-class="star" class="meta-item__icon" /> -->
101
- </template>
102
- </el-table-column>
103
- <el-table-column :label="'状态'" align="center">
104
- <template slot-scope="{ row }">
105
- <el-tag
106
- size="medium"
107
- :type="
108
- row.status == '0' ? 'danger' : row.status == '1' ? 'success' : ''
109
- "
110
- >
111
- <span v-if="row.status == '0'">不可用</span>
112
- <span v-if="row.status == '1'">正常</span>
113
- </el-tag>
114
- </template>
115
- </el-table-column>
116
- <el-table-column :label="'资质证书'" align="center">
117
- <template slot-scope="{ row }">
118
- <el-image
119
- v-for="(item, index) in row.certPicUrlList"
120
- :key="index"
121
- style="width: 50px; height: 50px"
122
- :src="`${constant}${img(item)}`"
123
- :preview-src-list="[`${constant}${img(item)}`]"
124
- />
125
- </template>
126
- </el-table-column>
127
- <el-table-column :label="'身份证'" align="center">
128
- <template slot-scope="{ row }">
129
- <el-image
130
- v-for="(item, index) in row.sfzUrlList"
131
- :key="index"
132
- style="width: 50px; height: 50px"
133
- :src="`${constant}${img(item)}`"
134
- :preview-src-list="[`${constant}${img(item)}`]"
135
- />
136
- </template>
137
- </el-table-column>
138
- <el-table-column :label="'学历证书'" align="center">
139
- <template slot-scope="{ row }">
140
- <el-image
141
- v-for="(item, index) in row.xlUrlList"
142
- :key="index"
143
- style="width: 50px; height: 50px"
144
- :src="`${constant}${img(item)}`"
145
- :preview-src-list="[`${constant}${img(item)}`]"
146
- />
147
- </template>
148
- </el-table-column>
149
- <!-- <el-table-column :label="'状态'" align="center">
150
- <template slot-scope="{row}">
151
- <el-tag size="medium" :type="row.status == '1' ? 'success' : row.status == '2' ? 'warning' : '' " >{{ row.status == '1' ? '有效' : row.status == '2' ? '无效' : row.status == '0' ? '待审核' : '-'}}</el-tag>
152
- </template>
153
- </el-table-column> -->
154
- <el-table-column
155
- :label="'操作'"
156
- align="center"
157
- width="280"
158
- class-name="small-padding fixed-width"
159
- >
160
- <template slot-scope="{ row, $index }">
161
- <el-button size="mini" type="success" @click="update(row, 'draft')">
162
- 更新状态
163
- </el-button>
164
- <el-button size="mini" type="primary" @click="edit(row, 'draft')">
165
- 修改
166
- </el-button>
167
- <el-button
168
- size="mini"
169
- type="danger"
170
- @click="handleDelete(row, $index)"
171
- >
172
- 注销
173
- </el-button>
174
- </template>
175
- </el-table-column>
176
- </el-table>
177
-
178
- <pagination
179
- v-show="total > 0"
180
- :total="total"
181
- :page.sync="listQuery.pageNo"
182
- :limit.sync="listQuery.size"
183
- @pagination="getList"
184
- />
185
- <el-dialog
186
- :close-on-click-modal="false"
187
- :close-on-press-escape="false"
188
- :title="textMap[dialogStatus]"
189
- :visible.sync="dialogFormVisible"
190
- width="40%"
191
- >
192
- <el-form
193
- ref="dataForm"
194
- :rules="rules"
195
- :model="temp"
196
- label-position="right"
197
- label-width="100px"
198
- >
199
- <el-row :gutter="20">
200
- <el-col :span="12">
201
- <el-form-item label="姓名" prop="name">
202
- <el-input
203
- v-model="temp.name"
204
- size="small"
205
- clearable
206
- placeholder="请输入姓名"
207
- />
208
- </el-form-item>
209
- </el-col>
210
- <el-col :span="12">
211
- <el-form-item label="性别" prop="sex">
212
- <el-select
213
- v-model="temp.sex"
214
- style="width: 100%"
215
- clearable
216
- filterable
217
- size="small"
218
- placeholder="请选择性别"
219
- class="filter-item"
220
- >
221
- <el-option
222
- v-for="(item, index) in [
223
- { label: '男', value: '男' },
224
- { label: '女', value: '女' },
225
- ]"
226
- :key="index"
227
- :label="item.label"
228
- :value="item.value"
229
- />
230
- </el-select>
231
- </el-form-item>
232
- </el-col>
233
- <el-col :span="12">
234
- <el-form-item label="手机号码" prop="phoneNumber">
235
- <el-input
236
- v-model="temp.phoneNumber"
237
- size="small"
238
- clearable
239
- placeholder="请输入手机号码"
240
- />
241
- </el-form-item>
242
- </el-col>
243
- <el-col :span="12">
244
- <el-form-item label="身份证号" prop="idCode">
245
- <el-input
246
- v-model="temp.idCode"
247
- size="small"
248
- clearable
249
- placeholder="请输入身份证号"
250
- />
251
- </el-form-item>
252
- </el-col>
253
- <el-col :span="12">
254
- <el-form-item label="居住地" prop="address">
255
- <el-input
256
- v-model="temp.address"
257
- size="small"
258
- clearable
259
- placeholder="请输入居住地"
260
- />
261
- </el-form-item>
262
- </el-col>
263
- <!-- <el-col :span="12">
264
- <el-form-item label="状态" prop="status">
265
- <el-select style="width:100%" clearable filterable size="small" v-model="temp.status"
266
- class="filter-item" placeholder="请选择状态">
267
- <el-option v-for="(item, index) in [{label:'有效',value:'1'},{label:'无效',value:'2'},{label:'待审核',value:'0'}]" :key="index" :label="item.label"
268
- :value="item.value" />
269
- </el-select>
270
- </el-form-item>
271
- </el-col> -->
272
- <el-col :span="12">
273
- <el-form-item label="所属机构" prop="unitId">
274
- <el-select
275
- v-model="temp.unitId"
276
- style="width: 100%"
277
- clearable
278
- filterable
279
- size="small"
280
- class="filter-item"
281
- placeholder="请选择所属机构"
282
- >
283
- <el-option
284
- v-for="(item, index) in institutionArrData"
285
- :key="index"
286
- :label="item.label"
287
- :value="item.value"
288
- />
289
- </el-select>
290
- </el-form-item>
291
- </el-col>
292
- <el-col :span="24">
293
- <el-form-item label="注:" prop="unitId">
294
- <span style="color: red"
295
- >上传的文件请使用姓名+类型去命名。防止文件名字重复被覆盖</span
296
- >
297
- </el-form-item>
298
- </el-col>
299
- <el-col :span="12">
300
- <el-form-item label="资质证书" prop="certPicUrlList">
301
- <el-upload
302
- action="#"
303
- :limit="1"
304
- :before-upload="beforeAvatarUploada"
305
- :http-request="certhandleFileUpload"
306
- :data="{ att_type: '22' }"
307
- :on-remove="handleCertPicUrlRemove"
308
- :before-remove="beforeRemove"
309
- :on-error="handleError"
310
- :file-list="temp.certPicUrlList"
311
- :on-preview="onPreview"
312
- >
313
- <el-button slot="trigger" size="small" type="primary"
314
- >选取文件</el-button
315
- >
316
- </el-upload>
317
- </el-form-item>
318
- </el-col>
319
- <el-col :span="12">
320
- <el-form-item label="身份证" prop="sfzUrlList">
321
- <el-upload
322
- action="#"
323
- :limit="1"
324
- :data="{ att_type: '01' }"
325
- :before-upload="beforeAvatarUploada"
326
- :http-request="sfzhandleFileUpload"
327
- :on-remove="handleSfzUrllRemove"
328
- :before-remove="beforeRemove"
329
- :file-list="temp.sfzUrlList"
330
- :on-preview="onPreview"
331
- >
332
- <el-button slot="trigger" size="small" type="primary"
333
- >选取文件</el-button
334
- >
335
- </el-upload>
336
- </el-form-item>
337
- </el-col>
338
- <el-col :span="12">
339
- <el-form-item label="学位证书" prop="xlUrlList">
340
- <el-upload
341
- action="#"
342
- :limit="1"
343
- :data="{ att_type: '21' }"
344
- :before-upload="beforeAvatarUploada"
345
- :http-request="xlhandleFileUpload"
346
- :on-remove="handleXlUrlRemove"
347
- :before-remove="beforeRemove"
348
- :file-list="temp.xlUrlList"
349
- :on-preview="onPreview"
350
- >
351
- <el-button slot="trigger" size="small" type="primary"
352
- >选取文件</el-button
353
- >
354
- </el-upload>
355
- </el-form-item>
356
- </el-col>
357
- </el-row>
358
- </el-form>
359
- <div slot="footer" class="dialog-footer">
360
- <el-button size="small" @click="dialogFormVisible = false">
361
-
362
- </el-button>
363
- <el-button
364
- type="primary"
365
- size="small"
366
- @click="dialogStatus === 'create' ? createData() : updateData()"
367
- >
368
-
369
- </el-button>
370
- </div>
371
- </el-dialog>
372
- <preview-file :file="file" />
373
- <el-dialog
374
- :close-on-click-modal="false"
375
- :close-on-press-escape="false"
376
- title="导出"
377
- :visible.sync="dialogVisibleExp"
378
- width="600px"
379
- :before-close="handleClose"
380
- >
381
- <el-form :inline="true" class="demo-form-inline">
382
- <el-form-item label="提示:">
383
- <el-link :underline="false" type="primary"
384
- >选择的开始日期和结束日期请将数据的入录时间包含起来,结束日期选后一天</el-link
385
- >
386
- </el-form-item>
387
- <el-form-item label="时间">
388
- <el-date-picker
389
- v-model="startDate"
390
- type="daterange"
391
- value-format="yyyy-MM-dd"
392
- range-separator="至"
393
- start-placeholder="开始日期"
394
- end-placeholder="结束日期"
395
- />
396
- </el-form-item>
397
- </el-form>
398
- <span slot="footer" class="dialog-footer">
399
- <el-button size="small" :loading="loadExp" @click="handleClose"
400
- >取 消</el-button
401
- >
402
- <el-button
403
- size="small"
404
- type="primary"
405
- :loading="loadExp"
406
- @click="expExcel"
407
- >
408
- 导 出
409
- </el-button>
410
- </span>
411
- </el-dialog>
412
-
413
- <el-dialog
414
- :close-on-click-modal="false"
415
- :close-on-press-escape="false"
416
- title="护工同步"
417
- :visible.sync="HugongdialogVisible"
418
- width="500px"
419
- :before-close="handleClose"
420
- >
421
- <el-form :inline="true" class="demo-form-inline">
422
- <el-form-item label="身份证">
423
- <el-input
424
- style="width: 100%"
425
- v-model="idCord"
426
- size="small"
427
- clearable
428
- placeholder="请输入身份证号"
429
- />
430
- </el-form-item>
431
- </el-form>
432
- <span slot="footer" class="dialog-footer">
433
- <el-button size="small" @click="HugongdialogVisible = false"
434
- >关 闭</el-button
435
- >
436
- <el-button size="small" type="primary" @click="synchronous">
437
-
438
- </el-button>
439
- </span>
440
- </el-dialog>
441
- </div>
442
- </template>
443
-
444
- <script>
445
- import {
446
- SPersonSave,
447
- SPersonPage,
448
- SPersonDel,
449
- ExportExcel,
450
- SPersonSync,
451
- updateStatus,
452
- } from "@/api/article";
453
- import { SysUnitPage } from "@/api/institution";
454
- import { uploadTP, uploadPDF, uploadThird } from "@/api/upload";
455
- import { fileUrl } from "@/utils/fileUrl.js";
456
- import Pagination from "@/components/Pagination";
457
- import PreviewFile from "@/components/previewFile";
458
- import { getUserInfoRole } from "@/utils/auth";
459
- export default {
460
- name: "Personnel",
461
- components: { Pagination, PreviewFile },
462
- filters: {},
463
- data() {
464
- return {
465
- userInfo: {},
466
- renyuanxinxi: [],
467
- dialogVisibleExp: false,
468
- loadExp: false,
469
- startDate: [],
470
- file: {
471
- fileurl: "",
472
- dialogVisible: false,
473
- title: "",
474
- type: "",
475
- },
476
- idCord: "",
477
- HugongdialogVisible: false,
478
- FormData: {},
479
- institutionArrData: [],
480
- dialogStatus: "",
481
- textMap: { update: "编辑", create: "创建" },
482
- tableKey: 0,
483
- list: null,
484
- total: 0,
485
- listLoading: true,
486
- listQuery: {
487
- pageNo: 1,
488
- size: 20,
489
- },
490
- dialogFormVisible: false,
491
- dialogPvVisible: false,
492
- rules: {
493
- name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
494
- idCode: [
495
- { required: true, message: "请输入身份证号", trigger: "blur" },
496
- ],
497
- phoneNumber: [
498
- { required: true, message: "请输入手机号码", trigger: "blur" },
499
- ],
500
- sex: [{ required: true, message: "请选择性别", trigger: "change" }],
501
- unitId: [
502
- { required: true, message: "请选择所属机构", trigger: "change" },
503
- ],
504
- },
505
- temp: {
506
- longtermPsnAttDtoList: [],
507
- },
508
- downloadLoading: false,
509
- };
510
- },
511
- computed: {
512
- constant() {
513
- return this.$constant.imgAddr;
514
- },
515
- img() {
516
- return function (value) {
517
- if (value.match(/^chx\/tp\//)) {
518
- return value;
519
- } else {
520
- return "chx/tp/" + value;
521
- }
522
- };
523
- },
524
- },
525
- created() {
526
- console.log("VUE_APP_BASE_API:", process.env);
527
- this.getList();
528
- this.getinstitution();
529
- this.userInfo = JSON.parse(getUserInfoRole());
530
- },
531
- methods: {
532
- handleError(err, file, fileList) {
533
- console.log("上传失败", err, file, fileList);
534
- // 这里可以添加你的错误处理逻辑,比如提示用户或者重试上传
535
- this.$message.error("图片上传失败,请重试");
536
- },
537
- // 护工同步
538
- synchronization() {
539
- this.HugongdialogVisible = true;
540
- },
541
- synchronous() {
542
- SPersonSync({ unitId: this.userInfo.unitId, idCord: this.idCord }).then(
543
- (res) => {
544
- if (res.status == 1) {
545
- this.getList();
546
- this.$notify({
547
- title: "提示",
548
- message: res.info,
549
- type: "success",
550
- duration: 2000,
551
- });
552
- this.dialogFormVisible = false;
553
- this.idCord = "";
554
- return;
555
- }
556
- this.$notify({
557
- title: "提示",
558
- message: res.info,
559
- type: "error",
560
- duration: 2000,
561
- });
562
- }
563
- );
564
- },
565
- handleClose() {
566
- this.dialogVisibleExp = false;
567
- this.HugongdialogVisible = false;
568
- this.startDate = [];
569
- },
570
- expExcel() {
571
- try {
572
- this.loadExp = true;
573
- const form = {
574
- startDate: this.startDate[0],
575
- endDate: this.startDate[1],
576
- };
577
- ExportExcel(form)
578
- .then((res) => {
579
- const blob = new Blob([res]);
580
- const fileName = "护工信息";
581
- if (blob.size > 0) {
582
- const elink = document.createElement("a");
583
- elink.style.display = "none";
584
- elink.href = URL.createObjectURL(blob);
585
- // 类似a标签下载
586
- // 自定义文件名称和导出类型。最好和后台保持一致
587
- elink.download = `${fileName}/${this.$moment().format(
588
- "YYYY-MM-DD"
589
- )}.xlsx`;
590
- document.body.appendChild(elink);
591
- elink.click();
592
- // 释放URL 对象
593
- URL.revokeObjectURL(elink.href);
594
- // 删除创建的 a 标签
595
- document.body.removeChild(elink);
596
- }
597
- this.handleClose();
598
- this.loadExp = false;
599
- })
600
- .catch(() => {
601
- this.loadExp = false;
602
- });
603
- } catch (e) {
604
- this.loadExp = false;
605
- }
606
- },
607
- // 获取机构
608
- getinstitution() {
609
- SysUnitPage({ pageNo: 1, size: 9999 }).then((response) => {
610
- this.institutionArrData = response.result.data.map((item) => {
611
- return { label: item.name, value: item.id };
612
- });
613
- });
614
- },
615
- // 文件格式验证
616
- beforeAvatarUploada(file) {
617
- this.loadingstate = true;
618
- const index = file.name.lastIndexOf(".");
619
- const extension = file.name.substr(index + 1);
620
- const extensionList = ["png", "PNG", "jpg", "JPG", "jpeg", "JPEG"];
621
- const isLt2M = file.size / 1024 / 1024 < 10;
622
- if (!isLt2M) {
623
- this.$message({
624
- message: "封面不可超出10M",
625
- type: "warning",
626
- center: true,
627
- });
628
- return false;
629
- } else if (extensionList.indexOf(extension) < 0) {
630
- this.$message({
631
- message: "只能图片文件",
632
- type: "error",
633
- center: true,
634
- });
635
- return false;
636
- }
637
- },
638
- onPreview(file) {
639
- const type = fileUrl(file.url);
640
- let url = `${this.$constant.imgAddr}${file.url}`;
641
- console.log(url);
642
- if (
643
- type == "word" ||
644
- type == "wps" ||
645
- type == "pdf" ||
646
- type == "pptx" ||
647
- type == "txt"
648
- ) {
649
- this.file.type = type;
650
- url = `https://wps-view.zhihuipk.com/?src=` + url;
651
- } else if (type == "image") {
652
- this.file.type = type;
653
- } else if (type == "video") {
654
- this.file.type = type;
655
- } else if (type == "radio") {
656
- this.file.type = type;
657
- } else {
658
- this.$message.error("该格式不可在线预览,请下载后查看");
659
- return;
660
- }
661
- this.file.fileurl = url; // 后端请求回来的文件地址url
662
- this.file.dialogVisible = true; // 弹窗
663
- this.file.title = file.name; // 文件名称
664
- },
665
- beforeRemove(file, fileList) {
666
- return this.$confirm(`确定移除 ${file.name}?`);
667
- },
668
- handleCertPicUrlRemove(file, fileList) {
669
- this.temp.certPicUrlList = this.temp.certPicUrlList.filter((item) => {
670
- // const regex = /(.*\/)([^\/]+)\.(jpg|png)$/;
671
- // const match1 = item.name.match(regex);
672
- // if (match1) {
673
- // return match1[2] + '.' + match1[3] != file.name
674
- // }
675
- return item.name != file.name;
676
- });
677
- this.temp.longtermPsnAttDtoList = this.temp.longtermPsnAttDtoList.filter(
678
- (item) => {
679
- return item.att_name != file.name;
680
- }
681
- );
682
- },
683
- handleSfzUrllRemove(file, fileList) {
684
- this.temp.sfzUrlList = this.temp.sfzUrlList.filter((item) => {
685
- // const regex = /(.*\/)([^\/]+)\.(jpg|png)$/;
686
- // const match1 = item.name.match(regex);
687
- // if (match1) {
688
- // return match1[2] + '.' + match1[3] != file.name
689
- // }
690
- return item.name != file.name;
691
- });
692
- this.temp.longtermPsnAttDtoList = this.temp.longtermPsnAttDtoList.filter(
693
- (item) => {
694
- return item.att_name != file.name;
695
- }
696
- );
697
- },
698
- handleXlUrlRemove(file, fileList) {
699
- this.temp.xlUrlList = this.temp.xlUrlList.filter((item) => {
700
- // const regex = /(.*\/)([^\/]+)\.(jpg|png)$/;
701
- // const match1 = item.name.match(regex);
702
- // if (match1) {
703
- // return match1[2] + '.' + match1[3] != file.name
704
- // }
705
- return item.name != file.name;
706
- });
707
- this.temp.longtermPsnAttDtoList = this.temp.longtermPsnAttDtoList.filter(
708
- (item) => {
709
- return item.att_name != file.name;
710
- }
711
- );
712
- // this.temp.xlUrlList = this.xlUrlList
713
- },
714
-
715
- // 处理文件上传操作
716
- certhandleFileUpload(file) {
717
- const obj = new FormData();
718
- // 上传文件
719
- obj.append("file", file.file);
720
- obj.append("realPath", file.file.name);
721
- obj.append("fileName", file.file.name);
722
- obj.append("att_type", file.data.att_type);
723
- this.temp.certPicUrlList = [];
724
- // 上传文件接口
725
- uploadTP(obj).then((data) => {
726
- console.log(data);
727
- if (data.status == 1) {
728
- this.$message({
729
- message: "上传成功",
730
- type: "success",
731
- });
732
- }
733
- this.temp.certPicUrlList.push({
734
- url: data.result.url,
735
- name: data.result.name,
736
- });
737
- uploadThird(obj).then((res) => {
738
- if (res.status == 1) {
739
- const obj = {
740
- att_type: file.data.att_type,
741
- att_name: res.result.output.att_name,
742
- file_id: res.result.output.file_id,
743
- file_type: res.result.output.file_type,
744
- };
745
- this.temp.longtermPsnAttDtoList.push(obj);
746
- }
747
- });
748
- });
749
- },
750
- sfzhandleFileUpload(file) {
751
- const obj = new FormData();
752
- // 上传文件
753
- obj.append("file", file.file);
754
- obj.append("realPath", file.file.name);
755
- obj.append("fileName", file.file.name);
756
- obj.append("att_type", file.data.att_type);
757
- this.temp.sfzUrlList = [];
758
- // 上传文件接口
759
- uploadTP(obj).then((data) => {
760
- console.log(data);
761
- if (data.status == 1) {
762
- this.$message({
763
- message: "上传成功",
764
- type: "success",
765
- });
766
- }
767
- this.temp.sfzUrlList.push({
768
- url: data.result.url,
769
- name: data.result.name,
770
- });
771
- uploadThird(obj).then((res) => {
772
- if (res.status == 1) {
773
- const obj = {
774
- att_type: file.data.att_type,
775
- att_name: res.result.output.att_name,
776
- file_id: res.result.output.file_id,
777
- file_type: res.result.output.file_type,
778
- };
779
- this.temp.longtermPsnAttDtoList.push(obj);
780
- }
781
- });
782
- });
783
- },
784
- xlhandleFileUpload(file) {
785
- const obj = new FormData();
786
- // 上传文件
787
- obj.append("file", file.file);
788
- obj.append("realPath", file.file.name);
789
- obj.append("fileName", file.file.name);
790
- obj.append("att_type", file.data.att_type);
791
- this.temp.xlUrlList = [];
792
- // 上传文件接口
793
- uploadTP(obj).then((data) => {
794
- console.log(data);
795
- if (data.status == 1) {
796
- this.$message({
797
- message: "上传成功",
798
- type: "success",
799
- });
800
- }
801
- this.temp.xlUrlList.push({
802
- url: data.result.url,
803
- name: data.result.name,
804
- });
805
- uploadThird(obj).then((res) => {
806
- if (res.status == 1) {
807
- const obj = {
808
- att_type: file.data.att_type,
809
- att_name: res.result.output.att_name,
810
- file_id: res.result.output.file_id,
811
- file_type: res.result.output.file_type,
812
- };
813
- this.temp.longtermPsnAttDtoList.push(obj);
814
- }
815
- });
816
- });
817
- },
818
- add() {
819
- this.dialogStatus = "create";
820
- this.dialogFormVisible = true;
821
- this.temp = {};
822
- this.temp.longtermPsnAttDtoList = [];
823
- this.temp.xlUrlList = [];
824
- this.temp.certPicUrlList = [];
825
- this.temp.sfzUrlList = [];
826
- },
827
- update(row) {
828
- updateStatus({ id: row.id }).then((res) => {
829
- if (res.status == 1) {
830
- this.getList();
831
- this.$notify({
832
- title: res.info,
833
- message: "更新成功",
834
- type: "success",
835
- duration: 2000,
836
- });
837
- this.dialogFormVisible = false;
838
- return;
839
- }
840
- this.$notify({
841
- title: res.info,
842
- message: "更新失败",
843
- type: "error",
844
- duration: 2000,
845
- });
846
- });
847
- },
848
- edit(row) {
849
- // if(!contains22Or01) {
850
- // this.$message({
851
- // message: "请传资质证书或身份证",
852
- // type: "warning",
853
- // center: true,
854
- // });
855
- // }
856
- this.temp = JSON.parse(JSON.stringify(row));
857
- this.dialogStatus = "update";
858
- this.dialogFormVisible = true;
859
- this.temp.longtermPsnAttDtoList = [];
860
- this.temp.certPicUrlList = [];
861
- this.temp.sfzUrlList = [];
862
- this.temp.xlUrlList = [];
863
- if (row.certPicUrlList) {
864
- this.temp.certPicUrlList = row.certPicUrlList.map((res) => {
865
- return {
866
- name: res,
867
- url: res,
868
- };
869
- });
870
- }
871
- if (row.sfzUrlList) {
872
- this.temp.sfzUrlList = row.sfzUrlList.map((res) => {
873
- return {
874
- name: res,
875
- url: res,
876
- };
877
- });
878
- }
879
- if (row.xlUrlList) {
880
- this.temp.xlUrlList = row.xlUrlList.map((res) => {
881
- return {
882
- name: res,
883
- url: res,
884
- };
885
- });
886
- }
887
- if (this.temp.thirdFileList && this.temp.thirdFileList.length > 0) {
888
- for (var i = 0; i < this.temp.thirdFileList.length; i++) {
889
- if (
890
- this.temp.thirdFileList[i].att_type == "01" ||
891
- this.temp.thirdFileList[i].att_type == "21" ||
892
- this.temp.thirdFileList[i].att_type == "22"
893
- ) {
894
- this.temp.longtermPsnAttDtoList.push(this.temp.thirdFileList[i]);
895
- }
896
- }
897
- }
898
- },
899
- getList() {
900
- this.listLoading = true;
901
- SPersonPage(this.listQuery).then((response) => {
902
- this.list = response.result.data;
903
- this.total = response.result.count;
904
- setTimeout(() => {
905
- this.listLoading = false;
906
- }, 1.5 * 1000);
907
- });
908
- SPersonPage({ size: 9999, pageNo: 1 }).then((response) => {
909
- this.renyuanxinxi = response.result.data;
910
- });
911
- },
912
- handleModifyStatus(row, status) {
913
- this.$message({
914
- message: "操作成功",
915
- type: "success",
916
- });
917
- row.status = status;
918
- },
919
- resetting(formName) {
920
- this.$nextTick(() => {
921
- this.$refs[formName].resetFields();
922
- });
923
- },
924
- onSubmit() {
925
- this.getList();
926
- },
927
- createData() {
928
- this.$refs["dataForm"].validate((valid) => {
929
- if (valid) {
930
- this.temp.rolel = "2";
931
- const obj = {
932
- certPicUrlList: [],
933
- xlUrlList: [],
934
- sfzUrlList: [],
935
- };
936
- if (this.temp.certPicUrlList.length > 0) {
937
- obj.certPicUrlList = this.temp.certPicUrlList.map((item) => {
938
- return item.name;
939
- });
940
- }
941
- if (this.temp.xlUrlList.length > 0) {
942
- obj.xlUrlList = this.temp.xlUrlList.map((item) => {
943
- return item.name;
944
- });
945
- }
946
- if (this.temp.sfzUrlList.length > 0) {
947
- obj.sfzUrlList = this.temp.sfzUrlList.map((item) => {
948
- return item.name;
949
- });
950
- }
951
- SPersonSave({ ...this.temp, ...obj }).then((res) => {
952
- if (res.status == 1) {
953
- this.getList();
954
- this.$notify({
955
- title: res.info,
956
- message: "创建成功,请通知医保审核",
957
- type: "success",
958
- duration: 2000,
959
- });
960
- this.dialogFormVisible = false;
961
- return;
962
- }
963
- this.$notify({
964
- title: res.info,
965
- message: "创建失败",
966
- type: "error",
967
- duration: 2000,
968
- });
969
- });
970
- }
971
- });
972
- },
973
- hasBothValues(arr, value1, value2) {
974
- const has22 = arr.some((item) => item.att_type === value1);
975
- const has01 = arr.some((item) => item.att_type === value2);
976
- return has22 && has01;
977
- },
978
- updateData() {
979
- this.$refs["dataForm"].validate((valid) => {
980
- if (valid) {
981
- this.temp.rolel = "2";
982
- const obj = {
983
- certPicUrlList: [],
984
- xlUrlList: [],
985
- sfzUrlList: [],
986
- };
987
- if (
988
- this.temp.certPicUrlList.length > 0 &&
989
- this.temp.certPicUrlList[0]
990
- ) {
991
- obj.certPicUrlList = this.temp.certPicUrlList.map((item) => {
992
- return item.name;
993
- });
994
- }
995
- if (this.temp.xlUrlList.length > 0 && this.temp.xlUrlList[0]) {
996
- obj.xlUrlList = this.temp.xlUrlList.map((item) => {
997
- return item.name;
998
- });
999
- }
1000
- if (this.temp.sfzUrlList.length > 0 && this.temp.sfzUrlList[0]) {
1001
- obj.sfzUrlList = this.temp.sfzUrlList.map((item) => {
1002
- return item.name;
1003
- });
1004
- }
1005
- if (this.temp.longtermPsnAttDtoList.length == 0) {
1006
- this.$message({
1007
- message: "请上传材料",
1008
- type: "warning",
1009
- center: true,
1010
- });
1011
- return;
1012
- }
1013
- const result = this.hasBothValues(
1014
- this.temp.longtermPsnAttDtoList,
1015
- "22",
1016
- "01"
1017
- );
1018
- console.log(result);
1019
- if (!result) {
1020
- this.$message({
1021
- message: "请传资质证书或身份证",
1022
- type: "warning",
1023
- center: true,
1024
- });
1025
- }
1026
- SPersonSave({ ...this.temp, ...obj }).then((res) => {
1027
- if (res.status == 1) {
1028
- this.getList();
1029
- this.$notify({
1030
- title: res.info,
1031
- message: "更新成功,请通知医保审核",
1032
- type: "success",
1033
- duration: 2000,
1034
- });
1035
- this.dialogFormVisible = false;
1036
- return;
1037
- }
1038
- this.$notify({
1039
- title: res.info,
1040
- message: "更新失败",
1041
- type: "error",
1042
- duration: 2000,
1043
- });
1044
- });
1045
- }
1046
- });
1047
- },
1048
- handleDelete(row, index) {
1049
- SPersonDel({ id: row.id, isDelete: "1" }).then((res) => {
1050
- if (res.status == 1) {
1051
- this.getList();
1052
- this.$notify({
1053
- title: res.info,
1054
- message: "删除成功",
1055
- type: "success",
1056
- duration: 2000,
1057
- });
1058
- return;
1059
- }
1060
- this.$notify({
1061
- title: res.info,
1062
- message: "删除失败",
1063
- type: "error",
1064
- duration: 2000,
1065
- });
1066
- });
1067
- },
1068
- },
1069
- };
1070
- </script>
1
+ <template>
2
+ <div class="app-container">
3
+ <div class="filter-container">
4
+ <el-form ref="listQuery" :inline="true" :model="listQuery" class="demo-form-inline">
5
+ <el-form-item label="姓名" prop="name">
6
+ <el-select v-model="listQuery.name" style="width: 100%" clearable filterable size="small" class="filter-item"
7
+ placeholder="请选择姓名">
8
+ <el-option v-for="(item, index) in renyuanxinxi" :key="index" :label="item.name" :value="item.name" />
9
+ </el-select>
10
+ </el-form-item>
11
+ <el-form-item label="性别" prop="sex">
12
+ <el-select v-model="listQuery.sex" size="small" placeholder="请选择性别">
13
+ <el-option v-for="(item, index) in [
14
+ { label: '男', value: '1' },
15
+ { label: '女', value: '2' },
16
+ ]" :key="index" :label="item.label" :value="item.value" />
17
+ </el-select>
18
+ </el-form-item>
19
+ <el-form-item>
20
+ <el-button size="small" type="primary" @click="onSubmit">查询</el-button>
21
+ </el-form-item>
22
+ <el-form-item>
23
+ <el-button size="small" type="warning" @click="resetting('listQuery')">重置</el-button>
24
+ </el-form-item>
25
+ <el-form-item>
26
+ <el-button size="small" type="success" @click="add">新增</el-button>
27
+ </el-form-item>
28
+ <el-form-item>
29
+ <el-button size="small" type="primary" @click="dialogVisibleExp = true">导出</el-button>
30
+ </el-form-item>
31
+ <el-form-item>
32
+ <el-button size="small" type="primary" @click="synchronization">护工同步</el-button>
33
+ </el-form-item>
34
+ </el-form>
35
+ </div>
36
+ <el-table border height="65vh" :data="list" style="width: 100%">
37
+ <!-- @sort-change="sortChange" -->
38
+ <el-table-column :label="'姓名'" prop="id" align="center">
39
+ <template slot-scope="{ row }">
40
+ <span>{{ row.name }}</span>
41
+ </template>
42
+ </el-table-column>
43
+ <el-table-column :label="'性别'" align="center">
44
+ <template slot-scope="{ row }">
45
+ <span>{{ row.sex }}</span>
46
+ </template>
47
+ </el-table-column>
48
+ <el-table-column :label="'手机号码'" align="center">
49
+ <template slot-scope="{ row }">
50
+ <span>{{ row.phoneNumber }}</span>
51
+ <!-- <el-tag>{{ row.type | typeFilter }}</el-tag> -->
52
+ </template>
53
+ </el-table-column>
54
+ <el-table-column :label="'身份证号'" align="center">
55
+ <template slot-scope="{ row }">
56
+ <span>{{ row.idCode }}</span>
57
+ <!-- <span style="color:red;">{{ row.reviewer }}</span> -->
58
+ </template>
59
+ </el-table-column>
60
+ <el-table-column :label="'居住地'" align="center">
61
+ <template slot-scope="{ row }">
62
+ <span>{{ row.address }}</span>
63
+ <!-- <svg-icon v-for="n in +row.importance" :key="n" icon-class="star" class="meta-item__icon" /> -->
64
+ </template>
65
+ </el-table-column>
66
+ <el-table-column :label="'状态'" align="center">
67
+ <template slot-scope="{ row }">
68
+ <el-tag size="medium" :type="row.status == '0' ? 'danger' : row.status == '1' ? 'success' : ''
69
+ ">
70
+ <span v-if="row.status == '0'">不可用</span>
71
+ <span v-if="row.status == '1'">正常</span>
72
+ </el-tag>
73
+ </template>
74
+ </el-table-column>
75
+ <el-table-column :label="'资质证书'" align="center">
76
+ <template slot-scope="{ row }">
77
+ <el-image v-for="(item, index) in row.certPicUrlList" :key="index" style="width: 50px; height: 50px"
78
+ :src="`${constant}${img(item)}`" :preview-src-list="[`${constant}${img(item)}`]" />
79
+ </template>
80
+ </el-table-column>
81
+ <el-table-column :label="'身份证'" align="center">
82
+ <template slot-scope="{ row }">
83
+ <el-image v-for="(item, index) in row.sfzUrlList" :key="index" style="width: 50px; height: 50px"
84
+ :src="`${constant}${img(item)}`" :preview-src-list="[`${constant}${img(item)}`]" />
85
+ </template>
86
+ </el-table-column>
87
+ <el-table-column :label="'健康证'" align="center">
88
+ <template slot-scope="{ row }">
89
+ <el-image v-for="(item, index) in row.xlUrlList" :key="index" style="width: 50px; height: 50px"
90
+ :src="`${constant}${img(item)}`" :preview-src-list="[`${constant}${img(item)}`]" />
91
+ </template>
92
+ </el-table-column>
93
+ <!-- <el-table-column :label="'状态'" align="center">
94
+ <template slot-scope="{row}">
95
+ <el-tag size="medium" :type="row.status == '1' ? 'success' : row.status == '2' ? 'warning' : '' " >{{ row.status == '1' ? '有效' : row.status == '2' ? '无效' : row.status == '0' ? '待审核' : '-'}}</el-tag>
96
+ </template>
97
+ </el-table-column> -->
98
+ <el-table-column :label="'操作'" align="center" width="280" class-name="small-padding fixed-width">
99
+ <template slot-scope="{ row, $index }">
100
+ <el-button size="mini" type="success" @click="update(row, 'draft')">
101
+ 更新状态
102
+ </el-button>
103
+ <el-button size="mini" type="primary" @click="edit(row, 'draft')">
104
+ 修改
105
+ </el-button>
106
+ <el-button size="mini" type="danger" @click="handleDelete(row, $index)">
107
+ 注销
108
+ </el-button>
109
+ </template>
110
+ </el-table-column>
111
+ </el-table>
112
+
113
+ <pagination v-show="total > 0" :total="total" :page.sync="listQuery.pageNo" :limit.sync="listQuery.size"
114
+ @pagination="getList" />
115
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :title="textMap[dialogStatus]"
116
+ :visible.sync="dialogFormVisible" width="40%">
117
+ <el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="100px">
118
+ <el-row :gutter="20">
119
+ <el-col :span="12">
120
+ <el-form-item label="姓名" prop="name">
121
+ <el-input v-model="temp.name" size="small" clearable placeholder="请输入姓名" />
122
+ </el-form-item>
123
+ </el-col>
124
+ <el-col :span="12">
125
+ <el-form-item label="性别" prop="sex">
126
+ <el-select v-model="temp.sex" style="width: 100%" clearable filterable size="small" placeholder="请选择性别"
127
+ class="filter-item">
128
+ <el-option v-for="(item, index) in [
129
+ { label: '男', value: '男' },
130
+ { label: '女', value: '女' },
131
+ ]" :key="index" :label="item.label" :value="item.value" />
132
+ </el-select>
133
+ </el-form-item>
134
+ </el-col>
135
+ <el-col :span="12">
136
+ <el-form-item label="手机号码" prop="phoneNumber">
137
+ <el-input v-model="temp.phoneNumber" size="small" clearable placeholder="请输入手机号码" />
138
+ </el-form-item>
139
+ </el-col>
140
+ <el-col :span="12">
141
+ <el-form-item label="身份证号" prop="idCode">
142
+ <el-input v-model="temp.idCode" size="small" clearable placeholder="请输入身份证号" />
143
+ </el-form-item>
144
+ </el-col>
145
+ <el-col :span="12">
146
+ <el-form-item label="居住地" prop="address">
147
+ <el-input v-model="temp.address" size="small" clearable placeholder="请输入居住地" />
148
+ </el-form-item>
149
+ </el-col>
150
+ <!-- <el-col :span="12">
151
+ <el-form-item label="状态" prop="status">
152
+ <el-select style="width:100%" clearable filterable size="small" v-model="temp.status"
153
+ class="filter-item" placeholder="请选择状态">
154
+ <el-option v-for="(item, index) in [{label:'有效',value:'1'},{label:'无效',value:'2'},{label:'待审核',value:'0'}]" :key="index" :label="item.label"
155
+ :value="item.value" />
156
+ </el-select>
157
+ </el-form-item>
158
+ </el-col> -->
159
+ <el-col :span="12">
160
+ <el-form-item label="所属机构" prop="unitId">
161
+ <el-select v-model="temp.unitId" style="width: 100%" clearable filterable size="small" class="filter-item"
162
+ placeholder="请选择所属机构">
163
+ <el-option v-for="(item, index) in institutionArrData" :key="index" :label="item.label"
164
+ :value="item.value" />
165
+ </el-select>
166
+ </el-form-item>
167
+ </el-col>
168
+ <el-col :span="12">
169
+ <el-form-item label="持证时间" prop="liceIssuDate">
170
+ <el-date-picker v-model="temp.liceIssuDate" value-format="yyyy-MM-dd" type="date" placeholder="持证时间">
171
+ </el-date-picker>
172
+ </el-form-item>
173
+ </el-col>
174
+ <el-col :span="24">
175
+ <el-form-item label="注:" prop="unitId">
176
+ <span style="color: red">上传的文件请使用姓名+类型去命名。防止文件名字重复被覆盖</span>
177
+ </el-form-item>
178
+ </el-col>
179
+ <el-col :span="12">
180
+ <el-form-item label="资质证书" prop="certPicUrlList">
181
+ <el-upload action="#" :limit="1" :before-upload="beforeAvatarUploada" :http-request="certhandleFileUpload"
182
+ :data="{ att_type: '22' }" :on-remove="handleCertPicUrlRemove" :before-remove="beforeRemove"
183
+ :on-error="handleError" :file-list="temp.certPicUrlList" :on-preview="onPreview">
184
+ <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
185
+ </el-upload>
186
+ </el-form-item>
187
+ </el-col>
188
+ <el-col :span="12">
189
+ <el-form-item label="身份证" prop="sfzUrlList">
190
+ <el-upload action="#" :limit="1" :data="{ att_type: '01' }" :before-upload="beforeAvatarUploada"
191
+ :http-request="sfzhandleFileUpload" :on-remove="handleSfzUrllRemove" :before-remove="beforeRemove"
192
+ :file-list="temp.sfzUrlList" :on-preview="onPreview">
193
+ <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
194
+ </el-upload>
195
+ </el-form-item>
196
+ </el-col>
197
+ <el-col :span="12">
198
+ <el-form-item label="学位证书" prop="xlUrlList">
199
+ <el-upload action="#" :limit="1" :data="{ att_type: '21' }" :before-upload="beforeAvatarUploada"
200
+ :http-request="xlhandleFileUpload" :on-remove="handleXlUrlRemove" :before-remove="beforeRemove"
201
+ :file-list="temp.xlUrlList" :on-preview="onPreview">
202
+ <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
203
+ </el-upload>
204
+ </el-form-item>
205
+ </el-col>
206
+
207
+ </el-row>
208
+ </el-form>
209
+ <div slot="footer" class="dialog-footer">
210
+ <el-button size="small" @click="dialogFormVisible = false">
211
+
212
+ </el-button>
213
+ <el-button type="primary" size="small" @click="dialogStatus === 'create' ? createData() : updateData()">
214
+
215
+ </el-button>
216
+ </div>
217
+ </el-dialog>
218
+ <preview-file :file="file" />
219
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" title="导出" :visible.sync="dialogVisibleExp"
220
+ width="600px" :before-close="handleClose">
221
+ <el-form :inline="true" class="demo-form-inline">
222
+ <el-form-item label="提示:">
223
+ <el-link :underline="false" type="primary">选择的开始日期和结束日期请将数据的入录时间包含起来,结束日期选后一天</el-link>
224
+ </el-form-item>
225
+ <el-form-item label="时间">
226
+ <el-date-picker v-model="startDate" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
227
+ start-placeholder="开始日期" end-placeholder="结束日期" />
228
+ </el-form-item>
229
+ </el-form>
230
+ <span slot="footer" class="dialog-footer">
231
+ <el-button size="small" :loading="loadExp" @click="handleClose">取 消</el-button>
232
+ <el-button size="small" type="primary" :loading="loadExp" @click="expExcel">
233
+
234
+ </el-button>
235
+ </span>
236
+ </el-dialog>
237
+
238
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" title="护工同步"
239
+ :visible.sync="HugongdialogVisible" width="500px" :before-close="handleClose">
240
+ <el-form :inline="true" class="demo-form-inline">
241
+ <el-form-item label="身份证">
242
+ <el-input style="width: 100%" v-model="idCord" size="small" clearable placeholder="请输入身份证号" />
243
+ </el-form-item>
244
+ </el-form>
245
+ <span slot="footer" class="dialog-footer">
246
+ <el-button size="small" @click="HugongdialogVisible = false">关 闭</el-button>
247
+ <el-button size="small" type="primary" @click="synchronous">
248
+ 同 步
249
+ </el-button>
250
+ </span>
251
+ </el-dialog>
252
+ </div>
253
+ </template>
254
+
255
+ <script>
256
+ import {
257
+ SPersonSave,
258
+ SPersonPage,
259
+ SPersonDel,
260
+ ExportExcel,
261
+ SPersonSync,
262
+ updateStatus,
263
+ } from "@/api/article";
264
+ import { SysUnitPage } from "@/api/institution";
265
+ import { uploadTP, uploadPDF, uploadThird } from "@/api/upload";
266
+ import { fileUrl } from "@/utils/fileUrl.js";
267
+ import Pagination from "@/components/Pagination";
268
+ import PreviewFile from "@/components/previewFile";
269
+ import { getUserInfoRole } from "@/utils/auth";
270
+ export default {
271
+ name: "Personnel",
272
+ components: { Pagination, PreviewFile },
273
+ filters: {},
274
+ data() {
275
+ return {
276
+ userInfo: {},
277
+ renyuanxinxi: [],
278
+ dialogVisibleExp: false,
279
+ loadExp: false,
280
+ startDate: [],
281
+ file: {
282
+ fileurl: "",
283
+ dialogVisible: false,
284
+ title: "",
285
+ type: "",
286
+ },
287
+ idCord: "",
288
+ HugongdialogVisible: false,
289
+ FormData: {},
290
+ institutionArrData: [],
291
+ dialogStatus: "",
292
+ textMap: { update: "编辑", create: "创建" },
293
+ tableKey: 0,
294
+ list: null,
295
+ total: 0,
296
+ listLoading: true,
297
+ listQuery: {
298
+ pageNo: 1,
299
+ size: 20,
300
+ },
301
+ dialogFormVisible: false,
302
+ dialogPvVisible: false,
303
+ rules: {
304
+ name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
305
+ idCode: [
306
+ { required: true, message: "请输入身份证号", trigger: "blur" },
307
+ ],
308
+ phoneNumber: [
309
+ { required: true, message: "请输入手机号码", trigger: "blur" },
310
+ ],
311
+ sex: [{ required: true, message: "请选择性别", trigger: "change" }],
312
+ unitId: [
313
+ { required: true, message: "请选择所属机构", trigger: "change" },
314
+ ],
315
+ },
316
+ temp: {
317
+ longtermPsnAttDtoList: [],
318
+ },
319
+ downloadLoading: false,
320
+ };
321
+ },
322
+ computed: {
323
+ constant() {
324
+ return this.$constant.imgAddr;
325
+ },
326
+ img() {
327
+ return function (value) {
328
+ if (value.match(/^chx\/tp\//)) {
329
+ return value;
330
+ } else {
331
+ return "chx/tp/" + value;
332
+ }
333
+ };
334
+ },
335
+ },
336
+ created() {
337
+ console.log("VUE_APP_BASE_API:", process.env);
338
+ this.getList();
339
+ this.getinstitution();
340
+ this.userInfo = JSON.parse(getUserInfoRole());
341
+ },
342
+ methods: {
343
+ handleError(err, file, fileList) {
344
+ console.log("上传失败", err, file, fileList);
345
+ // 这里可以添加你的错误处理逻辑,比如提示用户或者重试上传
346
+ this.$message.error("图片上传失败,请重试");
347
+ },
348
+ // 护工同步
349
+ synchronization() {
350
+ this.HugongdialogVisible = true;
351
+ },
352
+ synchronous() {
353
+ SPersonSync({ unitId: this.userInfo.unitId, idCord: this.idCord }).then(
354
+ (res) => {
355
+ if (res.status == 1) {
356
+ this.getList();
357
+ this.$notify({
358
+ title: "提示",
359
+ message: res.info,
360
+ type: "success",
361
+ duration: 2000,
362
+ });
363
+ this.dialogFormVisible = false;
364
+ this.idCord = "";
365
+ return;
366
+ }
367
+ this.$notify({
368
+ title: "提示",
369
+ message: res.info,
370
+ type: "error",
371
+ duration: 2000,
372
+ });
373
+ }
374
+ );
375
+ },
376
+ handleClose() {
377
+ this.dialogVisibleExp = false;
378
+ this.HugongdialogVisible = false;
379
+ this.startDate = [];
380
+ },
381
+ expExcel() {
382
+ try {
383
+ this.loadExp = true;
384
+ const form = {
385
+ startDate: this.startDate[0],
386
+ endDate: this.startDate[1],
387
+ };
388
+ ExportExcel(form)
389
+ .then((res) => {
390
+ const blob = new Blob([res]);
391
+ const fileName = "护工信息";
392
+ if (blob.size > 0) {
393
+ const elink = document.createElement("a");
394
+ elink.style.display = "none";
395
+ elink.href = URL.createObjectURL(blob);
396
+ // 类似a标签下载
397
+ // 自定义文件名称和导出类型。最好和后台保持一致
398
+ elink.download = `${fileName}/${this.$moment().format(
399
+ "YYYY-MM-DD"
400
+ )}.xlsx`;
401
+ document.body.appendChild(elink);
402
+ elink.click();
403
+ // 释放URL 对象
404
+ URL.revokeObjectURL(elink.href);
405
+ // 删除创建的 a 标签
406
+ document.body.removeChild(elink);
407
+ }
408
+ this.handleClose();
409
+ this.loadExp = false;
410
+ })
411
+ .catch(() => {
412
+ this.loadExp = false;
413
+ });
414
+ } catch (e) {
415
+ this.loadExp = false;
416
+ }
417
+ },
418
+ // 获取机构
419
+ getinstitution() {
420
+ SysUnitPage({ pageNo: 1, size: 9999 }).then((response) => {
421
+ this.institutionArrData = response.result.data.map((item) => {
422
+ return { label: item.name, value: item.id };
423
+ });
424
+ });
425
+ },
426
+ // 文件格式验证
427
+ beforeAvatarUploada(file) {
428
+ this.loadingstate = true;
429
+ const index = file.name.lastIndexOf(".");
430
+ const extension = file.name.substr(index + 1);
431
+ const extensionList = ["png", "PNG", "jpg", "JPG", "jpeg", "JPEG"];
432
+ const isLt2M = file.size / 1024 / 1024 < 10;
433
+ if (!isLt2M) {
434
+ this.$message({
435
+ message: "封面不可超出10M",
436
+ type: "warning",
437
+ center: true,
438
+ });
439
+ return false;
440
+ } else if (extensionList.indexOf(extension) < 0) {
441
+ this.$message({
442
+ message: "只能图片文件",
443
+ type: "error",
444
+ center: true,
445
+ });
446
+ return false;
447
+ }
448
+ },
449
+ onPreview(file) {
450
+ const type = fileUrl(file.url);
451
+ let url = `${this.$constant.imgAddr}${file.url}`;
452
+ console.log(url);
453
+ if (
454
+ type == "word" ||
455
+ type == "wps" ||
456
+ type == "pdf" ||
457
+ type == "pptx" ||
458
+ type == "txt"
459
+ ) {
460
+ this.file.type = type;
461
+ url = `https://wps-view.zhihuipk.com/?src=` + url;
462
+ } else if (type == "image") {
463
+ this.file.type = type;
464
+ } else if (type == "video") {
465
+ this.file.type = type;
466
+ } else if (type == "radio") {
467
+ this.file.type = type;
468
+ } else {
469
+ this.$message.error("该格式不可在线预览,请下载后查看");
470
+ return;
471
+ }
472
+ this.file.fileurl = url; // 后端请求回来的文件地址url
473
+ this.file.dialogVisible = true; // 弹窗
474
+ this.file.title = file.name; // 文件名称
475
+ },
476
+ beforeRemove(file, fileList) {
477
+ return this.$confirm(`确定移除 ${file.name}?`);
478
+ },
479
+ handleCertPicUrlRemove(file, fileList) {
480
+ this.temp.certPicUrlList = this.temp.certPicUrlList.filter((item) => {
481
+ // const regex = /(.*\/)([^\/]+)\.(jpg|png)$/;
482
+ // const match1 = item.name.match(regex);
483
+ // if (match1) {
484
+ // return match1[2] + '.' + match1[3] != file.name
485
+ // }
486
+ return item.name != file.name;
487
+ });
488
+ this.temp.longtermPsnAttDtoList = this.temp.longtermPsnAttDtoList.filter(
489
+ (item) => {
490
+ return item.att_name != file.name;
491
+ }
492
+ );
493
+ },
494
+ handleSfzUrllRemove(file, fileList) {
495
+ this.temp.sfzUrlList = this.temp.sfzUrlList.filter((item) => {
496
+ // const regex = /(.*\/)([^\/]+)\.(jpg|png)$/;
497
+ // const match1 = item.name.match(regex);
498
+ // if (match1) {
499
+ // return match1[2] + '.' + match1[3] != file.name
500
+ // }
501
+ return item.name != file.name;
502
+ });
503
+ this.temp.longtermPsnAttDtoList = this.temp.longtermPsnAttDtoList.filter(
504
+ (item) => {
505
+ return item.att_name != file.name;
506
+ }
507
+ );
508
+ },
509
+ handleXlUrlRemove(file, fileList) {
510
+ this.temp.xlUrlList = this.temp.xlUrlList.filter((item) => {
511
+ // const regex = /(.*\/)([^\/]+)\.(jpg|png)$/;
512
+ // const match1 = item.name.match(regex);
513
+ // if (match1) {
514
+ // return match1[2] + '.' + match1[3] != file.name
515
+ // }
516
+ return item.name != file.name;
517
+ });
518
+ this.temp.longtermPsnAttDtoList = this.temp.longtermPsnAttDtoList.filter(
519
+ (item) => {
520
+ return item.att_name != file.name;
521
+ }
522
+ );
523
+ // this.temp.xlUrlList = this.xlUrlList
524
+ },
525
+
526
+ // 处理文件上传操作
527
+ certhandleFileUpload(file) {
528
+ const obj = new FormData();
529
+ // 上传文件
530
+ obj.append("file", file.file);
531
+ obj.append("realPath", file.file.name);
532
+ obj.append("fileName", file.file.name);
533
+ obj.append("att_type", file.data.att_type);
534
+ this.temp.certPicUrlList = [];
535
+ // 上传文件接口
536
+ uploadTP(obj).then((data) => {
537
+ console.log(data);
538
+ if (data.status == 1) {
539
+ this.$message({
540
+ message: "上传成功",
541
+ type: "success",
542
+ });
543
+ }
544
+ this.temp.certPicUrlList.push({
545
+ url: data.result.url,
546
+ name: data.result.name,
547
+ });
548
+ uploadThird(obj).then((res) => {
549
+ if (res.status == 1) {
550
+ const obj = {
551
+ att_type: file.data.att_type,
552
+ att_name: res.result.output.att_name,
553
+ file_id: res.result.output.file_id,
554
+ file_type: res.result.output.file_type,
555
+ };
556
+ this.temp.longtermPsnAttDtoList.push(obj);
557
+ }
558
+ });
559
+ });
560
+ },
561
+ sfzhandleFileUpload(file) {
562
+ const obj = new FormData();
563
+ // 上传文件
564
+ obj.append("file", file.file);
565
+ obj.append("realPath", file.file.name);
566
+ obj.append("fileName", file.file.name);
567
+ obj.append("att_type", file.data.att_type);
568
+ this.temp.sfzUrlList = [];
569
+ // 上传文件接口
570
+ uploadTP(obj).then((data) => {
571
+ console.log(data);
572
+ if (data.status == 1) {
573
+ this.$message({
574
+ message: "上传成功",
575
+ type: "success",
576
+ });
577
+ }
578
+ this.temp.sfzUrlList.push({
579
+ url: data.result.url,
580
+ name: data.result.name,
581
+ });
582
+ uploadThird(obj).then((res) => {
583
+ if (res.status == 1) {
584
+ const obj = {
585
+ att_type: file.data.att_type,
586
+ att_name: res.result.output.att_name,
587
+ file_id: res.result.output.file_id,
588
+ file_type: res.result.output.file_type,
589
+ };
590
+ this.temp.longtermPsnAttDtoList.push(obj);
591
+ }
592
+ });
593
+ });
594
+ },
595
+ xlhandleFileUpload(file) {
596
+ const obj = new FormData();
597
+ // 上传文件
598
+ obj.append("file", file.file);
599
+ obj.append("realPath", file.file.name);
600
+ obj.append("fileName", file.file.name);
601
+ obj.append("att_type", file.data.att_type);
602
+ this.temp.xlUrlList = [];
603
+ // 上传文件接口
604
+ uploadTP(obj).then((data) => {
605
+ console.log(data);
606
+ if (data.status == 1) {
607
+ this.$message({
608
+ message: "上传成功",
609
+ type: "success",
610
+ });
611
+ }
612
+ this.temp.xlUrlList.push({
613
+ url: data.result.url,
614
+ name: data.result.name,
615
+ });
616
+ uploadThird(obj).then((res) => {
617
+ if (res.status == 1) {
618
+ const obj = {
619
+ att_type: file.data.att_type,
620
+ att_name: res.result.output.att_name,
621
+ file_id: res.result.output.file_id,
622
+ file_type: res.result.output.file_type,
623
+ };
624
+ this.temp.longtermPsnAttDtoList.push(obj);
625
+ }
626
+ });
627
+ });
628
+ },
629
+ add() {
630
+ this.dialogStatus = "create";
631
+ this.dialogFormVisible = true;
632
+ this.temp = {};
633
+ this.temp.longtermPsnAttDtoList = [];
634
+ this.temp.xlUrlList = [];
635
+ this.temp.certPicUrlList = [];
636
+ this.temp.sfzUrlList = [];
637
+ },
638
+ update(row) {
639
+ updateStatus({ id: row.id }).then((res) => {
640
+ if (res.status == 1) {
641
+ this.getList();
642
+ this.$notify({
643
+ title: res.info,
644
+ message: "更新成功",
645
+ type: "success",
646
+ duration: 2000,
647
+ });
648
+ this.dialogFormVisible = false;
649
+ return;
650
+ }
651
+ this.$notify({
652
+ title: res.info,
653
+ message: "更新失败",
654
+ type: "error",
655
+ duration: 2000,
656
+ });
657
+ });
658
+ },
659
+ edit(row) {
660
+ // if(!contains22Or01) {
661
+ // this.$message({
662
+ // message: "请传资质证书或身份证",
663
+ // type: "warning",
664
+ // center: true,
665
+ // });
666
+ // }
667
+ this.temp = JSON.parse(JSON.stringify(row));
668
+ this.dialogStatus = "update";
669
+ this.dialogFormVisible = true;
670
+ this.temp.longtermPsnAttDtoList = [];
671
+ this.temp.certPicUrlList = [];
672
+ this.temp.sfzUrlList = [];
673
+ this.temp.xlUrlList = [];
674
+ if (row.certPicUrlList) {
675
+ this.temp.certPicUrlList = row.certPicUrlList.map((res) => {
676
+ return {
677
+ name: res,
678
+ url: res,
679
+ };
680
+ });
681
+ }
682
+ if (row.sfzUrlList) {
683
+ this.temp.sfzUrlList = row.sfzUrlList.map((res) => {
684
+ return {
685
+ name: res,
686
+ url: res,
687
+ };
688
+ });
689
+ }
690
+ if (row.xlUrlList) {
691
+ this.temp.xlUrlList = row.xlUrlList.map((res) => {
692
+ return {
693
+ name: res,
694
+ url: res,
695
+ };
696
+ });
697
+ }
698
+ if (this.temp.thirdFileList && this.temp.thirdFileList.length > 0) {
699
+ for (var i = 0; i < this.temp.thirdFileList.length; i++) {
700
+ if (
701
+ this.temp.thirdFileList[i].att_type == "01" ||
702
+ this.temp.thirdFileList[i].att_type == "21" ||
703
+ this.temp.thirdFileList[i].att_type == "22"
704
+ ) {
705
+ this.temp.longtermPsnAttDtoList.push(this.temp.thirdFileList[i]);
706
+ }
707
+ }
708
+ }
709
+ },
710
+ getList() {
711
+ this.listLoading = true;
712
+ SPersonPage(this.listQuery).then((response) => {
713
+ this.list = response.result.data;
714
+ this.total = response.result.count;
715
+ setTimeout(() => {
716
+ this.listLoading = false;
717
+ }, 1.5 * 1000);
718
+ });
719
+ SPersonPage({ size: 9999, pageNo: 1 }).then((response) => {
720
+ this.renyuanxinxi = response.result.data;
721
+ });
722
+ },
723
+ handleModifyStatus(row, status) {
724
+ this.$message({
725
+ message: "操作成功",
726
+ type: "success",
727
+ });
728
+ row.status = status;
729
+ },
730
+ resetting(formName) {
731
+ this.$nextTick(() => {
732
+ this.$refs[formName].resetFields();
733
+ });
734
+ },
735
+ onSubmit() {
736
+ this.getList();
737
+ },
738
+ createData() {
739
+ this.$refs["dataForm"].validate((valid) => {
740
+ if (valid) {
741
+ this.temp.rolel = "2";
742
+ const obj = {
743
+ certPicUrlList: [],
744
+ xlUrlList: [],
745
+ sfzUrlList: [],
746
+ };
747
+ if (this.temp.certPicUrlList.length > 0) {
748
+ obj.certPicUrlList = this.temp.certPicUrlList.map((item) => {
749
+ return item.name;
750
+ });
751
+ }
752
+ if (this.temp.xlUrlList.length > 0) {
753
+ obj.xlUrlList = this.temp.xlUrlList.map((item) => {
754
+ return item.name;
755
+ });
756
+ }
757
+ if (this.temp.sfzUrlList.length > 0) {
758
+ obj.sfzUrlList = this.temp.sfzUrlList.map((item) => {
759
+ return item.name;
760
+ });
761
+ }
762
+ SPersonSave({ ...this.temp, ...obj }).then((res) => {
763
+ if (res.status == 1) {
764
+ this.getList();
765
+ this.$notify({
766
+ title: res.info,
767
+ message: "创建成功,请通知医保审核",
768
+ type: "success",
769
+ duration: 2000,
770
+ });
771
+ this.dialogFormVisible = false;
772
+ return;
773
+ }
774
+ this.$notify({
775
+ title: res.info,
776
+ message: "创建失败",
777
+ type: "error",
778
+ duration: 2000,
779
+ });
780
+ });
781
+ }
782
+ });
783
+ },
784
+ hasBothValues(arr, value1, value2) {
785
+ const has22 = arr.some((item) => item.att_type === value1);
786
+ const has01 = arr.some((item) => item.att_type === value2);
787
+ return has22 && has01;
788
+ },
789
+ updateData() {
790
+ this.$refs["dataForm"].validate((valid) => {
791
+ if (valid) {
792
+ this.temp.rolel = "2";
793
+ const obj = {
794
+ certPicUrlList: [],
795
+ xlUrlList: [],
796
+ sfzUrlList: [],
797
+ };
798
+ if (
799
+ this.temp.certPicUrlList.length > 0 &&
800
+ this.temp.certPicUrlList[0]
801
+ ) {
802
+ obj.certPicUrlList = this.temp.certPicUrlList.map((item) => {
803
+ return item.name;
804
+ });
805
+ }
806
+ if (this.temp.xlUrlList.length > 0 && this.temp.xlUrlList[0]) {
807
+ obj.xlUrlList = this.temp.xlUrlList.map((item) => {
808
+ return item.name;
809
+ });
810
+ }
811
+ if (this.temp.sfzUrlList.length > 0 && this.temp.sfzUrlList[0]) {
812
+ obj.sfzUrlList = this.temp.sfzUrlList.map((item) => {
813
+ return item.name;
814
+ });
815
+ }
816
+ if (this.temp.longtermPsnAttDtoList.length == 0) {
817
+ this.$message({
818
+ message: "请上传材料",
819
+ type: "warning",
820
+ center: true,
821
+ });
822
+ return;
823
+ }
824
+ const result = this.hasBothValues(
825
+ this.temp.longtermPsnAttDtoList,
826
+ "22",
827
+ "01"
828
+ );
829
+ console.log(result);
830
+ if (!result) {
831
+ this.$message({
832
+ message: "请传资质证书或身份证",
833
+ type: "warning",
834
+ center: true,
835
+ });
836
+ }
837
+ SPersonSave({ ...this.temp, ...obj }).then((res) => {
838
+ if (res.status == 1) {
839
+ this.getList();
840
+ this.$notify({
841
+ title: res.info,
842
+ message: "更新成功,请通知医保审核",
843
+ type: "success",
844
+ duration: 2000,
845
+ });
846
+ this.dialogFormVisible = false;
847
+ return;
848
+ }
849
+ this.$notify({
850
+ title: res.info,
851
+ message: "更新失败",
852
+ type: "error",
853
+ duration: 2000,
854
+ });
855
+ });
856
+ }
857
+ });
858
+ },
859
+ handleDelete(row, index) {
860
+ this.$confirm('护工注销需要确认上传明细,以免冲正重新上传变成自费,是否继续?', '提示', {
861
+ confirmButtonText: '确定',
862
+ cancelButtonText: '取消',
863
+ type: 'warning'
864
+ }).then(() => {
865
+ SPersonDel({ id: row.id, isDelete: "1" }).then((res) => {
866
+ if (res.status == 1) {
867
+ this.getList();
868
+ this.$notify({
869
+ title: res.info,
870
+ message: "删除成功",
871
+ type: "success",
872
+ duration: 2000,
873
+ });
874
+ return;
875
+ }
876
+ this.$notify({
877
+ title: res.info,
878
+ message: "删除失败",
879
+ type: "error",
880
+ duration: 2000,
881
+ });
882
+ });
883
+ }).catch(() => {
884
+ this.$message({
885
+ type: 'info',
886
+ message: '已取消删除'
887
+ });
888
+ });
889
+ },
890
+ },
891
+ };
892
+ </script>