Explorar el Código

Merge branch 'master' of http://182.92.126.35:3000/hrx/mky-vent-base

lxh hace 6 días
padre
commit
5ebdba2c2c

BIN
src/assets/images/themify/green/vent/login/btn-bg-hover.png


BIN
src/assets/images/themify/green/vent/login/btn-bg.png


BIN
src/assets/images/themify/green/vent/login/down.png


BIN
src/assets/images/themify/green/vent/login/icon.png


BIN
src/assets/images/themify/green/vent/login/input-down.png


BIN
src/assets/images/themify/green/vent/login/input-normal.png


BIN
src/assets/images/themify/green/vent/login/top.png


+ 14 - 0
src/views/sys/login/Login.vue

@@ -85,6 +85,20 @@
     }
   }
 
+  // 绿色主题特化的变量
+  @{theme-green} {
+    .login-container {
+      --image-top: url('/@/assets/images/themify/green/vent/login/top.png');
+      --image-icon: url('/@/assets/images/themify/green/vent/login/icon.png');
+      --image-down: url('/@/assets/images/themify/green/vent/login/down.png');
+      --image-bg: none;
+      --container-bg: #181B24;
+    }
+    .login-icon {
+      width: 325px !important;
+      background-size: 100% 100%;
+    }
+  }
   // 深蓝色主题特化的变量
   @{theme-deepblue} {
     .login-container {

+ 8 - 0
src/views/sys/login/LoginForm.vue

@@ -139,6 +139,14 @@
   @import '/@/design/theme.less';
   @ventSpace: zxm;
 
+  @{theme-green} {
+    .login-box {
+      --image-input-normal: url('/@/assets/images/themify/green/vent/login/input-normal.png');
+      --image-input-down: url('/@/assets/images/themify/green/vent/login/input-down.png');
+      --image-btn-bg: url('/@/assets/images/themify/green/vent/login/btn-bg.png');
+      --image-btn-bg-hover: url('/@/assets/images/themify/green/vent/login/btn-bg-hover.png');
+    }
+  }
   @{theme-deepblue} {
     .login-box {
       --image-input-normal: url('/@/assets/images/themify/deepblue/vent/login/input-normal.png');

+ 36 - 40
src/views/vent/dataCenter/deviceCenter/index.vue

@@ -49,8 +49,8 @@
                     }
                   "
                 >
-                  <DownOutlined v-if="expandedRowKeys.includes(record.id)" />
-                  <RightOutlined v-else />
+                  <DownCircleTwoTone v-if="expandedRowKeys.includes(record.id)" />
+                  <RightCircleTwoTone v-else />
                 </a-button>
               </template>
 
@@ -94,7 +94,7 @@ import { AesEncryption } from '/@/utils/cipher';
 import { loginCipher } from '/@/settings/encryptionSetting';
 import { message, TreeProps } from 'ant-design-vue';
 import { getDeviceTypeList, getDeviceListByType, getDevMonitorListById } from './device.api';
-import { DownOutlined, RightOutlined } from '@ant-design/icons-vue';
+import { RightCircleTwoTone, DownCircleTwoTone } from '@ant-design/icons-vue';
 import { alignElement } from 'dom-align';
 import { active } from 'sortablejs';
 
@@ -113,7 +113,6 @@ const isRefresh = ref(true);
 const treeNodeTitle = ref(''); // 选中的树形标题
 const deviceList = ref<any[]>([]); // 设备列表
 const monitorList = ref<any[]>([]); // 监测数据列表
-let timer: null | NodeJS.Timeout = undefined;
 // 当前展开的行key数组
 const expandedRowKeys = ref([]);
 
@@ -207,23 +206,6 @@ const onSelect: TreeProps['onSelect'] = (keys, e) => {
     if (deviceType.value != e.node.type) deviceType.value = e.node.type;
   }
   getDeviceList(deviceType.value);
-  // clearTimeout(timer);
-  // timer = undefined;
-  // if (startMonitorTimer) {
-  //   clearTimeout(startMonitorTimer);
-  // }
-  // dataSource.value = [];
-  // // monitorTable.value.resetPagination();
-  // if (!startMonitorTimer) {
-  //   startMonitorTimer = setTimeout(() => {
-  //     expandedKeys.value = keys;
-  //     selectedKeys.value = keys;
-  //     treeNodeTitle.value = e.node.title;
-  //     if (e.node.children?.length < 1 && timer) {
-  //       // getMonitor(true);
-  //     }
-  //   }, 1000);
-  // }
 };
 
 async function findTreeDataValue(obj) {
@@ -278,12 +260,6 @@ async function findTreeDataValue(obj) {
     expandedKeys.value = [defaultData.key as string];
     treeNodeTitle.value = defaultData.title;
   }
-
-  // if (timer === undefined) {
-  //   timer = null;
-  //   await getDataSource();
-  //   getMonitor(true);
-  // }
 }
 // 获取树形菜单数据
 async function getDeviceType(sysType?) {
@@ -326,6 +302,10 @@ async function getDeviceType(sysType?) {
 // 根据选择设备获取设备列表
 async function getDeviceList(deviceTypeVal?) {
   if (!deviceTypeVal) return;
+  if (timer) {
+    clearInterval(timer);
+    timer = undefined;
+  }
   const params: any = {
     devKind: deviceTypeVal,
   };
@@ -406,6 +386,10 @@ const toggleExpand = (deviceId) => {
   if (index > -1) {
     // 如果已经展开,则关闭
     expandedRowKeys.value.splice(index, 1);
+    if (timer) {
+      clearInterval(timer);
+      timer = undefined;
+    }
   } else {
     // 如果未展开,则打开
     expandedRowKeys.value.push(deviceId);
@@ -413,24 +397,36 @@ const toggleExpand = (deviceId) => {
   }
 };
 // 加载监测数据
-const loadMonitoringData = async (deviceId) => {
-  const device = deviceList.value.find((d) => d.id === deviceId);
-
-  loadingMap[deviceId] = true;
-  try {
-    const result = await getDevMonitorListById({ devId: deviceId.toString() });
-    monitorList.value = Object.values(result.readData);
-  } catch (error) {
-    console.error(`加载设备 ${deviceId} 数据失败:`, error);
-  } finally {
-    loadingMap[deviceId] = false;
+let timer: null | NodeJS.Timeout = null;
+async function loadMonitoringData(deviceId: string) {
+  // 先清除之前的定时器
+  if (timer) {
+    clearInterval(timer);
+    timer = null;
   }
-};
+  // 定时器会在1秒后开始,所以先手动加载一次
+  refreshData(deviceId);
+  // 设置新的定时器
+  timer = setInterval(() => {
+    refreshData(deviceId);
+  }, 1000);
+}
+async function refreshData(deviceId: string) {
+  // 这里实现具体的请求逻辑
+  const device = deviceList.value.find((d) => d.id === deviceId);
+  const result = await getDevMonitorListById({ devId: deviceId.toString() });
+  monitorList.value = Object.values(result.readData);
+}
 
 onMounted(async () => {
   await getDeviceType();
 });
-onUnmounted(() => {});
+onUnmounted(() => {
+  if (timer) {
+    clearInterval(timer);
+    timer = undefined;
+  }
+});
 // 监听分页变化
 watch(
   () => [paginationState.value.current, paginationState.value.pageSize],

+ 44 - 23
src/views/vent/dataCenter/stationCenter/index.vue

@@ -11,7 +11,7 @@
           <div class="left-box">
             <div class="left-content">
               <div class="card-box" v-for="(item, index) in cardList" :key="index">
-                <div :class="item.linkstatus ? 'card-itemL' : 'card-itemD'" @click="cardClick(item, index)">
+                <div :class="activeIndex1 === index ? 'card-itemD' : 'card-itemL'" @click="cardClick(item, index)">
                   <div class="card-item-label">{{ item.strname }}</div>
                 </div>
               </div>
@@ -42,8 +42,8 @@
                     }
                   "
                 >
-                  <DownOutlined v-if="expandedRowKeys.includes(record.id)" />
-                  <RightOutlined v-else />
+                  <DownCircleTwoTone v-if="expandedRowKeys.includes(record.id)" />
+                  <RightCircleTwoTone v-else />
                 </a-button>
               </template>
 
@@ -82,7 +82,8 @@ import customHeader from '/@/components/vent/customHeader.vue';
 import { message, TreeProps } from 'ant-design-vue';
 import { getDeviceList, getDeviceListByType, getDevMonitorListById } from './device.api';
 import { subStationList } from './device.api';
-import { DownOutlined, RightOutlined } from '@ant-design/icons-vue';
+import { RightCircleTwoTone, DownCircleTwoTone } from '@ant-design/icons-vue';
+import Index from '/@/layouts/page/index.vue';
 const { hasPermission } = usePermission();
 let activeKey = ref('device');
 //当前左侧激活菜单的索引
@@ -161,6 +162,7 @@ async function getSubStationList() {
   let res = await subStationList({ pageSize: 1000, pageNo: 1 });
   if (res.length != 0) {
     cardList.value = [...res];
+    getDeviceList(cardList.value[0].id);
     openNum.value = cardList.value?.filter((v) => v.linkstatus == 1)['length'];
     clsoeNum.value = cardList.value?.filter((v) => v.linkstatus == 0)['length'];
   } else {
@@ -169,7 +171,11 @@ async function getSubStationList() {
 }
 //菜单选项切换
 function cardClick(item, ind) {
-  activeIndex1.value = item;
+  if (timer) {
+    clearInterval(timer);
+    timer = undefined;
+  }
+  activeIndex1.value = ind;
   getDeviceList(item.id);
 }
 // 当前展开的行key数组
@@ -178,10 +184,9 @@ const expandedRowKeys = ref([]);
 // 加载状态映射
 const loadingMap = reactive({});
 // 根据选择设备获取设备列表
-async function getDeviceList(deviceTypeVal?) {
-  // if (!deviceTypeVal) return;
+async function getDeviceList(ID?) {
   const params: any = {
-    subId: deviceTypeVal.toString(),
+    subId: ID.toString(),
   };
   const result = await getDeviceListByType(params);
   deviceList.value = result.records;
@@ -266,24 +271,40 @@ const toggleExpand = (deviceId) => {
   }
 };
 // 加载监测数据
-const loadMonitoringData = async (deviceId) => {
-  const device = deviceList.value.find((d) => d.id === deviceId);
-
-  loadingMap[deviceId] = true;
-  try {
-    const result = await getDevMonitorListById({ devId: deviceId.toString() });
-    monitorList.value = Object.values(result.readData);
-  } catch (error) {
-    console.error(`加载设备 ${deviceId} 数据失败:`, error);
-  } finally {
-    loadingMap[deviceId] = false;
+let timer: null | NodeJS.Timeout = null;
+async function loadMonitoringData(deviceId: string) {
+  // 先清除之前的定时器
+  if (timer) {
+    clearInterval(timer);
+    timer = null;
   }
-};
+
+  // 立即请求一次数据
+  // 这里可以加上初始加载,避免等待1秒的间隔
+  // 定时器会在1秒后开始,所以先手动加载一次
+  refreshData(deviceId);
+
+  // 设置新的定时器
+  timer = setInterval(() => {
+    refreshData(deviceId);
+  }, 1000);
+}
+async function refreshData(deviceId: string) {
+  // 这里实现具体的请求逻辑
+  const device = deviceList.value.find((d) => d.id === deviceId);
+  const result = await getDevMonitorListById({ devId: deviceId.toString() });
+  monitorList.value = Object.values(result.readData);
+}
 onMounted(async () => {
-  getSubStationList();
-  getDeviceList();
+  await getSubStationList();
+  await getDeviceList();
+});
+onUnmounted(() => {
+  if (timer) {
+    clearInterval(timer);
+    timer = undefined;
+  }
 });
-onUnmounted(() => {});
 </script>
 
 <style lang="less" scoped>