Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
5aa484f22a
|
@ -25,7 +25,7 @@
|
|||
"event-source-polyfill": "^1.0.31",
|
||||
"global": "^4.4.0",
|
||||
"jetlinks-store": "^0.0.3",
|
||||
"jetlinks-ui-components": "^1.0.21",
|
||||
"jetlinks-ui-components": "^1.0.22",
|
||||
"js-cookie": "^3.0.1",
|
||||
"less": "^4.1.3",
|
||||
"less-loader": "^11.1.0",
|
||||
|
|
|
@ -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 = {}
|
||||
|
||||
|
|
|
@ -9,13 +9,12 @@
|
|||
@cancel="close"
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
v-bind="layout"
|
||||
width="650px"
|
||||
:confirmLoading="loading"
|
||||
>
|
||||
<div style="margin-top: 10px">
|
||||
<j-form
|
||||
:layout="'vertical'"
|
||||
layout="vertical"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
ref="formRef"
|
||||
|
|
|
@ -449,7 +449,6 @@ const query = reactive({
|
|||
key: 'id',
|
||||
search: {
|
||||
type: 'string',
|
||||
defaultTermType: 'eq',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -458,7 +457,7 @@ const query = reactive({
|
|||
dataIndex: 'accessProvider',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: () => {
|
||||
options: async () => {
|
||||
return new Promise((resolve) => {
|
||||
getProviders().then((resp: any) => {
|
||||
const data = resp.result || [];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
{{ item.name }}
|
||||
</div>
|
||||
<div class="desc">
|
||||
<j-tooltip :title="item.description">
|
||||
{{ item.description || '' }}
|
||||
</j-tooltip>
|
||||
<j-ellipsis :lineClamp="2">
|
||||
{{ item.description || '' }}
|
||||
</j-ellipsis>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -174,11 +174,8 @@ const click = (value: object) => {
|
|||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #666666;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,8 +185,10 @@ watch(
|
|||
|
||||
watchEffect(() => {
|
||||
const time = data.value.time
|
||||
if (time && Array.isArray(time) && time.length === 2 && time[0] && props.serviceId) {
|
||||
getCPUEcharts(data.value);
|
||||
if (time && Array.isArray(time) && time.length === 2 && time[0]) {
|
||||
if (!props.isNoCommunity || props.serviceId) {
|
||||
getCPUEcharts(data.value);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -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,8 +187,10 @@ watch(
|
|||
|
||||
watchEffect(() => {
|
||||
const time = data.value.time
|
||||
if (time && Array.isArray(time) && time.length === 2 && time[0] && props.serviceId) {
|
||||
getJVMEcharts(data.value);
|
||||
if (time && Array.isArray(time) && time.length === 2 && time[0]) {
|
||||
if (!props.isNoCommunity || props.serviceId) {
|
||||
getJVMEcharts(data.value);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -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>()
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ export default defineConfig(({ mode}) => {
|
|||
// target: 'http://192.168.32.244:8881',
|
||||
target: 'http://120.77.179.54:8844', // 120测试
|
||||
// target: 'http://192.168.33.46:8844', // 本地开发环境
|
||||
ws: 'ws://192.168.33.46:8844',
|
||||
ws: 'ws://120.77.179.54:8844',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
}
|
||||
|
|
|
@ -3823,10 +3823,10 @@ jetlinks-store@^0.0.3:
|
|||
resolved "https://registry.npmjs.org/jetlinks-store/-/jetlinks-store-0.0.3.tgz"
|
||||
integrity sha512-AZf/soh1hmmwjBZ00fr1emuMEydeReaI6IBTGByQYhTmK1Zd5pQAxC7WLek2snRAn/HHDgJfVz2hjditKThl6Q==
|
||||
|
||||
jetlinks-ui-components@^1.0.21:
|
||||
version "1.0.21"
|
||||
resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.21.tgz#e2dc28682db91b4b05332fb8ec76faa2a2f4dcd2"
|
||||
integrity sha512-nlVGo2ze6e4YFPOyqS1GVCpaH9P4VGPMGYJIucTEjjMb/QqPmkwS7HcwyDX3kvb6Acb+dG5oQZlscMHIGqv0YQ==
|
||||
jetlinks-ui-components@^1.0.22:
|
||||
version "1.0.22"
|
||||
resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.22.tgz#37e49fe435d8eccd82fc4d8e94980a98aaac1922"
|
||||
integrity sha512-iI7g2ui4pSuunkyPBWkscSZeUJfJURsj5Tmbfbc04wOhQh3GA6N3gKEDIvavFWHhFk1y/6EITyOYIZT4Wf3rdg==
|
||||
dependencies:
|
||||
"@vueuse/core" "^9.12.0"
|
||||
"@vueuse/router" "^9.13.0"
|
||||
|
|
Loading…
Reference in New Issue