From c4e2451ac8c858007fbc110d69d0010586080733 Mon Sep 17 00:00:00 2001 From: sheng <15292050171@163.com> Date: Mon, 31 Jul 2023 14:49:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/.env.development | 2 +- web/src/App.vue | 31 ++++----- .../system/dept/components/DeptFormCom.vue | 65 +++++++++++++------ .../dept/components/DeptUserCom/crud.tsx | 1 + .../views/system/dept/components/TreeCom.vue | 24 ++++--- web/src/views/system/dept/index.vue | 55 +++++++--------- web/src/views/system/dept/types.ts | 3 +- 7 files changed, 101 insertions(+), 80 deletions(-) diff --git a/web/.env.development b/web/.env.development index 93206aa..c6e45b8 100644 --- a/web/.env.development +++ b/web/.env.development @@ -3,7 +3,7 @@ ENV = 'development' # 本地环境接口地址 #`VITE_API_URL = 'https://demo.dvadmin.com/api' -VITE_API_URL = 'http://192.168.1.160:8003' +VITE_API_URL = 'http://192.168.1.94:10000' # 是否启用按钮权限 VITE_PM_ENABLED = true diff --git a/web/src/App.vue b/web/src/App.vue index 83d312a..ec824fa 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -34,8 +34,8 @@ const route = useRoute(); const stores = useTagsViewRoutes(); const storesThemeConfig = useThemeConfig(); const { themeConfig } = storeToRefs(storesThemeConfig); -import websocket from "/@/utils/websocket"; -import { ElNotification } from "element-plus"; +import websocket from '/@/utils/websocket'; +import { ElNotification } from 'element-plus'; // 获取版本号 const getVersion = computed(() => { let isVersion = false; @@ -61,11 +61,10 @@ onBeforeMount(() => { setIntroduction.jsCdn(); //websockt 模块 try { - websocket.init(wsReceive) + //websocket.init(wsReceive) } catch (e) { - console.log("websocket错误") + console.log('websocket错误'); } - }); // 页面加载时 onMounted(() => { @@ -87,7 +86,7 @@ onMounted(() => { }); // 页面销毁时,关闭监听布局配置/i18n监听 onUnmounted(() => { - mittBus.off('openSetingsDrawer', () => { }); + mittBus.off('openSetingsDrawer', () => {}); }); // 监听路由的变化,设置网站标题 watch( @@ -101,11 +100,11 @@ watch( ); // websocket相关代码 -import { messageCenterStore } from "/@/stores/messageCenter"; +import { messageCenterStore } from '/@/stores/messageCenter'; const wsReceive = (message: any) => { - const data = JSON.parse(message.data) - const { unread } = data - const messageCenter = messageCenterStore() + const data = JSON.parse(message.data); + const { unread } = data; + const messageCenter = messageCenterStore(); messageCenter.setUnread(unread); if (data.contentType === 'SYSTEM') { ElNotification({ @@ -113,14 +112,12 @@ const wsReceive = (message: any) => { message: data.content, type: 'success', position: 'bottom-right', - duration: 5000 - }) + duration: 5000, + }); } - -} +}; onBeforeUnmount(() => { // 关闭连接 - websocket.close() -}) - + websocket.close(); +}); diff --git a/web/src/views/system/dept/components/DeptFormCom.vue b/web/src/views/system/dept/components/DeptFormCom.vue index 989c0f6..0971fea 100644 --- a/web/src/views/system/dept/components/DeptFormCom.vue +++ b/web/src/views/system/dept/components/DeptFormCom.vue @@ -1,9 +1,15 @@