2 Commits e14530fa00 ... 961fa0bb1c

Autor SHA1 Mensagem Data
  rui.jiang 961fa0bb1c 修改 更新 há 2 meses atrás
  rui.jiang fb0b8df4b2 修改 há 2 meses atrás

+ 93 - 52
src/views/admin/cockpitManage/component/leftdata.vue

@@ -98,69 +98,45 @@
     </div>
 
     <!-- 入库信息 -->
-
-    <div class="BOX">
+    <!-- 离线 -->
+    <div class="BOX" v-hasPermi="['home:offlinedata']">
       <h3 class="centeredh3">
         入库数据
         <span>
-          <span
-            style="cursor: pointer"
-            @click="importdata"
-            v-hasPermi="['home:importData']"
-            >导入数据</span
-          >
-          <span
-            style="cursor: pointer"
-            @click="more"
-            v-hasPermi="['home:moneData']"
-            >更多</span
-          >
-          <span
-            style="cursor: pointer"
-            @click="onlinedata"
-            v-hasPermi="['home:onlinData']"
-            >在线数据</span
-          >
+          <span style="cursor: pointer" @click="importdata">导入数据</span>
+          <span style="cursor: pointer" @click="more">更多</span>
         </span>
       </h3>
       <div>
         <p class="titleYC"><span>风场名称</span><span>入库时间</span></p>
         <tabroll
-          v-hasPermi="['home:bePutData']"
           :table-data="tableData"
           :shujuloading="shujuloading"
           :columns="YCtableColumns"
           :column-widths="YCcolumnWidths"
           :max-height="140"
         ></tabroll>
-
-        <!-- <el-table
-          :data="tableData"
-          :max-height="maxHeight"
-          ref="shujuscroll_Table"
-          strip
-          id="Tabtab"
-          show-overflow-tooltip
-          :header-cell-style="{ backgroundColor: 'red' }"
-        >
-          <el-table-column
-            prop="windFarmName"
-            label="风场名称"
-            width="130"
-            show-overflow-tooltip
-          >
-          </el-table-column>
-          <el-table-column
-            prop="createTime"
-            label="时间"
-            width="150"
-            show-overflow-tooltip
-          >
-          </el-table-column>
-        </el-table> -->
       </div>
     </div>
-
+    <!-- 在线 -->
+    <div class="BOX" v-hasPermi="['home:onlinData']">
+      <h3 class="centeredh3">
+        接入数据
+        <span>
+          <span style="cursor: pointer" @click="onlinedata">更多</span>
+        </span>
+      </h3>
+      <div>
+        <p class="titleYC"><span>风场名称</span><span>采集状态</span></p>
+        <tabroll
+          :table-data="hometopdata"
+          :hometoploading="hometoploading"
+          :columns="hometopColumns"
+          :column-widths="hometopcolumnWidths"
+          :max-height="140"
+        ></tabroll>
+      </div>
+    </div>
     <el-dialog
       title="实时数据采集统计"
       :visible.sync="lineShow"
@@ -177,18 +153,23 @@
             prefix-icon="el-icon-search"
           ></el-input>
           <div class="windbox">
+            <el-empty
+              v-if="filteredWindList.length === 0"
+              :image-size="200"
+            ></el-empty>
             <div
               class="windlist"
               v-for="(item, index) in filteredWindList"
               :key="index"
             >
               <h3>{{ item.windFarmName }}</h3>
-              <p>数据类型:{{ item.typeName }}</p>
-              <p>采集次数:{{ item.count }} 次</p>
-              <p>采集时间:{{ item.latestDataTime }}</p>
+              <p>数据类型: {{ item.typeName }}</p>
+              <p>采集次数: {{ item.count }} 次</p>
+              <p>采集时间: {{ item.latestDataTime }}</p>
             </div>
           </div>
         </el-aside>
+
         <el-main>
           <div class="inquire">
             <p>
@@ -264,6 +245,12 @@
               align="center"
             >
             </el-table-column>
+
+            <el-table-column prop="canAnalysis" label="采集状态" align="center">
+              <template #default="{ row }">
+                {{ row.canAnalysis === 0 ? "不可分析" : "可分析" }}
+              </template>
+            </el-table-column>
           </el-table>
         </el-main>
       </el-container>
