index.vue
13.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
<route lang="yaml">
name: securityMenu //标签管理
</route>
<script lang="ts" setup name="securityMenu">
import { onUploadFilePreview } from '@/api/modules/common';
import { getComplianceInfoPageList, updateComplianceInfo } from '@/api/modules/securityMenu';
import TableTools from '@/components/Tools/table_tools.vue';
import { TableColumnWidth } from '@/utils/enum';
import { ElMessage } from 'element-plus';
const { proxy } = getCurrentInstance() as any;
const dialogLabelFormRef = ref();
onBeforeMount(async () => {
});
// 右侧表格配置
const tableDataList = ref([]);
const page = ref({
limit: 50,
curr: 1,
sizes: [
{ label: "10", value: 10 },
{ label: "50", value: 50 },
{ label: "100", value: 100 },
{ label: "150", value: 150 },
{ label: "200", value: 200 },
],
});
const tableInfo = ref({
id: "role-manage-table",
// multiple: true,
fixedSelection: true,
fields: [
{ label: "序号", type: "index", width: 56, align: "center" },
// { label: "数据产品编号", field: "label", width: 120, },
{
label: "数据产品名称", field: "damName", width: 140,
},
{ label: "数据类型", field: "damTypeName", width: 90 },
{
label: '权利主体', field: 'rightMainName', width: 200,
},
{
label: "是否公共数据", field: "isPublicData", width: 120, getName: (scope) => {
return scope.isPublicData == "Y" ? '是' : '否';
}
},
{
label: "状态", field: "updateTime", width: TableColumnWidth.STATE, align: 'center', type: "tag", getName: (scope) => {
//状态(1:待上传 2:部分上传 3:全部上传 )
// return statusList.find((item) => item.value == scope.row.state)?.label || '待上传';
const state = statusList.find((item) => item.value == scope.row.state)?.label || '待上传';
switch (state) {
case '待上传':
return '待上传';
case '部分上传':
return '部分上传';
case '全部上传':
return '全部上传';
default:
return '待上传';
}
}, tagType: (scope) => {
const state1 = scope.row.state;
switch (state1) {
case '1':
return 'warning';
case '2':
return 'warning';
case '3':
return 'success';
default:
return 'info';
}
}
},
{
label: "合规评估报告", field: "complianceEvaluateReport", width: 120, type: 'text_btn', value: 'complianceEvaluateReport', getName: (scope) => {
const value = scope.row.complianceEvaluateReport;
return value && value.length > 0 ? '预览' : '--';
},
},
{
label: "合规法律意见书", field: "complianceLegalOpinion", width: 130, type: 'text_btn', value: 'complianceLegalOpinion', getName: (scope) => {
return scope.row.complianceLegalOpinion?.length > 0 ? '预览' : '--';
}
},
{
label: "入表合规方案", field: "entryComplianceProgram", width: 120, type: 'text_btn', value: 'entryComplianceProgram', getName: (scope) => {
return scope.row.entryComplianceProgram?.length > 0 ? '预览' : '--';
}
},
{ label: "操作时间", field: "updateTime", width: TableColumnWidth.DATETIME },
],
data: tableDataList.value,
page: {
type: "normal",
rows: 0,
...page.value,
},
loading: false,
actionInfo: {
label: "操作",
type: "btn",
width: 80,
fixed: 'right',
btns: (scope) => {
if (scope.row.state == 3) {
return [
{
label: "详情", value: "detail", click: (scope) => {
tableTempValue.value = scope.row;
formItems.value.forEach((item) => {
if (['complianceEvaluateReport', 'complianceLegalOpinion', 'entryComplianceProgram'].includes(item.field)) {
item.default = scope.row[item.field] || [];
} else {
item.default = scope.row[item.field] || '';
}
});
dialogInfo.value.visible = true;
},
},
]
} else {
return [
{
label: "上传", value: "upload", click: (scope) => {
tableTempValue.value = scope.row;
formItems.value.forEach((item) => {
if (['complianceEvaluateReport', 'complianceLegalOpinion', 'entryComplianceProgram'].includes(item.field)) {
item.default = scope.row[item.field] || [];
} else {
item.default = scope.row[item.field] || '';
}
});
dialogInfo.value.visible = true;
},
},
]
}
},
},
});
const tableBtnClick = (scope, btn) => {
const type = btn.value;
const row = scope.row;
if ((type == 'complianceEvaluateReport' && row.complianceEvaluateReport.length > 0)) {
onUploadFilePreview(row.complianceEvaluateReport[0]);
}
else if ((type == 'complianceLegalOpinion' && row.complianceLegalOpinion.length > 0)) {
onUploadFilePreview(row.complianceLegalOpinion[0]);
}
else if ((type == 'entryComplianceProgram' && row.entryComplianceProgram.length > 0)) {
onUploadFilePreview(row.entryComplianceProgram[0]);
}
}
const formItems = ref([
{
label: '合规评估报告',
tip: '支持格式:pdf,单个文件不能超过10MB ',
type: 'upload-file',
accept: '.pdf',
field: 'complianceEvaluateReport',
templateUrl: '',
required: false,
block: true,
visible: true,
default: [],
limit: 1,
},
{
label: '出具机构',
type: 'input',
placeholder: '请输入',
field: 'reportIssuingInstitution',
maxlength: 50,
default: '',
required: false,
visible: true
},
{
label: '出具日期',
type: 'date',
placeholder: '请选择',
field: 'reportIssuingTime',
default: "",
unlink: true,
clearable: true,
required: false
},
{
label: '合规法律意见书',
tip: '支持格式:pdf,单个文件不能超过10MB ',
type: 'upload-file',
accept: '.pdf',
field: 'complianceLegalOpinion',
templateUrl: '',
required: false,
block: true,
visible: true,
default: [],
limit: 1,
},
{
label: '出具机构',
type: 'input',
placeholder: '请输入',
field: 'opinionIssuingInstitution',
default: '',
maxlength: 50,
required: false,
visible: true
},
{
label: '出具日期',
type: 'date',
placeholder: '请选择',
field: 'opinionIssuingTime',
default: "",
unlink: true,
clearable: true,
required: false
},
{
label: '入表合规方案',
tip: '支持格式:pdf,单个文件不能超过10MB ',
type: 'upload-file',
accept: '.pdf',
field: 'entryComplianceProgram',
templateUrl: '',
required: false,
block: true,
visible: true,
default: [],
limit: 1,
},
{
label: '出具机构',
type: 'input',
placeholder: '请输入',
field: 'planIssuingInstitution',
default: '',
maxlength: 50,
required: false,
visible: true
},
{
label: '出具日期',
type: 'date',
placeholder: '请选择',
field: 'planIssuingTime',
default: "",
unlink: true,
clearable: true,
required: false
},
]);
const formRules = ref({
});
const dialogInfo = ref({
visible: false,
size: 510,
direction: "column",
header: {
title: "合规信息",
},
type: '',//标识是否是重新提交
contents: [
{
type: 'form',
title: '',
formInfo: {
id: 'quality-coss-level',
items: formItems.value,
rules: formRules.value
}
}
],
footer: {
btns: [
{ type: "default", label: "取消", value: "cancel" },
{ type: "primary", label: "确定", value: "submit" },
],
},
});
const tableTempValue = ref<any>('');
const dialogBtnClick = (btn, info) => {
console.log('currTableData', info);
if (btn.value == 'submit') {
let params: any = {
damGuid: tableTempValue.value.guid,
complianceEvaluateReport: info.complianceEvaluateReport?.map(file => {
return {
name: file.name,
url: file.url
}
}) || [],
reportIssuingInstitution: info.reportIssuingInstitution,
reportIssuingTime: info.reportIssuingTime,
complianceLegalOpinion: info.complianceLegalOpinion?.map(file => {
return {
name: file.name,
url: file.url
}
}) || [],
opinionIssuingInstitution: info.opinionIssuingInstitution,
opinionIssuingTime: info.opinionIssuingTime,
entryComplianceProgram: info.entryComplianceProgram?.map(file => {
return {
name: file.name,
url: file.url
}
}) || [],
planIssuingInstitution: info.planIssuingInstitution,
planIssuingTime: info.planIssuingTime
}
if (params.complianceEvaluateReport?.length) {
if (!params.reportIssuingInstitution) {
ElMessage.error('请输入合规评估报告的出具机构');
return;
}
if (!params.reportIssuingTime) {
ElMessage.error('请输入合规评估报告的出具日期');
return;
}
}
if (params.complianceLegalOpinion?.length) {
if (!params.opinionIssuingInstitution) {
ElMessage.error('请输入合规法律意见书的出具机构');
return;
}
if (!params.opinionIssuingTime) {
ElMessage.error('请输入合规法律意见书的出具日期');
return;
}
}
if (params.entryComplianceProgram?.length) {
if (!params.planIssuingInstitution) {
ElMessage.error('请输入入表合规方案的出具机构');
return;
}
if (!params.planIssuingTime) {
ElMessage.error('请输入入表合规方案的出具日期');
return;
}
}
tableInfo.value.loading = true;
updateComplianceInfo(params).then((res: any) => {
tableInfo.value.loading = false;
if (res?.code == proxy.$passCode) {
if (res.data) {
ElMessage.success('上传成功');
dialogInfo.value.visible = false;
getTableData();
} else {
ElMessage.error('上传失败');
}
} else {
ElMessage.error(res.msg);
}
}).catch(() => {
tableInfo.value.loading = false;
});
}
else if (btn.value == 'cancel') {
dialogInfo.value.visible = false;
}
};
//状态(1:待上传 2:部分上传 3:全部上传 )
const statusList = [
{ label: '待上传', value: 1 },
{ label: '部分上传', value: 2 },
{ label: '全部上传', value: 3 },
];
const classSearchItemList = ref<any>([
{
type: 'input',
multiple: true,
label: '',
field: 'damName',
default: '',
placeholder: '请输入产品名称',
clearable: true,
visible: true
},
// 状态,可以编辑。
{
type: 'select',
multiple: true,
label: '',
field: 'state',
default: [],
options: statusList,
multiply: true,
placeholder: '请选择状态',
clearable: true,
filterable: true,
visible: true
}
]);
const searchItemValue: any = ref({});
/** 搜索查询分类标准 */
const toSearch = (val: any, clear: boolean = false) => {
if (clear) {
classSearchItemList.value.map((item) => (item.default = ""));
searchItemValue.value = {};
} else {
searchItemValue.value = Object.keys(val).length ? { ...val } : {};
!searchItemValue.value.state && (searchItemValue.value.state = null);
}
page.value.curr = 1;
tableInfo.value.page.curr = 1;
getTableData();
};
const tablePageChange = (info) => {
page.value.curr = Number(info.curr);
page.value.limit = Number(info.limit);
getTableData();
};
const getTableData = () => {
tableInfo.value.loading = true;
getComplianceInfoPageList(
Object.assign({}, searchItemValue.value, {
pageIndex: page.value.curr,
pageSize: page.value.limit,
})
)
.then((res: any) => {
tableInfo.value.loading = false;
tableInfo.value.data = res.data.records || [];
tableInfo.value.page.curr = res.data.pageIndex;
tableInfo.value.page.limit = res.data.pageSize;
tableInfo.value.page.rows = res.data.totalRows;
})
.catch((res) => {
tableInfo.value.loading = false;
});
};
</script>
<template>
<div class="data-label">
<div class="container_wrap">
<div class="main_wrap">
<div class="main_wrap-top-area">
<TableTools :searchItems="classSearchItemList" :searchId="'template-manage-search'" @search="toSearch" />
</div>
<div class="table_panel_wrap">
<Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tablePageChange="tablePageChange" />
</div>
</div>
</div>
<Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" />
</div>
</template>
<style lang="scss" scoped>
.data-label {
width: 100%;
height: 100%;
.container_wrap {
height: 100%;
.main_wrap {
height: 100%;
padding: 11px 8px 0 8px;
.main_wrap-top-area {
display: flex;
margin-bottom: 10px;
align-items: center;
.v-serach {
margin-left: 10px;
}
}
:deep(.tools_search) {
.el-form-item .el-select {
width: 230px;
}
}
.table_panel_wrap {
margin-top: 12px;
width: 100%;
height: calc(100% - 65px);
min-height: 210px;
overflow: visible;
}
}
}
}
</style>