添加日志管理
Showing
5 changed files
with
386 additions
and
4 deletions
| ... | @@ -51,12 +51,31 @@ export const onUploadFileDownload = async (params) => { | ... | @@ -51,12 +51,31 @@ export const onUploadFileDownload = async (params) => { |
| 51 | }) | 51 | }) |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | export function getPathUrl(url:string) { | ||
| 55 | // 查找问号的位置 | ||
| 56 | var questionMarkIndex = url.lastIndexOf('?'); | ||
| 57 | |||
| 58 | // 如果存在问号,则返回问号之前的部分;如果不存在,则返回原url | ||
| 59 | return questionMarkIndex !== -1 ? url.substring(0, questionMarkIndex) : url; | ||
| 60 | } | ||
| 61 | |||
| 54 | export const onUploadFilePreview = async (params) => { | 62 | export const onUploadFilePreview = async (params) => { |
| 55 | console.log(params, 'params'); | 63 | // console.log(params, 'params'); |
| 56 | const {name, url} = params; | 64 | let name = '' |
| 65 | let url = ''; | ||
| 66 | if (params && typeof params == 'string') { | ||
| 67 | url = params; | ||
| 68 | } else { | ||
| 69 | name = params.name; | ||
| 70 | url = params.url; | ||
| 71 | } | ||
| 72 | url = getPathUrl(url); | ||
| 57 | // let f = formInline.value[item.field].find(i => i.name == file.name); | 73 | // let f = formInline.value[item.field].find(i => i.name == file.name); |
| 58 | // let url = f.url; | 74 | // let url = f.url; |
| 59 | let fileName: string = parseAndDecodeUrl(url).fileName; | 75 | let fileName: string = parseAndDecodeUrl(url).fileName; |
| 76 | if (!name) { | ||
| 77 | name = fileName; | ||
| 78 | } | ||
| 60 | const refSignInfo: any = await getDownFileSignByUrl(fileName); | 79 | const refSignInfo: any = await getDownFileSignByUrl(fileName); |
| 61 | if (!refSignInfo?.data) { | 80 | if (!refSignInfo?.data) { |
| 62 | refSignInfo?.msg && ElMessage.error(refSignInfo?.msg); | 81 | refSignInfo?.msg && ElMessage.error(refSignInfo?.msg); | ... | ... |
| ... | @@ -287,6 +287,13 @@ export const getContractProcessLog = (params) => request({ | ... | @@ -287,6 +287,13 @@ export const getContractProcessLog = (params) => request({ |
| 287 | data: params | 287 | data: params |
| 288 | }) | 288 | }) |
| 289 | 289 | ||
| 290 | /** 整个系统日志管理 */ | ||
| 291 | export const getSysOperationLog = (params) => request({ | ||
| 292 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/trust-data-space-log/page-list`, | ||
| 293 | method: 'post', | ||
| 294 | data: params | ||
| 295 | }) | ||
| 296 | |||
| 290 | export const getContractProcessLogDetail = (guid) => request({ | 297 | export const getContractProcessLogDetail = (guid) => request({ |
| 291 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-process-log/detail?guid=${guid}`, | 298 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-process-log/detail?guid=${guid}`, |
| 292 | method: 'get' | 299 | method: 'get' | ... | ... |
| ... | @@ -177,6 +177,26 @@ const routes: RouteRecordRaw[] = [ | ... | @@ -177,6 +177,26 @@ const routes: RouteRecordRaw[] = [ |
| 177 | }, | 177 | }, |
| 178 | }] | 178 | }] |
| 179 | }, | 179 | }, |
| 180 | { | ||
| 181 | path: '/data-smart-contract/action-log-manage', | ||
| 182 | component: Layout, | ||
| 183 | meta: { | ||
| 184 | title: '日志管理', | ||
| 185 | icon: 'sidebar-videos', | ||
| 186 | }, | ||
| 187 | children: [{ | ||
| 188 | path: '', | ||
| 189 | name: 'actionLogManage', | ||
| 190 | component: () => import('@/views/data_smart_contract/actionLogManage.vue'), | ||
| 191 | meta: { | ||
| 192 | title: '', | ||
| 193 | sidebar: false, | ||
| 194 | breadcrumb: false, | ||
| 195 | cache: true, | ||
| 196 | editPage: true | ||
| 197 | }, | ||
| 198 | }] | ||
| 199 | }, | ||
| 180 | ] | 200 | ] |
| 181 | 201 | ||
| 182 | export default routes | 202 | export default routes |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -1484,9 +1484,9 @@ const respParamsTableInfo = ref({ | ... | @@ -1484,9 +1484,9 @@ const respParamsTableInfo = ref({ |
| 1484 | <span>{{ scope.row["updateTime"] || '--' }}</span> | 1484 | <span>{{ scope.row["updateTime"] || '--' }}</span> |
| 1485 | </template> | 1485 | </template> |
| 1486 | </el-table-column> | 1486 | </el-table-column> |
| 1487 | <el-table-column label="操作" v-if="!detailInfo?.nodeId || foundMode == 'download'" minWidth="120px" align="left" fixed="right" show-overflow-tooltip> | 1487 | <el-table-column label="操作" v-if="!detailInfo?.nodeId || foundMode == 'download' || foundMode == 'read'" minWidth="120px" align="left" fixed="right" show-overflow-tooltip> |
| 1488 | <template #default="scope"> | 1488 | <template #default="scope"> |
| 1489 | <span class="text_btn" @click="handleTableViewData(scope)">查看样例数据</span> | 1489 | <span v-show="!detailInfo.nodeId || foundMode == 'read'" class="text_btn" @click="handleTableViewData(scope)">查看样例数据</span> |
| 1490 | <el-divider v-show="foundMode == 'download'" direction="vertical" /> | 1490 | <el-divider v-show="foundMode == 'download'" direction="vertical" /> |
| 1491 | <span v-show="foundMode == 'download'" class="text_btn" @click="handleTableViewDataDown(scope)">下载数据</span> | 1491 | <span v-show="foundMode == 'download'" class="text_btn" @click="handleTableViewDataDown(scope)">下载数据</span> |
| 1492 | </template> | 1492 | </template> | ... | ... |
| 1 | <route lang="yaml"> | ||
| 2 | name: actionLogManage | ||
| 3 | </route> | ||
| 4 | |||
| 5 | <script lang="ts" setup name="actionLogManage"> | ||
| 6 | import TableTools from "@/components/Tools/table_tools.vue"; | ||
| 7 | import { commonPageConfig, TableColumnWidth } from "@/utils/enum"; | ||
| 8 | import { | ||
| 9 | getSysOperationLog, | ||
| 10 | getContractProcessLogDetail | ||
| 11 | } from "@/api/modules/dataSmartContract"; | ||
| 12 | import useUserStore from "@/store/modules/user"; | ||
| 13 | const { proxy } = getCurrentInstance() as any; | ||
| 14 | const route = useRoute(); | ||
| 15 | const router = useRouter(); | ||
| 16 | const fullPath = route.fullPath; | ||
| 17 | const userStore = useUserStore(); | ||
| 18 | |||
| 19 | /** 过程记录筛选框 */ | ||
| 20 | const processTableSearchItemList = ref([{ | ||
| 21 | type: 'date-time', | ||
| 22 | label: '', | ||
| 23 | field: 'operatorTime', | ||
| 24 | default: [], | ||
| 25 | defaultStartTime: new Date(2000, 1, 1, 0, 0, 0), | ||
| 26 | defaultEndTime: new Date(2000, 1, 1, 23, 59, 59), | ||
| 27 | startPlaceholder: '开始时间', | ||
| 28 | endPlaceholder: '结束时间', | ||
| 29 | clearable: true | ||
| 30 | }, { | ||
| 31 | type: "input", | ||
| 32 | label: "", | ||
| 33 | field: "bizName", | ||
| 34 | default: "", | ||
| 35 | placeholder: "业务名称", | ||
| 36 | maxlength: 50, | ||
| 37 | clearable: true, | ||
| 38 | },]); | ||
| 39 | |||
| 40 | const currTableData: any = ref({}); | ||
| 41 | |||
| 42 | /** ------------------ 过程记录 ----------------------- */ | ||
| 43 | const processPage = ref({ | ||
| 44 | ...commonPageConfig, | ||
| 45 | bizName: '', | ||
| 46 | operatorTime: [] | ||
| 47 | }); | ||
| 48 | |||
| 49 | const processTableInfo = ref({ | ||
| 50 | id: "process-table", | ||
| 51 | rowKey: 'guid', | ||
| 52 | fields: [ | ||
| 53 | { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" }, | ||
| 54 | { label: "业务Guid", field: "bizGuid", width: 180 }, | ||
| 55 | { label: "业务名称", field: "bizName", width: 220 }, | ||
| 56 | { label: "操作时间", field: "operatingTime", width: 170 }, | ||
| 57 | { label: "操作类型", field: "operatingType", width: 175, getName: (scope) => { | ||
| 58 | let typeMap = { | ||
| 59 | 1: '新增', | ||
| 60 | 2: '修改', | ||
| 61 | 3: '删除' | ||
| 62 | } | ||
| 63 | return !scope.row.operatingType ? '--' : typeMap[scope.row.operatingType]; | ||
| 64 | } }, | ||
| 65 | { label: "操作人", field: "operator", width: 160 } | ||
| 66 | ], | ||
| 67 | data: [], | ||
| 68 | showPage: true, | ||
| 69 | page: { | ||
| 70 | type: "normal", | ||
| 71 | rows: 0, | ||
| 72 | ...processPage.value, | ||
| 73 | }, | ||
| 74 | actionInfo: { | ||
| 75 | show: false, | ||
| 76 | label: "操作", | ||
| 77 | type: "btn", | ||
| 78 | width: 80, | ||
| 79 | btns: [{ | ||
| 80 | value: 'view', label: '查看', | ||
| 81 | // click: (scope) => { | ||
| 82 | // currTableData.value = scope.row; | ||
| 83 | // processDetailDialogInfo.value.visible = true; | ||
| 84 | // processDetailDialogInfo.value.contentLoading = true; | ||
| 85 | // getContractProcessLogDetail(scope.row.guid).then((res: any) => { | ||
| 86 | // processDetailDialogInfo.value.contentLoading = false; | ||
| 87 | // if (res?.code == proxy.$passCode) { | ||
| 88 | // processDetailInfo.value = res.data || {}; | ||
| 89 | // execContractTableInfo.value.data = processDetailInfo.value.policys || []; | ||
| 90 | // } else { | ||
| 91 | // res?.msg && proxy.$ElMessage.error(res?.msg) | ||
| 92 | // } | ||
| 93 | // }) | ||
| 94 | // } | ||
| 95 | }] | ||
| 96 | }, | ||
| 97 | loading: false | ||
| 98 | }); | ||
| 99 | |||
| 100 | const toProcessTableSearch = (val: any, clear: boolean = false) => { | ||
| 101 | if (clear) { | ||
| 102 | processTableSearchItemList.value.map((item) => (item.default = "")); | ||
| 103 | processPage.value.bizName = ''; | ||
| 104 | processPage.value.operatorTime = []; | ||
| 105 | } else { | ||
| 106 | processPage.value.bizName = val.bizName; | ||
| 107 | processPage.value.operatorTime = val.operatorTime; | ||
| 108 | } | ||
| 109 | getProcessTableData(); | ||
| 110 | }; | ||
| 111 | |||
| 112 | const getProcessTableData = () => { | ||
| 113 | processTableInfo.value.loading = true | ||
| 114 | getSysOperationLog({ | ||
| 115 | pageIndex: processPage.value.curr, | ||
| 116 | pageSize: processPage.value.limit, | ||
| 117 | bizName: processPage.value.bizName, | ||
| 118 | operationTimeStart: processPage.value.operatorTime?.[0], | ||
| 119 | operationTimeEnd: processPage.value.operatorTime?.[1] | ||
| 120 | }).then((res: any) => { | ||
| 121 | processTableInfo.value.data = []; | ||
| 122 | if (res?.code == proxy.$passCode) { | ||
| 123 | const data = res.data || {}; | ||
| 124 | processTableInfo.value.loading = false | ||
| 125 | processTableInfo.value.data = data.records || [] | ||
| 126 | processTableInfo.value.page.limit = data.pageSize | ||
| 127 | processTableInfo.value.page.curr = data.pageIndex | ||
| 128 | processTableInfo.value.page.rows = data.totalRows | ||
| 129 | } else { | ||
| 130 | res?.msg && proxy.$ElMessage.error(res?.msg) | ||
| 131 | processTableInfo.value.loading = false | ||
| 132 | } | ||
| 133 | }).catch(() => { | ||
| 134 | processTableInfo.value.loading = false | ||
| 135 | }) | ||
| 136 | } | ||
| 137 | |||
| 138 | const processTablePageChange = (info) => { | ||
| 139 | processPage.value.curr = Number(info.curr); | ||
| 140 | processPage.value.limit = Number(info.limit); | ||
| 141 | processTableInfo.value.page.curr = processPage.value.curr; | ||
| 142 | processTableInfo.value.page.limit = processPage.value.limit; | ||
| 143 | getProcessTableData(); | ||
| 144 | }; | ||
| 145 | |||
| 146 | onBeforeMount(() => { | ||
| 147 | toProcessTableSearch({}); | ||
| 148 | }) | ||
| 149 | |||
| 150 | onActivated(() => { | ||
| 151 | // if (fullPath === route.fullPath) { | ||
| 152 | // document.title = `使用日志-${route.query.contractName}`; | ||
| 153 | // let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === fullPath); | ||
| 154 | // if (tab) { | ||
| 155 | // tab.meta.title = `使用日志-${route.query.contractName}`; | ||
| 156 | // } | ||
| 157 | // } | ||
| 158 | }) | ||
| 159 | |||
| 160 | |||
| 161 | /** 过程记录详情对话框 */ | ||
| 162 | const processDetailDialogInfo = ref({ | ||
| 163 | visible: false, | ||
| 164 | size: 855, | ||
| 165 | direction: "column", | ||
| 166 | header: { | ||
| 167 | title: "查看过程记录", | ||
| 168 | }, | ||
| 169 | type: '', | ||
| 170 | contents: [], | ||
| 171 | footer: { | ||
| 172 | show: false | ||
| 173 | }, | ||
| 174 | contentLoading: false, | ||
| 175 | }); | ||
| 176 | |||
| 177 | /** 查看过程记录详情 */ | ||
| 178 | const processDetailInfo: any = ref({}); | ||
| 179 | |||
| 180 | const handleProcessDialogBtnClick = (btn) => { | ||
| 181 | if (btn.value == 'cancel') { | ||
| 182 | processDetailDialogInfo.value.visible = false; | ||
| 183 | } | ||
| 184 | } | ||
| 185 | |||
| 186 | const execContractTableInfo = ref({ | ||
| 187 | id: "exec-contract-table", | ||
| 188 | height: '214px', | ||
| 189 | fields: <any[]>[ | ||
| 190 | { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" }, | ||
| 191 | { label: "策略id", field: "strategyId", width: 260 }, | ||
| 192 | { label: "操作行为", field: "action", width: 120 }, | ||
| 193 | { label: "操作行为英文名称", field: "actionEnName", width: 140 }, | ||
| 194 | { label: "约束条件", field: "constraintName", width: 120 }, | ||
| 195 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, | ||
| 196 | { label: "约束条件运算符", field: "constraintOperatorName", width: 140 }, | ||
| 197 | { label: "约束条件值", field: "constraintValue", width: 150 }, | ||
| 198 | { label: "执行结果", field: "result", width: 130 }, | ||
| 199 | // { label: "上报时间", field: "reportingTime", width: 170 }, | ||
| 200 | ], | ||
| 201 | data: [], | ||
| 202 | showPage: false, | ||
| 203 | actionInfo: { | ||
| 204 | show: false | ||
| 205 | }, | ||
| 206 | loading: false | ||
| 207 | }); | ||
| 208 | |||
| 209 | </script> | ||
| 210 | |||
| 211 | <template> | ||
| 212 | <div class="container_wrap"> | ||
| 213 | <div class="table_tool_wrap"> | ||
| 214 | <TableTools :searchItems="processTableSearchItemList" :init="false" searchId="process-table-search" | ||
| 215 | @search="toProcessTableSearch" /> | ||
| 216 | </div> | ||
| 217 | <div class="table_panel_wrap"> | ||
| 218 | <Table :tableInfo="processTableInfo" @tablePageChange="processTablePageChange" /> | ||
| 219 | </div> | ||
| 220 | <!-- <Dialog ref="processDialogRef" :dialogInfo="processDetailDialogInfo" class="log-process-detail" | ||
| 221 | @btnClick="handleProcessDialogBtnClick"> | ||
| 222 | <template #extra-content> | ||
| 223 | <div class="main-content" v-loading="processDetailDialogInfo.contentLoading"> | ||
| 224 | <div class="list_panel"> | ||
| 225 | <div class="list_item"> | ||
| 226 | <span class="item_label">执行时间:</span> | ||
| 227 | <span class="item_value">{{ processDetailInfo?.operationTime || '--' }}</span> | ||
| 228 | </div> | ||
| 229 | <div class="list_item"> | ||
| 230 | <span class="item_label">执行结果:</span> | ||
| 231 | <span class="item_value"><ellipsis-tooltip :content="processDetailInfo?.executionResult || '--'" | ||
| 232 | class-name="w100f mr8-i" :refName="'tooltipOver' + 'executionResult'"></ellipsis-tooltip></span> | ||
| 233 | </div> | ||
| 234 | <div class="list_item"> | ||
| 235 | <span class="item_label">执行环节:</span> | ||
| 236 | <span class="item_value"><ellipsis-tooltip :content="processDetailInfo?.executionProcess || '--'" | ||
| 237 | class-name="w100f mr8-i" :refName="'tooltipOver' + 'executionProcess'"></ellipsis-tooltip></span> | ||
| 238 | </div> | ||
| 239 | <div class="list_item"> | ||
| 240 | <span class="item_label">合约名称:</span> | ||
| 241 | <span class="item_value"><ellipsis-tooltip :content="processDetailInfo?.contractName || '--'" | ||
| 242 | class-name="w100f mr8-i" :refName="'tooltipOver' + 'contractName'"></ellipsis-tooltip></span> | ||
| 243 | </div> | ||
| 244 | <div class="list_item"> | ||
| 245 | <span class="item_label">执行节点标识:</span> | ||
| 246 | <span class="item_value"><ellipsis-tooltip :content="processDetailInfo?.executionEntityId || '--'" | ||
| 247 | class-name="w100f mr8-i" :refName="'tooltipOver' + 'executionEntityId'"></ellipsis-tooltip></span> | ||
| 248 | </div> | ||
| 249 | <div class="list_item"> | ||
| 250 | <span class="item_label">执行节点名称:</span> | ||
| 251 | <span class="item_value"><ellipsis-tooltip :content="processDetailInfo?.executionEntityName || '--'" | ||
| 252 | class-name="w100f mr8-i" :refName="'tooltipOver' + 'executionEntityName'"></ellipsis-tooltip></span> | ||
| 253 | </div> | ||
| 254 | <div class="h-title">策略信息</div> | ||
| 255 | <Table :table-info="execContractTableInfo"></Table> | ||
| 256 | </div> | ||
| 257 | </div> | ||
| 258 | </template> | ||
| 259 | </Dialog>--> | ||
| 260 | </div> | ||
| 261 | </template> | ||
| 262 | |||
| 263 | <style lang="scss" scoped> | ||
| 264 | .table_panel_wrap { | ||
| 265 | height: calc(100% - 44px); | ||
| 266 | } | ||
| 267 | |||
| 268 | .main-content { | ||
| 269 | margin: 20px; | ||
| 270 | } | ||
| 271 | |||
| 272 | .list_panel { | ||
| 273 | display: flex; | ||
| 274 | flex-wrap: wrap; | ||
| 275 | display: flex; | ||
| 276 | align-items: flex-start; | ||
| 277 | |||
| 278 | &.main { | ||
| 279 | .list_item { | ||
| 280 | width: 25%; | ||
| 281 | } | ||
| 282 | } | ||
| 283 | |||
| 284 | .list_item { | ||
| 285 | width: 50%; | ||
| 286 | line-height: 32px; | ||
| 287 | font-size: 14px; | ||
| 288 | color: var(--el-text-color-regular); | ||
| 289 | display: flex; | ||
| 290 | justify-content: space-between; | ||
| 291 | min-width: 120px; | ||
| 292 | |||
| 293 | .item_label { | ||
| 294 | text-align: left; | ||
| 295 | } | ||
| 296 | |||
| 297 | .item_value { | ||
| 298 | color: var(--el-color-regular); | ||
| 299 | padding: 0 4px 0 0; | ||
| 300 | flex: 1; | ||
| 301 | text-align: justify; | ||
| 302 | min-width: 0; | ||
| 303 | |||
| 304 | .link { | ||
| 305 | color: var(--el-color-primary); | ||
| 306 | cursor: pointer; | ||
| 307 | margin-left: 4px; | ||
| 308 | } | ||
| 309 | |||
| 310 | } | ||
| 311 | |||
| 312 | &.is_block { | ||
| 313 | width: 100%; | ||
| 314 | |||
| 315 | .item_value { | ||
| 316 | white-space: pre-wrap; | ||
| 317 | } | ||
| 318 | } | ||
| 319 | |||
| 320 | } | ||
| 321 | } | ||
| 322 | |||
| 323 | :deep(.policy-table-detail) { | ||
| 324 | .dialog_content { | ||
| 325 | padding: 0px 20px 20px; | ||
| 326 | } | ||
| 327 | } | ||
| 328 | |||
| 329 | .h-title { | ||
| 330 | font-size: 14px; | ||
| 331 | color: #212121; | ||
| 332 | font-weight: 600; | ||
| 333 | margin-right: 8px; | ||
| 334 | margin-bottom: 8px; | ||
| 335 | } | ||
| 336 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment