Browse Source

常规消缺

wangb 3 days atrás
parent
commit
bf0eb4ad65

+ 1 - 1
.env.development

@@ -12,7 +12,7 @@ VUE_APP_TITLE = '页面标题'
 # VUE_APP_LOGIN_URL = 'http://192.168.2.45:48080'
 # 王波
 # VUE_APP_LOGIN_URL = 'http://172.16.12.101:48080'
-VUE_APP_LOGIN_URL = 'http://172.16.12.102:8190'
+VUE_APP_LOGIN_URL = 'http://172.16.12.101:48080'
 
 # 发电能力分析
 # VUE_APP_GENERAT_URL = 'http://192.168.0.102:9002'

+ 10 - 10
.env.production

@@ -19,37 +19,37 @@ VUE_APP_TITLE = '页面标题'
 # VUE_APP_LOGIN_URL = 'http://192.168.2.231:48080'
 # VUE_APP_LOGIN_URL = 'http://127.0.0.1:48080'
 
-VUE_APP_LOGIN_URL = 'http://10.127.7.241:48080'
-# VUE_APP_LOGIN_URL = 'http://172.16.12.101:48080'
+# VUE_APP_LOGIN_URL = 'http://10.127.7.241:48080'
+VUE_APP_LOGIN_URL = 'http://172.16.12.101:48080'
 
 # 生产环境/重写路径(公共路径)
 
 # 发电能力分析
 # VUE_APP_GENERAT_URL = 'http://123.60.219.66:9002'
-VUE_APP_GENERAT_URL = 'http://10.127.7.241:9002'
-# VUE_APP_GENERAT_URL = 'http://172.16.12.101:9002'
+# VUE_APP_GENERAT_URL = 'http://10.127.7.241:9002'
+VUE_APP_GENERAT_URL = 'http://172.16.12.101:9002'
 # VUE_APP_GENERAT_URL = 'http://192.168.2.231:9002'
 # VUE_APP_GENERAT_URL = 'http://127.0.0.1:9002'
 
 # 智能报表
 # VUE_APP_REPORT_URL = 'http://123.60.219.66:9001'
 # VUE_APP_REPORT_URL = 'http://192.168.0.105:9001'
-VUE_APP_REPORT_URL = 'http://10.127.7.241:9001'
-# VUE_APP_REPORT_URL = 'http://172.16.12.101:9001'
+# VUE_APP_REPORT_URL = 'http://10.127.7.241:9001'
+VUE_APP_REPORT_URL = 'http://172.16.12.101:9001'
 # VUE_APP_REPORT_URL = 'http://192.168.2.231:9001'
 # VUE_APP_REPORT_URL = 'http://127.0.0.1:9001'
 
 # 功率预测
 # VUE_APP_BASE_URL = 'http://123.60.219.66:8086'
 # VUE_APP_BASE_URL = 'http://192.168.0.105:8086'
-VUE_APP_BASE_URL = 'http://10.127.7.241:8086'
-# VUE_APP_BASE_URL = 'http://172.16.12.101:8086'
+# VUE_APP_BASE_URL = 'http://10.127.7.241:8086'
+VUE_APP_BASE_URL = 'http://172.16.12.101:8086'
 # VUE_APP_BASE_URL = 'http://192.168.2.231:8086'
 # VUE_APP_BASE_URL = 'http://127.0.0.1:8086'
 
 # 综合报警
-VUE_APP_ALARM = 'http://10.127.7.241:6015'
-# VUE_APP_ALARM = 'http://172.16.12.101:6015'
+# VUE_APP_ALARM = 'http://10.127.7.241:6015'
+VUE_APP_ALARM = 'http://172.16.12.101:6015'
 
 # VUE_APP_ADP_BASE_URL = 'http://10.127.7.241:6015'
 VUE_APP_ADP_BASE_URL = 'http://172.16.12.101'

+ 4 - 4
public/static/config/modeConfig.js

@@ -21,11 +21,11 @@ const skipLogin = false;
 // 切换模块时是否提示当前模块名称(用于对内介绍项目时便捷显示模块名称)
 const showModuleName = 0;
 
-const reportBaseUrl = "http://10.127.7.241:8083";
-// const reportBaseUrl = "http://172.16.12.101:8083";
+// const reportBaseUrl = "http://10.127.7.241:8083";
+const reportBaseUrl = "http://172.16.12.101:8083";
 
-const baseReportUrl = "http://10.127.7.196";
-// const baseReportUrl = "http://172.16.12.101";
+// const baseReportUrl = "http://10.127.7.196";
+const baseReportUrl = "http://172.16.12.101";
 
 // 是否隐藏控制台打印的 log info warn 信息
 const hideLog = false;

+ 103 - 15
src/views/generatingCapacity/report/index.vue

@@ -69,7 +69,7 @@
               resizable
               align="center"
               prop="wtidcount"
-              label="风机数量"
+              label="风机频次"
             />
             <el-table-column resizable align="center" label="操作">
               <template #default="scope">
@@ -103,9 +103,13 @@
     style="padding: 15px 40px"
   >
     <div
-      id="pdfDom"
+      ref="pdfDom"
       :class="!theme ? 'block' : 'white'"
-      :style="!theme ? 'background-color: #040c0b' : 'background-color: #fff'"
+      :style="
+        !theme
+          ? 'background-color: #040c0b; color: #fff'
+          : 'background-color: #fff; color: #000'
+      "
     >
       <h3
         style="
@@ -171,7 +175,7 @@
             width="180"
           />
           <el-table-column prop="module" align="center" label="偏差率" />
-          <el-table-column prop="wtidcount" align="center" label="风机数量" />
+          <el-table-column prop="wtidcount" align="center" label="风机频次" />
           <el-table-column
             prop="windturbineId"
             show-overflow-tooltip
@@ -208,7 +212,7 @@
             label="严重程度"
             width="180"
           />
-          <el-table-column prop="wtidcount" align="center" label="风机数量" />
+          <el-table-column prop="wtidcount" align="center" label="风机频次" />
           <!-- <el-table-column prop="amount1" label="风机数量" /> -->
           <el-table-column
             prop="windturbineId"
@@ -241,7 +245,7 @@
             width="180"
           />
           <!-- <el-table-column prop="name" label="偏差率" /> -->
-          <el-table-column prop="wtidcount" align="center" label="风机数量" />
+          <el-table-column prop="wtidcount" align="center" label="风机频次" />
           <el-table-column
             prop="windturbineId"
             show-overflow-tooltip
@@ -273,7 +277,7 @@
             width="180"
           />
           <!-- <el-table-column prop="name" label="偏差率" /> -->
-          <el-table-column prop="wtidcount" align="center" label="风机数量" />
+          <el-table-column prop="wtidcount" align="center" label="风机频次" />
           <el-table-column
             prop="windturbineId"
             show-overflow-tooltip
@@ -305,7 +309,7 @@
             width="180"
           />
 
-          <el-table-column prop="wtidcount" align="center" label="风机数量" />
+          <el-table-column prop="wtidcount" align="center" label="风机频次" />
           <el-table-column prop="remark" align="center" label="累计时间(min)" />
           <el-table-column
             prop="windturbineId"
@@ -1401,15 +1405,92 @@ const reportParamDate = ref(
 const exportPDF = () => {
   loading.value = true;
   // 调用htmlToPdf工具函数
-  htmlToPdf.getPdf(document.querySelector("#pdfDom"), "风电场性能分析报告");
+  // htmlToPdf.getPdf(document.querySelector("#pdfDom"), "风电场性能分析报告");
   // 定时器模拟按钮loading动画的时间
-  setTimeout(() => {
-    loading.value = false;
-    ElMessage.success("打印成功!");
-  }, 1000);
+  // setTimeout(() => {
+  //   loading.value = false;
+  //   ElMessage.success("打印成功!");
+  // }, 1000);
+  generatePDF();
   centerDialogVisible.value = false;
 };
 
+const pdfDom = ref("");
+const generatePDF = async () => {
+  try {
+    // 获取要转换为PDF的内容
+    const element = pdfDom.value;
+
+    // 保存当前滚动位置
+    const originalScrollTop = window.scrollY;
+
+    // 将页面滚动到顶部
+    window.scrollTo(0, 0);
+
+    // 设置元素的高度为内容的实际高度
+    const originalHeight = element.style.height;
+    const originalOverflow = element.style.overflow;
+    if (originalHeight) {
+      element.style.height = `${element.scrollHeight}px`;
+    }
+    if (originalOverflow) {
+      element.style.overflow = "hidden";
+    }
+
+    // 使用html2canvas将HTML内容转换为canvas
+    const canvas = await html2canvas(element, {
+      scale: 2, // 提高分辨率
+      logging: true, // 开启日志记录
+      useCORS: true, // 处理跨域图片
+    });
+
+    // 恢复原来的样式
+    element.style.height = originalHeight || "";
+    element.style.overflow = originalOverflow || "";
+
+    // 恢复滚动位置
+    window.scrollTo(0, originalScrollTop);
+
+    // 将canvas转换为Data URL
+    const imgData = canvas.toDataURL("image/png");
+
+    // 创建一个新的jsPDF实例
+    const doc = new jsPDF("p", "mm", "a4");
+
+    // 计算图片在PDF中的位置和大小
+    const imgProps = doc.getImageProperties(imgData);
+    const pdfWidth = doc.internal.pageSize.getWidth();
+    const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width;
+
+    // 计算每页的高度
+    const pageHeight = doc.internal.pageSize.getHeight();
+    let heightLeft = pdfHeight;
+
+    // 添加第一页
+    doc.addImage(imgData, "PNG", 0, 0, pdfWidth, pdfHeight);
+
+    // 添加后续页面
+    while (heightLeft > pageHeight) {
+      heightLeft -= pageHeight;
+      doc.addPage();
+      doc.addImage(
+        imgData,
+        "PNG",
+        0,
+        -pdfHeight + heightLeft,
+        pdfWidth,
+        pdfHeight
+      );
+    }
+
+    // 保存PDF文件
+    doc.save("能效分析报告.pdf");
+  } catch (error) {
+    console.error("Error generating PDF:", error);
+  }
+  loading.value = false;
+};
+
 const exportWORD = () => {
   httpRequest
     .get(`/MeetingReport/Analysisreport?time=${reportParamDate.value}`)
@@ -1546,7 +1627,6 @@ const exportWORD = () => {
               stack: error.stack,
               properties: error.properties,
             };
-            console.log(JSON.stringify({ error: e }));
             throw error;
           }
           // 生成一个代表docxtemplater对象的zip文件(不是一个真实的文件,而是在内存中的表示)
@@ -1775,7 +1855,6 @@ const renderReportPage = (res) => {
       }
     });
   });
-  console.log("wdssdl===>>", arr);
   wdssdlfx.value = arr;
   // 能耗指标分析(风电)
   const stationArr = [
@@ -2024,6 +2103,15 @@ onMounted(() => {
     }
   }
 }
