fix: bug#11037 11041 11051 11066
This commit is contained in:
parent
b8dac68cfa
commit
ace81f616d
|
|
@ -439,7 +439,7 @@ const setDevMesChartOption = (
|
|||
// // },
|
||||
// },
|
||||
{
|
||||
name: '占比',
|
||||
name: '消息量',
|
||||
data: y,
|
||||
// data: percentageY,
|
||||
type: 'line',
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
justify-content: center;
|
||||
height: 630px;
|
||||
padding: 20px;
|
||||
background-color: #e6e6e6;
|
||||
border: 1px solid #e6e6e6;
|
||||
}
|
||||
|
||||
.driver {
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
line-height: 22px !important;
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.driver-prev-btn.driver-disabled {
|
||||
display: none !important;
|
||||
}
|
||||
|
|
@ -70,4 +71,4 @@
|
|||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -419,7 +419,6 @@ import { marked } from 'marked';
|
|||
import type { TableColumnType } from 'ant-design-vue';
|
||||
import { useMenuStore } from '@/store/menu';
|
||||
import _ from 'lodash';
|
||||
import encodeQuery from '@/utils/encodeQuery';
|
||||
|
||||
const tableRef = ref();
|
||||
const formRef = ref();
|
||||
|
|
@ -1060,13 +1059,6 @@ nextTick(() => {
|
|||
.item-style {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.info {
|
||||
height: 630px;
|
||||
padding: 20px;
|
||||
background-color: #e6e6e6;
|
||||
}
|
||||
|
||||
.ellipsis-style {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ const deviceList = ref([
|
|||
const form = reactive({
|
||||
id: undefined,
|
||||
name: '',
|
||||
classifiedId: '',
|
||||
classifiedId: undefined,
|
||||
classifiedName: '',
|
||||
deviceType: '',
|
||||
describe: undefined,
|
||||
|
|
@ -278,7 +278,7 @@ const show = (data: any) => {
|
|||
idDisabled.value = true;
|
||||
} else if (props.isAdd === 1) {
|
||||
form.name = '';
|
||||
form.classifiedId = '';
|
||||
form.classifiedId = undefined;
|
||||
form.classifiedName = '';
|
||||
form.photoUrl = getImage('/device/instance/device-card.png');
|
||||
form.deviceType = '';
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
/>
|
||||
</j-tooltip>
|
||||
</template>
|
||||
<j-input v-model:value="modalForm.publicHost">
|
||||
<j-input v-model:value="modalForm.publicHost" placeholder="请输入公网地址">
|
||||
</j-input>
|
||||
</j-form-item>
|
||||
</j-col>
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
/>
|
||||
</j-tooltip>
|
||||
</template>
|
||||
<j-select v-model:value="modalForm.port">
|
||||
<j-select v-model:value="modalForm.port" placeholder="请选择本地端口" show-search>
|
||||
<j-select-option
|
||||
v-for="item in optionPorts"
|
||||
:key="item"
|
||||
|
|
@ -105,6 +105,7 @@
|
|||
</template>
|
||||
<j-input-number
|
||||
v-model:value="modalForm.publicPort"
|
||||
placeholder="请输入公网端口"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</j-form-item>
|
||||
|
|
@ -142,9 +143,6 @@ const visible = ref<boolean>(false);
|
|||
*/
|
||||
const modalForm = reactive<modalState>({
|
||||
host: '0.0.0.0',
|
||||
port: '',
|
||||
publicHost: '',
|
||||
publicPort: null,
|
||||
});
|
||||
/**
|
||||
* 校验官网地址
|
||||
|
|
|
|||
|
|
@ -13,68 +13,80 @@
|
|||
<script lang="ts" setup>
|
||||
import { getImage } from '@/utils/comm';
|
||||
import BaseMenu from '../data/baseMenu';
|
||||
import { getSystemPermission } from '@/api/initHome'
|
||||
import { getSystemPermission , updateMenus } from '@/api/initHome';
|
||||
/**
|
||||
* 获取菜单数据
|
||||
*/
|
||||
const menuDatas = reactive({
|
||||
count: 0,
|
||||
/**
|
||||
* 获取当前系统权限信息
|
||||
*/
|
||||
getSystemPermissionData: async () => {
|
||||
const resp = await getSystemPermission();
|
||||
if (resp.status === 200) {
|
||||
const newTree = menuDatas.filterMenu(
|
||||
resp.result.map((item: any) => JSON.parse(item).id),
|
||||
BaseMenu,
|
||||
);
|
||||
const _count = menuDatas.menuCount(newTree);
|
||||
menuDatas.count = _count;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 过滤菜单
|
||||
*/
|
||||
filterMenu: (permissions: string[], menus: any[]) => {
|
||||
return menus.filter((item) => {
|
||||
let isShow = false;
|
||||
if (item.showPage && item.showPage.length) {
|
||||
isShow = item.showPage.every((pItem: any) => {
|
||||
return permissions.includes(pItem);
|
||||
});
|
||||
}
|
||||
if (item.children) {
|
||||
item.children = menuDatas.filterMenu(
|
||||
permissions,
|
||||
item.children,
|
||||
);
|
||||
}
|
||||
return isShow || !!item.children?.length;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 计算菜单数量
|
||||
*/
|
||||
menuCount: (menus: any[]) => {
|
||||
return menus.reduce((pre, next) => {
|
||||
let _count = 1;
|
||||
if (next.children) {
|
||||
_count = menuDatas.menuCount(next.children);
|
||||
}
|
||||
return pre + _count;
|
||||
}, 0);
|
||||
},
|
||||
current:undefined,
|
||||
});
|
||||
/**
|
||||
* 获取当前系统权限信息
|
||||
*/
|
||||
const getSystemPermissionData = async () => {
|
||||
const resp = await getSystemPermission();
|
||||
if (resp.status === 200) {
|
||||
const newTree = filterMenu(
|
||||
resp.result.map((item: any) => JSON.parse(item).id),
|
||||
BaseMenu,
|
||||
);
|
||||
const _count = menuCount(newTree);
|
||||
menuDatas.current = newTree;
|
||||
menuDatas.count = _count;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 过滤菜单
|
||||
*/
|
||||
const filterMenu = (permissions: string[], menus: any[]) => {
|
||||
return menus.filter((item) => {
|
||||
let isShow = false;
|
||||
if (item.showPage && item.showPage.length) {
|
||||
isShow = item.showPage.every((pItem: any) => {
|
||||
return permissions.includes(pItem);
|
||||
});
|
||||
}
|
||||
if (item.children) {
|
||||
item.children = filterMenu(permissions, item.children);
|
||||
}
|
||||
return isShow || !!item.children?.length;
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 计算菜单数量
|
||||
*/
|
||||
const menuCount = (menus: any[]) => {
|
||||
return menus.reduce((pre, next) => {
|
||||
let _count = 1;
|
||||
if (next.children) {
|
||||
_count = menuCount(next.children);
|
||||
}
|
||||
return pre + _count;
|
||||
}, 0);
|
||||
};
|
||||
/**
|
||||
* 初始化菜单
|
||||
*/
|
||||
const initMenu = () =>{
|
||||
return new Promise((resolve) => {
|
||||
updateMenus(menuDatas.current).then((res) => {
|
||||
resolve(res.status === 200);
|
||||
})
|
||||
})
|
||||
}
|
||||
const { count } = toRefs(menuDatas);
|
||||
menuDatas.getSystemPermissionData();
|
||||
getSystemPermissionData();
|
||||
defineExpose({
|
||||
updataMenu:initMenu
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.menu-style {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.menu-img {
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
.menu-style {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.menu-img {
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -29,6 +29,21 @@ export const RoleData = {
|
|||
|
||||
export default {
|
||||
[ROLEKEYS.device]: [
|
||||
{
|
||||
assetAccesses: [],
|
||||
code: "device/DashBoard",
|
||||
createTime: 1679906031144,
|
||||
granted: true,
|
||||
icon: "icon-keshihua",
|
||||
id:"68a02c9efa9fb4885c89b007f97d074d",
|
||||
level:3,
|
||||
name:"仪表盘",
|
||||
owner: "iot",
|
||||
parentId :"b6327c3ff01b49c9a7a96101606dc27a",
|
||||
path:"WXaI-KCgA-gBU0",
|
||||
sortIndex:1,
|
||||
url:"/iot/device/DashBoard",
|
||||
},
|
||||
{
|
||||
id: '1-3-2',
|
||||
parentId: '1-3',
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import type { UploadChangeParam, UploadProps } from 'ant-design-vue';
|
|||
/** 初始化数据提交表单 */
|
||||
export interface modalState {
|
||||
host: string; // 本地地址
|
||||
port: string; // 本地端口
|
||||
publicHost: string; // 公网地址
|
||||
publicPort: number | null; // 公网端口
|
||||
port?: string; // 本地端口
|
||||
publicHost?: string; // 公网地址
|
||||
publicPort?: number | null; // 公网端口
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@
|
|||
</template>
|
||||
<Basic ref="basicRef" />
|
||||
</j-collapse-panel>
|
||||
<j-collapse-panel key="2" >
|
||||
<j-collapse-panel key="2" forceRender>
|
||||
<template #header>
|
||||
<span class="title">菜单初始化</span>
|
||||
<span class="sub-title"
|
||||
>初始化菜单数据</span
|
||||
>
|
||||
</template>
|
||||
<Menu></Menu>
|
||||
<Menu ref="menuRef"></Menu>
|
||||
</j-collapse-panel>
|
||||
<j-collapse-panel key="3" forceRender>
|
||||
<template #header>
|
||||
|
|
@ -74,6 +74,7 @@ import { message } from 'jetlinks-ui-components';
|
|||
const basicRef = ref();
|
||||
const roleRef = ref();
|
||||
const initDataRef = ref();
|
||||
const menuRef = ref();
|
||||
const loading = ref(false);
|
||||
/**
|
||||
* 默认打开第一个初始菜单
|
||||
|
|
@ -97,11 +98,12 @@ const jump = () => {
|
|||
const submitData = async () => {
|
||||
loading.value = true;
|
||||
const basicRes = await basicRef.value.submitBasic();
|
||||
const menuRes = await menuRef.value.updataMenu();
|
||||
const roleRes = await roleRef.value.submitRole();
|
||||
const initDataRes = await initDataRef.value.save();
|
||||
loading.value = false;
|
||||
// 当前数据是否成功提交
|
||||
if (basicRes && roleRes && initDataRes) {
|
||||
if (basicRes && menuRes && roleRes && initDataRes ) {
|
||||
message.success('保存成功');
|
||||
// // 记录初始化数据,跳转首页
|
||||
const res = await saveInit();
|
||||
|
|
|
|||
|
|
@ -83,10 +83,10 @@ const form = reactive({
|
|||
const updateTree = updatePrimissTree_api(roleId, {
|
||||
menus: form.menus,
|
||||
});
|
||||
|
||||
console.log(form.menus);
|
||||
Promise.all([updateRole, updateTree]).then((resp) => {
|
||||
message.success('操作成功');
|
||||
router.push('/system/Role');
|
||||
// router.push('/system/Role');
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue