提交泛化文件迁移
Showing
5 changed files
with
326 additions
and
0 deletions
src/api/modules/dataAnonymization.ts
0 → 100644
| 1 | /** | ||
| 2 | * 匿名化管理的接口api文件 | ||
| 3 | */ | ||
| 4 | import request from "@/utils/request"; | ||
| 5 | |||
| 6 | /** 字段类型 */ | ||
| 7 | export const fieldTypeList = [{ | ||
| 8 | value: '1', | ||
| 9 | label: '日期' | ||
| 10 | }, { | ||
| 11 | value: '2', | ||
| 12 | label: '字符串' | ||
| 13 | }, { | ||
| 14 | value: '3', | ||
| 15 | label: '数值' | ||
| 16 | }] | ||
| 17 | |||
| 18 | /** 获取泛化文件列表 */ | ||
| 19 | export const getGeneralizeFileList = (params) => request({ | ||
| 20 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/generalize-file/page-list`, | ||
| 21 | method: 'post', | ||
| 22 | data: params | ||
| 23 | }) | ||
| 24 | |||
| 25 | /** 获取泛化文件列表,包括名称和guid */ | ||
| 26 | export const getGeneralizeFileNameList = () => request({ | ||
| 27 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/generalize-file/name-list`, | ||
| 28 | method: 'post' | ||
| 29 | }) | ||
| 30 | |||
| 31 | export const saveGeneralizeFile = (data) => request({ | ||
| 32 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/generalize-file/save`, | ||
| 33 | method: 'post', | ||
| 34 | data | ||
| 35 | }) | ||
| 36 | |||
| 37 | /** 删除泛化文件 */ | ||
| 38 | export const deleteGeneralizeFile = (data) => request({ | ||
| 39 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/generalize-file/delete`, | ||
| 40 | method: 'delete', | ||
| 41 | data | ||
| 42 | }) | ||
| 43 | |||
| 44 | /** 获取泛化文件详情 */ | ||
| 45 | export const getGeneralizeFileDetail = (guid) => request({ | ||
| 46 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/generalize-file/detail?guid=${guid}`, | ||
| 47 | method: 'get' | ||
| 48 | }) | ||
| 49 | |||
| 50 | export const updateGeneralizeFile = (data) => request({ | ||
| 51 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/generalize-file/update`, | ||
| 52 | method: 'put', | ||
| 53 | data | ||
| 54 | }) | ||
| 55 | |||
| 56 | /** 获取泛化文件解析结果 */ | ||
| 57 | export const parseGeneralizeFileData = (data) => request({ | ||
| 58 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/generalize-file/parse-file`, | ||
| 59 | method: 'post', | ||
| 60 | data | ||
| 61 | }) | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -217,6 +217,46 @@ const routes: RouteRecordRaw[] = [ | ... | @@ -217,6 +217,46 @@ const routes: RouteRecordRaw[] = [ |
| 217 | }, | 217 | }, |
| 218 | }] | 218 | }] |
| 219 | }, | 219 | }, |
| 220 | { | ||
| 221 | path: '/data-smart-contract-common/generalize-file', | ||
| 222 | component: Layout, | ||
| 223 | meta: { | ||
| 224 | title: '泛化文件管理', | ||
| 225 | icon: 'sidebar-videos', | ||
| 226 | }, | ||
| 227 | children: [ | ||
| 228 | { | ||
| 229 | path: '', | ||
| 230 | name: 'generalizeFile', | ||
| 231 | component: () => import('@/views/data_smart_contract/generalizeFile.vue'), | ||
| 232 | meta: { | ||
| 233 | title: '', | ||
| 234 | sidebar: false, | ||
| 235 | breadcrumb: false, | ||
| 236 | cache: true | ||
| 237 | }, | ||
| 238 | }, | ||
| 239 | { | ||
| 240 | path: 'generalize-file-edit', | ||
| 241 | name: 'generalizeFileEdit', | ||
| 242 | component: () => import('@/views/data_smart_contract/generalizeFileEdit.vue'), | ||
| 243 | meta: { | ||
| 244 | title: '新建泛化文件', | ||
| 245 | sidebar: false, | ||
| 246 | breadcrumb: false, | ||
| 247 | cache: true, | ||
| 248 | reuse: true, | ||
| 249 | editPage: true, | ||
| 250 | activeMenu: '/data-smart-contract-common/generalize-file' | ||
| 251 | }, | ||
| 252 | beforeEnter: (to, from) => { | ||
| 253 | if (to.query.fileName) { | ||
| 254 | to.meta.title = `编辑-${to.query.fileName}`; | ||
| 255 | } | ||
| 256 | } | ||
| 257 | }, | ||
| 258 | ], | ||
| 259 | }, | ||
| 220 | ] | 260 | ] |
| 221 | 261 | ||
| 222 | export default routes | 262 | export default routes |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
src/store/modules/dataAnonymization.ts
0 → 100644
| 1 | const useDataAnonymizationStore = defineStore( | ||
| 2 | // 资产目录guid | ||
| 3 | 'anonymization', | ||
| 4 | () => { | ||
| 5 | const isRefresh = ref<boolean>(false); | ||
| 6 | function setIsRefresh(v: boolean) { | ||
| 7 | isRefresh.value = v; | ||
| 8 | } | ||
| 9 | |||
| 10 | const isAnonPageRefresh = ref<boolean>(false); | ||
| 11 | function setIsAnonPageRefresh(v: boolean) { | ||
| 12 | isAnonPageRefresh.value = v; | ||
| 13 | } | ||
| 14 | |||
| 15 | return { | ||
| 16 | isRefresh, | ||
| 17 | isAnonPageRefresh, | ||
| 18 | setIsRefresh, | ||
| 19 | setIsAnonPageRefresh, | ||
| 20 | }; | ||
| 21 | } | ||
| 22 | ); | ||
| 23 | |||
| 24 | export default useDataAnonymizationStore; |
| 1 | <route lang="yaml"> | ||
| 2 | name: generalizeFile | ||
| 3 | </route> | ||
| 4 | |||
| 5 | <script lang="ts" setup name="generalizeFile"> | ||
| 6 | import TableTools from "@/components/Tools/table_tools.vue"; | ||
| 7 | import { commonPageConfig } from '@/components/PageNav/index'; | ||
| 8 | import { TableColumnWidth } from "@/utils/enum"; | ||
| 9 | import { | ||
| 10 | deleteGeneralizeFile, | ||
| 11 | getGeneralizeFileList, | ||
| 12 | fieldTypeList, | ||
| 13 | } from '@/api/modules/dataAnonymization'; | ||
| 14 | import useDataAnonymizationStore from "@/store/modules/dataAnonymization"; | ||
| 15 | |||
| 16 | const anonymizationStore = useDataAnonymizationStore(); | ||
| 17 | const router = useRouter() | ||
| 18 | const { proxy } = getCurrentInstance() as any; | ||
| 19 | |||
| 20 | const searchItemList = ref([{ | ||
| 21 | type: "input", | ||
| 22 | label: "", | ||
| 23 | field: "generalizeFileName", | ||
| 24 | default: "", | ||
| 25 | placeholder: "泛化文件名称", | ||
| 26 | clearable: true, | ||
| 27 | }, { | ||
| 28 | type: "select", | ||
| 29 | label: "", | ||
| 30 | field: "fieldType", | ||
| 31 | default: null, | ||
| 32 | options: fieldTypeList, | ||
| 33 | placeholder: "字段类型", | ||
| 34 | clearable: true, | ||
| 35 | filterable: true, | ||
| 36 | }]) | ||
| 37 | |||
| 38 | /** 分页及搜索传参信息配置。 */ | ||
| 39 | const page = ref({ | ||
| 40 | ...commonPageConfig, | ||
| 41 | generalizeFileName: '', | ||
| 42 | fieldType: '' | ||
| 43 | }); | ||
| 44 | |||
| 45 | const tableInfo = ref({ | ||
| 46 | id: 'data-file-table', | ||
| 47 | fields: [ | ||
| 48 | { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" }, | ||
| 49 | { label: "泛化文件名称", field: "generalizeFileName", width: 160 }, | ||
| 50 | { label: "字段类型", field: "fieldType", width: 120, getName: (scope) => { | ||
| 51 | return scope.row.fieldType && fieldTypeList.find(f => f.value == scope.row.fieldType)?.label || '--'; | ||
| 52 | } }, | ||
| 53 | { label: "泛化层级", field: "generalizeLevel", width: 120, align: 'right', type: 'chnum' }, | ||
| 54 | { label: "修改人", field: "updateUserName", width: TableColumnWidth.USERNAME }, | ||
| 55 | { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME }, | ||
| 56 | ], | ||
| 57 | data: [], | ||
| 58 | page: { | ||
| 59 | type: "normal", | ||
| 60 | rows: 0, | ||
| 61 | ...page.value, | ||
| 62 | }, | ||
| 63 | loading: false, | ||
| 64 | actionInfo: { | ||
| 65 | label: "操作", | ||
| 66 | type: "btn", | ||
| 67 | width: 120, | ||
| 68 | fixed: 'right', | ||
| 69 | btns: (scope) => { | ||
| 70 | return [{ | ||
| 71 | label: "编辑", value: "edit", click: (scope) => { | ||
| 72 | router.push({ | ||
| 73 | name: 'generalizeFileEdit', | ||
| 74 | query: { | ||
| 75 | guid: scope.row.guid, | ||
| 76 | fileName: scope.row.generalizeFileName | ||
| 77 | } | ||
| 78 | }); | ||
| 79 | } | ||
| 80 | }, { | ||
| 81 | label: "删除", value: "delete", disabled: scope.row.bizState == 'Y', click: (scope) => { | ||
| 82 | proxy.$openMessageBox("此操作将永久删除, 是否继续?", () => { | ||
| 83 | let guids = [scope.row.guid]; | ||
| 84 | deleteGeneralizeFile(guids).then((res: any) => { | ||
| 85 | if (res?.code == proxy.$passCode) { | ||
| 86 | getTableData(); | ||
| 87 | proxy.$ElMessage({ | ||
| 88 | type: "success", | ||
| 89 | message: "删除成功", | ||
| 90 | }); | ||
| 91 | } else { | ||
| 92 | proxy.$ElMessage({ | ||
| 93 | type: "error", | ||
| 94 | message: res.msg, | ||
| 95 | }); | ||
| 96 | } | ||
| 97 | }); | ||
| 98 | }, () => { | ||
| 99 | proxy.$ElMessage.info("已取消"); | ||
| 100 | }) | ||
| 101 | } | ||
| 102 | }] | ||
| 103 | } | ||
| 104 | } | ||
| 105 | }) | ||
| 106 | |||
| 107 | const toSearch = (val: any, clear: boolean = false) => { | ||
| 108 | if (clear) { | ||
| 109 | searchItemList.value.map((item) => (item.default = "")); | ||
| 110 | page.value.generalizeFileName = ''; | ||
| 111 | page.value.fieldType = ''; | ||
| 112 | } else { | ||
| 113 | page.value.generalizeFileName = val.generalizeFileName; | ||
| 114 | page.value.fieldType = val.fieldType; | ||
| 115 | } | ||
| 116 | getTableData(); | ||
| 117 | }; | ||
| 118 | |||
| 119 | const getTableData = () => { | ||
| 120 | tableInfo.value.loading = true | ||
| 121 | getGeneralizeFileList({ | ||
| 122 | pageIndex: page.value.curr, | ||
| 123 | pageSize: page.value.limit, | ||
| 124 | generalizeFileName: page.value.generalizeFileName, | ||
| 125 | fieldType: page.value.fieldType | ||
| 126 | }).then((res: any) => { | ||
| 127 | if (res?.code == proxy.$passCode) { | ||
| 128 | const data = res.data || {} | ||
| 129 | tableInfo.value.data = data.records || [] | ||
| 130 | tableInfo.value.page.limit = data.pageSize | ||
| 131 | tableInfo.value.page.curr = data.pageIndex | ||
| 132 | tableInfo.value.page.rows = data.totalRows | ||
| 133 | } else { | ||
| 134 | proxy.$ElMessage({ | ||
| 135 | type: 'error', | ||
| 136 | message: res.msg, | ||
| 137 | }) | ||
| 138 | } | ||
| 139 | tableInfo.value.loading = false | ||
| 140 | }) | ||
| 141 | }; | ||
| 142 | |||
| 143 | const tablePageChange = (info) => { | ||
| 144 | page.value.curr = Number(info.curr); | ||
| 145 | page.value.limit = Number(info.limit); | ||
| 146 | getTableData(); | ||
| 147 | }; | ||
| 148 | |||
| 149 | onBeforeMount(() => { | ||
| 150 | toSearch({}); | ||
| 151 | }) | ||
| 152 | |||
| 153 | onActivated(() => { | ||
| 154 | if (anonymizationStore.isRefresh) {//如果是首次加载,则不需要调用 | ||
| 155 | page.value.curr = 1; | ||
| 156 | getTableData(); | ||
| 157 | anonymizationStore.setIsRefresh(false); | ||
| 158 | } | ||
| 159 | }) | ||
| 160 | |||
| 161 | const handleCreate = () => { | ||
| 162 | router.push({ | ||
| 163 | name: 'generalizeFileEdit' | ||
| 164 | }); | ||
| 165 | } | ||
| 166 | |||
| 167 | </script> | ||
| 168 | |||
| 169 | <template> | ||
| 170 | <div class="container_wrap"> | ||
| 171 | <div class="table_tool_wrap"> | ||
| 172 | <!-- 头部搜索 --> | ||
| 173 | <TableTools :searchItems="searchItemList" :searchId="'data-label-search'" @search="toSearch" :init="false" /> | ||
| 174 | <div class="tools_btns"> | ||
| 175 | <el-button type="primary" @click="handleCreate">新建</el-button> | ||
| 176 | </div> | ||
| 177 | </div> | ||
| 178 | <div class="table_panel_wrap"> | ||
| 179 | <!-- 右侧标签管理表格 --> | ||
| 180 | <Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" /> | ||
| 181 | </div> | ||
| 182 | </div> | ||
| 183 | </template> | ||
| 184 | |||
| 185 | <style lang="scss" scoped> | ||
| 186 | .table_tool_wrap { | ||
| 187 | width: 100%; | ||
| 188 | height: 84px !important; | ||
| 189 | padding: 0 8px; | ||
| 190 | |||
| 191 | .tools_btns { | ||
| 192 | padding: 0px 0 0; | ||
| 193 | } | ||
| 194 | } | ||
| 195 | |||
| 196 | .table_panel_wrap { | ||
| 197 | width: 100%; | ||
| 198 | height: calc(100% - 84px); | ||
| 199 | padding: 0px 8px 0; | ||
| 200 | } | ||
| 201 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment