代码评审内容修改
Showing
12 changed files
with
411 additions
and
250 deletions
| ... | @@ -13,6 +13,7 @@ declare module '@vue/runtime-core' { | ... | @@ -13,6 +13,7 @@ declare module '@vue/runtime-core' { |
| 13 | Auth: typeof import('./src/components/Auth/index.vue')['default'] | 13 | Auth: typeof import('./src/components/Auth/index.vue')['default'] |
| 14 | AuthAll: typeof import('./src/components/AuthAll/index.vue')['default'] | 14 | AuthAll: typeof import('./src/components/AuthAll/index.vue')['default'] |
| 15 | CarouselPanel: typeof import('./src/components/CarouselPanel/src/CarouselPanel.vue')['default'] | 15 | CarouselPanel: typeof import('./src/components/CarouselPanel/src/CarouselPanel.vue')['default'] |
| 16 | CommonTable: typeof import('./src/components/CommonTable/src/CommonTable.vue')['default'] | ||
| 16 | ContentWrap: typeof import('./src/components/ContentWrap/src/ContentWrap.vue')['default'] | 17 | ContentWrap: typeof import('./src/components/ContentWrap/src/ContentWrap.vue')['default'] |
| 17 | Copyright: typeof import('./src/components/Copyright/index.vue')['default'] | 18 | Copyright: typeof import('./src/components/Copyright/index.vue')['default'] |
| 18 | Day: typeof import('./src/components/Schedule/component/day.vue')['default'] | 19 | Day: typeof import('./src/components/Schedule/component/day.vue')['default'] | ... | ... |
src/api/apiHander.ts
0 → 100644
| 1 | /** | ||
| 2 | * API响应处理工具函数 | ||
| 3 | * 统一处理API请求的成功/失败逻辑 | ||
| 4 | */ | ||
| 5 | |||
| 6 | interface ApiResponse { | ||
| 7 | code: number; | ||
| 8 | data?: any; | ||
| 9 | msg?: string; | ||
| 10 | } | ||
| 11 | |||
| 12 | export interface ApiHandlerOptions { | ||
| 13 | /* 当前实例的proxy对象(用于获取$passCode和$ElMessage)*/ | ||
| 14 | proxy: any | ||
| 15 | /** 加载状态ref */ | ||
| 16 | loadingRef?: Ref<boolean>; | ||
| 17 | /** 成功回调函数 */ | ||
| 18 | onSuccess?: (res: any) => void; | ||
| 19 | /** 失败回调函数 */ | ||
| 20 | onError?: (res: any) => void; | ||
| 21 | /** 是否显示错误消息,默认true */ | ||
| 22 | showError?: boolean; | ||
| 23 | } | ||
| 24 | |||
| 25 | /** | ||
| 26 | * 统一处理API响应的工具函数 | ||
| 27 | * @param apiPromise API请求Promise | ||
| 28 | * @param options 配置选项 | ||
| 29 | */ | ||
| 30 | export const handleApiResponse = async ( | ||
| 31 | apiPromise: Promise<ApiResponse>, | ||
| 32 | options: ApiHandlerOptions, | ||
| 33 | ) => { | ||
| 34 | const { | ||
| 35 | loadingRef, | ||
| 36 | onSuccess, | ||
| 37 | onError, | ||
| 38 | showError = true, | ||
| 39 | proxy | ||
| 40 | } = options; | ||
| 41 | |||
| 42 | try { | ||
| 43 | // 设置加载状态 | ||
| 44 | if (loadingRef) { | ||
| 45 | loadingRef.value = true; | ||
| 46 | } | ||
| 47 | |||
| 48 | // 执行API请求 | ||
| 49 | const res = await apiPromise; | ||
| 50 | |||
| 51 | // 设置加载状态 | ||
| 52 | if (loadingRef) { | ||
| 53 | loadingRef.value = false; | ||
| 54 | } | ||
| 55 | |||
| 56 | // 判断请求是否成功 | ||
| 57 | if (res?.code == proxy.$passCode) { | ||
| 58 | // 成功回调 | ||
| 59 | onSuccess && onSuccess(res); | ||
| 60 | } else { | ||
| 61 | // 失败处理 | ||
| 62 | const errorMsg = res?.msg || ''; | ||
| 63 | if (showError) { | ||
| 64 | proxy.$ElMessage.error(errorMsg); | ||
| 65 | } | ||
| 66 | onError && onError(res); | ||
| 67 | } | ||
| 68 | } catch (error: any) { | ||
| 69 | // 异常处理 | ||
| 70 | if (loadingRef) { | ||
| 71 | loadingRef.value = false; | ||
| 72 | } | ||
| 73 | } | ||
| 74 | }; |
| ... | @@ -2,6 +2,7 @@ | ... | @@ -2,6 +2,7 @@ |
| 2 | * 匿名化管理的接口api文件 | 2 | * 匿名化管理的接口api文件 |
| 3 | */ | 3 | */ |
| 4 | import request from "@/utils/request"; | 4 | import request from "@/utils/request"; |
| 5 | import { handleApiResponse, ApiHandlerOptions } from '../apiHander'; // 导入公共处理方法 | ||
| 5 | 6 | ||
| 6 | /** 获取标签列表。 */ | 7 | /** 获取标签列表。 */ |
| 7 | export const getDataLabelList = (params) => request({ | 8 | export const getDataLabelList = (params) => request({ |
| ... | @@ -246,6 +247,12 @@ export const updateAnonTask = (params) => request({ | ... | @@ -246,6 +247,12 @@ export const updateAnonTask = (params) => request({ |
| 246 | }) | 247 | }) |
| 247 | 248 | ||
| 248 | /** 获取匿名化任务详情 */ | 249 | /** 获取匿名化任务详情 */ |
| 250 | // export const getAnonTaskDetail = (guid, defaultOptions: ApiHandlerOptions) => handleApiResponse(request({ | ||
| 251 | // url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/anon-task/detail?guid=${guid}`, | ||
| 252 | // method: 'get' | ||
| 253 | // }), defaultOptions) | ||
| 254 | |||
| 255 | /** 获取匿名化任务详情 */ | ||
| 249 | export const getAnonTaskDetail = (guid) => request({ | 256 | export const getAnonTaskDetail = (guid) => request({ |
| 250 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/anon-task/detail?guid=${guid}`, | 257 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/anon-task/detail?guid=${guid}`, |
| 251 | method: 'get' | 258 | method: 'get' |
| ... | @@ -265,12 +272,18 @@ export const anonTaskCheck = (params) => request({ | ... | @@ -265,12 +272,18 @@ export const anonTaskCheck = (params) => request({ |
| 265 | }) | 272 | }) |
| 266 | 273 | ||
| 267 | /** 获取匿名化任务分析结果数据 */ | 274 | /** 获取匿名化任务分析结果数据 */ |
| 268 | export const getAnonAnalyzeResult = (execGuid) => request({ | 275 | export const getAnonAnalyzeResult1 = (execGuid) => request({ |
| 269 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/anon-task/get-anon-analyze?taskExecGuid=${execGuid}`, | 276 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/anon-task/get-anon-analyze?taskExecGuid=${execGuid}`, |
| 270 | method: 'get' | 277 | method: 'get' |
| 271 | }) | 278 | }) |
| 272 | 279 | ||
| 273 | /** 获取匿名化任务分析结果数据 */ | 280 | /** 获取匿名化任务分析结果数据 */ |
| 281 | export const getAnonAnalyzeResult = (execGuid, defaultOptions: ApiHandlerOptions) => handleApiResponse(request({ | ||
| 282 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/anon-task/get-anon-analyze?taskExecGuid=${execGuid}`, | ||
| 283 | method: 'get' | ||
| 284 | }), defaultOptions) | ||
| 285 | |||
| 286 | /** 获取匿名化任务分析结果数据 */ | ||
| 274 | export const getLastAnonAnalyzeResult = (execGuid) => request({ | 287 | export const getLastAnonAnalyzeResult = (execGuid) => request({ |
| 275 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/anon-task/get-anon-analyze?isResult=true&taskExecGuid=${execGuid}`, | 288 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/anon-task/get-anon-analyze?isResult=true&taskExecGuid=${execGuid}`, |
| 276 | method: 'get' | 289 | method: 'get' | ... | ... |
src/components/CommonTable/index.ts
0 → 100644
| 1 | <script lang="ts" setup name="CommonTable"> | ||
| 2 | import { ref, watch, computed } from "vue"; | ||
| 3 | import { TableColumnWidth } from "@/utils/enum"; | ||
| 4 | import { calcColumnWidth } from "@/utils/index"; | ||
| 5 | import Moment from 'moment'; | ||
| 6 | |||
| 7 | const props = defineProps({ | ||
| 8 | data: { | ||
| 9 | type: Array, | ||
| 10 | default: () => [] | ||
| 11 | }, | ||
| 12 | fields: { | ||
| 13 | type: Array, | ||
| 14 | default: () => [] | ||
| 15 | }, | ||
| 16 | loading: { | ||
| 17 | type: Boolean, | ||
| 18 | default: false | ||
| 19 | }, | ||
| 20 | height: { | ||
| 21 | type: String, | ||
| 22 | default: '100%' | ||
| 23 | }, | ||
| 24 | showIndex: { | ||
| 25 | type: Boolean, | ||
| 26 | default: false | ||
| 27 | }, | ||
| 28 | rowKey: { | ||
| 29 | type: String, | ||
| 30 | default: 'guid' | ||
| 31 | }, | ||
| 32 | style: { | ||
| 33 | type: Object, | ||
| 34 | default: () => ({}) | ||
| 35 | } | ||
| 36 | }); | ||
| 37 | |||
| 38 | const originTableFieldColumn = ref({}); | ||
| 39 | |||
| 40 | const getTextAlign = (field) => { | ||
| 41 | if (field.dataType === 'decimal' || field.dataType === 'int' || field.dataType == 'bit' || field.dataType == 'tinyint') { | ||
| 42 | return 'right'; | ||
| 43 | } | ||
| 44 | return 'left' | ||
| 45 | }; | ||
| 46 | |||
| 47 | const formatterPreviewDate = (row, info) => { | ||
| 48 | let enName = info.enName; | ||
| 49 | let v = row[enName]; | ||
| 50 | if (v === 0) { | ||
| 51 | return v; | ||
| 52 | } | ||
| 53 | if (!v || v == 'null') { | ||
| 54 | return '--'; | ||
| 55 | } | ||
| 56 | if (info.dataType === 'datetime') { | ||
| 57 | return Moment(v).format('YYYY-MM-DD HH:mm:ss'); | ||
| 58 | } | ||
| 59 | if (info.dataType === 'date') { | ||
| 60 | if (isNaN(<any>(new Date(v)))) { | ||
| 61 | return Moment(parseInt(v)).format('YYYY-MM-DD'); | ||
| 62 | } else { | ||
| 63 | return Moment(v).format('YYYY-MM-DD'); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | return v; | ||
| 67 | }; | ||
| 68 | |||
| 69 | const calcTableColumnWidth = (data: any[], prop, title, otherWidth = 0) => { | ||
| 70 | let d: any[] = []; | ||
| 71 | data.forEach((dt) => d.push(dt[prop])); | ||
| 72 | return calcColumnWidth( | ||
| 73 | d, | ||
| 74 | title, | ||
| 75 | { | ||
| 76 | fontSize: 14, | ||
| 77 | fontFamily: "SimSun", | ||
| 78 | }, | ||
| 79 | { | ||
| 80 | fontSize: 14, | ||
| 81 | fontFamily: "SimSun", | ||
| 82 | }, | ||
| 83 | otherWidth | ||
| 84 | ); | ||
| 85 | }; | ||
| 86 | |||
| 87 | watch( | ||
| 88 | () => props.data, | ||
| 89 | (val: any[], oldVal) => { | ||
| 90 | if (!props.fields?.length) { | ||
| 91 | originTableFieldColumn.value = {}; | ||
| 92 | return; | ||
| 93 | } | ||
| 94 | originTableFieldColumn.value = {}; | ||
| 95 | props.fields.forEach((field, index) => { | ||
| 96 | originTableFieldColumn.value[field.enName] = calcTableColumnWidth( | ||
| 97 | val?.slice(0, 20) || [], | ||
| 98 | field.enName, | ||
| 99 | field.chName, | ||
| 100 | 24 | ||
| 101 | ); | ||
| 102 | }); | ||
| 103 | }, | ||
| 104 | { | ||
| 105 | deep: true, | ||
| 106 | } | ||
| 107 | ); | ||
| 108 | </script> | ||
| 109 | |||
| 110 | <template> | ||
| 111 | <div class="common-table" v-loading="loading"> | ||
| 112 | <el-table | ||
| 113 | :data="data" | ||
| 114 | :highlight-current-row="true" | ||
| 115 | stripe | ||
| 116 | border | ||
| 117 | tooltip-effect="light" | ||
| 118 | :height="height" | ||
| 119 | :row-key="rowKey" | ||
| 120 | :style="style" | ||
| 121 | > | ||
| 122 | <el-table-column | ||
| 123 | v-if="showIndex" | ||
| 124 | label="序号" | ||
| 125 | type="index" | ||
| 126 | width="56px" | ||
| 127 | align="center" | ||
| 128 | show-overflow-tooltip | ||
| 129 | ></el-table-column> | ||
| 130 | <template v-for="(item, index) in (fields || [])" :key="index"> | ||
| 131 | <el-table-column | ||
| 132 | :label="item.chName" | ||
| 133 | :width="item.dataType === 'datetime' | ||
| 134 | ? TableColumnWidth.DATETIME | ||
| 135 | : item.dataType === 'date' | ||
| 136 | ? TableColumnWidth.DATE | ||
| 137 | : originTableFieldColumn[item.enName] | ||
| 138 | " | ||
| 139 | :align="getTextAlign(item)" | ||
| 140 | :header-align="getTextAlign(item)" | ||
| 141 | :formatter="(row) => formatterPreviewDate(row, item)" | ||
| 142 | :show-overflow-tooltip="true" | ||
| 143 | > | ||
| 144 | </el-table-column> | ||
| 145 | </template> | ||
| 146 | </el-table> | ||
| 147 | <div v-show="!fields.length" class="empty-content"> | ||
| 148 | <img src="@/assets/images/empty-data.png" :style="{ width: '168px', height: '96px' }" /> | ||
| 149 | <div class="empty-text">暂无数据</div> | ||
| 150 | </div> | ||
| 151 | </div> | ||
| 152 | </template> | ||
| 153 | |||
| 154 | <style lang="scss" scoped> | ||
| 155 | .common-table { | ||
| 156 | width: 100%; | ||
| 157 | height: 100%; | ||
| 158 | |||
| 159 | .el-table { | ||
| 160 | display: inline-block; | ||
| 161 | } | ||
| 162 | |||
| 163 | .empty-content { | ||
| 164 | display: flex; | ||
| 165 | align-items: center; | ||
| 166 | justify-content: center; | ||
| 167 | height: 100%; | ||
| 168 | width: 100%; | ||
| 169 | flex-direction: column; | ||
| 170 | |||
| 171 | .empty-text { | ||
| 172 | font-size: 14px; | ||
| 173 | color: #b2b2b2; | ||
| 174 | } | ||
| 175 | } | ||
| 176 | } | ||
| 177 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -133,8 +133,8 @@ const routes: RouteRecordRaw[] = [ | ... | @@ -133,8 +133,8 @@ const routes: RouteRecordRaw[] = [ |
| 133 | children: [ | 133 | children: [ |
| 134 | { | 134 | { |
| 135 | path: '', | 135 | path: '', |
| 136 | name: 'resultProcess', | 136 | name: 'anonResultProcessManage', |
| 137 | component: () => import('@/views/data_anonymization/resultProcess.vue'), | 137 | component: () => import('@/views/data_anonymization/anonResultProcessManage.vue'), |
| 138 | meta: { | 138 | meta: { |
| 139 | title: '匿名化处理', | 139 | title: '匿名化处理', |
| 140 | sidebar: false, | 140 | sidebar: false, | ... | ... |
| ... | @@ -13,6 +13,7 @@ declare module '@vue/runtime-core' { | ... | @@ -13,6 +13,7 @@ declare module '@vue/runtime-core' { |
| 13 | Auth: typeof import('./../components/Auth/index.vue')['default'] | 13 | Auth: typeof import('./../components/Auth/index.vue')['default'] |
| 14 | AuthAll: typeof import('./../components/AuthAll/index.vue')['default'] | 14 | AuthAll: typeof import('./../components/AuthAll/index.vue')['default'] |
| 15 | CarouselPanel: typeof import('./../components/CarouselPanel/src/CarouselPanel.vue')['default'] | 15 | CarouselPanel: typeof import('./../components/CarouselPanel/src/CarouselPanel.vue')['default'] |
| 16 | CommonTable: typeof import('./../components/CommonTable/src/CommonTable.vue')['default'] | ||
| 16 | ContentWrap: typeof import('./../components/ContentWrap/src/ContentWrap.vue')['default'] | 17 | ContentWrap: typeof import('./../components/ContentWrap/src/ContentWrap.vue')['default'] |
| 17 | Copyright: typeof import('./../components/Copyright/index.vue')['default'] | 18 | Copyright: typeof import('./../components/Copyright/index.vue')['default'] |
| 18 | Day: typeof import('./../components/Schedule/component/day.vue')['default'] | 19 | Day: typeof import('./../components/Schedule/component/day.vue')['default'] | ... | ... |
| 1 | <route lang="yaml"> | 1 | <route lang="yaml"> |
| 2 | name: resultProcess | 2 | name: anonResultProcessManage |
| 3 | </route> | 3 | </route> |
| 4 | 4 | ||
| 5 | <script lang="ts" setup name="resultProcess"> | 5 | <script lang="ts" setup name="anonResultProcessManage"> |
| 6 | import TableTools from "@/components/Tools/table_tools.vue"; | 6 | import TableTools from "@/components/Tools/table_tools.vue"; |
| 7 | import { commonPageConfig } from '@/components/PageNav/index'; | 7 | import { commonPageConfig } from '@/components/PageNav/index'; |
| 8 | import { TableColumnWidth } from "@/utils/enum"; | 8 | import { TableColumnWidth } from "@/utils/enum"; |
| ... | @@ -11,14 +11,13 @@ import { | ... | @@ -11,14 +11,13 @@ import { |
| 11 | getAnonTaskList, | 11 | getAnonTaskList, |
| 12 | deleteAnonTask, | 12 | deleteAnonTask, |
| 13 | } from '@/api/modules/dataAnonymization'; | 13 | } from '@/api/modules/dataAnonymization'; |
| 14 | import { useValidator } from '@/hooks/useValidator'; | ||
| 15 | import useDataAnonymizationStore from "@/store/modules/dataAnonymization"; | 14 | import useDataAnonymizationStore from "@/store/modules/dataAnonymization"; |
| 16 | 15 | ||
| 17 | const anonymizationStore = useDataAnonymizationStore(); | 16 | const anonymizationStore = useDataAnonymizationStore(); |
| 18 | const router = useRouter() | 17 | const router = useRouter() |
| 19 | const { proxy } = getCurrentInstance() as any; | 18 | const { proxy } = getCurrentInstance() as any; |
| 20 | const { required } = useValidator(); | ||
| 21 | 19 | ||
| 20 | /** -------------- 搜索栏输入框配置 ------------------------ */ | ||
| 22 | const searchItemList = ref([{ | 21 | const searchItemList = ref([{ |
| 23 | type: "input", | 22 | type: "input", |
| 24 | label: "", | 23 | label: "", |
| ... | @@ -44,6 +43,7 @@ const page = ref({ | ... | @@ -44,6 +43,7 @@ const page = ref({ |
| 44 | dataSource: null | 43 | dataSource: null |
| 45 | }); | 44 | }); |
| 46 | 45 | ||
| 46 | /** ----------------- 表格展示配置信息,及查询数据处理 ----------------- */ | ||
| 47 | const tableInfo = ref({ | 47 | const tableInfo = ref({ |
| 48 | id: 'data-file-table', | 48 | id: 'data-file-table', |
| 49 | fields: [ | 49 | fields: [ |
| ... | @@ -72,64 +72,18 @@ const tableInfo = ref({ | ... | @@ -72,64 +72,18 @@ const tableInfo = ref({ |
| 72 | width: 230, | 72 | width: 230, |
| 73 | fixed: 'right', | 73 | fixed: 'right', |
| 74 | btns: (scope) => { | 74 | btns: (scope) => { |
| 75 | return [{ | 75 | return [{ label: "编辑", value: "edit", disabled: scope.row.isConfirm == 'Y' || scope.row.dataSource == 4, click: tableBtnHandles['edit'] }, { |
| 76 | label: "编辑", value: "edit", disabled: scope.row.isConfirm == 'Y' || scope.row.dataSource == 4, click: (scope) => { | 76 | label: '查看报告', value: 'report', disabled: scope.row.status != 'Y', click: tableBtnHandles['report'] |
| 77 | router.push({ | ||
| 78 | name: 'anonTaskCreate', | ||
| 79 | query: { | ||
| 80 | guid: scope.row.guid, | ||
| 81 | taskName: scope.row.taskName | ||
| 82 | } | ||
| 83 | }); | ||
| 84 | } | ||
| 85 | }, { | ||
| 86 | label: '查看报告', value: 'report', disabled: scope.row.status != 'Y', click: (scope) => { | ||
| 87 | router.push({ | ||
| 88 | name: 'anonResultReportView', | ||
| 89 | query: { | ||
| 90 | guid: scope.row.guid, | ||
| 91 | execGuid: scope.row.lastExecGuid, | ||
| 92 | taskName: scope.row.taskName | ||
| 93 | } | ||
| 94 | }); | ||
| 95 | } | ||
| 96 | }, { | 77 | }, { |
| 97 | label: '查看数据', value: 'view', disabled: scope.row.status != 'Y' || scope.row.handleType == '02', click: (scope) => { | 78 | label: '查看数据', value: 'view', disabled: scope.row.status != 'Y' || scope.row.handleType == '02', click: tableBtnHandles['view'] |
| 98 | router.push({ | ||
| 99 | name: 'anonResultView', | ||
| 100 | query: { | ||
| 101 | guid: scope.row.guid, | ||
| 102 | execGuid: scope.row.lastExecGuid, | ||
| 103 | taskName: scope.row.taskName | ||
| 104 | } | ||
| 105 | }); | ||
| 106 | } | ||
| 107 | }, { | 79 | }, { |
| 108 | label: "删除", value: "delete", disabled: scope.row.isConfirm == 'Y', click: (scope) => { | 80 | label: "删除", value: "delete", click: tableBtnHandles['delete'] |
| 109 | proxy.$openMessageBox("此操作将永久删除, 是否继续?", () => { | ||
| 110 | let guids = [scope.row.guid]; | ||
| 111 | deleteAnonTask(guids).then((res: any) => { | ||
| 112 | if (res?.code == proxy.$passCode) { | ||
| 113 | page.value.curr = 1; | ||
| 114 | getTableData(); | ||
| 115 | proxy.$ElMessage({ | ||
| 116 | type: "success", | ||
| 117 | message: "删除成功", | ||
| 118 | }); | ||
| 119 | } else { | ||
| 120 | proxy.$ElMessage({ | ||
| 121 | type: "error", | ||
| 122 | message: res.msg, | ||
| 123 | }); | ||
| 124 | } | ||
| 125 | }); | ||
| 126 | }) | ||
| 127 | } | ||
| 128 | }] | 81 | }] |
| 129 | } | 82 | } |
| 130 | } | 83 | } |
| 131 | }) | 84 | }) |
| 132 | 85 | ||
| 86 | /** 搜索栏触发搜索 */ | ||
| 133 | const toSearch = (val: any, clear: boolean = false) => { | 87 | const toSearch = (val: any, clear: boolean = false) => { |
| 134 | if (clear) { | 88 | if (clear) { |
| 135 | searchItemList.value.map((item) => (item.default = "")); | 89 | searchItemList.value.map((item) => (item.default = "")); |
| ... | @@ -175,6 +129,58 @@ const tablePageChange = (info) => { | ... | @@ -175,6 +129,58 @@ const tablePageChange = (info) => { |
| 175 | getTableData(); | 129 | getTableData(); |
| 176 | }; | 130 | }; |
| 177 | 131 | ||
| 132 | const tableBtnHandles = { | ||
| 133 | edit: (scope) => { | ||
| 134 | router.push({ | ||
| 135 | name: 'anonTaskCreate', | ||
| 136 | query: { | ||
| 137 | guid: scope.row.guid, | ||
| 138 | taskName: scope.row.taskName | ||
| 139 | } | ||
| 140 | }); | ||
| 141 | }, | ||
| 142 | report: (scope) => { | ||
| 143 | router.push({ | ||
| 144 | name: 'anonResultReportView', | ||
| 145 | query: { | ||
| 146 | guid: scope.row.guid, | ||
| 147 | execGuid: scope.row.lastExecGuid, | ||
| 148 | taskName: scope.row.taskName | ||
| 149 | } | ||
| 150 | }); | ||
| 151 | }, | ||
| 152 | view: (scope) => { | ||
| 153 | router.push({ | ||
| 154 | name: 'anonResultView', | ||
| 155 | query: { | ||
| 156 | guid: scope.row.guid, | ||
| 157 | execGuid: scope.row.lastExecGuid, | ||
| 158 | taskName: scope.row.taskName | ||
| 159 | } | ||
| 160 | }); | ||
| 161 | }, | ||
| 162 | delete: (scope) => { | ||
| 163 | proxy.$openMessageBox("此操作将永久删除, 是否继续?", () => { | ||
| 164 | let guids = [scope.row.guid]; | ||
| 165 | deleteAnonTask(guids).then((res: any) => { | ||
| 166 | if (res?.code == proxy.$passCode) { | ||
| 167 | page.value.curr = 1; | ||
| 168 | getTableData(); | ||
| 169 | proxy.$ElMessage({ | ||
| 170 | type: "success", | ||
| 171 | message: "删除成功", | ||
| 172 | }); | ||
| 173 | } else { | ||
| 174 | proxy.$ElMessage({ | ||
| 175 | type: "error", | ||
| 176 | message: res.msg, | ||
| 177 | }); | ||
| 178 | } | ||
| 179 | }); | ||
| 180 | }) | ||
| 181 | } | ||
| 182 | } | ||
| 183 | |||
| 178 | const handleCreate = () => { | 184 | const handleCreate = () => { |
| 179 | router.push({ | 185 | router.push({ |
| 180 | name: 'anonTaskCreate' | 186 | name: 'anonTaskCreate' | ... | ... |
| ... | @@ -228,17 +228,16 @@ onMounted(() => { | ... | @@ -228,17 +228,16 @@ onMounted(() => { |
| 228 | 228 | ||
| 229 | onBeforeMount(() => { | 229 | onBeforeMount(() => { |
| 230 | resultDataLoading.value = true; | 230 | resultDataLoading.value = true; |
| 231 | getAnonAnalyzeResult(taskExecGuid.value).then((res: any) => { | 231 | getAnonAnalyzeResult(taskExecGuid.value, { |
| 232 | resultDataLoading.value = false; | 232 | proxy: proxy, |
| 233 | if (res?.code == proxy.$passCode) { | 233 | loadingRef: resultDataLoading, |
| 234 | analysisResultInfo.value = res.data || {}; | 234 | onSuccess: (res: any) => { |
| 235 | analysisResultInfo.value = res?.data || {}; | ||
| 235 | analysisResultTableFields.value = res.data?.column || []; | 236 | analysisResultTableFields.value = res.data?.column || []; |
| 236 | pageInfo.value.curr = 1; | 237 | pageInfo.value.curr = 1; |
| 237 | getAnalysisResultPageData(true); | 238 | getAnalysisResultPageData(true); |
| 238 | } else { | ||
| 239 | res?.msg && proxy.$ElMessage.error(res.msg); | ||
| 240 | } | 239 | } |
| 241 | }); | 240 | }) |
| 242 | getAnonTaskDetail(taskGuid.value).then((res: any) => { | 241 | getAnonTaskDetail(taskGuid.value).then((res: any) => { |
| 243 | if (res?.code == proxy.$passCode) { | 242 | if (res?.code == proxy.$passCode) { |
| 244 | oldAnonTaskValueInfo.value = res.data || {}; | 243 | oldAnonTaskValueInfo.value = res.data || {}; | ... | ... |
| ... | @@ -9,9 +9,6 @@ import { | ... | @@ -9,9 +9,6 @@ import { |
| 9 | getLastAnonAnalyzeResult, | 9 | getLastAnonAnalyzeResult, |
| 10 | exportAnonExecData, | 10 | exportAnonExecData, |
| 11 | } from "@/api/modules/dataAnonymization"; | 11 | } from "@/api/modules/dataAnonymization"; |
| 12 | import { calcColumnWidth } from "@/utils/index"; | ||
| 13 | import Moment from 'moment'; | ||
| 14 | import { TableColumnWidth } from "@/utils/enum"; | ||
| 15 | import { ElMessage } from "element-plus"; | 12 | import { ElMessage } from "element-plus"; |
| 16 | import { commonPageConfig } from '@/components/PageNav/index'; | 13 | import { commonPageConfig } from '@/components/PageNav/index'; |
| 17 | import { download } from "@/utils/common"; | 14 | import { download } from "@/utils/common"; |
| ... | @@ -69,56 +66,7 @@ const getData = () => { | ... | @@ -69,56 +66,7 @@ const getData = () => { |
| 69 | }); | 66 | }); |
| 70 | } | 67 | } |
| 71 | 68 | ||
| 72 | const getTextAlign = (field) => { | ||
| 73 | if (field.dataType === 'decimal' || field.dataType === 'int' || field.dataType == 'bit' || field.dataType == 'tinyint') { | ||
| 74 | return 'right'; | ||
| 75 | } | ||
| 76 | return 'left' | ||
| 77 | } | ||
| 78 | |||
| 79 | /** otherWidth表示使用标题宽度时添加标题排序图标等宽度 */ | ||
| 80 | const calcTableColumnWidth = (data: any[], prop, title, otherWidth = 0) => { | ||
| 81 | let d: any[] = []; | ||
| 82 | data.forEach((dt) => d.push(dt[prop])); | ||
| 83 | return calcColumnWidth( | ||
| 84 | d, | ||
| 85 | title, | ||
| 86 | { | ||
| 87 | fontSize: 14, | ||
| 88 | fontFamily: "SimSun", | ||
| 89 | }, | ||
| 90 | { | ||
| 91 | fontSize: 14, | ||
| 92 | fontFamily: "SimSun", | ||
| 93 | }, | ||
| 94 | otherWidth | ||
| 95 | ); | ||
| 96 | }; | ||
| 97 | |||
| 98 | /** 每列字段对应的列宽计算结果。 */ | ||
| 99 | const originTableFieldColumn = ref({}); | ||
| 100 | 69 | ||
| 101 | watch( | ||
| 102 | tableData, | ||
| 103 | (val: any[], oldVal) => { | ||
| 104 | if (!tableFields.value?.length) { | ||
| 105 | originTableFieldColumn.value = {}; | ||
| 106 | return; | ||
| 107 | } | ||
| 108 | originTableFieldColumn.value = {}; | ||
| 109 | tableFields.value.forEach((field, index) => { | ||
| 110 | originTableFieldColumn.value[field.enName] = calcTableColumnWidth( | ||
| 111 | val?.slice(0, 20) || [], | ||
| 112 | field.enName, | ||
| 113 | field.chName, | ||
| 114 | 24 | ||
| 115 | ); | ||
| 116 | }); | ||
| 117 | }, | ||
| 118 | { | ||
| 119 | deep: true, | ||
| 120 | } | ||
| 121 | ); | ||
| 122 | 70 | ||
| 123 | watch(() => props.execGuid, (val) => { | 71 | watch(() => props.execGuid, (val) => { |
| 124 | if (!val) { | 72 | if (!val) { |
| ... | @@ -157,27 +105,7 @@ onBeforeMount(() => { | ... | @@ -157,27 +105,7 @@ onBeforeMount(() => { |
| 157 | }); | 105 | }); |
| 158 | }); | 106 | }); |
| 159 | 107 | ||
| 160 | const formatterPreviewDate = (row, info) => { | 108 | |
| 161 | let enName = info.enName; | ||
| 162 | let v = row[enName]; | ||
| 163 | if (v === 0) { | ||
| 164 | return v; | ||
| 165 | } | ||
| 166 | if (!v || v == 'null') { | ||
| 167 | return '--'; | ||
| 168 | } | ||
| 169 | if (info.dataType === 'datetime') { | ||
| 170 | return Moment(v).format('YYYY-MM-DD HH:mm:ss'); | ||
| 171 | } | ||
| 172 | if (info.dataType === 'date') { | ||
| 173 | if (isNaN(<any>(new Date(v)))) { | ||
| 174 | return Moment(parseInt(v)).format('YYYY-MM-DD'); | ||
| 175 | } else { | ||
| 176 | return Moment(v).format('YYYY-MM-DD'); | ||
| 177 | } | ||
| 178 | } | ||
| 179 | return v; | ||
| 180 | }; | ||
| 181 | 109 | ||
| 182 | const pageChange = (info) => { | 110 | const pageChange = (info) => { |
| 183 | pageInfo.value.curr = Number(info.curr); | 111 | pageInfo.value.curr = Number(info.curr); |
| ... | @@ -212,19 +140,14 @@ const exportData = () => { | ... | @@ -212,19 +140,14 @@ const exportData = () => { |
| 212 | <div class="table_tool_wrap" v-loading="tableDataLoading"> | 140 | <div class="table_tool_wrap" v-loading="tableDataLoading"> |
| 213 | <el-button v-show="props.isPage" style="margin-bottom: 8px;" type="primary" @click="exportData" | 141 | <el-button v-show="props.isPage" style="margin-bottom: 8px;" type="primary" @click="exportData" |
| 214 | v-preReClick>导出数据</el-button> | 142 | v-preReClick>导出数据</el-button> |
| 215 | <el-table ref="tableRef" v-show="tableFields.length" :data="tableData" :highlight-current-row="true" stripe border | 143 | <CommonTable |
| 216 | tooltip-effect="light" height="100%" row-key="guid" :style="{ width: '100%', height: !props.isPage ? 'calc(100% - 34px)' : 'calc(100% - 64px)' }"> | 144 | v-show="tableFields.length" |
| 217 | <template v-for="(item, index) in (tableFields || [])"> | 145 | :data="tableData" |
| 218 | <el-table-column :label="item.chName" :width="item.dataType === 'datetime' | 146 | :fields="tableFields" |
| 219 | ? TableColumnWidth.DATETIME | 147 | :loading="tableDataLoading" |
| 220 | : item.dataType === 'date' | 148 | :height="'100%'" |
| 221 | ? TableColumnWidth.DATE | 149 | :style="{ width: '100%', height: !props.isPage ? 'calc(100% - 34px)' : 'calc(100% - 64px)' }" |
| 222 | : originTableFieldColumn[item.enName] | 150 | /> |
| 223 | " :align="getTextAlign(item)" :header-align="getTextAlign(item)" | ||
| 224 | :formatter="(row) => formatterPreviewDate(row, item)" :show-overflow-tooltip="true"> | ||
| 225 | </el-table-column> | ||
| 226 | </template> | ||
| 227 | </el-table> | ||
| 228 | <div v-show="!tableFields.length" class="empty-content"> | 151 | <div v-show="!tableFields.length" class="empty-content"> |
| 229 | <img src="../../assets/images/empty-data.png" :style="{ width: '168px', height: '96px' }" /> | 152 | <img src="../../assets/images/empty-data.png" :style="{ width: '168px', height: '96px' }" /> |
| 230 | <div class="empty-text">暂无数据</div> | 153 | <div class="empty-text">暂无数据</div> | ... | ... |
| ... | @@ -5,7 +5,7 @@ | ... | @@ -5,7 +5,7 @@ |
| 5 | <template> | 5 | <template> |
| 6 | <div class="container_wrap full" v-loading="fullscreenLoading" ref="containerRef"> | 6 | <div class="container_wrap full" v-loading="fullscreenLoading" ref="containerRef"> |
| 7 | <div class="content_main"> | 7 | <div class="content_main"> |
| 8 | <!-- 顶部步骤条 --> | 8 | <!-- 顶部步骤条, 需根据不同的条件显示不同的步骤 --> |
| 9 | <div class="top_tool_wrap"> | 9 | <div class="top_tool_wrap"> |
| 10 | <StepBar :steps-info="stepsInfo" :style="{ width: stepsInfo.list.length == 2 ? '30%' : '60%' }" /> | 10 | <StepBar :steps-info="stepsInfo" :style="{ width: stepsInfo.list.length == 2 ? '30%' : '60%' }" /> |
| 11 | </div> | 11 | </div> |
| ... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
| 17 | formId="model-select-edit" col="col3 custom-form" @select-change="handleDataSelectFormSelectChange" | 17 | formId="model-select-edit" col="col3 custom-form" @select-change="handleDataSelectFormSelectChange" |
| 18 | @uploadFileChange="uploadFileChange" @checkboxChange="handleDataSelectFormCheckboxChange" /> | 18 | @uploadFileChange="uploadFileChange" @checkboxChange="handleDataSelectFormCheckboxChange" /> |
| 19 | </ContentWrap> | 19 | </ContentWrap> |
| 20 | <!-- 抽样预览的表单填写配置,及表格展示 --> | ||
| 20 | <ContentWrap v-show="formRef?.formInline?.dataSource != 3" id="id-previewData" title="数据抽样预览" description="" | 21 | <ContentWrap v-show="formRef?.formInline?.dataSource != 3" id="id-previewData" title="数据抽样预览" description="" |
| 21 | style="margin-top: 16px;"> | 22 | style="margin-top: 16px;"> |
| 22 | <!-- 选择抽样预览的表单设置 --> | 23 | <!-- 选择抽样预览的表单设置 --> |
| ... | @@ -26,33 +27,29 @@ | ... | @@ -26,33 +27,29 @@ |
| 26 | <!-- 抽样预览的数据表格设置 --> | 27 | <!-- 抽样预览的数据表格设置 --> |
| 27 | <div class="table-v2-main" v-show="dataSimpleFormRef?.formInline?.enableSamplingRate == 'Y'" | 28 | <div class="table-v2-main" v-show="dataSimpleFormRef?.formInline?.enableSamplingRate == 'Y'" |
| 28 | v-loading="sampleTableDataLoading"> | 29 | v-loading="sampleTableDataLoading"> |
| 29 | <el-table ref="tableRef" v-show="sampleTableFields.length" :data="sampleTableData" | 30 | <CommonTable |
| 30 | :highlight-current-row="true" stripe border tooltip-effect="light" height="100%" row-key="guid" | 31 | v-show="sampleTableFields.length" |
| 31 | :style="{ width: '100%', height: '240px' }"> | 32 | :data="sampleTableData" |
| 32 | <el-table-column label="序号" type="index" width="56px" align="center" | 33 | :fields="sampleTableFields" |
| 33 | show-overflow-tooltip></el-table-column> | 34 | :loading="sampleTableDataLoading" |
| 34 | <template v-for="(item, index) in (sampleTableFields || [])"> | 35 | :height="'100%'" |
| 35 | <el-table-column :label="item.chName" :width="item.dataType === 'datetime' | 36 | :show-index="true" |
| 36 | ? TableColumnWidth.DATETIME | 37 | :style="{ width: '100%', height: '240px' }" |
| 37 | : item.dataType === 'date' | 38 | /> |
| 38 | ? TableColumnWidth.DATE | 39 | <!-- 无抽样数据时显示占位图片信息 --> |
| 39 | : originTableFieldColumn[item.enName] | ||
| 40 | " :align="getTextAlign(item)" :header-align="getTextAlign(item)" | ||
| 41 | :formatter="(row) => formatterPreviewDate(row, item)" :show-overflow-tooltip="true"> | ||
| 42 | </el-table-column> | ||
| 43 | </template> | ||
| 44 | </el-table> | ||
| 45 | <div v-show="!sampleTableFields.length" class="main-placeholder"> | 40 | <div v-show="!sampleTableFields.length" class="main-placeholder"> |
| 46 | <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> | 41 | <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> |
| 47 | <div class="empty-text">暂无抽样数据</div> | 42 | <div class="empty-text">暂无抽样数据</div> |
| 48 | </div> | 43 | </div> |
| 49 | </div> | 44 | </div> |
| 50 | </ContentWrap> | 45 | </ContentWrap> |
| 46 | <!-- 数据来源为文件夹时显示提取文件进度及结果分析 --> | ||
| 51 | <ContentWrap v-show="formRef?.formInline?.dataSource == 3" id="id-folder" title="提取文件" description="" | 47 | <ContentWrap v-show="formRef?.formInline?.dataSource == 3" id="id-folder" title="提取文件" description="" |
| 52 | style="margin-top: 16px;"> | 48 | style="margin-top: 16px;"> |
| 53 | <div class="folder-main"> | 49 | <div class="folder-main"> |
| 54 | <el-button v-show="!clickSelectNode.path && !Object.keys(dicomStatisticsData)?.length" :icon="Upload" | 50 | <el-button v-show="!clickSelectNode.path && !Object.keys(dicomStatisticsData)?.length" :icon="Upload" |
| 55 | class="mr8" @click=uploadFolder>上传文件</el-button> | 51 | class="mr8" @click=uploadFolder>上传文件</el-button> |
| 52 | <!-- 弹框展示服务器文件夹目录,并选择 --> | ||
| 56 | <Dialog ref="dialogRef" :dialog-info="uploadFileDialogInfo" @btnClick="dialogBtnClick"> | 53 | <Dialog ref="dialogRef" :dialog-info="uploadFileDialogInfo" @btnClick="dialogBtnClick"> |
| 57 | <template #extra-content> | 54 | <template #extra-content> |
| 58 | <div class="folder-main-content" v-loading="uploadFileDialogInfo.contentLoading"> | 55 | <div class="folder-main-content" v-loading="uploadFileDialogInfo.contentLoading"> |
| ... | @@ -128,6 +125,7 @@ | ... | @@ -128,6 +125,7 @@ |
| 128 | </div> | 125 | </div> |
| 129 | </div> | 126 | </div> |
| 130 | </div> | 127 | </div> |
| 128 | <!-- 解析成功之后需要显示预览文件,和删除重新上传文件按钮 --> | ||
| 131 | <div v-show="clickSelectNode.path && folderFileTableInfo.data?.length" class="preview-title">预览文件仅展示5条数据 | 129 | <div v-show="clickSelectNode.path && folderFileTableInfo.data?.length" class="preview-title">预览文件仅展示5条数据 |
| 132 | </div> | 130 | </div> |
| 133 | <Table v-show="clickSelectNode.path && folderFileTableInfo.data?.length" :tableInfo="folderFileTableInfo"> | 131 | <Table v-show="clickSelectNode.path && folderFileTableInfo.data?.length" :tableInfo="folderFileTableInfo"> |
| ... | @@ -150,6 +148,7 @@ | ... | @@ -150,6 +148,7 @@ |
| 150 | <div class="desc">正在进行匿名化处理,请稍候...</div> | 148 | <div class="desc">正在进行匿名化处理,请稍候...</div> |
| 151 | <el-button :icon="RefreshRight" link @click="refreshQueryData" v-preReClick>刷新查看结果</el-button> | 149 | <el-button :icon="RefreshRight" link @click="refreshQueryData" v-preReClick>刷新查看结果</el-button> |
| 152 | </div> | 150 | </div> |
| 151 | <!-- 展示执行失败页面 --> | ||
| 153 | <div class="wait-result-div" v-show="isExecEnd && analysisResultInfo.status == 'E'"> | 152 | <div class="wait-result-div" v-show="isExecEnd && analysisResultInfo.status == 'E'"> |
| 154 | <el-icon class="failed"> | 153 | <el-icon class="failed"> |
| 155 | <CircleCloseFilled /> | 154 | <CircleCloseFilled /> |
| ... | @@ -158,6 +157,7 @@ | ... | @@ -158,6 +157,7 @@ |
| 158 | <div v-show="analysisResultInfo.errorMsg" class="error-desc">{{ '【' + analysisResultInfo.errorMsg + '】' }} | 157 | <div v-show="analysisResultInfo.errorMsg" class="error-desc">{{ '【' + analysisResultInfo.errorMsg + '】' }} |
| 159 | </div> | 158 | </div> |
| 160 | </div> | 159 | </div> |
| 160 | <!-- 执行成功的报告结果查看页面 --> | ||
| 161 | <anonResultAnalysis v-show="isExecEnd && analysisResultInfo.status == 'Y'" ref="resultReportRef" | 161 | <anonResultAnalysis v-show="isExecEnd && analysisResultInfo.status == 'Y'" ref="resultReportRef" |
| 162 | v-loading="downloadLoading" :analysis-result-info="analysisResultInfo" :is-word-style="isWordStyle" | 162 | v-loading="downloadLoading" :analysis-result-info="analysisResultInfo" :is-word-style="isWordStyle" |
| 163 | :element-loading-text="loadingText" :analysis-result-loading="analysisResultLoading" | 163 | :element-loading-text="loadingText" :analysis-result-loading="analysisResultLoading" |
| ... | @@ -190,25 +190,26 @@ | ... | @@ -190,25 +190,26 @@ |
| 190 | <div class="bottom_tool_wrap"> | 190 | <div class="bottom_tool_wrap"> |
| 191 | <template v-if="step == 0"> | 191 | <template v-if="step == 0"> |
| 192 | <el-button @click="cancelTask">取消</el-button> | 192 | <el-button @click="cancelTask">取消</el-button> |
| 193 | <!-- 匿名化评测情况下只有2个步骤条,根据传参选择对应的处理函数 --> | ||
| 193 | <el-button type="primary" | 194 | <el-button type="primary" |
| 194 | :disabled="formRef?.formInline?.handleType == '02' && formRef?.formInline?.dataSource == 3 && dicomStatisticsData?.state != 'Y'" | 195 | :disabled="formRef?.formInline?.handleType == '02' && formRef?.formInline?.dataSource == 3 && dicomStatisticsData?.state != 'Y'" |
| 195 | @click="changeStep(formRef?.formInline?.handleType == '02' ? 3 : 2)">下一步</el-button> | 196 | @click="changeStepHandlers[formRef?.formInline?.handleType == '02' ? 3 : 2]()">下一步</el-button> |
| 196 | </template> | 197 | </template> |
| 197 | <template v-else-if="step == 1"> | 198 | <template v-else-if="step == 1"> |
| 198 | <el-button @click="changeStep(1)">上一步</el-button> | 199 | <el-button @click="changeStepHandlers['lastStep'](1)">上一步</el-button> |
| 199 | <el-button type="primary" @click="changeStep(3)">下一步</el-button> | 200 | <el-button type="primary" @click="changeStepHandlers['3']()">下一步</el-button> |
| 200 | </template> | 201 | </template> |
| 201 | <template v-else-if="step == 2"> | 202 | <template v-else-if="step == 2"> |
| 202 | <el-button @click="changeStep(formRef?.formInline?.handleType == '02' ? 1 : 2)">上一步</el-button> | 203 | <el-button @click="changeStepHandlers.lastStep(formRef?.formInline?.handleType == '02' ? 1 : 2)">上一步</el-button> |
| 203 | <el-button v-show="formRef?.formInline?.handleType != '02'" type="primary" | 204 | <el-button v-show="formRef?.formInline?.handleType != '02'" type="primary" |
| 204 | :disabled="analysisResultInfo.status == 'R' || (isExecEnd && analysisResultInfo.status == 'E')" | 205 | :disabled="analysisResultInfo.status == 'R' || (isExecEnd && analysisResultInfo.status == 'E')" |
| 205 | @click="changeStep(4)">下一步</el-button> | 206 | @click="changeStepHandlers['4']()">下一步</el-button> |
| 206 | <el-button type="primary" v-show="formRef?.formInline?.handleType == '02'" | 207 | <el-button type="primary" v-show="formRef?.formInline?.handleType == '02'" |
| 207 | :disabled="analysisResultInfo.status == 'R' || (isExecEnd && analysisResultInfo.status == 'E')" v-preReClick | 208 | :disabled="analysisResultInfo.status == 'R' || (isExecEnd && analysisResultInfo.status == 'E')" v-preReClick |
| 208 | @click="closeTask">关闭</el-button> | 209 | @click="closeTask">关闭</el-button> |
| 209 | </template> | 210 | </template> |
| 210 | <template v-else> | 211 | <template v-else> |
| 211 | <el-button @click="changeStep(3)">上一步</el-button> | 212 | <el-button @click="changeStepHandlers.lastStep(3)">上一步</el-button> |
| 212 | <el-button type="primary" v-preReClick @click="exportResult">导出</el-button> | 213 | <el-button type="primary" v-preReClick @click="exportResult">导出</el-button> |
| 213 | </template> | 214 | </template> |
| 214 | </div> | 215 | </div> |
| ... | @@ -221,7 +222,7 @@ import { | ... | @@ -221,7 +222,7 @@ import { |
| 221 | getAnonTaskDetail, | 222 | getAnonTaskDetail, |
| 222 | getParamsList, | 223 | getParamsList, |
| 223 | chTransformEn, | 224 | chTransformEn, |
| 224 | getAnonAnalyzeResult, | 225 | getAnonAnalyzeResult1, |
| 225 | getAnonAnalyzePageData, | 226 | getAnonAnalyzePageData, |
| 226 | getDatabase, | 227 | getDatabase, |
| 227 | getDsTableByDs, | 228 | getDsTableByDs, |
| ... | @@ -247,8 +248,6 @@ import { | ... | @@ -247,8 +248,6 @@ import { |
| 247 | import useUserStore from "@/store/modules/user"; | 248 | import useUserStore from "@/store/modules/user"; |
| 248 | import { useValidator } from '@/hooks/useValidator'; | 249 | import { useValidator } from '@/hooks/useValidator'; |
| 249 | import { TableColumnWidth } from '@/utils/enum'; | 250 | import { TableColumnWidth } from '@/utils/enum'; |
| 250 | import { calcColumnWidth } from "@/utils/index"; | ||
| 251 | import Moment from 'moment'; | ||
| 252 | import anonTaskStepTwo from './anonTaskStepTwo.vue'; | 251 | import anonTaskStepTwo from './anonTaskStepTwo.vue'; |
| 253 | import * as XLSX from 'xlsx'; | 252 | import * as XLSX from 'xlsx'; |
| 254 | import { ElMessage } from 'element-plus'; | 253 | import { ElMessage } from 'element-plus'; |
| ... | @@ -261,6 +260,7 @@ import { commonPageConfig } from '@/components/PageNav'; | ... | @@ -261,6 +260,7 @@ import { commonPageConfig } from '@/components/PageNav'; |
| 261 | import { Upload } from "@element-plus/icons-vue"; | 260 | import { Upload } from "@element-plus/icons-vue"; |
| 262 | import anonResultAnalysis from './components/anonResultAnalysis.vue'; | 261 | import anonResultAnalysis from './components/anonResultAnalysis.vue'; |
| 263 | import html2canvas from 'html2canvas'; | 262 | import html2canvas from 'html2canvas'; |
| 263 | import { calcColumnWidth } from '@/utils'; | ||
| 264 | 264 | ||
| 265 | const anonymizationStore = useDataAnonymizationStore(); | 265 | const anonymizationStore = useDataAnonymizationStore(); |
| 266 | const { proxy } = getCurrentInstance() as any; | 266 | const { proxy } = getCurrentInstance() as any; |
| ... | @@ -580,11 +580,12 @@ const dataSelectInfoFormRules = ref({ | ... | @@ -580,11 +580,12 @@ const dataSelectInfoFormRules = ref({ |
| 580 | }] | 580 | }] |
| 581 | }); | 581 | }); |
| 582 | 582 | ||
| 583 | /** 最新选中的 */ | 583 | /** 最新选中的数据源 */ |
| 584 | const currDatasourceSelect: any = ref({}); | 584 | const currDatasourceSelect: any = ref({}); |
| 585 | 585 | ||
| 586 | const handleDataSelectFormSelectChange = async (val, row, formInfo) => { | 586 | /** 数据基本信息选择表单下拉变化对应的处理函数 */ |
| 587 | if (row.field == 'dataSource') { | 587 | const dataSelectFormSelectChangeHandlers = { |
| 588 | dataSource: (val, row, formInfo) => { | ||
| 588 | dataSelectInfoItems.value[5].visible = val == 1; | 589 | dataSelectInfoItems.value[5].visible = val == 1; |
| 589 | dataSelectInfoItems.value[6].visible = val == 1; | 590 | dataSelectInfoItems.value[6].visible = val == 1; |
| 590 | dataSelectInfoItems.value[8].visible = val == 2; | 591 | dataSelectInfoItems.value[8].visible = val == 2; |
| ... | @@ -592,7 +593,8 @@ const handleDataSelectFormSelectChange = async (val, row, formInfo) => { | ... | @@ -592,7 +593,8 @@ const handleDataSelectFormSelectChange = async (val, row, formInfo) => { |
| 592 | sampleTableFields.value = []; | 593 | sampleTableFields.value = []; |
| 593 | parseFileDataSum.value = []; | 594 | parseFileDataSum.value = []; |
| 594 | sampleTableData.value = []; | 595 | sampleTableData.value = []; |
| 595 | } else if (row.field == 'dataSourceGuid') { | 596 | }, |
| 597 | dataSourceGuid: async (val, row, formInfo) => { | ||
| 596 | if (!val) { | 598 | if (!val) { |
| 597 | currDatasourceSelect.value = []; | 599 | currDatasourceSelect.value = []; |
| 598 | sampleTableFields.value = []; | 600 | sampleTableFields.value = []; |
| ... | @@ -625,7 +627,8 @@ const handleDataSelectFormSelectChange = async (val, row, formInfo) => { | ... | @@ -625,7 +627,8 @@ const handleDataSelectFormSelectChange = async (val, row, formInfo) => { |
| 625 | sampleTableFields.value = []; | 627 | sampleTableFields.value = []; |
| 626 | parseFileDataSum.value = []; | 628 | parseFileDataSum.value = []; |
| 627 | sampleTableData.value = []; | 629 | sampleTableData.value = []; |
| 628 | } else if (row.field == 'tableName') { | 630 | }, |
| 631 | tableName: (val, row, formInfo) => { | ||
| 629 | if (!val) { | 632 | if (!val) { |
| 630 | sampleTableFields.value = []; | 633 | sampleTableFields.value = []; |
| 631 | sampleTableData.value = []; | 634 | sampleTableData.value = []; |
| ... | @@ -652,11 +655,16 @@ const handleDataSelectFormSelectChange = async (val, row, formInfo) => { | ... | @@ -652,11 +655,16 @@ const handleDataSelectFormSelectChange = async (val, row, formInfo) => { |
| 652 | ElMessage.error(res.msg); | 655 | ElMessage.error(res.msg); |
| 653 | } | 656 | } |
| 654 | }); | 657 | }); |
| 655 | } else if (row.field == 'handleType') { | 658 | }, |
| 659 | handleType: (val, row, formInfo) => { | ||
| 656 | setDataSelectFormItems(formInfo); | 660 | setDataSelectFormItems(formInfo); |
| 657 | } | 661 | } |
| 658 | } | 662 | } |
| 659 | 663 | ||
| 664 | const handleDataSelectFormSelectChange = async (val, row, formInfo) => { | ||
| 665 | dataSelectFormSelectChangeHandlers[row.field]?.(val, row, formInfo); | ||
| 666 | } | ||
| 667 | |||
| 660 | const setDataSelectFormItems = (info, isDetail = false) => { | 668 | const setDataSelectFormItems = (info, isDetail = false) => { |
| 661 | dataSelectInfoItems.value.forEach(item => { | 669 | dataSelectInfoItems.value.forEach(item => { |
| 662 | item.default = info[item.field]; | 670 | item.default = info[item.field]; |
| ... | @@ -785,38 +793,6 @@ const calcTableColumnWidth = (data: any[], prop, title, otherWidth = 0) => { | ... | @@ -785,38 +793,6 @@ const calcTableColumnWidth = (data: any[], prop, title, otherWidth = 0) => { |
| 785 | ); | 793 | ); |
| 786 | }; | 794 | }; |
| 787 | 795 | ||
| 788 | /** 每列字段对应的列宽计算结果。 */ | ||
| 789 | const originTableFieldColumn = ref({}); | ||
| 790 | |||
| 791 | const getTextAlign = (field) => { | ||
| 792 | if (field.dataType === 'decimal' || field.dataType === 'int') { | ||
| 793 | return 'right'; | ||
| 794 | } | ||
| 795 | return 'left' | ||
| 796 | } | ||
| 797 | |||
| 798 | watch( | ||
| 799 | sampleTableData, | ||
| 800 | (val: any[], oldVal) => { | ||
| 801 | if (!sampleTableFields.value?.length) { | ||
| 802 | originTableFieldColumn.value = {}; | ||
| 803 | return; | ||
| 804 | } | ||
| 805 | originTableFieldColumn.value = {}; | ||
| 806 | sampleTableFields.value.forEach((field, index) => { | ||
| 807 | originTableFieldColumn.value[field.enName] = calcTableColumnWidth( | ||
| 808 | val?.slice(0, 20) || [], | ||
| 809 | field.enName, | ||
| 810 | field.chName, | ||
| 811 | 24 | ||
| 812 | ); | ||
| 813 | }); | ||
| 814 | }, | ||
| 815 | { | ||
| 816 | deep: true, | ||
| 817 | } | ||
| 818 | ); | ||
| 819 | |||
| 820 | watch(() => sampleTableFields.value, (val) => { | 796 | watch(() => sampleTableFields.value, (val) => { |
| 821 | let formInfo = formRef.value.formInline; | 797 | let formInfo = formRef.value.formInline; |
| 822 | if (formInfo.dataSource == 3) { | 798 | if (formInfo.dataSource == 3) { |
| ... | @@ -831,27 +807,7 @@ watch(() => sampleTableFields.value, (val) => { | ... | @@ -831,27 +807,7 @@ watch(() => sampleTableFields.value, (val) => { |
| 831 | deep: true | 807 | deep: true |
| 832 | }) | 808 | }) |
| 833 | 809 | ||
| 834 | const formatterPreviewDate = (row, info) => { | 810 | |
| 835 | let enName = info.enName; | ||
| 836 | let v = row[enName]; | ||
| 837 | if (v === 0) { | ||
| 838 | return v; | ||
| 839 | } | ||
| 840 | if (!v || v == 'null') { | ||
| 841 | return '--'; | ||
| 842 | } | ||
| 843 | if (info.dataType === 'datetime') { | ||
| 844 | return Moment(v).format('YYYY-MM-DD HH:mm:ss'); | ||
| 845 | } | ||
| 846 | if (info.dataType === 'date') { | ||
| 847 | if (isNaN(<any>(new Date(v)))) { | ||
| 848 | return Moment(parseInt(v)).format('YYYY-MM-DD'); | ||
| 849 | } else { | ||
| 850 | return Moment(v).format('YYYY-MM-DD'); | ||
| 851 | } | ||
| 852 | } | ||
| 853 | return v; | ||
| 854 | }; | ||
| 855 | 811 | ||
| 856 | /** 解析的总的表格数据,方便后面修改抽样比例时使用 */ | 812 | /** 解析的总的表格数据,方便后面修改抽样比例时使用 */ |
| 857 | const parseFileDataSum: any = ref([]); | 813 | const parseFileDataSum: any = ref([]); |
| ... | @@ -1354,11 +1310,14 @@ const calculateElapsedTime = (parsingTime, parsingCompletedTime) => { | ... | @@ -1354,11 +1310,14 @@ const calculateElapsedTime = (parsingTime, parsingCompletedTime) => { |
| 1354 | /** 第二步的配置组件引用。 */ | 1310 | /** 第二步的配置组件引用。 */ |
| 1355 | const anonTaskStepTwoRef = ref(); | 1311 | const anonTaskStepTwoRef = ref(); |
| 1356 | 1312 | ||
| 1357 | const changeStep = async (val) => { | 1313 | /** 步骤条对应的不同步骤下一步,上一步的处理函数。 */ |
| 1358 | if (val <= step.value) { | 1314 | const changeStepHandlers = { |
| 1315 | 'lastStep': (val) => { | ||
| 1359 | step.value = val - 1; | 1316 | step.value = val - 1; |
| 1360 | stepsInfo.value.step = val - 1; | 1317 | stepsInfo.value.step = val - 1; |
| 1361 | } else if (val == 2) { | 1318 | }, |
| 1319 | '2': () => { | ||
| 1320 | let val = 2; | ||
| 1362 | formRef.value?.ruleFormRef?.validate((valid) => { | 1321 | formRef.value?.ruleFormRef?.validate((valid) => { |
| 1363 | if (valid) { | 1322 | if (valid) { |
| 1364 | if (formRef.value?.formInline?.dataSource == 2 && !sampleTableFields.value?.length) { | 1323 | if (formRef.value?.formInline?.dataSource == 2 && !sampleTableFields.value?.length) { |
| ... | @@ -1375,7 +1334,9 @@ const changeStep = async (val) => { | ... | @@ -1375,7 +1334,9 @@ const changeStep = async (val) => { |
| 1375 | }); | 1334 | }); |
| 1376 | } | 1335 | } |
| 1377 | }); | 1336 | }); |
| 1378 | } else if (val == 3) { | 1337 | }, |
| 1338 | '3': async () => { | ||
| 1339 | let val = 3; | ||
| 1379 | let exec = (saveParams) => { | 1340 | let exec = (saveParams) => { |
| 1380 | if (saveParams.coverageArea?.length) { | 1341 | if (saveParams.coverageArea?.length) { |
| 1381 | saveParams.coverageArea = [saveParams.coverageArea]; | 1342 | saveParams.coverageArea = [saveParams.coverageArea]; |
| ... | @@ -1514,8 +1475,10 @@ const changeStep = async (val) => { | ... | @@ -1514,8 +1475,10 @@ const changeStep = async (val) => { |
| 1514 | } | 1475 | } |
| 1515 | }) | 1476 | }) |
| 1516 | } | 1477 | } |
| 1517 | } else if (val == 4) { | 1478 | }, |
| 1518 | //下一步之后,设置执行结束, 查看结果。 | 1479 | '4': () => { |
| 1480 | let val = 4; | ||
| 1481 | //下一步之后,设置执行结束, 查看结果。 | ||
| 1519 | step.value = val - 1; | 1482 | step.value = val - 1; |
| 1520 | stepsInfo.value.step = val - 1; | 1483 | stepsInfo.value.step = val - 1; |
| 1521 | } | 1484 | } |
| ... | @@ -1757,7 +1720,7 @@ const cancelTask = () => { | ... | @@ -1757,7 +1720,7 @@ const cancelTask = () => { |
| 1757 | proxy.$openMessageBox("当前页面尚未保存,确定放弃修改吗?", () => { | 1720 | proxy.$openMessageBox("当前页面尚未保存,确定放弃修改吗?", () => { |
| 1758 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); | 1721 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); |
| 1759 | router.push({ | 1722 | router.push({ |
| 1760 | name: 'resultProcess' | 1723 | name: 'anonResultProcessManage' |
| 1761 | }); | 1724 | }); |
| 1762 | }, () => { | 1725 | }, () => { |
| 1763 | proxy.$ElMessage.info("已取消"); | 1726 | proxy.$ElMessage.info("已取消"); |
| ... | @@ -1768,7 +1731,7 @@ const cancelTask = () => { | ... | @@ -1768,7 +1731,7 @@ const cancelTask = () => { |
| 1768 | const closeTask = () => { | 1731 | const closeTask = () => { |
| 1769 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); | 1732 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); |
| 1770 | router.push({ | 1733 | router.push({ |
| 1771 | name: 'resultProcess' | 1734 | name: 'anonResultProcessManage' |
| 1772 | }); | 1735 | }); |
| 1773 | } | 1736 | } |
| 1774 | 1737 | ||
| ... | @@ -1786,7 +1749,7 @@ const processStepThreeResultView = (isRefresh = false) => { | ... | @@ -1786,7 +1749,7 @@ const processStepThreeResultView = (isRefresh = false) => { |
| 1786 | return; | 1749 | return; |
| 1787 | } | 1750 | } |
| 1788 | let process = (isRefresh) => { | 1751 | let process = (isRefresh) => { |
| 1789 | getResultPromise.value = getAnonAnalyzeResult(taskExecGuid.value).then((res: any) => { | 1752 | getResultPromise.value = getAnonAnalyzeResult1(taskExecGuid.value).then((res: any) => { |
| 1790 | getResultPromise.value = null; | 1753 | getResultPromise.value = null; |
| 1791 | if (res?.code == proxy.$passCode) { | 1754 | if (res?.code == proxy.$passCode) { |
| 1792 | analysisResultInfo.value = res.data || {}; | 1755 | analysisResultInfo.value = res.data || {}; | ... | ... |
| ... | @@ -98,7 +98,7 @@ | ... | @@ -98,7 +98,7 @@ |
| 98 | </div> | 98 | </div> |
| 99 | </div> | 99 | </div> |
| 100 | <div class="result-title">重标识风险表</div> | 100 | <div class="result-title">重标识风险表</div> |
| 101 | <el-table ref="tableRef" v-show="analysisResultTableFields.length" :data="resultData" | 101 | <el-table ref="tableRef" v-show="analysisResultTableFields?.length" :data="resultData" |
| 102 | v-loading="analysisResultLoading" :highlight-current-row="true" stripe border tooltip-effect="light" | 102 | v-loading="analysisResultLoading" :highlight-current-row="true" stripe border tooltip-effect="light" |
| 103 | height="100%" row-key="guid" :style="{ width: '100%', height: '280px' }"> | 103 | height="100%" row-key="guid" :style="{ width: '100%', height: '280px' }"> |
| 104 | <el-table-column label="等价类" type="index" width="68px" align="center" show-overflow-tooltip> | 104 | <el-table-column label="等价类" type="index" width="68px" align="center" show-overflow-tooltip> |
| ... | @@ -127,14 +127,14 @@ | ... | @@ -127,14 +127,14 @@ |
| 127 | <el-table-column label="判断重风险是否大于门限阈值" prop="isGtThreshold" width="130" align="left" fixed="right" | 127 | <el-table-column label="判断重风险是否大于门限阈值" prop="isGtThreshold" width="130" align="left" fixed="right" |
| 128 | show-overflow-tooltip></el-table-column> | 128 | show-overflow-tooltip></el-table-column> |
| 129 | </el-table> | 129 | </el-table> |
| 130 | <div v-show="!analysisResultTableFields.length" class="empty-content"> | 130 | <div v-show="!analysisResultTableFields?.length" class="empty-content"> |
| 131 | <img src="../../../assets/images/empty-data.png" :style="{ width: '168px', height: '96px' }" /> | 131 | <img src="../../../assets/images/empty-data.png" :style="{ width: '168px', height: '96px' }" /> |
| 132 | <div class="empty-text">暂无数据</div> | 132 | <div class="empty-text">暂无数据</div> |
| 133 | </div> | 133 | </div> |
| 134 | <div v-show="analysisResultTableFields.length" class="result-table-desc">门限阈值的取值:完全公开共享数据发布,取值 | 134 | <div v-show="analysisResultTableFields?.length" class="result-table-desc">门限阈值的取值:完全公开共享数据发布,取值 |
| 135 | 1/20;受控公开共享数据发布,取值 | 135 | 1/20;受控公开共享数据发布,取值 |
| 136 | 1/5;领地公开共享数据发布,取值 1/3</div> | 136 | 1/5;领地公开共享数据发布,取值 1/3</div> |
| 137 | <PageNav v-show="analysisResultTableFields.length" :class="[pageInfo.type]" :pageInfo="pageInfo" | 137 | <PageNav v-show="analysisResultTableFields?.length" :class="[pageInfo.type]" :pageInfo="pageInfo" |
| 138 | @pageChange="pageChange" /> | 138 | @pageChange="pageChange" /> |
| 139 | <div class="row-two-main" style="margin-top: 12px;"> | 139 | <div class="row-two-main" style="margin-top: 12px;"> |
| 140 | <div class="table-one"> | 140 | <div class="table-one"> |
| ... | @@ -394,7 +394,7 @@ const props = defineProps({ | ... | @@ -394,7 +394,7 @@ const props = defineProps({ |
| 394 | }, | 394 | }, |
| 395 | analysisResultTableFields: { | 395 | analysisResultTableFields: { |
| 396 | type: Array, | 396 | type: Array, |
| 397 | default: [], | 397 | default: <any>[], |
| 398 | }, | 398 | }, |
| 399 | originResultTableFieldColumn: { | 399 | originResultTableFieldColumn: { |
| 400 | type: Object, | 400 | type: Object, | ... | ... |
-
Please register or sign in to post a comment