@liuqiongqiong/vue-pages 1.0.4 → 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,885 +1,892 @@
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="24">
169
- <el-form-item label="注:" prop="unitId">
170
- <span style="color: red">上传的文件请使用姓名+类型去命名。防止文件名字重复被覆盖</span>
171
- </el-form-item>
172
- </el-col>
173
- <el-col :span="12">
174
- <el-form-item label="资质证书" prop="certPicUrlList">
175
- <el-upload action="#" :limit="1" :before-upload="beforeAvatarUploada" :http-request="certhandleFileUpload"
176
- :data="{ att_type: '22' }" :on-remove="handleCertPicUrlRemove" :before-remove="beforeRemove"
177
- :on-error="handleError" :file-list="temp.certPicUrlList" :on-preview="onPreview">
178
- <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
179
- </el-upload>
180
- </el-form-item>
181
- </el-col>
182
- <el-col :span="12">
183
- <el-form-item label="身份证" prop="sfzUrlList">
184
- <el-upload action="#" :limit="1" :data="{ att_type: '01' }" :before-upload="beforeAvatarUploada"
185
- :http-request="sfzhandleFileUpload" :on-remove="handleSfzUrllRemove" :before-remove="beforeRemove"
186
- :file-list="temp.sfzUrlList" :on-preview="onPreview">
187
- <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
188
- </el-upload>
189
- </el-form-item>
190
- </el-col>
191
- <el-col :span="12">
192
- <el-form-item label="学位证书" prop="xlUrlList">
193
- <el-upload action="#" :limit="1" :data="{ att_type: '21' }" :before-upload="beforeAvatarUploada"
194
- :http-request="xlhandleFileUpload" :on-remove="handleXlUrlRemove" :before-remove="beforeRemove"
195
- :file-list="temp.xlUrlList" :on-preview="onPreview">
196
- <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
197
- </el-upload>
198
- </el-form-item>
199
- </el-col>
200
- </el-row>
201
- </el-form>
202
- <div slot="footer" class="dialog-footer">
203
- <el-button size="small" @click="dialogFormVisible = false">
204
- 取 消
205
- </el-button>
206
- <el-button type="primary" size="small" @click="dialogStatus === 'create' ? createData() : updateData()">
207
- 确 认
208
- </el-button>
209
- </div>
210
- </el-dialog>
211
- <preview-file :file="file" />
212
- <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" title="导出" :visible.sync="dialogVisibleExp"
213
- width="600px" :before-close="handleClose">
214
- <el-form :inline="true" class="demo-form-inline">
215
- <el-form-item label="提示:">
216
- <el-link :underline="false" type="primary">选择的开始日期和结束日期请将数据的入录时间包含起来,结束日期选后一天</el-link>
217
- </el-form-item>
218
- <el-form-item label="时间">
219
- <el-date-picker v-model="startDate" type="daterange" value-format="yyyy-MM-dd" range-separator=""
220
- start-placeholder="开始日期" end-placeholder="结束日期" />
221
- </el-form-item>
222
- </el-form>
223
- <span slot="footer" class="dialog-footer">
224
- <el-button size="small" :loading="loadExp" @click="handleClose">取 消</el-button>
225
- <el-button size="small" type="primary" :loading="loadExp" @click="expExcel">
226
-
227
- </el-button>
228
- </span>
229
- </el-dialog>
230
-
231
- <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" title="护工同步"
232
- :visible.sync="HugongdialogVisible" width="500px" :before-close="handleClose">
233
- <el-form :inline="true" class="demo-form-inline">
234
- <el-form-item label="身份证">
235
- <el-input style="width: 100%" v-model="idCord" size="small" clearable placeholder="请输入身份证号" />
236
- </el-form-item>
237
- </el-form>
238
- <span slot="footer" class="dialog-footer">
239
- <el-button size="small" @click="HugongdialogVisible = false">关 闭</el-button>
240
- <el-button size="small" type="primary" @click="synchronous">
241
-
242
- </el-button>
243
- </span>
244
- </el-dialog>
245
- </div>
246
- </template>
247
-
248
- <script>
249
- import {
250
- SPersonSave,
251
- SPersonPage,
252
- SPersonDel,
253
- ExportExcel,
254
- SPersonSync,
255
- updateStatus,
256
- } from "@/api/article";
257
- import { SysUnitPage } from "@/api/institution";
258
- import { uploadTP, uploadPDF, uploadThird } from "@/api/upload";
259
- import { fileUrl } from "@/utils/fileUrl.js";
260
- import Pagination from "@/components/Pagination";
261
- import PreviewFile from "@/components/previewFile";
262
- import { getUserInfoRole } from "@/utils/auth";
263
- export default {
264
- name: "Personnel",
265
- components: { Pagination, PreviewFile },
266
- filters: {},
267
- data() {
268
- return {
269
- userInfo: {},
270
- renyuanxinxi: [],
271
- dialogVisibleExp: false,
272
- loadExp: false,
273
- startDate: [],
274
- file: {
275
- fileurl: "",
276
- dialogVisible: false,
277
- title: "",
278
- type: "",
279
- },
280
- idCord: "",
281
- HugongdialogVisible: false,
282
- FormData: {},
283
- institutionArrData: [],
284
- dialogStatus: "",
285
- textMap: { update: "编辑", create: "创建" },
286
- tableKey: 0,
287
- list: null,
288
- total: 0,
289
- listLoading: true,
290
- listQuery: {
291
- pageNo: 1,
292
- size: 20,
293
- },
294
- dialogFormVisible: false,
295
- dialogPvVisible: false,
296
- rules: {
297
- name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
298
- idCode: [
299
- { required: true, message: "请输入身份证号", trigger: "blur" },
300
- ],
301
- phoneNumber: [
302
- { required: true, message: "请输入手机号码", trigger: "blur" },
303
- ],
304
- sex: [{ required: true, message: "请选择性别", trigger: "change" }],
305
- unitId: [
306
- { required: true, message: "请选择所属机构", trigger: "change" },
307
- ],
308
- },
309
- temp: {
310
- longtermPsnAttDtoList: [],
311
- },
312
- downloadLoading: false,
313
- };
314
- },
315
- computed: {
316
- constant() {
317
- return this.$constant.imgAddr;
318
- },
319
- img() {
320
- return function (value) {
321
- if (value.match(/^chx\/tp\//)) {
322
- return value;
323
- } else {
324
- return "chx/tp/" + value;
325
- }
326
- };
327
- },
328
- },
329
- created() {
330
- console.log("VUE_APP_BASE_API:", process.env);
331
- this.getList();
332
- this.getinstitution();
333
- this.userInfo = JSON.parse(getUserInfoRole());
334
- },
335
- methods: {
336
- handleError(err, file, fileList) {
337
- console.log("上传失败", err, file, fileList);
338
- // 这里可以添加你的错误处理逻辑,比如提示用户或者重试上传
339
- this.$message.error("图片上传失败,请重试");
340
- },
341
- // 护工同步
342
- synchronization() {
343
- this.HugongdialogVisible = true;
344
- },
345
- synchronous() {
346
- SPersonSync({ unitId: this.userInfo.unitId, idCord: this.idCord }).then(
347
- (res) => {
348
- if (res.status == 1) {
349
- this.getList();
350
- this.$notify({
351
- title: "提示",
352
- message: res.info,
353
- type: "success",
354
- duration: 2000,
355
- });
356
- this.dialogFormVisible = false;
357
- this.idCord = "";
358
- return;
359
- }
360
- this.$notify({
361
- title: "提示",
362
- message: res.info,
363
- type: "error",
364
- duration: 2000,
365
- });
366
- }
367
- );
368
- },
369
- handleClose() {
370
- this.dialogVisibleExp = false;
371
- this.HugongdialogVisible = false;
372
- this.startDate = [];
373
- },
374
- expExcel() {
375
- try {
376
- this.loadExp = true;
377
- const form = {
378
- startDate: this.startDate[0],
379
- endDate: this.startDate[1],
380
- };
381
- ExportExcel(form)
382
- .then((res) => {
383
- const blob = new Blob([res]);
384
- const fileName = "护工信息";
385
- if (blob.size > 0) {
386
- const elink = document.createElement("a");
387
- elink.style.display = "none";
388
- elink.href = URL.createObjectURL(blob);
389
- // 类似a标签下载
390
- // 自定义文件名称和导出类型。最好和后台保持一致
391
- elink.download = `${fileName}/${this.$moment().format(
392
- "YYYY-MM-DD"
393
- )}.xlsx`;
394
- document.body.appendChild(elink);
395
- elink.click();
396
- // 释放URL 对象
397
- URL.revokeObjectURL(elink.href);
398
- // 删除创建的 a 标签
399
- document.body.removeChild(elink);
400
- }
401
- this.handleClose();
402
- this.loadExp = false;
403
- })
404
- .catch(() => {
405
- this.loadExp = false;
406
- });
407
- } catch (e) {
408
- this.loadExp = false;
409
- }
410
- },
411
- // 获取机构
412
- getinstitution() {
413
- SysUnitPage({ pageNo: 1, size: 9999 }).then((response) => {
414
- this.institutionArrData = response.result.data.map((item) => {
415
- return { label: item.name, value: item.id };
416
- });
417
- });
418
- },
419
- // 文件格式验证
420
- beforeAvatarUploada(file) {
421
- this.loadingstate = true;
422
- const index = file.name.lastIndexOf(".");
423
- const extension = file.name.substr(index + 1);
424
- const extensionList = ["png", "PNG", "jpg", "JPG", "jpeg", "JPEG"];
425
- const isLt2M = file.size / 1024 / 1024 < 10;
426
- if (!isLt2M) {
427
- this.$message({
428
- message: "封面不可超出10M",
429
- type: "warning",
430
- center: true,
431
- });
432
- return false;
433
- } else if (extensionList.indexOf(extension) < 0) {
434
- this.$message({
435
- message: "只能图片文件",
436
- type: "error",
437
- center: true,
438
- });
439
- return false;
440
- }
441
- },
442
- onPreview(file) {
443
- const type = fileUrl(file.url);
444
- let url = `${this.$constant.imgAddr}${file.url}`;
445
- console.log(url);
446
- if (
447
- type == "word" ||
448
- type == "wps" ||
449
- type == "pdf" ||
450
- type == "pptx" ||
451
- type == "txt"
452
- ) {
453
- this.file.type = type;
454
- url = `https://wps-view.zhihuipk.com/?src=` + url;
455
- } else if (type == "image") {
456
- this.file.type = type;
457
- } else if (type == "video") {
458
- this.file.type = type;
459
- } else if (type == "radio") {
460
- this.file.type = type;
461
- } else {
462
- this.$message.error("该格式不可在线预览,请下载后查看");
463
- return;
464
- }
465
- this.file.fileurl = url; // 后端请求回来的文件地址url
466
- this.file.dialogVisible = true; // 弹窗
467
- this.file.title = file.name; // 文件名称
468
- },
469
- beforeRemove(file, fileList) {
470
- return this.$confirm(`确定移除 ${file.name}?`);
471
- },
472
- handleCertPicUrlRemove(file, fileList) {
473
- this.temp.certPicUrlList = this.temp.certPicUrlList.filter((item) => {
474
- // const regex = /(.*\/)([^\/]+)\.(jpg|png)$/;
475
- // const match1 = item.name.match(regex);
476
- // if (match1) {
477
- // return match1[2] + '.' + match1[3] != file.name
478
- // }
479
- return item.name != file.name;
480
- });
481
- this.temp.longtermPsnAttDtoList = this.temp.longtermPsnAttDtoList.filter(
482
- (item) => {
483
- return item.att_name != file.name;
484
- }
485
- );
486
- },
487
- handleSfzUrllRemove(file, fileList) {
488
- this.temp.sfzUrlList = this.temp.sfzUrlList.filter((item) => {
489
- // const regex = /(.*\/)([^\/]+)\.(jpg|png)$/;
490
- // const match1 = item.name.match(regex);
491
- // if (match1) {
492
- // return match1[2] + '.' + match1[3] != file.name
493
- // }
494
- return item.name != file.name;
495
- });
496
- this.temp.longtermPsnAttDtoList = this.temp.longtermPsnAttDtoList.filter(
497
- (item) => {
498
- return item.att_name != file.name;
499
- }
500
- );
501
- },
502
- handleXlUrlRemove(file, fileList) {
503
- this.temp.xlUrlList = this.temp.xlUrlList.filter((item) => {
504
- // const regex = /(.*\/)([^\/]+)\.(jpg|png)$/;
505
- // const match1 = item.name.match(regex);
506
- // if (match1) {
507
- // return match1[2] + '.' + match1[3] != file.name
508
- // }
509
- return item.name != file.name;
510
- });
511
- this.temp.longtermPsnAttDtoList = this.temp.longtermPsnAttDtoList.filter(
512
- (item) => {
513
- return item.att_name != file.name;
514
- }
515
- );
516
- // this.temp.xlUrlList = this.xlUrlList
517
- },
518
-
519
- // 处理文件上传操作
520
- certhandleFileUpload(file) {
521
- const obj = new FormData();
522
- // 上传文件
523
- obj.append("file", file.file);
524
- obj.append("realPath", file.file.name);
525
- obj.append("fileName", file.file.name);
526
- obj.append("att_type", file.data.att_type);
527
- this.temp.certPicUrlList = [];
528
- // 上传文件接口
529
- uploadTP(obj).then((data) => {
530
- console.log(data);
531
- if (data.status == 1) {
532
- this.$message({
533
- message: "上传成功",
534
- type: "success",
535
- });
536
- }
537
- this.temp.certPicUrlList.push({
538
- url: data.result.url,
539
- name: data.result.name,
540
- });
541
- uploadThird(obj).then((res) => {
542
- if (res.status == 1) {
543
- const obj = {
544
- att_type: file.data.att_type,
545
- att_name: res.result.output.att_name,
546
- file_id: res.result.output.file_id,
547
- file_type: res.result.output.file_type,
548
- };
549
- this.temp.longtermPsnAttDtoList.push(obj);
550
- }
551
- });
552
- });
553
- },
554
- sfzhandleFileUpload(file) {
555
- const obj = new FormData();
556
- // 上传文件
557
- obj.append("file", file.file);
558
- obj.append("realPath", file.file.name);
559
- obj.append("fileName", file.file.name);
560
- obj.append("att_type", file.data.att_type);
561
- this.temp.sfzUrlList = [];
562
- // 上传文件接口
563
- uploadTP(obj).then((data) => {
564
- console.log(data);
565
- if (data.status == 1) {
566
- this.$message({
567
- message: "上传成功",
568
- type: "success",
569
- });
570
- }
571
- this.temp.sfzUrlList.push({
572
- url: data.result.url,
573
- name: data.result.name,
574
- });
575
- uploadThird(obj).then((res) => {
576
- if (res.status == 1) {
577
- const obj = {
578
- att_type: file.data.att_type,
579
- att_name: res.result.output.att_name,
580
- file_id: res.result.output.file_id,
581
- file_type: res.result.output.file_type,
582
- };
583
- this.temp.longtermPsnAttDtoList.push(obj);
584
- }
585
- });
586
- });
587
- },
588
- xlhandleFileUpload(file) {
589
- const obj = new FormData();
590
- // 上传文件
591
- obj.append("file", file.file);
592
- obj.append("realPath", file.file.name);
593
- obj.append("fileName", file.file.name);
594
- obj.append("att_type", file.data.att_type);
595
- this.temp.xlUrlList = [];
596
- // 上传文件接口
597
- uploadTP(obj).then((data) => {
598
- console.log(data);
599
- if (data.status == 1) {
600
- this.$message({
601
- message: "上传成功",
602
- type: "success",
603
- });
604
- }
605
- this.temp.xlUrlList.push({
606
- url: data.result.url,
607
- name: data.result.name,
608
- });
609
- uploadThird(obj).then((res) => {
610
- if (res.status == 1) {
611
- const obj = {
612
- att_type: file.data.att_type,
613
- att_name: res.result.output.att_name,
614
- file_id: res.result.output.file_id,
615
- file_type: res.result.output.file_type,
616
- };
617
- this.temp.longtermPsnAttDtoList.push(obj);
618
- }
619
- });
620
- });
621
- },
622
- add() {
623
- this.dialogStatus = "create";
624
- this.dialogFormVisible = true;
625
- this.temp = {};
626
- this.temp.longtermPsnAttDtoList = [];
627
- this.temp.xlUrlList = [];
628
- this.temp.certPicUrlList = [];
629
- this.temp.sfzUrlList = [];
630
- },
631
- update(row) {
632
- updateStatus({ id: row.id }).then((res) => {
633
- if (res.status == 1) {
634
- this.getList();
635
- this.$notify({
636
- title: res.info,
637
- message: "更新成功",
638
- type: "success",
639
- duration: 2000,
640
- });
641
- this.dialogFormVisible = false;
642
- return;
643
- }
644
- this.$notify({
645
- title: res.info,
646
- message: "更新失败",
647
- type: "error",
648
- duration: 2000,
649
- });
650
- });
651
- },
652
- edit(row) {
653
- // if(!contains22Or01) {
654
- // this.$message({
655
- // message: "请传资质证书或身份证",
656
- // type: "warning",
657
- // center: true,
658
- // });
659
- // }
660
- this.temp = JSON.parse(JSON.stringify(row));
661
- this.dialogStatus = "update";
662
- this.dialogFormVisible = true;
663
- this.temp.longtermPsnAttDtoList = [];
664
- this.temp.certPicUrlList = [];
665
- this.temp.sfzUrlList = [];
666
- this.temp.xlUrlList = [];
667
- if (row.certPicUrlList) {
668
- this.temp.certPicUrlList = row.certPicUrlList.map((res) => {
669
- return {
670
- name: res,
671
- url: res,
672
- };
673
- });
674
- }
675
- if (row.sfzUrlList) {
676
- this.temp.sfzUrlList = row.sfzUrlList.map((res) => {
677
- return {
678
- name: res,
679
- url: res,
680
- };
681
- });
682
- }
683
- if (row.xlUrlList) {
684
- this.temp.xlUrlList = row.xlUrlList.map((res) => {
685
- return {
686
- name: res,
687
- url: res,
688
- };
689
- });
690
- }
691
- if (this.temp.thirdFileList && this.temp.thirdFileList.length > 0) {
692
- for (var i = 0; i < this.temp.thirdFileList.length; i++) {
693
- if (
694
- this.temp.thirdFileList[i].att_type == "01" ||
695
- this.temp.thirdFileList[i].att_type == "21" ||
696
- this.temp.thirdFileList[i].att_type == "22"
697
- ) {
698
- this.temp.longtermPsnAttDtoList.push(this.temp.thirdFileList[i]);
699
- }
700
- }
701
- }
702
- },
703
- getList() {
704
- this.listLoading = true;
705
- SPersonPage(this.listQuery).then((response) => {
706
- this.list = response.result.data;
707
- this.total = response.result.count;
708
- setTimeout(() => {
709
- this.listLoading = false;
710
- }, 1.5 * 1000);
711
- });
712
- SPersonPage({ size: 9999, pageNo: 1 }).then((response) => {
713
- this.renyuanxinxi = response.result.data;
714
- });
715
- },
716
- handleModifyStatus(row, status) {
717
- this.$message({
718
- message: "操作成功",
719
- type: "success",
720
- });
721
- row.status = status;
722
- },
723
- resetting(formName) {
724
- this.$nextTick(() => {
725
- this.$refs[formName].resetFields();
726
- });
727
- },
728
- onSubmit() {
729
- this.getList();
730
- },
731
- createData() {
732
- this.$refs["dataForm"].validate((valid) => {
733
- if (valid) {
734
- this.temp.rolel = "2";
735
- const obj = {
736
- certPicUrlList: [],
737
- xlUrlList: [],
738
- sfzUrlList: [],
739
- };
740
- if (this.temp.certPicUrlList.length > 0) {
741
- obj.certPicUrlList = this.temp.certPicUrlList.map((item) => {
742
- return item.name;
743
- });
744
- }
745
- if (this.temp.xlUrlList.length > 0) {
746
- obj.xlUrlList = this.temp.xlUrlList.map((item) => {
747
- return item.name;
748
- });
749
- }
750
- if (this.temp.sfzUrlList.length > 0) {
751
- obj.sfzUrlList = this.temp.sfzUrlList.map((item) => {
752
- return item.name;
753
- });
754
- }
755
- SPersonSave({ ...this.temp, ...obj }).then((res) => {
756
- if (res.status == 1) {
757
- this.getList();
758
- this.$notify({
759
- title: res.info,
760
- message: "创建成功,请通知医保审核",
761
- type: "success",
762
- duration: 2000,
763
- });
764
- this.dialogFormVisible = false;
765
- return;
766
- }
767
- this.$notify({
768
- title: res.info,
769
- message: "创建失败",
770
- type: "error",
771
- duration: 2000,
772
- });
773
- });
774
- }
775
- });
776
- },
777
- hasBothValues(arr, value1, value2) {
778
- const has22 = arr.some((item) => item.att_type === value1);
779
- const has01 = arr.some((item) => item.att_type === value2);
780
- return has22 && has01;
781
- },
782
- updateData() {
783
- this.$refs["dataForm"].validate((valid) => {
784
- if (valid) {
785
- this.temp.rolel = "2";
786
- const obj = {
787
- certPicUrlList: [],
788
- xlUrlList: [],
789
- sfzUrlList: [],
790
- };
791
- if (
792
- this.temp.certPicUrlList.length > 0 &&
793
- this.temp.certPicUrlList[0]
794
- ) {
795
- obj.certPicUrlList = this.temp.certPicUrlList.map((item) => {
796
- return item.name;
797
- });
798
- }
799
- if (this.temp.xlUrlList.length > 0 && this.temp.xlUrlList[0]) {
800
- obj.xlUrlList = this.temp.xlUrlList.map((item) => {
801
- return item.name;
802
- });
803
- }
804
- if (this.temp.sfzUrlList.length > 0 && this.temp.sfzUrlList[0]) {
805
- obj.sfzUrlList = this.temp.sfzUrlList.map((item) => {
806
- return item.name;
807
- });
808
- }
809
- if (this.temp.longtermPsnAttDtoList.length == 0) {
810
- this.$message({
811
- message: "请上传材料",
812
- type: "warning",
813
- center: true,
814
- });
815
- return;
816
- }
817
- const result = this.hasBothValues(
818
- this.temp.longtermPsnAttDtoList,
819
- "22",
820
- "01"
821
- );
822
- console.log(result);
823
- if (!result) {
824
- this.$message({
825
- message: "请传资质证书或身份证",
826
- type: "warning",
827
- center: true,
828
- });
829
- }
830
- SPersonSave({ ...this.temp, ...obj }).then((res) => {
831
- if (res.status == 1) {
832
- this.getList();
833
- this.$notify({
834
- title: res.info,
835
- message: "更新成功,请通知医保审核",
836
- type: "success",
837
- duration: 2000,
838
- });
839
- this.dialogFormVisible = false;
840
- return;
841
- }
842
- this.$notify({
843
- title: res.info,
844
- message: "更新失败",
845
- type: "error",
846
- duration: 2000,
847
- });
848
- });
849
- }
850
- });
851
- },
852
- handleDelete(row, index) {
853
- this.$confirm('护工注销需要确认上传明细,以免冲正重新上传变成自费,是否继续?', '提示', {
854
- confirmButtonText: '确定',
855
- cancelButtonText: '取消',
856
- type: 'warning'
857
- }).then(() => {
858
- SPersonDel({ id: row.id, isDelete: "1" }).then((res) => {
859
- if (res.status == 1) {
860
- this.getList();
861
- this.$notify({
862
- title: res.info,
863
- message: "删除成功",
864
- type: "success",
865
- duration: 2000,
866
- });
867
- return;
868
- }
869
- this.$notify({
870
- title: res.info,
871
- message: "删除失败",
872
- type: "error",
873
- duration: 2000,
874
- });
875
- });
876
- }).catch(() => {
877
- this.$message({
878
- type: 'info',
879
- message: '已取消删除'
880
- });
881
- });
882
- },
883
- },
884
- };
885
- </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>