anonResultAnalysis.vue 34.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 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791
<template>
  <div style="display: flex;justify-content: center;width: 100%;">
    <div v-show="!isWordStyle" class="analysis-result-main">
       <div class="reject" v-show="analysisResultInfo.rating <= 2">
      <div v-if="analysisResultInfo.rating == 2" class="header_title">
        <span class="title_text">{{ `匿名化评测结果不符合评测要求,等级为${analysisResultInfo.rating}级,重标识符风险大于风险阈值0.05,请对如性别、年龄、地区等准标识符加大泛化以降低重标识风险。` }}</span>
      </div>
       <div v-else class="header_title">
        <span class="title_text">{{ `匿名化评测结果不符合评测要求,等级为${analysisResultInfo.rating}级,数据中仍含可直接识别个人身份的信息,请对该信息进行脱敏处理。点击下载`}}</span>
        <span class="title_text link" @click="downErrorFile">《需修正文件明细表》</span>
      </div>
    </div>
      <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>
    <div v-show="isWordStyle" class="analysis-result-main report-main" ref="report">
      <div
        style="font-family: simsun;height: 40px;display: block;line-height: 32px;font-size: 18px;color: #212121;font-weight: 700;text-align: center;margin-top: 10px;margin-bottom: 10px;">匿名化效果评估指标</div>
      <p style="font-family: simsun;margin: 0px;font-size: 14px;line-height: 21px;white-space: pre-wrap;color: #212121;">{{ '    依据GB/T 42460-2023《信息安全技术个人信息去标识化效果评估指南》附录D,对去标识化以后的数据集基于K匿名模型进行去标识化效果的评估。' }}</p>
      <p style="font-family: simsun;margin: 0px;font-size: 14px;line-height: 21px;white-space: pre-wrap;color: #212121;">
       {{  `    总体方案为先计算数据集每行记录、整体数据集的重标识风险,进而计算环境重标识攻击概率,最后再结合环境重标识攻击概率计算整个数据集的重标识整体风险。去标识化效果评估结果为${analysisResultInfo.rating + '级'}。具体指标如下:` }}</p>
      <div
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;font-weight: 700;margin: 8px 0px;">
        匿名化结果分析</div>
      <div class="kpi-content" v-show="Object.keys(analysisResultInfo).length > 0">
        <div class="border-content">
          <div class="text" style="color: #212121;">去标识化效果评估结果</div>
          <span class="number score-color">{{ analysisResultInfo.rating + '级' }}</span>
        </div>
        <div class="border-content">
          <span class="text" style="color: #212121;">重标识风险最大值</span>
          <span class="number">{{ analysisResultInfo.reIdentifyRiskRb != null ?
            (analysisResultInfo.reIdentifyRiskRb || 0) : '--'
          }}</span>
        </div>
        <div class="border-content">
          <span class="text" style="color: #212121;">重标识风险平均值</span>
          <span class="number">{{ analysisResultInfo.reIdentifyRiskRc != null ?
            (analysisResultInfo.reIdentifyRiskRc || 0) : '--' }}</span>
        </div>
        <div class="border-content">
          <span class="text" style="color: #212121;">环境重标识攻击概率</span>
          <span class="number">{{ analysisResultInfo.envReAttackPr != null ?
            (analysisResultInfo.envReAttackPr || 0) : '--' }}</span>
        </div>
        <div class="border-content">
          <span class="text" style="color: #212121;">等价类门限风险</span>
          <span class="number">{{ analysisResultInfo.reIdentifyRiskRa != null ?
            (analysisResultInfo.reIdentifyRiskRa || 0) : '--' }}</span>
        </div>
        <div class="border-content">
          <span class="text" style="color: #212121;">重标识风险总体风险</span>
          <span class="number">{{ analysisResultInfo.reIdentifyOverallRisk != null ?
            (analysisResultInfo.reIdentifyOverallRisk || 0) : '--' }}</span>
        </div>
        <div class="border-content">
          <span class="text" style="color: #212121;">重标识可接受风险阈值</span>
          <span class="number">{{ oldAnonTaskValueInfo.anonPrivacyMode?.riskThreshold == null ? 0.05 :
            (oldAnonTaskValueInfo.anonPrivacyMode?.riskThreshold || 0) }}</span>
        </div>
      </div>
      <div
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;font-weight: 700;margin: 8px 0px 4px;">
        重标识风险表</div>
      <div style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;margin-bottom: 4px;white-space: pre-wrap;">{{ '    门限阈值的取值:完全公开共享数据发布,取值 1/20;受控公开共享数据发布,取值 1/5;领地公开共享数据发布,取值 1/3。' }}</div>
      <table border="0" cellspacing="0"
        style="width:100%;word-break: break-all;margin: 0 auto;text-align: center;border-collapse: collapse;color: #212121">
        <thead>
          <tr>
            <th v-for="(item, index) in resultTableFields" :key="index" style="border: 0.5px solid #d9d9d9">
              <span>{{ item.chName }}</span>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="(recordItem, j) in fullResultData" :key="j">
            <td v-for="(columnItem, i) in resultTableFields" :key="i"
              :style="{ border: '0.5px solid #d9d9d9', 'text-align': <any>(getTextAlign(columnItem) ?? 'left') }">
              <span :style="{ 'word-break': 'break-all' }">
                {{ columnItem.enName == 'index' ? (j + 1) : formatterPreviewDate(recordItem, columnItem) }}
              </span>
            </td>
          </tr>
        </tbody>
      </table>
      <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;font-weight: 700;margin: 8px 0px 4px;">
        内部故意攻击概率</div>
      <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;margin-bottom: 4px;white-space: pre-wrap;">{{ '    重标识数据的动机和能力为低,从重标识攻击可能性分析表可得出在内部攻击方面,重标识攻击概率的取值为0.05。'}}</div>
      <table v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'" border="0" cellspacing="0"
        style="width:100%;word-break: break-all;margin: 0 auto;text-align: center;border-collapse: collapse;color: #212121;">
        <thead>
          <tr>
            <th v-for="(item, index) in innerResultFields" :key="index" style="border: 0.5px solid #d9d9d9">
              <span>{{ item.label }}</span>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="(recordItem, j) in innerResultData" :key="j">
            <template v-for="(columnItem, i) in innerResultFields" :key="i">
              <td :rowspan="i == 0 ? 3 : 1" v-show="!(j % 3 != 0 && i == 0)"
                :style="{ border: '0.5px solid #d9d9d9', 'text-align': <any>(columnItem.align ?? 'left') }">
                <span :style="{ 'word-break': 'break-all' }">
                  {{ recordItem[columnItem.field] }}
                </span>
              </td>
            </template>
          </tr>
        </tbody>
      </table>
      <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;font-weight: 700;margin: 8px 0px;">数据集包含熟人概率</div>
      <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;text-align: center; display: block;line-height: 21px;font-size: 14px;color: #212121;font-weight: 700">pr=1-1-p^m</div>
      <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;white-space: pre-wrap;">
        {{ `    数据集包含熟人概率可通过以上公式计算,${new Date().getFullYear()}年我国最新的人口统计为${analysisResultInfo?.allPerson ||
          0}亿人,其中该数据集的容量为${analysisResultInfo?.dataSetNum || 0}万,占总人口的比例为${analysisResultInfo.patientPopulationRate ||
          0}%,m值取推荐值150,数据集包含熟人的概率为${analysisResultInfo.randomAcquaintancePr || 0}。` }}</div>
      <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;font-weight: 700;margin: 8px 0px;">数据泄露概率
      </div>
      <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;white-space: pre-wrap;">{{ 
        '    对于安全和隐私控制能力评估为低的情况,推荐将数据泄露概率设定为0.55。' }}</div>
      <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;white-space: pre-wrap;">{{ '    对于安全和隐私控制能力评估为中的情况,推荐将数据泄露概率设定为0.27。' }}</div>
      <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;white-space: pre-wrap;">{{ '    对于安全和隐私控制能力评估为高的情况,推荐将数据泄露概率设定为 0.14。' }}</div> 
       <div v-show="oldAnonTaskValueInfo.dataSharingTypeCode != '01'"
        style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;white-space: pre-wrap;">{{  `    数据接收方的安全和隐私控制能力为高,按照推荐值将数据泄露概率设定为${analysisResultInfo.dataBreachPr || 0}。` }}</div>
      <div style="font-family: simsun;display: block;line-height: 21px;font-size: 14px;color: #212121;font-weight: 700;margin: 8px 0px;">备注:</div>
      <p style="font-family: simsun;margin: 0px;font-size: 14px;line-height: 21px;color: #212121;margin-top: 8px;white-space: pre-wrap;">{{ '    重标识风险最大值:所有等价类的重标识风险最大值;' }}</p>
      <p style="font-family: simsun;margin: 0px;font-size: 14px;line-height: 21px;color: #212121;white-space: pre-wrap;">{{ '    重标识风险平均值:所有等价类的重标识风险平均值;'}}</p>
      <p style="font-family: simsun;margin: 0px;font-size: 14px;line-height: 21px;color: #212121;white-space: pre-wrap;">{{ '    环境重标识攻击概率:完全公开共享数据发布,攻击者对数据集进行环境重标识攻击的概率为1。领地公开共享与受控公开共享数据发布,环境重标识攻击概率为内部故意攻击概率、数据集包含熟人概率和数据泄露概率三者的最大值;' }}</p>
      <p style="font-family: simsun;margin: 0px;font-size: 14px;line-height: 21px;color: #212121;white-space: pre-wrap;">{{ '    等价类门限风险:完全公开共享数据发布,门限阈值取值1/20;受控公开共享数据发布,门限阈值取值 1/5;领地公开共享数据发布,门限阈值取值 1/3;等价类门限风险为:等价类的重标识风险大于门限阈值为1,小于等于为0,求和后除以等价类个数;'}}</p>
      <p style="font-family: simsun;margin: 0px;font-size: 14px;line-height: 21px;color: #212121;white-space: pre-wrap;">{{ '    重标识风险总体风险:完全公开共享,当等价类门限风险=0时,重标识风险总体风险公式为等价类重标识风险最大值*环境重标识攻击概率;当等价类门限风险!=0时,重标识风险总体风险为1。' }}</p>
      <p style="font-family: simsun;margin: 0px;font-size: 14px;line-height: 21px;color: #212121;white-space: pre-wrap;">{{ '    受控公开共享和领地公开共享,当等价类门限风险=0时,重标识风险总体风险公式为等价类重标识风险平均值*环境重标识攻击概率;当等价类门限风险!=0时,重标识风险总体风险为1。' }}</p>
      <p v-show="analysisResultInfo.rating >= 3" style="font-family: simsun;margin: 0px;font-size: 14px;line-height: 21px;color: #212121;white-space: pre-wrap;">{{ '    依据《数据安全技术个人信息匿名化处理指南及评价方法(征求意见稿)》4.2,去标识化的数据集达到3级可展开对数据级的对抗性测试和不可复原性核验。对抗性测试关键变量如下表:' }}</p>
      <table border="0" cellspacing="0" v-show="analysisResultInfo.rating >= 3"
        style="width:100%;word-break: break-all;margin: 4px auto 0px auto;text-align: center;border-collapse: collapse;color: #212121;">
        <thead>
          <tr>
            <th v-for="(item, index) in adversarialTestFields" :key="index" style="border: 0.5px solid #d9d9d9">
              <span>{{ item.label }}</span>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="(recordItem, j) in analysisResultInfo?.adversarialTest || []" :key="j">
            <td v-for="(columnItem, i) in adversarialTestFields" :key="i"
              :style="{ border: '0.5px solid #d9d9d9', 'text-align': <any>(columnItem.align ?? 'left') }">
              <span :style="{ 'word-break': 'break-all' }">
                {{ columnItem.field == 'index' ? (j + 1) : recordItem[columnItem.field] === 0 ? 0 :
                  (recordItem[columnItem.field] || '--') }}
              </span>
            </td>
          </tr>
        </tbody>
      </table>
      <p v-show="analysisResultInfo.rating >= 3" style="font-family: simsun;margin: 4px 0px 0px;font-size: 14px;line-height: 21px;color: #212121;white-space: pre-wrap;">{{ '    通过识别关键变量,选择标识度高于0.5的属性作为攻击测试的关键变量,在攻击测试中,涉及到的攻击场景,其重标识概率均远小于所接受的风险水平0.05。另外,未发现任何其它可能的安全性问题。' }}</p>
    </div>
  </div>
