| | |
| | | <span> |
| | | <img class="imgSpan" :src=imgurl> |
| | | </span> |
| | | <span> {{ website.indexTitle }}</span> |
| | | <span class="indexTitle"> {{ website.indexTitle }}</span> |
| | | </span> |
| | | </template> |
| | | </transition-group> |
| | |
| | | top: 15px; |
| | | left: 12px; |
| | | } |
| | | .indexTitle{ |
| | | //background-image: linear-gradient(120deg, #54b6d0 16%, #3f8bdb, #3f8bdb); |
| | | background-image: linear-gradient(-225deg, #5D9FFF 0%, #B8DCFF 48%, #6BBBFF 100%); |
| | | background-clip: text; |
| | | color: transparent; |
| | | font-weight: 700; |
| | | } |
| | | </style> |
| | |
| | | |
| | | getLogHandler() { |
| | | this.loading = true; |
| | | const logTypes = ["4", "1", "3"]; // 操作日志、登录日志、授权日志的 logType |
| | | const logNames = ["操作日志统计", "登录日志统计", "授权日志统计"]; // 对应的日志名称 |
| | | const textList = ["当前登录日志总记录数", "当前授权日志总记录数", "当前操作日志总记录数"]; |
| | | const color = ['rgb(27, 201, 142)', 'rgb(230, 71, 88)', 'rgb(178, 159, 255)'] |
| | | const router = ['/LogOperateMain?logType=4&roleType=2', '/LogInfoMain?logType=1&roleType=2', '/LogAuthorizeMain?logType=3&roleType=2'] |
| | | |
| | | // 日志请求和展示的相关的配置 |
| | | const logConfig = [ |
| | | { logType: "4", logName: "操作日志统计", text: "当前操作日志总记录数", color: 'rgb(27, 201, 142)', router: '/LogOperateMain?logType=4&roleType=2' }, |
| | | { logType: "1", logName: "登录日志统计", text: "当前登录日志总记录数", color: 'rgb(230, 71, 88)', router: '/LogInfoMain?logType=1&roleType=2' }, |
| | | { logType: "3", logName: "授权日志统计", text: "当前授权日志总记录数", color: 'rgb(178, 159, 255)', router: '/LogAuthorizeMain?logType=3&roleType=2' } |
| | | ]; |
| | | |
| | | const roleType = "2"; |
| | | |
| | | const requests = logTypes.map(logType => getLogListByContion(1, -1, {logType, roleType})); |
| | | const requests = logConfig.map(config => getLogListByContion(1, -1, { logType: config.logType, roleType })); |
| | | |
| | | Promise.all(requests).then(responses => { |
| | | // console.log('responses', responses); |
| | | // 计算总和 |
| | | const allcount = responses.reduce((sum, res) => sum + (res.data.total || 0), 0); |
| | | // 计算三个日志的总和 |
| | | const totalCount = responses.reduce((sum, res) => sum + (res.data.total || 0), 0); |
| | | |
| | | this.topOption.data = responses.map((res, index) => { |
| | | return { |
| | | title: logNames[index], |
| | | text: textList[index], |
| | | color: color[index], |
| | | subtitle: '实时', |
| | | count: res.data.total, |
| | | allcount: '日志总数:' + allcount, |
| | | key: '日志', |
| | | click: () => { |
| | | this.$router.push({path:router[index]}); |
| | | }, |
| | | }; |
| | | }); |
| | | this.topOption.data = responses.map((res, index) => ({ |
| | | title: logConfig[index].logName, |
| | | text: logConfig[index].text, |
| | | color: logConfig[index].color, |
| | | subtitle: '实时', |
| | | count: res.data.total, |
| | | allcount: `日志总数:${totalCount}`, |
| | | key: '日志', |
| | | click: () => this.$router.push({ path: logConfig[index].router }), |
| | | })); |
| | | |
| | | this.loading = false; |
| | | }).catch(error => { |
| | | console.error("An error occurred:", error); |
| | | this.$message.error(error); |
| | | this.loading = false; |
| | | }); |
| | | } |
| | | }, |