@@ -346,9 +333,11 @@ export default {
       FXData: [],
       PdData: [],
       tableData: [],
+      hometopdata: [],
       maxHeight: "200",
       gridData: [],
       shujuloading: false,
+      hometoploading: false,
       searchvalue: "",
       timeval: [],
       windvalue: "",
@@ -402,15 +391,30 @@ export default {
         windFarmName: 130,
         createTime: 150,
       },
-
+      hometopColumns: [
+        { prop: "windFarmName", label: "风场名称" },
+        {
+          prop: "canAnalysis",
+          label: "分析状态",
+        },
+      ],
+      hometopcolumnWidths: {
+        windFarmName: 130,
+        canAnalysis: 150,
+      },
       ListtableData: [],
       startDate: "",
       endDate: "",
+
+
+      pollInterval: null, // 轮询定时器
+      pollTime: 5000 // 轮询间隔,单位:毫秒
     };
   },
   created() {
     this.getbacklog();
     this.ruku();
+    // this.hometop();
   },
   computed: {
     filteredWindList() {
@@ -421,7 +425,15 @@ export default {
         : this.windList;
     },
   },
-  mounted() {},
+
+  // 在线版本 离线需要注释
+  mounted() {
+    this.startPolling();
+  },
+    // 在线版本 离线需要注释
+  beforeDestroy() {
+  this.stopPolling();
+},
   methods: {
     getbacklog() {
       queryWaitTask().then((res) => {
@@ -579,6 +591,35 @@ export default {
       });
       this.conditions();
     },
+    // 首页top
+    hometop() {
+    axios
+      .post('/transDataWeb/windFarmDayCount/getIndexOnlineData')
+      .then((res) => {
+        this.hometopdata = res.data.datas.map((item) => ({
+          ...item,
+          canAnalysis: item.canAnalysis === 1 ? '可分析' : '不可分析'
+        }));
+        this.errorCount = 0; // 请求成功时重置错误计数
+      })
+      .catch((err) => {
+        this.errorCount++;
+        if (this.errorCount < 3) {
+          console.log(`请求失败(第 ${this.errorCount} 次):`, err.message);
+        }
+      });
+  },
+
+    startPolling() {
+    this.hometop(); // 先执行一次
+    this.pollInterval = setInterval(this.hometop, this.pollTime);
+  },
+  stopPolling() {
+    if (this.pollInterval) {
+      clearInterval(this.pollInterval);
+      this.pollInterval = null;
+    }
+  },
 
     conditions() {
       // 获取历史数据

+ 40 - 19
src/views/health/components/spectrogramcharts.vue

@@ -2,12 +2,15 @@
   <div>
     <div class="FD">
       <div v-if="TZshow" class="eigenvalue">
-        <el-checkbox
-          v-for="(item, index) in checkList"
-          :key="index"
-          v-model="checked[index]"
-          >{{ item.val }}</el-checkbox
-        >
+        <el-checkbox-group v-model="checkedCheckList">
+          <el-checkbox
+            v-for="(item, index) in checkList"
+            :key="index"
+            :label="item.val"
+          >
+            {{ item.val }}
+          </el-checkbox>
+        </el-checkbox-group>
         <!-- <h5>特征值</h5>
         <p>有效值:{{ this.spectrumList.Xrms }}</p>
         <p>平均值:{{ this.spectrumList.mean_value }}</p>
@@ -23,20 +26,26 @@
       </div>
 
       <div v-if="BGshow" class="eigenvalue">
-        <el-checkbox
-          v-for="(item, index) in GBcheckList"
-          :key="index"
-          v-model="checked[index]"
-          >{{ item.val }}</el-checkbox
-        >
+        <el-checkbox-group v-model="checkedGB">
+          <el-checkbox
+            v-for="(item, index) in GBcheckList"
+            :key="index"
+            :label="item.val"
+          >
+            {{ item.val }}
+          </el-checkbox>
+        </el-checkbox-group>
       </div>
       <div v-if="PXshow" class="eigenvalue">
-        <el-checkbox
-          v-for="(item, index) in PXcheckList"
-          :key="index"
-          v-model="checked[index]"
-          >{{ item.val }}</el-checkbox
-        >
+        <el-checkbox-group v-model="checkedValues">
+          <el-checkbox
+            v-for="(item, index) in PXcheckList"
+            :key="index"
+            :label="item.val"
+          >
+            {{ item.val }}
+          </el-checkbox>
+        </el-checkbox-group>
       </div>
     </div>
     <!-- ECharts 图表容器 -->
@@ -106,10 +115,22 @@ export default {
         { val: "GMF" },
         { val: "±5Fr" },
       ],
-      checked: "",
+
+      checkedGB: [],
+      checkedCheckList: [],
+      checkedValues: [],
     };
   },
   watch: {
+    checkedGB(newValues) {
+      console.log("当前选中的复选框值:", newValues);
+    },
+    checkedCheckList(newValues) {
+      console.log("当前选中的复选框值:", newValues);
+    },
+    checkedValues(newValues) {
+      console.log("当前选中的复选框值:", newValues);
+    },
     // 监听 chartData 和 chartLabels 的变化,重新绘制图表
     chartData(newData) {
       this.updateChart(newData, this.chartLabels);

+ 1 - 1
src/views/home/Index.vue

@@ -23,7 +23,7 @@
 
 <script>
 import HeaderCom from "@/components/HeaderCom.vue";
-import Menu from "./components/Menu";
+import Menu from "./components/Menu.vue";
 import MenuTag from "@/components/MenuTag.vue";
 
 export default {

+ 449 - 0
src/views/home/components/MenuHD.vue

@@ -0,0 +1,449 @@
+<template>
+  <el-aside :width="!isCollapse ? '250px' : '100px'" class="asideBox">
+    <div class="homeBox"></div>
+    <el-menu
+      collapse-transition
+      ref="menu"
+      class="mt-3 el-menu-vertical-demo"
+      @open="handleOpen"
+      @close="handleClose"
+      background-color="#eff1f3"
+      text-color="#000"
+      :active-text-color="activeTextColor"
+      :router="true"
+      :default-active="defaultActive"
+      :collapse="isCollapse"
+      :default-openeds="openMenus"
+    >
+      <template v-for="item in routerList">
+        <el-submenu
+          v-if="
+            item.children && item.children.length && item.meta?.hidden === false
+          "
+          :index="item.path"
+        >
+          <template slot="title">
+            <i v-if="isElPrefix(item.iconName)" class="el-icon-menu"></i>
+            <i v-else class="svnIcon">
+              <svg-icon :icon-class="item.iconName" />
+            </i>
+            <span>{{ item.name }}</span>
+          </template>
+          <el-menu-item
+            v-for="child in item.children"
+            v-if="child.meta?.hidden === false"
+            :key="child.id"
+            :index="`${child.path}?id=${child.id}`"
+            @click="handleChangeMenuUrl(child, `${child.path}?id=${child.id}`)"
+          >
+            <i v-if="isElPrefix(child.iconName)" class="el-icon-menu"></i>
+            <i v-else class="svnIcon">
+              <svg-icon :icon-class="child.iconName" />
+            </i>
+            <span>{{ child.name }}</span>
+          </el-menu-item>
+        </el-submenu>
+        <el-menu-item
+          v-else-if="item.meta?.hidden === false"
+          :key="item.id"
+          :index="`${item.path}?id=${item.id}`"
+          @click="handleChangeMenuUrl(item, `${item.path}?id=${item.id}`)"
+        >
+          <i v-if="isElPrefix(item.iconName)" class="el-icon-menu"></i>
+          <i v-else-if="item.iconName" class="svnIcon">
+            <svg-icon :icon-class="item.iconName" />
+          </i>
+          <i class="svnIcon" v-else-if="item.path === '/home/laserRangeFinder'">
+            <svg-icon
+              style="width: 22px; height: 22px"
+              icon-class="laserRangeFinder"
+            />
+          </i>
+          <span>{{ item.name }}</span>
+        </el-menu-item>
+      </template>
+    </el-menu>
+
+    <div class="foldBox flexCenter">
+      <span
+        v-show="isCollapse"
+        class="el-icon-s-unfold icon"
+        @click.stop="isCollapse = false"
+        >展开</span
+      >
+      <el-switch
+        v-show="!isCollapse"
+        :value="isExpanded"
+        @change="toggleAllMenus"
+      >
+        <!-- :inactive-text="isExpanded ? '收起全部菜单' : '展开全部菜单'" -->
+      </el-switch>
+      <span
+        v-show="!isCollapse"
+        class="el-icon-s-fold icon"
+        @click.stop="isCollapse = true"
+        >收起</span
+      >
+    </div>
+  </el-aside>
+</template>
+
+<script>
+import { mapActions, mapState } from "vuex";
+import { orgList } from "./mockData";
+import Vue from "vue";
+
+export default {
+  data() {
+    return {
+      isExpanded: false, // 控制是否展开所有子菜单
+      openMenus: [], // 用来存储展开的菜单
+      isCollapse: true,
+      orgList: orgList,
+      searchInputValue: "",
+      defaultActive: this.$route.fullPath,
+      activeIndex: false,
+      keyObject: {},
+      activeTextColor: Vue.prototype.$backgroundColor,
+      routerList: [
+        {
+          id: 1,
+          path: "/home/cockpitManage",
+          name: "首页",
+          iconName: "gps",
+          meta: {
+            hidden: false,
+          },
+          // children: [
+          //   {
+          //     id: 11,
+          //     iconName: "",
+          //     meta: {
+          //       hidden: false,
+          //     },
+          //     path: "electronic-map",
+          //     name: "电子地图",
+          //   },
+          // ],
+        },
+      ],
+    };
+  },
+  created() {
+    this.routerList = [
+      ...this.routerList,
+      ...this.$store.state.auth.dynamicRouter,
+    ];
+    console.log(this.routerList, "routerList");
+  },
+  computed: {
+    ...mapState({
+      currentMenuIndex: (state) => state.breadStore?.currentUrl?.routeUrl,
+    }),
+    // 获取所有父级菜单的 index
+    allMenuIndexes() {
+      return this.routerList.map((item) => {
+        if (
+          item.children &&
+          item.children.length &&
+          item.meta?.hidden === false
+        ) {
+          return item.path;
+        } else {
+          return `${item.path}?id=${item.id}`;
+        }
+      });
+    },
+  },
+  watch: {
+    currentMenuIndex: {
+      deep: true,
+      handler(newVale, oldVal) {
+        if (newVale) {
+          this.$refs.menu.close(newVale);
+        }
+      },
+    },
+    keyObject: {
+      deep: true,
+      handler(newVale) {
+        if (newVale && newVale.key === this.defaultActive) {
+          this.getBreadcrumbList(newVale.keyPath);
+        }
+      },
+    },
+  },
+  methods: {
+    ...mapActions("menuTag", ["addTag"]),
+    // 切换展开/收起所有菜单
+    toggleAllMenus() {
+      this.isExpanded = !this.isExpanded;
+
+      if (this.isExpanded) {
+        // 展开所有子菜单
+        this.openMenus = this.routerList
+          .filter((item) => item.children && item.children.length)
+          .map((item) => item.path);
+      } else {
+        // 收起所有子菜单
+        this.openMenus = [];
+      }
+    },
+    handleChangeMenuUrl(item, path) {
+      this.defaultActive = path;
+      this.$router.push(path); // 跳转到指定的路由
+    },
+    isElPrefix(str) {
+      const regex = /^el-/;
+      return regex.test(str);
+    },
+    getBreadcrumbList(keyPath) {
+      const urls = keyPath;
+      const result = urls.map((url, index) => {
+        const params = new URLSearchParams(url.split("?")[1]);
+        const id = params.get("id");
+        const name = params.get("name");
+        const routeUrl = url;
+        if (index === urls.length - 1) {
+          return { id, name, routeUrl, currentPage: true };
+        }
+        return { id, name, routeUrl };
+      });
+      this.$store.commit("breadStore/ADD_BREAD", result);
+      return result;
+    },
+    handleOpen(key, keyPath) {
+      this.activeIndex = false;
+      this.keyObject = {
+        key,
+        keyPath,
+      };
+    },
+    handleClose(key, keyPath) {
+      this.activeIndex = false;
+      this.keyObject = {
+        key,
+        keyPath,
+      };
+    },
+    shrinkTree() {
+      this.$refs.menu.close(`/orgsPage?id=${orgList.id}&name=${orgList.name}`);
+    },
+    handleChangeRouter() {
+      this.activeIndex = true;
+      this.defaultActive = "";
+      this.$store.commit("breadStore/ADD_BREAD", []);
+      this.$refs.menu.close(`/orgsPage?id=${orgList.id}&name=${orgList.name}`);
+      this.$router.push("/");
+    },
+    handleChangeMenuUrl(item, key) {
+      this.defaultActive = key;
+      if (item) {
+        item.activeIndex = true;
+      }
+      const tag = {
+        path: key,
+        name: item.name,
+        label: item.name,
+      };
+      this.addTag(tag);
+      this.$router.push({
+        path: key,
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.el-menu-vertical-demo:not(.el-menu--collapse) {
+  width: 200px;
+  min-height: 400px;
+}
+.stop-animation,
+.active-animation {
+  font-size: 0px;
+}
+
+.asideBox {
+  height: 100vh;
+  overflow-y: scroll;
+  position: relative;
+  padding-bottom: 40px;
+  padding-top: 16px;
+  box-sizing: border-box;
+  display: flex;
+  align-items: flex-start;
+  justify-content: flex-start;
+  flex-direction: column;
+  border-right: 1px solid #d8d8d8;
+  position: relative;
+
+  .homeBox {
+    width: 100%;
+    padding: 0 20px;
+    display: flex;
+    flex-direction: column;
+    align-items: flex-start;
+    justify-content: flex-start;
+    box-sizing: border-box;
+
+    .logoItem {
+      display: flex;
+      width: 100%;
+      cursor: pointer;
+      box-sizing: border-box;
+
+      span {
+        line-height: 50px;
+        margin: 0 auto;
+      }
+
+      .logoImg {
+        img {
+          height: 100%;
+          width: inherit;
+        }
+
+        width: 50px;
+        height: 50px;
+      }
+    }
+
+    .search {
+      display: flex;
+      width: 100%;
+      align-items: center;
+      justify-content: center;
+
+      .el-icon-search {
+        margin-top: 28px;
+      }
+
+      .el-input {
+        width: inherit;
+      }
+    }
+
+    .frame {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      color: #666;
+      width: 100%;
+      margin-top: 20px;
+      margin-bottom: 10px;
+      cursor: pointer;
+
+      .homeIndex {
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        font-size: 18px;
+
+        .home_active {
+          margin-right: 2px;
+        }
+
+        p {
+          color: #666;
+          font-size: 18px;
+        }
+      }
+
+      &:hover {
+        p {
+          color: #19436d;
+        }
+
+        transition: width 0.5s ease, transform 0.5s ease;
+        transform-origin: left;
+      }
+
+      .left {
+        left: 50%;
+        transform: scaleX(0);
+      }
+
+      .right {
+        left: 0;
+        transform: scaleX(0);
+      }
+    }
+  }
+
+  .el-menu {
+    margin-bottom: 10px;
+    border: none;
+    overflow-y: auto;
+    width: 100% !important;
+    height: 100%;
+  }
+}
+
+.flexCenter {
+  display: flex;
+  align-items: center !important;
+  justify-content: space-between !important;
+  width: 200px;
+}
+
+.foldBox {
+  position: fixed;
+  bottom: 10px;
+  left: 20px;
+  padding: 10px;
+
+  .icon {
+    cursor: pointer;
+    color: #666;
+    font-size: 14px;
+  }
+}
+
+::v-deep .el-submenu__title {
+  display: flex;
+  align-items: center;
+  margin-left: 15px;
+}
+
+::v-deep .el-submenu__icon-arrow {
+  right: 30px;
+}
+
+::v-deep .svnIcon {
+  vertical-align: middle;
+  margin-right: 5px;
+  width: 24px;
+  text-align: center;
+  font-size: 18px;
+}
+
+::-webkit-scrollbar {
+  width: 6px;
+  display: none;
+}
+
+::-webkit-scrollbar-thumb {
+  border-radius: 10px;
+  background-color: #aaabaa;
+  cursor: pointer;
+}
+
+::-webkit-scrollbar-thumb:hover {
+  background-color: #efeff0;
+}
+
+::-webkit-scrollbar-track-piece {
+  background-color: #efeff0;
+  border-radius: 10px;
+}
+
+.asideBox:hover ::-webkit-scrollbar {
+  display: block !important;
+}
+
+.el-menu-item {
+  margin-left: 18px;
+}
+</style>

+ 2 - 2
vue.config.js

@@ -66,8 +66,8 @@ module.exports = {
         // target: "http://192.168.5.4:16200", // 石月
         // target: "http://192.168.50.235:16200", // 内网
         // target: "http://192.168.5.15:16200",
-        target: "http://192.168.50.235:16500", //演示环境
-        // target: "http://106.120.102.238:26500", //外网演示环境
+        // target: "http://192.168.50.235:16500", //演示环境
+        target: "http://106.120.102.238:26500", //外网演示环境
         // target: "http://106.120.102.238:16700", // 外网16700  生产16600
         // target: "http://10.96.137.5",
         changeOrigin: true,