From 49cf7c5594fc61bc330567de3015441972a14760 Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Wed, 26 Jul 2023 10:09:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96monaco-editor=E7=BC=96?= =?UTF-8?q?=E8=BE=91=EF=BC=9B=E4=BF=AE=E6=94=B9=E6=88=91=E7=9A=84=E8=AE=A2?= =?UTF-8?q?=E9=98=85=EF=BC=9B=E4=BF=AE=E5=A4=8D=E8=BF=90=E7=BB=B4=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=BB=AA=E8=A1=A8=E7=9B=98=E5=9C=A8=E6=9A=82=E6=97=A0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=83=85=E5=86=B5=E4=B8=8B=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=97=A0=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 优化菜单跳转 * fix: 优化菜单跳转 * fix: bug#16693 * feat: task#2572 * fix: 优化物模型映射保存请求异常 * fix: 修复运维管理仪表盘在暂无数据情况下切换导致无数据展示问题 * fix: 修改订阅管理文字提示 * fix: totalFlow * fix: 修改我的订阅 * fix: 优化monaco-editor编辑 --- package.json | 2 +- src/App.vue | 5 - src/api/data-collect/collector.ts | 3 + src/components/Layout/BasicLayoutPage.vue | 124 ++--- src/components/Layout/BlankLayoutPage.vue | 20 +- src/store/menu.ts | 39 +- src/store/permission.ts | 13 + src/store/system.ts | 12 + src/utils/menu.ts | 486 ++++++++++++------ .../DataCollect/Collector/Tree/Save/index.vue | 45 +- .../DataCollect/Collector/Tree/index.vue | 16 +- src/views/DataCollect/Collector/data.ts | 2 + .../Center/components/EditInfo/index.vue | 4 +- .../components/Subscribe/components/Bind.vue | 2 +- .../components/Subscribe/components/Card.vue | 62 ++- .../Subscribe/components/Detail.vue | 49 +- .../Subscribe/components/Unsubscribe.vue | 2 +- .../Instance/Detail/MetadataMap/index.vue | 2 +- src/views/device/Instance/Detail/index.vue | 2 +- .../Product/Detail/MetadataMap/index.vue | 2 +- src/views/device/Product/Save/index.vue | 2 +- .../device/components/InklingDevice/index.vue | 96 +++- .../device/components/Metadata/Base/Base.vue | 41 +- .../components/Metadata/Base/columns.tsx | 32 +- src/views/iot-card/CardManagement/index.vue | 10 +- src/views/link/DashBoard/components/Cpu.vue | 1 + src/views/link/DashBoard/components/Jvm.vue | 1 + .../link/DashBoard/components/Network.vue | 1 + .../link/DashBoard/components/echarts.vue | 2 +- .../NoticeRule/components/Auth/index.vue | 21 +- .../NoticeRule/components/Item/index.vue | 94 ++-- .../NoticeRule/components/Role/index.vue | 2 +- .../Save/components/NotifyConfig.vue | 2 +- .../Save/components/NotifyTemplate.vue | 2 +- .../components/Save/components/NotifyWay.vue | 4 +- .../NoticeRule/components/Save/index.vue | 23 +- yarn.lock | 17 +- 37 files changed, 777 insertions(+), 466 deletions(-) diff --git a/package.json b/package.json index 971fdf85..36392bc2 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "event-source-polyfill": "^1.0.31", "global": "^4.4.0", "jetlinks-store": "^0.0.3", - "jetlinks-ui-components": "^1.0.26", + "jetlinks-ui-components": "^1.0.27", "js-cookie": "^3.0.1", "jsencrypt": "^3.3.2", "less": "^4.1.3", diff --git a/src/App.vue b/src/App.vue index c1c758c3..8c6581c2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,10 +1,5 @@ - - - - - diff --git a/src/api/data-collect/collector.ts b/src/api/data-collect/collector.ts index 191913ce..53304ef6 100644 --- a/src/api/data-collect/collector.ts +++ b/src/api/data-collect/collector.ts @@ -3,6 +3,9 @@ import server from '@/utils/request'; export const queryCollector = (data: any) => server.post(`/data-collect/collector/_query/no-paging?paging=false`, data); +export const queryCollectorTree = (data: any) => + server.post(`/data-collect/collector/_detail/no-paging?paging=false`, data); + export const queryChannelNoPaging = () => server.post(`/data-collect/channel/_query/no-paging`, { paging: false, diff --git a/src/components/Layout/BasicLayoutPage.vue b/src/components/Layout/BasicLayoutPage.vue index 8f97ad37..92ab5f9d 100644 --- a/src/components/Layout/BasicLayoutPage.vue +++ b/src/components/Layout/BasicLayoutPage.vue @@ -1,12 +1,12 @@ @@ -25,9 +25,9 @@ - - - + + + @@ -54,14 +54,14 @@ const route = useRoute(); const menu = useMenuStore(); const system = useSystem(); -const {configInfo,layout} = storeToRefs(system); +const {configInfo,layout, basicLayout} = storeToRefs(system); const layoutConf = reactive({ theme: DefaultSetting.layout.theme, siderWidth: layout.value.siderWidth, logo: DefaultSetting.layout.logo, title: DefaultSetting.layout.title, - menuData: [...clearMenuItem(menu.siderMenus), AccountMenu], + menuData: [...menu.siderMenus, AccountMenu], // menuData: menu.siderMenus, splitMenus: true, }); @@ -72,87 +72,51 @@ watchEffect(() => { layoutConf.logo = configInfo.value.front?.logo || DefaultSetting.layout.logo; }) -const state = reactive({ - pure: false, - collapsed: false, // default value - openKeys: [], - selectedKeys: [], -}); +const components = computed(() => { + const componentName = route.matched[route.matched.length - 1]?.components?.default?.name + if (componentName !== 'BasicLayoutPage') { + return route.matched[route.matched.length - 1]?.components?.default + } + return undefined +}) + +/** + * 面包屑 + */ +const breadcrumbs = computed(() => + { + const paths = router.currentRoute.value.matched + + return paths.map((item, index) => { + return { + index, + isLast: index === (paths.length -1), + path: item.path, + breadcrumbName: (item.meta as any).title || '', + } + }) + } +); const routerBack = () => { router.go(-1) } -const findRouteMeta = (code: string) => { - let meta = [] - let menuItem: any = menu.menus[code] - while (menuItem) { - meta.unshift(menuItem) - if (menuItem.parentName) { - menuItem = menu.menus[menuItem.parentName] - } else { - menuItem = false - } - } - return meta -} const jump = (item: any) => { - let path = history.state.back - if (path) { - // 包含query参数,清除?参数 - if (path.includes('?')) { - const _path = path.split('?')[0] - path = _path === item.path ? path : item.path - } else if (path !== item.path) { - path = item.path - } - } else { - path = item.path - } - - // jumpPage(slotProps.route.path) - router.push(path) + router.push(item.path) } -const breadcrumb = computed(() => - { - const paths = router.currentRoute.value.name as string - const metas = findRouteMeta(paths) - return metas.map((item, index) => { - return { - index, - isLast: index === (metas.length - 1), - path: item.path, - breadcrumbName: item.title || '', - }; - }) + +watchEffect(() => { + if (router.currentRoute) { + const paths = router.currentRoute.value.matched + basicLayout.value.selectedKeys = paths.map(item => item.path) + basicLayout.value.openKeys = paths.map(item => item.path) + console.log(paths) // } -); - -watchEffect(() => { - if (router.currentRoute) { - const paths = router.currentRoute.value.name as string - if (paths) { - const _metas = findRouteMeta(paths) - state.selectedKeys = _metas.map(item => item.path) - state.openKeys = _metas.filter((r) => r !== router.currentRoute.value.path).map(item => item.path) - } - } -}); - -watchEffect(() => { - if ( - route.query && - 'layout' in route.query && - route.query.layout === 'false' - ) { - state.pure = true; - } else { - state.pure = false; - } -}); +}) const toDoc = () => window.open('http://doc.v2.jetlinks.cn/'); diff --git a/src/components/Layout/BlankLayoutPage.vue b/src/components/Layout/BlankLayoutPage.vue index 69d6fa16..72b16120 100644 --- a/src/components/Layout/BlankLayoutPage.vue +++ b/src/components/Layout/BlankLayoutPage.vue @@ -1,11 +1,21 @@ - + + + - \ No newline at end of file diff --git a/src/views/system/NoticeRule/components/Item/index.vue b/src/views/system/NoticeRule/components/Item/index.vue index 661ecd06..b4c49b9e 100644 --- a/src/views/system/NoticeRule/components/Item/index.vue +++ b/src/views/system/NoticeRule/components/Item/index.vue @@ -22,7 +22,7 @@ 暂无权限,请联系管理员 - 用于配制外层权限未配置外层权限将执行通知方式中配置的权限配置外层权限后将覆盖所有通知方式中配置的权限 + 通过角色控制【{{ data.name }}】的所有的通知方式可被哪些用户订阅。 @@ -346,49 +348,53 @@ const onSwitchChange = (e: boolean) => { if (_checked) { onAction(e); } else { - Modal.confirm({ - title: e - ? '开启后默认平台所有用户都能接收到该通知' - : '关闭后平台所有用户都不能接收到该通知', - cancelText: '取消', - okText: e ? '确认开启' : '确认关闭', - content: h( - 'div', - { - style: { - display: 'flex', - justifyContent: 'flex-end', - marginTop: '20px', - }, - }, - [ - h( - Checkbox, - { - onChange: (_e: any) => { - LocalStore.set( - user.userInfos?.username, - e - ? { - ..._value, - open: _e.target?.checked, - } - : { - ..._value, - close: _e.target?.checked, - }, - ); - }, + if (e) { + onAction(e); + } else { + Modal.confirm({ + title: e + ? '开启后默认平台所有用户都能接收到该通知' + : '关闭后平台所有用户都不能接收到该通知', + cancelText: '取消', + okText: e ? '确认开启' : '确认关闭', + content: h( + 'div', + { + style: { + display: 'flex', + justifyContent: 'flex-end', + marginTop: '20px', }, - '不再提示', - ), - ], - ), - onOk() { - onAction(e); - }, - onCancel() {}, - }); + }, + [ + h( + Checkbox, + { + onChange: (_e: any) => { + LocalStore.set( + user.userInfos?.username, + e + ? { + ..._value, + open: _e.target?.checked, + } + : { + ..._value, + close: _e.target?.checked, + }, + ); + }, + }, + '不再提示', + ), + ], + ), + onOk() { + onAction(e); + }, + onCancel() {}, + }); + } } }; @@ -489,7 +495,7 @@ const onSave = (_data: any) => { .box-item-add { cursor: pointer; - background-color: #F7F8FA; + background-color: #f7f8fa; width: 54px; height: 54px; display: flex; diff --git a/src/views/system/NoticeRule/components/Role/index.vue b/src/views/system/NoticeRule/components/Role/index.vue index 4b1010af..7188b5ed 100644 --- a/src/views/system/NoticeRule/components/Role/index.vue +++ b/src/views/system/NoticeRule/components/Role/index.vue @@ -70,7 +70,7 @@ - + 钉钉群机器人类型的配置在当前页面将被过滤 - + 已规定固定收信人的模板在当前页面将被过滤 - + { iconUrl: iconMap.get(item.id), }; }); + emit('update:value', options.value?.[0]?.value); + emit('update:name', options.value?.[0]?.label); + emit('change', {label: options.value?.[0]?.label, value: options.value?.[0]?.value}); } loading.value = false; }); - notifyType.value = props.value; }); diff --git a/src/views/system/NoticeRule/components/Save/index.vue b/src/views/system/NoticeRule/components/Save/index.vue index a4c3d280..fca7e00c 100644 --- a/src/views/system/NoticeRule/components/Save/index.vue +++ b/src/views/system/NoticeRule/components/Save/index.vue @@ -11,11 +11,12 @@ {{ item - }} + }} - 内层权限配置外层权限已配置的情况下,将取外层权限与当前页面分配权限的交集,向对应角色发送通知。外层权限未配置的情况下,将按此处配置的权限发送通知。 + + 通过角色控制【{{ name }}】下的【{{ showName }}通知】可被哪些用户订阅。 + 注意:当前配置会被外层【{{ name }}】中的权限控制覆盖。 + @@ -32,6 +33,7 @@ @@ -161,6 +163,10 @@ const props = defineProps({ type: String, default: '', }, + name: { + type: String, + default: '', + }, }); const stepList = [ @@ -190,14 +196,15 @@ const formModel = reactive<{ }); const variableRef = ref(); const formRef = ref(); +const showName = ref('钉钉') const _getType = computed(() => { - if(['notifier-dingTalk'].includes(props.data?.channelProvider)) { - return ['user', 'tag'] + if (['notifier-dingTalk'].includes(props.data?.channelProvider)) { + return ['user', 'tag']; } else { - return ['user', 'org', 'tag'] + return ['user', 'org', 'tag']; } -}) +}); const _variableDefinitions = computed(() => { return variable.value.filter((item: any) => { diff --git a/yarn.lock b/yarn.lock index 5a0e275e..267e7848 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3738,7 +3738,7 @@ 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.23, jetlinks-ui-components@^1.0.26: +jetlinks-ui-components@^1.0.23: version "1.0.26" resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.26.tgz#26896c578396b09d49649ac87c3943491af3a9ae" integrity sha512-HkLk52C6pDKe/Ca9O4w34h1/PrC7GdBUheiicPOX2V/Lc49N+WzI9wmrCd82XBm8MocPM4gAOJxNaTxY20EO9w== @@ -3753,6 +3753,21 @@ jetlinks-ui-components@^1.0.23, jetlinks-ui-components@^1.0.26: sortablejs "^1.15.0" vuedraggable "^4.1.0" +jetlinks-ui-components@^1.0.27: + version "1.0.27" + resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.27.tgz#c2e62ebf26d9465aed5489fdde37297738d57f2b" + integrity sha512-IVWCPfC5awTIIMQ5t6V5KTHLjfENj0owb6HsHxqRLrHebz7FaDng6oNfebvn17P+gHGVwwMemTCF7b8PpWFiwg== + dependencies: + "@vueuse/core" "^9.12.0" + "@vueuse/router" "^9.13.0" + ant-design-vue "^3.2.15" + colorpicker-v3 "^2.10.2" + jetlinks-ui-components "^1.0.23" + lodash-es "^4.17.21" + monaco-editor "^0.40.0" + sortablejs "^1.15.0" + vuedraggable "^4.1.0" + js-cookie@^3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.1.tgz"