feat: task#2060
* fix: 15017 * fix: 修改bug(13663、15022、13672) * fix: 修改操作栏的距离 * fix: bug#15019 * fix: 修改菜单配置 * fix: 修改网络组件的集群控制 * fix: 修改用户管理的类型展示问题 * fix:修改15034 * feat: 优化社区版运维管理-仪表盘-数据加载 * feat: task#2060
This commit is contained in:
parent
099c6fa32a
commit
5efd20a863
|
@ -1,12 +1,13 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { queryOwnThree } from '@/api/system/menu'
|
||||
import { filterAsyncRouter, findCodeRoute, MenuItem } from '@/utils/menu'
|
||||
import {filterAsyncRouter, filterCommunityMenus, findCodeRoute, MenuItem} from '@/utils/menu'
|
||||
import { cloneDeep, isArray } from 'lodash-es'
|
||||
import { usePermissionStore } from './permission'
|
||||
import router from '@/router'
|
||||
import { onlyMessage } from '@/utils/comm'
|
||||
import { AccountMenu, NotificationRecordCode, NotificationSubscriptionCode } from '@/router/menu'
|
||||
import { MESSAGE_SUBSCRIBE_MENU_CODE, USER_CENTER_MENU_CODE } from '@/utils/consts'
|
||||
import {isNoCommunity} from "@/utils/utils";
|
||||
|
||||
const defaultOwnParams = [
|
||||
{
|
||||
|
@ -95,15 +96,19 @@ export const useMenuStore = defineStore({
|
|||
const resp = await queryOwnThree({ paging: false, terms: defaultOwnParams })
|
||||
if (resp.success) {
|
||||
const permission = usePermissionStore()
|
||||
let resultData = resp.result
|
||||
if (!isNoCommunity) {
|
||||
resultData = filterCommunityMenus(resultData)
|
||||
}
|
||||
permission.permissions = {}
|
||||
const { menusData, silderMenus } = filterAsyncRouter(resp.result)
|
||||
const { menusData, silderMenus } = filterAsyncRouter(resultData)
|
||||
|
||||
// 是否存在通知订阅
|
||||
const hasMessageSub = resp.result.some((item: { code: string }) => item.code === MESSAGE_SUBSCRIBE_MENU_CODE)
|
||||
const hasMessageSub = resultData.some((item: { code: string }) => item.code === MESSAGE_SUBSCRIBE_MENU_CODE)
|
||||
if (!hasMessageSub) {
|
||||
AccountMenu.children = AccountMenu.children.filter((item: { code: string }) => ![NotificationSubscriptionCode, NotificationRecordCode].includes(item.code) )
|
||||
}
|
||||
this.menus = findCodeRoute([...resp.result, AccountMenu])
|
||||
this.menus = findCodeRoute([...resultData, AccountMenu])
|
||||
Object.keys(this.menus).forEach((item) => {
|
||||
const _item = this.menus[item]
|
||||
if (_item.buttons?.length) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { cloneDeep } from 'lodash-es'
|
||||
import { BlankLayoutPage, BasicLayoutPage } from 'components/Layout'
|
||||
import { isNoCommunity } from '@/utils/utils'
|
||||
|
||||
const pagesComponent = import.meta.glob('../views/**/*.vue');
|
||||
|
||||
/**
|
||||
|
@ -206,6 +208,16 @@ const findDetailRoutes = (routes: any[]): any[] => {
|
|||
return newRoutes
|
||||
}
|
||||
|
||||
const filterMenus = ['device/DashBoard']
|
||||
export const filterCommunityMenus = (menuData: any[]) => {
|
||||
return menuData.filter(item => {
|
||||
if (item.children) {
|
||||
item.children = filterCommunityMenus(item.children)
|
||||
}
|
||||
return !filterMenus.includes(item.code)
|
||||
})
|
||||
}
|
||||
|
||||
export const findCodeRoute = (asyncRouterMap: any[]) => {
|
||||
const routeMeta = {}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="device-count-container">
|
||||
<h5 class="title">设备统计</h5>
|
||||
<span class="detail" @click="jumpPage('device/DashBoard')"> 详情 </span>
|
||||
<span class="detail" @click="jumpPage('device/DashBoard')" v-if="isNoCommunity"> 详情 </span>
|
||||
|
||||
<div class="box-list">
|
||||
<div class="box-item">
|
||||
|
@ -21,6 +21,7 @@
|
|||
<script setup lang="ts">
|
||||
import { getDeviceCount_api, getProductCount_api } from '@/api/home';
|
||||
import { useMenuStore } from '@/store/menu';
|
||||
import { isNoCommunity } from '@/utils/utils'
|
||||
|
||||
const { jumpPage } = useMenuStore();
|
||||
const projectNum = ref(0);
|
||||
|
|
|
@ -61,10 +61,15 @@ import {
|
|||
} from './tool.ts';
|
||||
import { DataType } from '../typings';
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
serviceId: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
isNoCommunity: {
|
||||
type:Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -86,7 +91,8 @@ const getCPUEcharts = async (val: any) => {
|
|||
const _cpuOptions = {};
|
||||
const _cpuXAxis = new Set();
|
||||
if (res.result?.length) {
|
||||
const filterArray = res.result.filter((item : any) => item.data?.clusterNodeId === props.serviceId)
|
||||
// 根据服务节点来筛选数据
|
||||
const filterArray = props.isNoCommunity ? res.result.filter((item : any) => item.data?.clusterNodeId === props.serviceId) : res.result
|
||||
filterArray.forEach((item: any) => {
|
||||
const value = item.data.value;
|
||||
const nodeID = item.data.clusterNodeId;
|
||||
|
@ -97,7 +103,7 @@ const getCPUEcharts = async (val: any) => {
|
|||
if (!_cpuOptions[nodeID]) {
|
||||
_cpuOptions[nodeID] = [];
|
||||
}
|
||||
_cpuOptions[nodeID].push(
|
||||
_cpuOptions[nodeID]?.push(
|
||||
Number(value.cpuSystemUsage).toFixed(2),
|
||||
);
|
||||
});
|
||||
|
@ -179,9 +185,11 @@ watch(
|
|||
|
||||
watchEffect(() => {
|
||||
const time = data.value.time
|
||||
if (time && Array.isArray(time) && time.length === 2 && time[0] && props.serviceId) {
|
||||
if (time && Array.isArray(time) && time.length === 2 && time[0]) {
|
||||
if (!props.isNoCommunity || props.serviceId) {
|
||||
getCPUEcharts(data.value);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
|
@ -65,6 +65,10 @@ const props = defineProps({
|
|||
serviceId: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
isNoCommunity: {
|
||||
type:Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -86,7 +90,7 @@ const getJVMEcharts = async (val: any) => {
|
|||
const _jvmOptions = {};
|
||||
const _jvmXAxis = new Set();
|
||||
if (res.result?.length) {
|
||||
const filterArray = res.result.filter((item : any) => item.data?.clusterNodeId === props.serviceId)
|
||||
const filterArray = props.isNoCommunity ? res.result.filter((item : any) => item.data?.clusterNodeId === props.serviceId) : res.result
|
||||
filterArray.forEach((item: any) => {
|
||||
const value = item.data.value;
|
||||
const memoryJvmHeapFree = value.memoryJvmHeapFree;
|
||||
|
@ -104,7 +108,7 @@ const getJVMEcharts = async (val: any) => {
|
|||
_jvmXAxis.add(
|
||||
dayjs(value.timestamp).format('YYYY-MM-DD HH:mm'),
|
||||
);
|
||||
_jvmOptions[nodeID].push(_value);
|
||||
_jvmOptions[nodeID]?.push(_value);
|
||||
});
|
||||
handleJVMOptions(_jvmOptions, [..._jvmXAxis.keys()]);
|
||||
} else {
|
||||
|
@ -183,9 +187,11 @@ watch(
|
|||
|
||||
watchEffect(() => {
|
||||
const time = data.value.time
|
||||
if (time && Array.isArray(time) && time.length === 2 && time[0] && props.serviceId) {
|
||||
if (time && Array.isArray(time) && time.length === 2 && time[0]) {
|
||||
if (!props.isNoCommunity || props.serviceId) {
|
||||
getJVMEcharts(data.value);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
|
@ -127,6 +127,8 @@ onMounted(() => {
|
|||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
getData()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<div>
|
||||
<j-row :gutter="[24, 24]">
|
||||
<j-col :span="24"><TopCard @serviceChange='serviceChange' /> </j-col>
|
||||
<j-col :span="24"><Network :serviceId='serviceId' /></j-col>
|
||||
<j-col :span="12"><Cpu :serviceId='serviceId'/></j-col>
|
||||
<j-col :span="12"><Jvm :serviceId='serviceId'/></j-col>
|
||||
<j-col :span="24" v-if="isNoCommunity"><Network :serviceId='serviceId' /></j-col>
|
||||
<j-col :span="12"><Cpu :isNoCommunity="isNoCommunity" :serviceId='serviceId'/></j-col>
|
||||
<j-col :span="12"><Jvm :isNoCommunity="isNoCommunity" :serviceId='serviceId'/></j-col>
|
||||
</j-row>
|
||||
</div>
|
||||
</page-container>
|
||||
|
@ -16,6 +16,7 @@ import TopCard from './components/TopCard.vue';
|
|||
import Network from './components/Network.vue';
|
||||
import Cpu from './components/Cpu.vue';
|
||||
import Jvm from './components/Jvm.vue';
|
||||
import { isNoCommunity } from '@/utils/utils'
|
||||
|
||||
const serviceId = ref<string | undefined>()
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ const form = reactive({
|
|||
const updateTree = updatePrimissTree_api(roleId, {
|
||||
menus: form.menus,
|
||||
});
|
||||
console.log(form.menus);
|
||||
// console.log(form.menus);
|
||||
Promise.all([updateRole, updateTree]).then((resp) => {
|
||||
message.success('操作成功');
|
||||
// jumpPage(`system/Role`);
|
||||
|
|
|
@ -118,6 +118,7 @@ const props = defineProps({
|
|||
});
|
||||
const treeRef = ref();
|
||||
let { ctx: that, proxy } = getCurrentInstance();
|
||||
const flatTableData: tableItemType[] = []; // 表格数据的扁平化版本--浅克隆 方便进行对表格数据进行操作
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
@ -227,8 +228,6 @@ const resetBulk = () => {
|
|||
bulkShow.value = false;
|
||||
};
|
||||
// ------------下面为表格内容部分------------------
|
||||
const flatTableData: tableItemType[] = []; // 表格数据的扁平化版本--浅克隆 方便进行对表格数据进行操作
|
||||
|
||||
const init = () => {
|
||||
getAllPermiss();
|
||||
// 监听权限的修改情况,产生修改后反馈给父组件
|
||||
|
@ -407,8 +406,8 @@ function actionChange(row: tableItemType) {
|
|||
* 将树形结构的表格数据拍扁为一个普通数组
|
||||
* @param treeData
|
||||
*/
|
||||
function treeToSimple(treeData: tableItemType[]) {
|
||||
treeData.forEach((item) => {
|
||||
function treeToSimple(_treeData: tableItemType[]) {
|
||||
_treeData.forEach((item) => {
|
||||
// 数据权限回填
|
||||
if (item.accessSupport && item.accessSupport.value === 'support') {
|
||||
const select =
|
||||
|
@ -416,13 +415,18 @@ function treeToSimple(treeData: tableItemType[]) {
|
|||
{};
|
||||
item.selectAccesses = select.supportId || '';
|
||||
}
|
||||
if (item.buttons && item.buttons.length > 0) setStatus(item, 'buttons');
|
||||
else setStatus(item, 'children');
|
||||
if (item.buttons && item.buttons.length > 0) {
|
||||
setStatus(item, 'buttons');
|
||||
} else {
|
||||
setStatus(item, 'children');
|
||||
}
|
||||
if(item.children){
|
||||
treeToSimple(item.children);
|
||||
}
|
||||
flatTableData.push(item);
|
||||
item.children && treeToSimple(item.children);
|
||||
});
|
||||
// console.log('flatTableData: ', flatTableData);
|
||||
// 根据所有权限, 取assetAccesses并集数据
|
||||
if(isNoCommunity){
|
||||
let assets: any[] = [];
|
||||
flatTableData?.forEach((item: any) => {
|
||||
assets = [...assets, ...item.assetAccesses];
|
||||
|
@ -432,6 +436,7 @@ function treeToSimple(treeData: tableItemType[]) {
|
|||
value: m.supportId,
|
||||
}));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 设置子节点的状态
|
||||
* @param childrens
|
||||
|
|
Loading…
Reference in New Issue