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 { defineStore } from 'pinia'
|
||||||
import { queryOwnThree } from '@/api/system/menu'
|
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 { cloneDeep, isArray } from 'lodash-es'
|
||||||
import { usePermissionStore } from './permission'
|
import { usePermissionStore } from './permission'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import { onlyMessage } from '@/utils/comm'
|
import { onlyMessage } from '@/utils/comm'
|
||||||
import { AccountMenu, NotificationRecordCode, NotificationSubscriptionCode } from '@/router/menu'
|
import { AccountMenu, NotificationRecordCode, NotificationSubscriptionCode } from '@/router/menu'
|
||||||
import { MESSAGE_SUBSCRIBE_MENU_CODE, USER_CENTER_MENU_CODE } from '@/utils/consts'
|
import { MESSAGE_SUBSCRIBE_MENU_CODE, USER_CENTER_MENU_CODE } from '@/utils/consts'
|
||||||
|
import {isNoCommunity} from "@/utils/utils";
|
||||||
|
|
||||||
const defaultOwnParams = [
|
const defaultOwnParams = [
|
||||||
{
|
{
|
||||||
|
@ -95,15 +96,19 @@ export const useMenuStore = defineStore({
|
||||||
const resp = await queryOwnThree({ paging: false, terms: defaultOwnParams })
|
const resp = await queryOwnThree({ paging: false, terms: defaultOwnParams })
|
||||||
if (resp.success) {
|
if (resp.success) {
|
||||||
const permission = usePermissionStore()
|
const permission = usePermissionStore()
|
||||||
|
let resultData = resp.result
|
||||||
|
if (!isNoCommunity) {
|
||||||
|
resultData = filterCommunityMenus(resultData)
|
||||||
|
}
|
||||||
permission.permissions = {}
|
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) {
|
if (!hasMessageSub) {
|
||||||
AccountMenu.children = AccountMenu.children.filter((item: { code: string }) => ![NotificationSubscriptionCode, NotificationRecordCode].includes(item.code) )
|
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) => {
|
Object.keys(this.menus).forEach((item) => {
|
||||||
const _item = this.menus[item]
|
const _item = this.menus[item]
|
||||||
if (_item.buttons?.length) {
|
if (_item.buttons?.length) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
import { BlankLayoutPage, BasicLayoutPage } from 'components/Layout'
|
import { BlankLayoutPage, BasicLayoutPage } from 'components/Layout'
|
||||||
|
import { isNoCommunity } from '@/utils/utils'
|
||||||
|
|
||||||
const pagesComponent = import.meta.glob('../views/**/*.vue');
|
const pagesComponent = import.meta.glob('../views/**/*.vue');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,6 +208,16 @@ const findDetailRoutes = (routes: any[]): any[] => {
|
||||||
return newRoutes
|
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[]) => {
|
export const findCodeRoute = (asyncRouterMap: any[]) => {
|
||||||
const routeMeta = {}
|
const routeMeta = {}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="device-count-container">
|
<div class="device-count-container">
|
||||||
<h5 class="title">设备统计</h5>
|
<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-list">
|
||||||
<div class="box-item">
|
<div class="box-item">
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getDeviceCount_api, getProductCount_api } from '@/api/home';
|
import { getDeviceCount_api, getProductCount_api } from '@/api/home';
|
||||||
import { useMenuStore } from '@/store/menu';
|
import { useMenuStore } from '@/store/menu';
|
||||||
|
import { isNoCommunity } from '@/utils/utils'
|
||||||
|
|
||||||
const { jumpPage } = useMenuStore();
|
const { jumpPage } = useMenuStore();
|
||||||
const projectNum = ref(0);
|
const projectNum = ref(0);
|
||||||
|
|
|
@ -61,10 +61,15 @@ import {
|
||||||
} from './tool.ts';
|
} from './tool.ts';
|
||||||
import { DataType } from '../typings';
|
import { DataType } from '../typings';
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
serviceId: {
|
serviceId: {
|
||||||
type: String,
|
type: String,
|
||||||
default: undefined
|
default: undefined
|
||||||
|
},
|
||||||
|
isNoCommunity: {
|
||||||
|
type:Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -86,7 +91,8 @@ const getCPUEcharts = async (val: any) => {
|
||||||
const _cpuOptions = {};
|
const _cpuOptions = {};
|
||||||
const _cpuXAxis = new Set();
|
const _cpuXAxis = new Set();
|
||||||
if (res.result?.length) {
|
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) => {
|
filterArray.forEach((item: any) => {
|
||||||
const value = item.data.value;
|
const value = item.data.value;
|
||||||
const nodeID = item.data.clusterNodeId;
|
const nodeID = item.data.clusterNodeId;
|
||||||
|
@ -97,7 +103,7 @@ const getCPUEcharts = async (val: any) => {
|
||||||
if (!_cpuOptions[nodeID]) {
|
if (!_cpuOptions[nodeID]) {
|
||||||
_cpuOptions[nodeID] = [];
|
_cpuOptions[nodeID] = [];
|
||||||
}
|
}
|
||||||
_cpuOptions[nodeID].push(
|
_cpuOptions[nodeID]?.push(
|
||||||
Number(value.cpuSystemUsage).toFixed(2),
|
Number(value.cpuSystemUsage).toFixed(2),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -179,8 +185,10 @@ watch(
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const time = data.value.time
|
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]) {
|
||||||
getCPUEcharts(data.value);
|
if (!props.isNoCommunity || props.serviceId) {
|
||||||
|
getCPUEcharts(data.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,10 @@ const props = defineProps({
|
||||||
serviceId: {
|
serviceId: {
|
||||||
type: String,
|
type: String,
|
||||||
default: undefined
|
default: undefined
|
||||||
|
},
|
||||||
|
isNoCommunity: {
|
||||||
|
type:Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -86,7 +90,7 @@ const getJVMEcharts = async (val: any) => {
|
||||||
const _jvmOptions = {};
|
const _jvmOptions = {};
|
||||||
const _jvmXAxis = new Set();
|
const _jvmXAxis = new Set();
|
||||||
if (res.result?.length) {
|
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) => {
|
filterArray.forEach((item: any) => {
|
||||||
const value = item.data.value;
|
const value = item.data.value;
|
||||||
const memoryJvmHeapFree = value.memoryJvmHeapFree;
|
const memoryJvmHeapFree = value.memoryJvmHeapFree;
|
||||||
|
@ -104,7 +108,7 @@ const getJVMEcharts = async (val: any) => {
|
||||||
_jvmXAxis.add(
|
_jvmXAxis.add(
|
||||||
dayjs(value.timestamp).format('YYYY-MM-DD HH:mm'),
|
dayjs(value.timestamp).format('YYYY-MM-DD HH:mm'),
|
||||||
);
|
);
|
||||||
_jvmOptions[nodeID].push(_value);
|
_jvmOptions[nodeID]?.push(_value);
|
||||||
});
|
});
|
||||||
handleJVMOptions(_jvmOptions, [..._jvmXAxis.keys()]);
|
handleJVMOptions(_jvmOptions, [..._jvmXAxis.keys()]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -183,8 +187,10 @@ watch(
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const time = data.value.time
|
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]) {
|
||||||
getJVMEcharts(data.value);
|
if (!props.isNoCommunity || props.serviceId) {
|
||||||
|
getJVMEcharts(data.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,8 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
getData()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
<div>
|
<div>
|
||||||
<j-row :gutter="[24, 24]">
|
<j-row :gutter="[24, 24]">
|
||||||
<j-col :span="24"><TopCard @serviceChange='serviceChange' /> </j-col>
|
<j-col :span="24"><TopCard @serviceChange='serviceChange' /> </j-col>
|
||||||
<j-col :span="24"><Network :serviceId='serviceId' /></j-col>
|
<j-col :span="24" v-if="isNoCommunity"><Network :serviceId='serviceId' /></j-col>
|
||||||
<j-col :span="12"><Cpu :serviceId='serviceId'/></j-col>
|
<j-col :span="12"><Cpu :isNoCommunity="isNoCommunity" :serviceId='serviceId'/></j-col>
|
||||||
<j-col :span="12"><Jvm :serviceId='serviceId'/></j-col>
|
<j-col :span="12"><Jvm :isNoCommunity="isNoCommunity" :serviceId='serviceId'/></j-col>
|
||||||
</j-row>
|
</j-row>
|
||||||
</div>
|
</div>
|
||||||
</page-container>
|
</page-container>
|
||||||
|
@ -16,6 +16,7 @@ import TopCard from './components/TopCard.vue';
|
||||||
import Network from './components/Network.vue';
|
import Network from './components/Network.vue';
|
||||||
import Cpu from './components/Cpu.vue';
|
import Cpu from './components/Cpu.vue';
|
||||||
import Jvm from './components/Jvm.vue';
|
import Jvm from './components/Jvm.vue';
|
||||||
|
import { isNoCommunity } from '@/utils/utils'
|
||||||
|
|
||||||
const serviceId = ref<string | undefined>()
|
const serviceId = ref<string | undefined>()
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ const form = reactive({
|
||||||
const updateTree = updatePrimissTree_api(roleId, {
|
const updateTree = updatePrimissTree_api(roleId, {
|
||||||
menus: form.menus,
|
menus: form.menus,
|
||||||
});
|
});
|
||||||
console.log(form.menus);
|
// console.log(form.menus);
|
||||||
Promise.all([updateRole, updateTree]).then((resp) => {
|
Promise.all([updateRole, updateTree]).then((resp) => {
|
||||||
message.success('操作成功');
|
message.success('操作成功');
|
||||||
// jumpPage(`system/Role`);
|
// jumpPage(`system/Role`);
|
||||||
|
|
|
@ -118,6 +118,7 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
const treeRef = ref();
|
const treeRef = ref();
|
||||||
let { ctx: that, proxy } = getCurrentInstance();
|
let { ctx: that, proxy } = getCurrentInstance();
|
||||||
|
const flatTableData: tableItemType[] = []; // 表格数据的扁平化版本--浅克隆 方便进行对表格数据进行操作
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
@ -227,8 +228,6 @@ const resetBulk = () => {
|
||||||
bulkShow.value = false;
|
bulkShow.value = false;
|
||||||
};
|
};
|
||||||
// ------------下面为表格内容部分------------------
|
// ------------下面为表格内容部分------------------
|
||||||
const flatTableData: tableItemType[] = []; // 表格数据的扁平化版本--浅克隆 方便进行对表格数据进行操作
|
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
getAllPermiss();
|
getAllPermiss();
|
||||||
// 监听权限的修改情况,产生修改后反馈给父组件
|
// 监听权限的修改情况,产生修改后反馈给父组件
|
||||||
|
@ -407,8 +406,8 @@ function actionChange(row: tableItemType) {
|
||||||
* 将树形结构的表格数据拍扁为一个普通数组
|
* 将树形结构的表格数据拍扁为一个普通数组
|
||||||
* @param treeData
|
* @param treeData
|
||||||
*/
|
*/
|
||||||
function treeToSimple(treeData: tableItemType[]) {
|
function treeToSimple(_treeData: tableItemType[]) {
|
||||||
treeData.forEach((item) => {
|
_treeData.forEach((item) => {
|
||||||
// 数据权限回填
|
// 数据权限回填
|
||||||
if (item.accessSupport && item.accessSupport.value === 'support') {
|
if (item.accessSupport && item.accessSupport.value === 'support') {
|
||||||
const select =
|
const select =
|
||||||
|
@ -416,21 +415,27 @@ function treeToSimple(treeData: tableItemType[]) {
|
||||||
{};
|
{};
|
||||||
item.selectAccesses = select.supportId || '';
|
item.selectAccesses = select.supportId || '';
|
||||||
}
|
}
|
||||||
if (item.buttons && item.buttons.length > 0) setStatus(item, 'buttons');
|
if (item.buttons && item.buttons.length > 0) {
|
||||||
else setStatus(item, 'children');
|
setStatus(item, 'buttons');
|
||||||
|
} else {
|
||||||
|
setStatus(item, 'children');
|
||||||
|
}
|
||||||
|
if(item.children){
|
||||||
|
treeToSimple(item.children);
|
||||||
|
}
|
||||||
flatTableData.push(item);
|
flatTableData.push(item);
|
||||||
item.children && treeToSimple(item.children);
|
|
||||||
});
|
});
|
||||||
// console.log('flatTableData: ', flatTableData);
|
|
||||||
// 根据所有权限, 取assetAccesses并集数据
|
// 根据所有权限, 取assetAccesses并集数据
|
||||||
let assets: any[] = [];
|
if(isNoCommunity){
|
||||||
flatTableData?.forEach((item: any) => {
|
let assets: any[] = [];
|
||||||
assets = [...assets, ...item.assetAccesses];
|
flatTableData?.forEach((item: any) => {
|
||||||
});
|
assets = [...assets, ...item.assetAccesses];
|
||||||
bulkOptions.value = uniqBy(assets, 'supportId')?.map((m: any) => ({
|
});
|
||||||
label: m.name,
|
bulkOptions.value = uniqBy(assets, 'supportId')?.map((m: any) => ({
|
||||||
value: m.supportId,
|
label: m.name,
|
||||||
}));
|
value: m.supportId,
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 设置子节点的状态
|
* 设置子节点的状态
|
||||||
|
|
Loading…
Reference in New Issue