</template>
<script lang="ts" setup name="anonResultAnalysis">
import { TableColumnWidth } from '@/utils/enum';
import { QuestionFilled, CircleCloseFilled } from "@element-plus/icons-vue";
import Moment from 'moment';
import {
  downDicomPath,
} from '@/api/modules/dataAnonymization';
import { download } from '@/utils/common';
import { ElMessage } from 'element-plus';

const props = defineProps({
  isWordStyle: { //显示的是否是word报告的样式
    type: Boolean,
    default: false,
  },
  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: []
  },
  fullResultData: { //全部数据,下载word时使用。
    type: Array,
    default: []
  },
  analysisResultTableFields: {
    type: Array,
    default: [],
  },
  originResultTableFieldColumn: {
    type: Object,
    default: {},
  },
  containerWidth: {
    type: Number,
    default: 1200,
  },
})

const report = ref();

const resultTableFields = computed(() => {
  let arr: any[] = [{ chName: '等价类', dataType: 'int', enName: 'index' }]
  return arr.concat(props.analysisResultTableFields).concat([{
    chName: '等价类大小',
    enName: 'equivalenceClassNum',
    dataType: 'int'
  }, {
    chName: '重标识风险',
    enName: 'reIdentifyRisk',
    dataType: 'decimal'
  }, {
    chName: '判断重风险是否大于门限阈值',
    enName: 'isGtThreshold',
    dataType: 'text'
  }]);
})

