anonResultAnalysis.vue
17.1 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
<template>
<div class="analysis-result-main">
<div v-if="showTitle" class="result-title">匿名结果分析</div>
<div class="kpi-content" v-show="Object.keys(analysisResultInfo).length > 0">
<div class="border-content">
<div class="text">去标识化效果评估结果</div>
<span class="number score-color">{{ analysisResultInfo.rating + '级' }}</span>
</div>
<div class="border-content">
<span class="text">重标识风险最大值<el-tooltip placement="top" effect="light" popper-class="table_tooltip">
<template #content>
<div style="max-width: 236px;">
所有等价类的重标识风险最大值
</div>
</template>
<el-icon style="margin-left: 2px;margin-top: 2px;">
<QuestionFilled />
</el-icon>
</el-tooltip></span>
<span class="number">{{ analysisResultInfo.reIdentifyRiskRb != null ?
(analysisResultInfo.reIdentifyRiskRb || 0) : '--'
}}</span>
</div>
<div class="border-content">
<span class="text">重标识风险平均值<el-tooltip placement="top" effect="light" popper-class="table_tooltip">
<template #content>
<div style="max-width: 236px;">
所有等价类的重标识风险平均值
</div>
</template>
<el-icon style="margin-left: 2px;margin-top: 2px;">
<QuestionFilled />
</el-icon>
</el-tooltip></span>
<span class="number">{{ analysisResultInfo.reIdentifyRiskRc != null ?
(analysisResultInfo.reIdentifyRiskRc || 0) : '--' }}</span>
</div>
<div class="border-content">
<span class="text">环境重标识攻击概率<el-tooltip placement="top" effect="light" popper-class="table_tooltip">
<template #content>
<div style="max-width: 236px;">
完全公开共享数据发布,攻击者对数据集进行环境重标识攻击的概率为1。领地公开共享与受控公开共享数据发布,环境重标识攻击概率为内部故意攻击概率、数据集包含熟人概率和数据泄露概率三者的最大值。
</div>
</template>
<el-icon style="margin-left: 2px;margin-top: 2px;">
<QuestionFilled />
</el-icon>
</el-tooltip></span>
<span class="number">{{ analysisResultInfo.envReAttackPr != null ?
(analysisResultInfo.envReAttackPr || 0) : '--' }}</span>
</div>
<div class="border-content">
<span class="text">等价类门限风险<el-tooltip placement="top" effect="light" popper-class="table_tooltip">
<template #content>
<div style="max-width: 236px;">
完全公开共享数据发布,门限阈值取值 1/20;受控公开共享数据发布,门限阈值取值 1/5;领地公开共享数据发布,门限阈值取值
1/3;等价类门限风险为:等价类的重标识风险大于门限阈值为1,小于等于为0,求和后除以等价类个数。
</div>
</template>
<el-icon style="margin-left: 2px;margin-top: 2px;">
<QuestionFilled />
</el-icon>
</el-tooltip></span>
<span class="number">{{ analysisResultInfo.reIdentifyRiskRa != null ?
(analysisResultInfo.reIdentifyRiskRa || 0) : '--' }}</span>
</div>
<div class="border-content">
<span class="text">重标识风险总体风险<el-tooltip placement="top" effect="light" popper-class="table_tooltip">
<template #content>
<div style="max-width: 236px;">
完全公开共享,当等价类门限风险=0时,重标识风险总体风险公式为等价类重标识风险最大值*环境重标识攻击概率;当等价类门限风险!=0时,重标识风险总体风险为1。
受控公开共享和领地公开共享,当等价类门限风险=0时,重标识风险总体风险公式为等价类重标识风险平均值*环境重标识攻击概率;当等价类门限风险!=0时,重标识风险总体风险为1。
<!-- {{ oldAnonTaskValueInfo.dataSharingTypeCode == '01' ? '完全公开共享,当等价类门限风险=0时,重标识风险总体风险公式为等价类重标识风险最大值*环境重标识攻击概率;当等价类门限风险!=0时,重标识风险总体风险为1。'
: `${oldAnonTaskValueInfo.dataSharingTypeCode == '02' ? '受控公开共享' : '领地公开共享'},当等价类门限风险=0时,重标识风险总体风险公式为等价类重标识风险平均值*环境重标识攻击概率;当等价类门限风险!=0时,重标识风险总体风险为1。` }} -->
</div>
</template>
<el-icon style="margin-left: 2px;margin-top: 2px;">
<QuestionFilled />
</el-icon>
</el-tooltip></span>
<span class="number">{{ analysisResultInfo.reIdentifyOverallRisk != null ?
(analysisResultInfo.reIdentifyOverallRisk || 0) : '--' }}</span>
</div>
<div class="border-content">
<span class="text">重标识可接受风险阈值</span>
<span class="number">{{ oldAnonTaskValueInfo.anonPrivacyMode?.riskThreshold == null ? 0.05 :
(oldAnonTaskValueInfo.anonPrivacyMode?.riskThreshold || 0) }}</span>
</div>
</div>
<div class="result-title">重标识风险表</div>
<el-table ref="tableRef" v-show="analysisResultTableFields.length" :data="resultData"
v-loading="analysisResultLoading" :highlight-current-row="true" stripe border tooltip-effect="light" height="100%"
row-key="guid" :style="{ width: '100%', height: '280px' }">
<el-table-column label="等价类" type="index" width="68px" align="center" show-overflow-tooltip>
<template #default="scope">
<span>{{
pageInfo.curr !== undefined
? (pageInfo.curr - 1) * pageInfo.limit + scope.$index + 1
: scope.$index + 1
}}</span>
</template>
</el-table-column>
<template v-for="(item, index) in (analysisResultTableFields || [])">
<el-table-column :label="item.chName" :width="item.dataType === 'datetime'
? TableColumnWidth.DATETIME
: item.dataType === 'date'
? TableColumnWidth.DATE
: originResultTableFieldColumn[item.enName]
" :align="getTextAlign(item)" :header-align="getTextAlign(item)"
:formatter="(row) => formatterPreviewDate(row, item)" :show-overflow-tooltip="true">
</el-table-column>
</template>
<el-table-column label="等价类大小" prop="equivalenceClassNum" width="98" align="right" fixed="right"
show-overflow-tooltip></el-table-column>
<el-table-column label="重标识风险" prop="reIdentifyRisk" width="96" align="right" fixed="right"
show-overflow-tooltip></el-table-column>
<el-table-column label="判断重风险是否大于门限阈值" prop="isGtThreshold" width="130" align="left" fixed="right"
show-overflow-tooltip></el-table-column>
</el-table>
<div v-show="!analysisResultTableFields.length" class="empty-content">
<img src="../../../assets/images/empty-data.png" :style="{ width: '168px', height: '96px' }" />
<div class="empty-text">暂无数据</div>
</div>
<div v-show="analysisResultTableFields.length" class="result-table-desc">门限阈值的取值:完全公开共享数据发布,取值
1/20;受控公开共享数据发布,取值
1/5;领地公开共享数据发布,取值 1/3</div>
<PageNav v-show="analysisResultTableFields.length" :class="[pageInfo.type]" :pageInfo="pageInfo"
@pageChange="pageChange" />
<div class="row-two-main" style="margin-top: 12px;">
<div class="table-one">
<div class="result-title">对抗性测试关键变量</div>
<el-table ref="varTableRef" :data="analysisResultInfo?.adversarialTest || []" :highlight-current-row="true"
stripe border tooltip-effect="light" height="100%" row-key="guid"
:style="{ height: oldAnonTaskValueInfo.dataSharingTypeCode != '01' ? (containerWidth > 1397 ? '378px' : (containerWidth < 1048 ? '414px' : '396px')) : 'auto' }">
<el-table-column label="序号" type="index" width="56px" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column label="数据项" prop="chName" width="150px" align="left" show-overflow-tooltip></el-table-column>
<el-table-column label="唯一性分值" prop="uniqueScore" width="110px" align="right"
show-overflow-tooltip></el-table-column>
<el-table-column label="影响力分值" prop="influenceScore" width="110" align="right"
show-overflow-tooltip></el-table-column>
<el-table-column label="数据属性标识度分值" prop="dataAttrIdentScore" width="160" align="right"
show-overflow-tooltip></el-table-column>
</el-table>
</div>
<div class="table-two" v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'">
<div class="result-title">内部故意攻击概率</div>
<div class="desc" style="margin-bottom: 4px;color: #999;line-height: 18px;">
重标识数据的动机和能力为低,从重标识攻击可能性分析表可得出在内部攻击方面,重标识攻击概率的取值为0.05。</div>
<el-table ref="innerTableRef" :data="innerResultData" :highlight-current-row="true" stripe border
tooltip-effect="light" height="100%" row-key="guid" :style="{ height: '356px' }"
:span-method="arrayInnerSpanMethod" :cell-class-name="handleInnerCellClass">
<!-- <el-table-column label="序号" type="index" width="56px" align="center" show-overflow-tooltip>
</el-table-column> -->
<el-table-column label="风险减缓控制水平" prop="level" width="150px" align="left"
show-overflow-tooltip></el-table-column>
<el-table-column label="动机和能力" prop="competencyLevel" width="140px" align="left"
show-overflow-tooltip></el-table-column>
<el-table-column label="重标识攻击概率" prop="value" width="140" align="right" show-overflow-tooltip>
<template #default="scope">
<span>{{ scope.row.value }}</span>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="row-two-main" v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'">
<div class="table-one border">
<div class="result-title">数据集包含熟人概率</div>
<div class="result-title-h1">pr=1-(1-p)^m</div>
<div class="result-title-desc">
{{ ` 数据集包含熟人概率可通过以上公式计算,${new
Date().getFullYear()}年我国最新的人口统计为${analysisResultInfo?.allPerson ||
0}亿人,其中该数据集的容量为${analysisResultInfo?.dataSetNum || 0}万,
占总人口的比例为${analysisResultInfo.patientPopulationRate ||
0}%,m值取推荐值150,数据集包含熟人的概率为${analysisResultInfo.randomAcquaintancePr || 0}。` }}
</div>
</div>
<div class="table-two border">
<div class="result-title">数据泄露概率</div>
<div class="result-title-desc">
<div>对于安全和隐私控制能力评估为低的情况,推荐将数据泄露概率设定为0.55。</div>
<div>对于安全和隐私控制能力评估为中的情况,推荐将数据泄露概率设定为0.27。</div>
<div>对于安全和隐私控制能力评估为高的情况,推荐将数据泄露概率设定为 0.14。</div>
<div>{{ `数据接收方的安全和隐私控制能力为高,按照推荐值将数据泄露概率设定为${analysisResultInfo.dataBreachPr || 0}。` }}</div>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup name="anonResultAnalysis">
import { TableColumnWidth } from '@/utils/enum';
import Moment from 'moment';
defineProps({
showTitle: {
type: Boolean,
default: false,
},
analysisResultInfo: {
type: Object,
default: {},
},
pageInfo: {
type: Object,
default: {},
},
analysisResultLoading: {
type: Boolean,
default: false,
},
oldAnonTaskValueInfo: {
type: Object,
default: {},
},
resultData: {
type: Array,
default: []
},
analysisResultTableFields: {
type: Array,
default: [],
},
originResultTableFieldColumn: {
type: Object,
default: {},
},
containerWidth: {
type: Number,
default: 1200,
},
})
const emits = defineEmits([
"pageChange"
]);
const getTextAlign = (field) => {
if (field.dataType === 'decimal' || field.dataType === 'int') {
return 'right';
}
return 'left'
}
const formatterPreviewDate = (row, info) => {
let enName = info.enName;
let v = row[enName];
if (v === 0) {
return v;
}
if (!v || v == 'null') {
return '--';
}
if (info.dataType === 'datetime') {
return Moment(v).format('YYYY-MM-DD HH:mm:ss');
}
if (info.dataType === 'date') {
if (isNaN(<any>(new Date(v)))) {
return Moment(parseInt(v)).format('YYYY-MM-DD');
} else {
return Moment(v).format('YYYY-MM-DD');
}
}
return v;
};
/** 内部故意攻击概率的表格 */
const innerResultData = ref([{
guid: '1',
level: '高',
competencyLevel: '低',
value: '0.05'
}, {
guid: '2',
level: '高',
competencyLevel: '中',
tooltip: true,
value: '0.1'
}, {
guid: '3',
level: '高',
competencyLevel: '高',
tooltip: true,
value: '0.2'
}, {
guid: '4',
level: '中',
competencyLevel: '低',
value: '0.2'
}, {
guid: '5',
level: '中',
competencyLevel: '中',
value: '0.3'
}, {
guid: '6',
level: '中',
competencyLevel: '高',
value: '0.4'
}, {
guid: '7',
level: '低',
competencyLevel: '低',
value: '0.4'
}, {
guid: '8',
level: '低',
competencyLevel: '中',
value: '0.5'
}, {
guid: '9',
level: '低',
competencyLevel: '高',
value: '0.6'
}]);
const arrayInnerSpanMethod = ({ row, column, rowIndex, columnIndex }) => {
if (columnIndex > 0) {
return [1, 1];
}
// 查找当前字段值相同的连续行
let startRow = rowIndex;
let endRow = rowIndex;
let field = 'level';
// 向前查找
while (startRow > 0 && innerResultData.value[startRow - 1][field] === innerResultData.value[rowIndex][field]) {
startRow--;
}
// 向后查找
while (endRow < innerResultData.value.length - 1 && innerResultData.value[endRow + 1][field] === innerResultData.value[rowIndex][field]) {
endRow++;
}
// 如果当前行不是相同值组的起始行,则不显示
if (startRow !== rowIndex) {
return [0, 0];
}
// 返回合并的行数
const rowspan = endRow - startRow + 1;
return [rowspan, 1];
}
const handleInnerCellClass = ({ row, column, rowIndex, columnIndex }) => {
if (rowIndex == 0 && columnIndex > 0) {
return 'cell-tooltip-bg';
}
return '';
}
const pageChange = (info) => {
emits('pageChange', info);
}
</script>
<style lang="scss" scoped>
.analysis-result-main {
min-height: 250px;
.value-desc {
font-size: 14px;
color: #212121;
line-height: 21px;
}
.result-title {
font-size: 16px;
color: #212121;
line-height: 24px;
font-weight: 600;
margin-bottom: 6px;
}
.result-title-h1 {
color: #212121;
font-weight: 600;
font-size: 24px;
text-align: center;
line-height: 36px;
margin-top: 12px;
}
.result-title-desc {
color: #666;
font-size: 14px;
line-height: 21px;
margin-top: 12px;
}
.kpi-content {
display: flex;
flex-direction: row;
column-gap: 12px;
row-gap: 12px;
flex-wrap: wrap;
margin-bottom: 20px;
}
.border-content {
height: 76px;
display: flex;
flex-direction: column;
align-items: left;
padding-left: 16px;
justify-content: center;
border: 1px solid #d9d9d9;
width: calc(20% - 8px);
min-width: 228px;
border-radius: 2px;
padding-left: 16px;
.number {
font-weight: 700;
font-size: 20px;
color: #212121;
line-height: 30px;
margin-top: 2px;
&.score-color {
color: #FF5F1F;
}
}
.text {
font-size: 14px;
line-height: 21px;
color: #666666;
display: flex;
.el-icon {
color: #b2b2b2;
}
}
}
.result-table-desc {
font-size: 14px;
color: #999999;
line-height: 21px;
}
.row-two-main {
margin-top: 18px;
display: flex;
.table-one {
width: 586px;
&.border {
border: 1px solid #d9d9d9;
padding: 14px 18px 18px;
}
}
.table-two {
margin-left: 20px;
width: calc(100% - 606px);
&.border {
border: 1px solid #d9d9d9;
padding: 14px 18px 18px;
}
}
}
}
.empty-content {
display: flex;
align-items: center;
justify-content: center;
height: 316px;
width: 100%;
flex-direction: column;
.empty-text {
font-size: 14px;
color: #b2b2b2;
}
}
</style>