+
+.reportDia {
+  .block {
+    div,
+    p {
+      color: #fff;
+    }
+  }
+}
 </style>
 <style lang="less">
 .el-overlay {

+ 10 - 18
src/views/intelligentReporting/existing.vue

@@ -1,13 +1,14 @@
 <template>
-  <div class="existingPage" :class="!theme ? 'themeDark' : 'themeLight'">
+  <!-- <div class="existingPage" :class="!theme ? 'themeDark' : 'themeLight'"> -->
+  <div class="existingPage">
     <p class="tableTit">已有脚本</p>
     <el-table
       :data="tableData2"
-      highlight-current-row
       :height="height"
-      @current-change="handleCurrentChange"
+      @selection-change="handleCurrentChange"
       ref="singleTableRef"
     >
+      <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="脚本名称">
         <template #default="scope">
           <el-tag type="primary">{{ scope.row.scriptName }}</el-tag>
@@ -103,7 +104,7 @@ export default {
     return {
       listHeight: document.documentElement.clientHeight - 220,
       tableData2: [],
-      childCurrentRow: {},
+      childCurrentRow: [],
       dialogVisible: false,
       scriptname: "",
       editTable: [],
@@ -115,16 +116,14 @@ export default {
   methods: {
     getData() {
       read().then((res) => {
-        console.log("res:", res.data);
-        this.$emit("getExistingData", res.data);
         this.tableData2 = res.data;
       });
     },
     handleCurrentChange(val) {
-      this.$emit("getExistingData", val);
       this.childCurrentRow = val;
-      //清除父组件的行选择
-      this.tableRow();
+      this.$emit("getExistingData", val);
+      // //清除父组件的行选择
+      // this.tableRow();
       this.setTableRow(val);
     },
     setTableRow(row) {
@@ -186,17 +185,10 @@ export default {
 
 
 <style scoped lang="less">
-.existingPage {
-  .tableTit {
-    line-height: 40px;
-    margin-left: 10px;
-  }
-}
-
 .themeDark {
   .tableTit {
     font-size: 16px;
-    color: #f8f9ff;
+    color: #fff;
   }
 }
 
@@ -205,7 +197,7 @@ export default {
 
   .tableTit {
     font-size: 16px;
-    color: #9093a6;
+    color: #000;
   }
 }
 

+ 168 - 126
src/views/intelligentReporting/reporting/index.vue

@@ -1,120 +1,115 @@
 <template>
   <div class="intellReport" :class="!theme ? 'themeDark' : 'themeLight'">
-    <el-row :gutter="50" justify="space-evenly" :style="pageHeight">
-      <el-col :span="9" class="warn-table">
-        <existing
-          @getExistingData="getData"
-          :height="tableHeight"
-          :theme="theme"
-        />
-      </el-col>
-      <el-col :span="1" style="text-align: center">
-        <div :style="btnHeight">
-          <!-- <el-button type="primary" @click="onAddItem1">
-                        <el-icon class="el-icon--right">
-                            <ArrowRight />
-                        </el-icon>
-                    </el-button> -->
-          <img
-            src="../../../assets/images/left.png"
-            @click="onAddItem1"
-            alt=""
-          />
+    <div class="l">
+      <existing
+        @getExistingData="getData"
+        :height="tableHeight"
+        :theme="theme"
+      />
+    </div>
+    <div class="c">
+      <div class="t">
+        <el-button
+          type="primary"
+          size="large"
+          :disabled="!childCurrentRow?.length"
+          @click="onAddItem1"
+          >添加至脚本列表
+          <el-icon style="margin-left: 4px" :size="16"><DArrowRight /></el-icon>
+        </el-button>
+      </div>
+      <div class="b">
+        <el-button
+          type="primary"
+          size="large"
+          :disabled="!childCurrentRow?.length"
+          @click="onAddItem2"
+          >添加至每日运行
+          <el-icon style="margin-left: 4px" :size="16"><DArrowRight /></el-icon>
+        </el-button>
+      </div>
+    </div>
+    <div class="r">
+      <div class="t">
+        <div class="listTop">
+          <p class="tableTit">脚本列表</p>
+          <el-button
+            class="run-all-script"
+            type="primary"
+            :disabled="btnloading"
+            @click="runAllScript"
+          >
+            全部运行
+          </el-button>
         </div>
-        <div :style="btnHeight">
-          <!-- <el-button type="primary" @click="onAddItem2">
-                        <el-icon class="el-icon--right">
-                            <ArrowRight />
-                        </el-icon>
-                    </el-button> -->
-          <img
-            src="../../../assets/images/left.png"
-            @click="onAddItem2"
-            alt=""
+        <el-table :data="tableData" style="height: calc(100% - 40px)">
+          <el-table-column
+            type="index"
+            label="序号"
+            width="50"
+            align="center"
           />
-        </div>
-      </el-col>
-      <el-col :span="13">
-        <div class="listTop warn-table">
-          <div style="display: flex; justify-content: space-between">
-            <p class="tableTit">脚本列表</p>
-            <el-button
-              class="run-all-script"
-              type="primary"
-              :disabled="btnloading"
-              @click="runAllScript"
-            >
-              全部运行
-            </el-button>
-          </div>
-          <el-table :data="tableData" :height="listHeight">
-            <el-table-column type="index" width="30" />
-            <el-table-column label="脚本名称">
-              <template #default="scope">
-                <!-- <el-button v-if="scope.row.scriptName !==''" type="warning" round>
-                                    {{ scope.row.scriptName}}
-                                </el-button> -->
-                <el-tag type="primary">{{ scope.row.scriptName }}</el-tag>
-              </template>
-            </el-table-column>
-            <el-table-column align="right">
-              <template #default="scope">
-                <el-button
-                  :type="`${$store.state.theme ? 'primary' : ''}`"
-                  :disabled="btnloading"
-                  @click="handleRun(scope.$index)"
-                  >运行
-                </el-button>
-                <el-button type="danger" @click="handleDeleteList(scope.$index)"
-                  >删除
-                </el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-        </div>
-
-        <div class="listTop listBot warn-table">
+          <el-table-column label="脚本名称">
+            <template #default="scope">
+              <el-tag type="primary">{{ scope.row.scriptName }}</el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column align="right">
+            <template #default="scope">
+              <el-button
+                :type="`${$store.state.theme ? 'primary' : ''}`"
+                :disabled="btnloading"
+                @click="handleRun(scope.$index)"
+                >运行
+              </el-button>
+              <el-button type="danger" @click="handleDeleteList(scope.$index)"
+                >删除
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <div class="b">
+        <div class="listTop">
           <p class="tableTit">每天运行一次</p>
-          <el-table :data="tableData4" :max-height="listHeight">
-            <el-table-column label="时间" width="300">
-              <template #default="scope">
-                <el-time-select
-                  v-model="scope.row.time"
-                  start="00:05"
-                  step="00:05"
-                  end="23:55"
-                  placeholder="选择时间"
-                />
-              </template>
-            </el-table-column>
-            <el-table-column label="脚本名称">
-              <template #default="scope">
-                <!-- <el-button v-if="scope.row.scriptName !==''" type="warning" round>
-                                    {{ scope.row.scriptName}}
-                                </el-button> -->
-                <el-tag type="primary">{{ scope.row.scriptName }}</el-tag>
-              </template>
-            </el-table-column>
-            <el-table-column align="right">
-              <template #default="scope">
-                <el-button
-                  :type="`${$store.state.theme ? 'primary' : ''}`"
-                  v-if="!scope.row.isRunning"
-                  @click="dayRun(scope.row)"
-                  >运行
-                </el-button>
-                <el-button v-else disabled>运行中 </el-button>
-                <el-button
-                  type="danger"
-                  @click="handleDeleteDayRun(scope.$index, scope.row)"
-                  >删除
-                </el-button>
-              </template>
-            </el-table-column>
-          </el-table>
+          <p></p>
         </div>
-      </el-col>
-    </el-row>
+        <el-table :data="tableData4" style="height: calc(100% - 120px)">
+          <el-table-column label="时间" width="300">
+            <template #default="scope">
+              <el-time-select
+                v-model="scope.row.time"
+                start="00:05"
+                step="00:05"
+                end="23:55"
+                placeholder="选择时间"
+              />
+            </template>
+          </el-table-column>
+          <el-table-column label="脚本名称">
+            <template #default="scope">
+              <el-tag type="primary">{{ scope.row.scriptName }}</el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column align="right">
+            <template #default="scope">
+              <el-button
+                :type="`${$store.state.theme ? 'primary' : ''}`"
+                v-if="!scope.row.isRunning"
+                @click="dayRun(scope.row)"
+                >运行
+              </el-button>
+              <el-button v-else disabled>运行中 </el-button>
+              <el-button
+                type="danger"
+                @click="handleDeleteDayRun(scope.$index, scope.row)"
+                >删除
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
   </div>
 </template>
 <script>
@@ -176,10 +171,10 @@ export default {
       });
     },
     onAddItem1() {
-      this.tableData.push(this.childCurrentRow);
+      this.tableData.push(...this.childCurrentRow);
     },
     onAddItem2() {
-      this.tableData4.push(this.childCurrentRow);
+      this.tableData4.push(...this.childCurrentRow);
     },
     runAllScript() {
       this.btnloading = true;
@@ -230,8 +225,7 @@ export default {
       }
     },
     getData(data) {
-      console.log("data:", data);
-      this.childCurrentRow = data;
+      this.childCurrentRow = data || [];
     },
   },
 };
@@ -239,19 +233,67 @@ export default {
 
 <style scoped lang="less">
 .intellReport {
-  .listTop {
-    margin-bottom: 20px;
+  width: 100%;
+  height: 100%;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
 
-    .tableTit {
-      line-height: 40px;
-      margin-left: 10px;
+  .l {
+    width: 35%;
+    height: calc(100% - 20px);
+    padding: 0 0 20px 0;
+    margin-left: 20px;
+  }
+  .c {
+    width: 15%;
+    height: calc(100% - 20px);
+    padding: 0 0 20px 0;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    flex-direction: column;
+
+    .t,
+    .b {
+      width: 100%;
+      height: 50%;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+
+      .el-button {
+        margin: 0;
+      }
     }
   }
 
-  .run-all-script {
-    position: relative;
-    right: 10px;
-    top: 10px;
+  .r {
+    width: 45%;
+    height: calc(100% - 20px);
+    padding: 0 0 20px 0;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    flex-direction: column;
+    margin-right: 20px;
+
+    .t,
+    .b {
+      width: 100%;
+      height: 50%;
+      display: flex;
+      justify-content: flex-start;
+      align-items: center;
+      flex-direction: column;
+
+      .listTop {
+        width: 100%;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+      }
+    }
   }
 }
 
@@ -262,7 +304,7 @@ export default {
 
   .tableTit {
     font-size: 16px;
-    color: #f8f9ff;
+    color: #fff;
   }
 }
 
@@ -276,7 +318,7 @@ export default {
 
     .tableTit {
       font-size: 16px;
-      color: #9093a6;
+      color: #000;
     }
   }
 }