liujiejie 3 hónapja
szülő
commit
dd557051d6

+ 23 - 23
downLoadServer/src/server/utils/chartsCom/3DDrawingChart.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2025-04-14 16:09:13
- * @LastEditTime: 2025-04-15 09:40:22
+ * @LastEditTime: 2025-04-15 13:54:17
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /downLoadServer/src/server/utils/chartsCom/3DDrawingChart.js
@@ -161,28 +161,28 @@ export const generate3DDrawingChart = async (data) => {
 
       // 准备 HTML 内容
       const htmlContent = `
-<!DOCTYPE html>
-<html>
-<head>
-  <meta charset="UTF-8">
-  <title>热力图</title>
-  <script>${plotlyContent}</script>
-</head>
-<body>
-  <div id="chart" style="width: 100%; height: 450px"></div>
-  <script>
-    const traces = ${JSON.stringify(traces)};
-    const layout = ${JSON.stringify(layout)};
-    Plotly.newPlot('chart', traces, layout, { responsive: true }).then(() => {
-      window.chartRendered = true; // 确保在图表渲染完成后设置
-      console.log("图表渲染完成");
-    }).catch((error) => {
-      console.error("图表渲染错误:", error); // 捕获渲染错误
-    });
-  </script>
-</body>
-</html>
-`;
+        <!DOCTYPE html>
+        <html>
+        <head>
+          <meta charset="UTF-8">
+          <title>热力图</title>
+          <script>${plotlyContent}</script>
+        </head>
+        <body>
+          <div id="chart" style="width: 100%; height: 450px"></div>
+          <script>
+            const traces = ${JSON.stringify(traces)};
+            const layout = ${JSON.stringify(layout)};
+            Plotly.newPlot('chart', traces, layout, { responsive: true }).then(() => {
+              window.chartRendered = true; // 确保在图表渲染完成后设置
+              console.log("图表渲染完成");
+            }).catch((error) => {
+              console.error("图表渲染错误:", error); // 捕获渲染错误
+            });
+          </script>
+        </body>
+        </html>
+        `;
       // ... existing code ...
       // 设置页面内容
       await page.setContent(htmlContent, {

+ 211 - 1
downLoadServer/src/server/utils/chartsCom/Time3DChart.js

@@ -1,8 +1,218 @@
 /*
  * @Author: your name
  * @Date: 2025-04-14 17:49:33
- * @LastEditTime: 2025-04-14 17:49:33
+ * @LastEditTime: 2025-04-15 14:03:44
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/downLoadServer/src/server/utils/chartsCom/Time3DChart.js
  */
+import puppeteer from "puppeteer";
+import fs from "fs-extra";
+import path from "path";
+import FormData from "form-data";
+import { colorSchemes } from "../colors.js";
+export const generate3DDrawingChart = async (data) => {
+  try {
+    console.log("开始生成热力图...");
+    console.log("数据:", data);
+    const colorSchemesItem = colorSchemes[0].colors;
+    // 创建临时目录
+    const tempDir = path.join(process.cwd(), "images");
+    await fs.ensureDir(tempDir);
+    const tempFilePath = path.join(
+      tempDir,
+      `temp_heatmap_chart_${Date.now()}.png`
+    );
+
+    // 获取 plotly.js 的绝对路径
+    const plotlyPath = path.join(
+      process.cwd(),
+      "src",
+      "public",
+      "js",
+      "plotly-3.0.1.min.js"
+    );
+    const plotlyContent = await fs.readFile(plotlyPath, "utf-8");
+
+    // 创建浏览器实例
+    const browser = await puppeteer.launch({
+      headless: "new",
+      args: ["--no-sandbox", "--disable-setuid-sandbox"],
+    });
+
+    try {
+      const page = await browser.newPage();
+
+      // 准备图表数据
+      const chartDataset = data.data[0]; // 修改为 data.chartData
+
+      const uniqueColors = [...new Set(chartDataset.color)];
+      const traces = uniqueColors.map((color, idx) => {
+        const colorData = chartDataset.color.map((c) => (c === color ? 1 : 0));
+
+        return {
+          x: chartDataset.xData.filter((_, i) => colorData[i] === 1),
+          y: chartDataset.yData.filter((_, i) => colorData[i] === 1),
+          z: chartDataset.zData.filter((_, i) => colorData[i] === 1),
+          mode: "markers", // 根据需要设置模式
+          type: "scatter3d",
+          marker: {
+            size: 1, // 使用动态点大小
+            color: colorSchemesItem[idx], // 使用配色方案
+            colorscale: "YlGnBu",
+          },
+          name: ` ${color}`,
+          // hovertemplate: `${data.xaixs}: %{x} <br> ${data.yaixs}: %{y} <br> ${data.zaixs}: %{z} <extra></extra>`,
+        };
+      });
+      // 准备布局配置
+      const layout = {
+        title: {
+          text: chartDataset.title,
+          font: {
+            size: 16,
+            weight: "bold",
+          },
+        },
+        scene: {
+          xaxis: {
+            gridcolor: "rgb(255,255,255)",
+            tickcolor: "rgb(255,255,255)",
+            backgroundcolor: "#CFD4DC",
+            showbackground: true,
+            linecolor: "black", // 轴线颜色
+            ticks: "outside", // 设置刻度线在轴线外
+            fixedrange: true, // 防止缩放
+            tickcolor: "black",
+            tickangle: -10,
+            title: {
+              text: data.xaixs,
+            },
+          },
+          yaxis: {
+            type: "category",
+            categoryorder: "array", // 自定义顺序,确保间隔均匀
+            categoryarray: [...new Set(chartDataset.yData)],
+            gridcolor: "rgb(255,255,255)",
+            linecolor: "black",
+            ticks: "outside",
+            gridcolor: "rgb(255,255,255)",
+            tickcolor: "rgb(255,255,255)",
+            backgroundcolor: "#CFD4DC",
+            showbackground: true,
+            tickcolor: "black",
+            tickangle: 25,
+            title: {
+              text: data.yaixs,
+            },
+          },
+          zaxis: {
+            gridcolor: "rgb(255,255,255)",
+            tickcolor: "rgb(255,255,255)",
+            backgroundcolor: "#CFD4DC",
+            showbackground: true,
+            fixedrange: true, // 防止缩放
+            linecolor: "black", // 轴线颜色
+            ticks: "outside", // 设置刻度线在轴线外
+            tickcolor: "black",
+            tickangle: -90,
+            title: {
+              text: data.zaixs,
+            },
+          },
+          aspectratio: {
+            x: 2.2,
+            y: 1.7,
+            z: 1,
+          },
+          plot_bgcolor: "#e5ecf6",
+          gridcolor: "#fff",
+          bgcolor: "#e5ecf6", // 设置背景颜色
+          camera: {
+            up: {
+              x: 0.200292643688136,
+              y: 0.2488259353493132,
+              z: 0.947612004346693,
+            },
+            center: {
+              x: -0.052807476121180814,
+              y: 0.02451796399554085,
+              z: -0.022911006648570736,
+            },
+            eye: {
+              x: -2.126379643342493,
+              y: -2.551422475965373,
+              z: 1.0917667684145647,
+            },
+            projection: {
+              type: "orthographic",
+            },
+          },
+        },
+        margin: { t: 50, b: 50, l: 50, r: 50 },
+        staticPlot: false,
+        showlegend: true,
+        legend: {
+          marker: {
+            size: 10, // 图例中点的大小
+          },
+        },
+      };
+
+      // 准备 HTML 内容
+      const htmlContent = `
+        <!DOCTYPE html>
+        <html>
+        <head>
+          <meta charset="UTF-8">
+          <title>热力图</title>
+          <script>${plotlyContent}</script>
+        </head>
+        <body>
+          <div id="chart" style="width: 100%; height: 450px"></div>
+          <script>
+            const traces = ${JSON.stringify(traces)};
+            const layout = ${JSON.stringify(layout)};
+            Plotly.newPlot('chart', traces, layout, { responsive: true }).then(() => {
+              window.chartRendered = true; // 确保在图表渲染完成后设置
+              console.log("图表渲染完成");
+            }).catch((error) => {
+              console.error("图表渲染错误:", error); // 捕获渲染错误
+            });
+          </script>
+        </body>
+        </html>
+        `;
+      // ... existing code ...
+      // 设置页面内容
+      await page.setContent(htmlContent, {
+        waitUntil: "networkidle0",
+      });
+
+      // 等待图表渲染完成,延长超时时间
+      await page.waitForFunction(() => window.chartRendered === true, {
+        timeout: 150000, // 延长到 120 秒
+      });
+
+      // 截图并保存到临时文件
+      const chartElement = await page.$("#chart");
+      await chartElement.screenshot({
+        path: tempFilePath,
+        type: "png",
+      });
+
+      // 上传图片到服务器
+      const formData = new FormData();
+      formData.append("file", fs.createReadStream(tempFilePath));
+      return formData;
+    } catch (error) {
+      console.error("生成3D图失败:", error);
+      throw error;
+    } finally {
+      await browser.close();
+    }
+  } catch (error) {
+    console.error("生成3D图失败:", error);
+    throw error;
+  }
+};

+ 40 - 41
src/components/map/index.vue

@@ -223,11 +223,12 @@ export default {
       layers: [
         new TileLayer({
           source: new XYZ({
-            url: "http://106.120.102.238:18000/tiles/{z}/{x}/{y}.png", //外网
+            // url: "http://106.120.102.238:18000/tiles/{z}/{x}/{y}.png", //外网
             // url: "http://127.0.0.1:8010/tiles/{z}/{x}/{y}.png", //本地
             // url: "http://192.168.50.235/tiles/{z}/{x}/{y}.png", //内网
             // url: "http://10.96.137.5:9080/tiles/{z}/{x}/{y}.png", //大~#@唐
             // url: "http://192.168.0.1/tiles/{z}/{x}/{y}.png", //华电
+            url: "http://192.168.50.235/tiles/{z}/{x}/{y}.png", //中广核
           }),
         }),
         new VectorLayer({
@@ -239,45 +240,44 @@ export default {
     });
 
     // -------------【添加山西省真实边界线】------------- 定位全国的时候注释这个代码
-    // if (this.$route.path === "/home/cockpitManage") {
-    //   // 通过导入的 JSON 文件加载边界数据(GeoJSON 格式),并解析成矢量要素
-    //   const shanxiSource = new Vector({
-    //     features: new GeoJSON().readFeatures(shanxiBoundary, {
-    //       featureProjection: "EPSG:4326",
-    //     }),
-    //   });
-    //   // 创建矢量图层,仅显示边界线(填充颜色设为透明)
-    //   const shanxiLayer = new VectorLayer({
-    //     source: shanxiSource,
-    //     style: new Style({
-    //       stroke: new Stroke({
-    //         color: "rgba(59, 130, 246, 0.5)",
-    //         width: 3,
-    //       }),
-    //       fill: new Fill({
-    //         color: "rgba(59, 130, 246, 0.05)", // 透明填充
-    //       }),
-    //     }),
-    //   });
-    //   this.map.addLayer(shanxiLayer);
-
-    //   const markerLayer = this.map
-    //     .getLayers()
-    //     .getArray()
-    //     .find((layer) => {
-    //       return layer.get("id") === "marker";
-    //     });
-    //   if (markerLayer) {
-    //     markerLayer.setZIndex(10);
-    //   }
+    if (this.$route.path === "/home/cockpitManage") {
+      // 通过导入的 JSON 文件加载边界数据(GeoJSON 格式),并解析成矢量要素
+      const shanxiSource = new Vector({
+        features: new GeoJSON().readFeatures(shanxiBoundary, {
+          featureProjection: "EPSG:4326",
+        }),
+      });
+      // 创建矢量图层,仅显示边界线(填充颜色设为透明)
+      const shanxiLayer = new VectorLayer({
+        source: shanxiSource,
+        style: new Style({
+          stroke: new Stroke({
+            color: "rgba(59, 130, 246, 0.5)",
+            width: 3,
+          }),
+          fill: new Fill({
+            color: "rgba(59, 130, 246, 0.05)", // 透明填充
+          }),
+        }),
+      });
+      this.map.addLayer(shanxiLayer);
 
-    //   // 同时设置高亮图层 zIndex 较低
-    //   shanxiLayer.setZIndex(1);
-    //   // -------------【结束】-------------
-    //     const targetExtent = [106.8, 34.3, 118.6, 41.2];
-    //     this.map.getView().fit(targetExtent, { duration: 2000 });
+      const markerLayer = this.map
+        .getLayers()
+        .getArray()
+        .find((layer) => {
+          return layer.get("id") === "marker";
+        });
+      if (markerLayer) {
+        markerLayer.setZIndex(10);
+      }
 
-    // }
+      // 同时设置高亮图层 zIndex 较低
+      shanxiLayer.setZIndex(1);
+      // -------------【结束】-------------
+      const targetExtent = [106.8, 34.3, 118.6, 41.2];
+      this.map.getView().fit(targetExtent, { duration: 2000 });
+    }
     // 这个放在外面
     this.initEvent();
   },
@@ -538,13 +538,13 @@ export default {
   padding: 0;
   z-index: 100;
   h3 {
-    background-color:var(--header-bg);
+    background-color: var(--header-bg);
     width: 240px;
     padding: 5px 10px;
     font-size: 16px;
   }
   div {
-    background-color:var(--content-bg);
+    background-color: var(--content-bg);
     width: 240px;
     font-size: 12px;
     p {
@@ -577,5 +577,4 @@ export default {
     }
   }
 }
-
 </style>

+ 2 - 4
src/router/index.js

@@ -28,8 +28,8 @@ const createRouter = () =>
             iconName: "gps",
             component: () =>
               import(
-                // /*webpackChunkName:'home-cockpitManage'*/ "../views/admin/cockpitManage/Index.vue"
-                /*webpackChunkName:'home-cockpitManage'*/ "../views/admin/cockpitManage/HD.vue"
+                /*webpackChunkName:'home-cockpitManage'*/ "../views/admin/cockpitManage/Index.vue"
+                // /*webpackChunkName:'home-cockpitManage'*/ "../views/admin/cockpitManage/HD.vue"
               ),
           },
           {
@@ -68,8 +68,6 @@ const createRouter = () =>
         component: () => import("../views/login/Index.vue"),
       },
 
-
-
       {
         path: "/transition",
         name: "transition",

+ 1 - 4
src/views/ledger/component/windsiteup.vue

@@ -71,7 +71,7 @@
         <el-upload
           class="uploaddemo2"
           :file-list="resourcefileList"
-          action="http://192.168.0.1:16200/energy-manage-service/api/check/upload"
+          action="http://192.168.50.235/energy-manage-service/api/check/upload"
           :multiple="false"
           :before-upload="resourcebeforeUpload"
           :limit="1"
@@ -200,7 +200,6 @@ export default {
     handleOnChange(fileList) {
       this.globalFileList = fileList.raw;
       console.log(fileList);
-      
     },
 
     // 附件提交
@@ -294,8 +293,6 @@ export default {
     },
 
     resourcefilesubmit() {
-    
-      
       let filedata = {
         fieldCode: this.rowdata.fieldCode,
         fileName: this.globalFileList.name,

+ 15 - 34
src/views/ledger/milltype.vue

@@ -1,6 +1,9 @@
 <template>
   <div class="global-variable" v-loading="loading">
-    <div class="condition" style="display: flex;justify-content: space-between;">
+    <div
+      class="condition"
+      style="display: flex; justify-content: space-between"
+    >
       <el-form :inline="true" :model="formInline" class="demo-form-inline">
         <el-form-item label="收资机型型号:">
           <el-input
@@ -29,14 +32,10 @@
         </el-form-item>
       </el-form>
       <div class="newly">
-        <el-button @click="newnuedialog" size="small"
-          >新增</el-button
-        >
+        <el-button @click="newnuedialog" size="small">新增</el-button>
       </div>
-
     </div>
     <div class="list-page">
-
       <el-table
         class="center-align-table"
         :data="tableData"
@@ -59,7 +58,6 @@
             >
           </template>
         </el-table-column>
-   
 
         <el-table-column
           prop="curvedMotionType"
@@ -196,16 +194,10 @@
       >
         <div class="form-row">
           <el-form-item label="收资机型型号:" prop="machineTypeCode">
-            <el-input
-              v-model="ruleForm.machineTypeCode"
-      
-            ></el-input>
+            <el-input v-model="ruleForm.machineTypeCode"></el-input>
           </el-form-item>
           <el-form-item label="厂商名称:" prop="manufacturerName">
-            <el-input
-              v-model="ruleForm.manufacturerName"
-
-            ></el-input>
+            <el-input v-model="ruleForm.manufacturerName"></el-input>
           </el-form-item>
         </div>
 
@@ -216,7 +208,6 @@
               placeholder="请选择"
               value-key="contentsValue"
               @change="handleSelectChange"
- 
             >
               <el-option
                 v-for="item in curvedMotionTypeOptions"
@@ -227,7 +218,7 @@
             </el-select>
           </el-form-item>
           <el-form-item label="塔筒高度:" prop="towerHeight">
-            <el-input v-model="ruleForm.towerHeight" ></el-input>
+            <el-input v-model="ruleForm.towerHeight"></el-input>
           </el-form-item>
         </div>
         <div class="form-row">
@@ -235,32 +226,23 @@
             <el-input v-model="ruleForm.vaneLong"></el-input>
           </el-form-item>
           <el-form-item label="叶轮直径:" prop="rotorDiameter">
-            <el-input v-model="ruleForm.rotorDiameter" ></el-input>
+            <el-input v-model="ruleForm.rotorDiameter"></el-input>
           </el-form-item>
         </div>
         <div class="form-row">
           <el-form-item label="传动比-转速比:" prop="rotationalSpeedRatio">
-            <el-input
-              v-model="ruleForm.rotationalSpeedRatio"
-         
-            ></el-input>
+            <el-input v-model="ruleForm.rotationalSpeedRatio"></el-input>
           </el-form-item>
           <el-form-item label="额定风速:" prop="ratedWindSpeed">
-            <el-input v-model="ruleForm.ratedWindSpeed" ></el-input>
+            <el-input v-model="ruleForm.ratedWindSpeed"></el-input>
           </el-form-item>
         </div>
         <div class="form-row">
           <el-form-item label="切入风速:" prop="ratedCutInWindspeed">
-            <el-input
-              v-model="ruleForm.ratedCutInWindspeed"
-         
-            ></el-input>
+            <el-input v-model="ruleForm.ratedCutInWindspeed"></el-input>
           </el-form-item>
           <el-form-item label="切出风速:" prop="ratedCutOutWindspeed">
-            <el-input
-              v-model="ruleForm.ratedCutOutWindspeed"
-           
-            ></el-input>
+            <el-input v-model="ruleForm.ratedCutOutWindspeed"></el-input>
           </el-form-item>
         </div>
         <div class="form-row">
@@ -280,7 +262,6 @@
         <el-button type="primary" @click="submitForm('ruleForm')" size="small"
           >确定</el-button
         >
- 
       </div>
     </el-dialog>
 
@@ -588,6 +569,7 @@ export default {
           this.onSubmit();
           this.$message.success(this.isEdit ? "编辑成功" : "新增成功");
           this.isEdit = false;
+          this.handleClose();
         }).catch((error) => {});
       });
     },
@@ -901,7 +883,7 @@ export default {
 .form-grid {
   display: flex;
   flex-wrap: wrap;
-  
+
   // flex-direction: column;
   // gap: 10px;
 }
@@ -924,5 +906,4 @@ export default {
   display: flex;
   justify-content: center;
 }
-
 </style>

+ 16 - 7
src/views/performance/assetssMag.vue

@@ -52,11 +52,19 @@
 
         <el-form-item class="right-align">
           <el-button @click="Newanalyse" size="small">创建分析</el-button>
-          <el-button @click="examine" size="small">查看导入数据</el-button>
-          <el-button @click="handleAutoAsstessList" size="small"
+          <el-button
+            @click="examine"
+            size="small"
+            v-hasPermi="['home:offlinedata']"
+            >查看导入数据</el-button
+          >
+          <el-button
+            @click="handleAutoAsstessList"
+            size="small"
+            v-hasPermi="['home:performance:autoAssetss']"
             >查看自动分析列表</el-button
           >
-          <el-button @click="handleDownLoadChart" size="small">下载</el-button>
+          <!-- <el-button @click="handleDownLoadChart" size="small">下载</el-button> -->
         </el-form-item>
       </el-form>
     </div>
@@ -167,24 +175,25 @@
         >
         </el-table-column>
 
-        <!-- <el-table-column
+        <el-table-column
+          v-hasPermi="['home:performance:autoAssetss']"
           prop="onOffCall"
           align="center"
-          label="是否开启自动分析"
+          label="自动分析状态"
           min-width="140"
         >
           <template slot-scope="scope">
             <span>
               {{
                 scope.row.onOffCall == 0
-                  ? "不开启"
+                  ? "暂停"
                   : scope.row.onOffCall === 1
                   ? "开启"
                   : "/"
               }}</span
             >
           </template>
-        </el-table-column> -->
+        </el-table-column>
         <el-table-column
           prop="roleName"
           align="center"