const emits = defineEmits([
  "pageChange"
]);

const getTextAlign = (field) => {
  if (field.enName === 'index') {
    return 'center';
  }
  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 innerResultFields = ref([{
  field: 'level',
  label: '风险减缓控制水平'
}, {
  field: 'competencyLevel',
  label: '动机和能力'
}, {
  field: 'value',
  label: '重标识攻击概率',
  align: 'right'
}]);
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 adversarialTestFields = ref([{
  field: 'index',
  label: '序号',
  align: 'center',
}, {
  field: 'chName',
  label: '数据项'
}, {
  field: 'uniqueScore',
  label: '唯一性分值',
  align: 'right'
}, {
  field: 'influenceScore',
  label: '影响力分值',
  align: 'right'
}, {
  field: 'dataAttrIdentScore',
  label: '数据属性标识度分值',
  align: 'right'
}]);

const pageChange = (info) => {
  emits('pageChange', info);
}

const downPromise: any = ref(null)
const downErrorFile = () => {
  if (downPromise.value) {
    return;
  }
  downDicomPath(props.analysisResultInfo.guid).then((res: any) => {
     downPromise.value = null
      if (res && !res.msg) {
        debugger
        download(res, (props.oldAnonTaskValueInfo.taskName) + '_需修正文件明细表.xlsx', 'excel')
      } else {
        res?.msg && ElMessage.error(res?.msg);
      }
  })
}

defineExpose({
  report,
})

</script>

<style lang="scss" scoped>
.analysis-result-main {
  min-height: 250px;
  width: 100%;

  .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;
  }
}

.report-main.analysis-result-main {
  width: 625px;

  .kpi-content {
    margin-bottom: 0px;

    .border-content {
      width: calc(33% - 8px);
      min-width: 168px;
    }
  }
}

.reject {
      background-color: #FDF2F4;
      box-shadow: 0 0 0 1px #E63E33;
      margin-bottom: 8px;

      .header_title {
          .el-icon {
            color: #E63E33;
          }
        }
    }

.header_title {
  height: 40px;
  padding: 0 16px;
  display: flex;
  align-items: center;

  .title_text {
    line-height: 22px;
    font-size: 14px;
    color: var(--el-color-regular);
    font-weight: 600;
    display: flex;
    align-items: center;

    .title_icon {
      width: 26px;
      height: 21px;
      margin-right: 4px;
      cursor: pointer;

      &.active {
        transform: rotate(90deg);
      }
    }

    &.link {
      cursor: pointer;
      color: var(--el-color-primary);
    }
  }
}
</style>