Explorar el Código

各环境区分配置

liujiejie hace 1 semana
padre
commit
a4927ac28a

+ 15 - 0
.env.dev

@@ -0,0 +1,15 @@
+###
+ # @Author: your name
+ # @Date: 2025-07-17 14:14:27
+ # @LastEditTime: 2025-07-17 14:54:36
+ # @LastEditors: bogon
+ # @Description: In User Settings Edit
+ # @FilePath: /performance-test/.env.dev
+### 
+VUE_APP_MAPVIEW=http://192.168.50.235/tiles/{z}/{x}/{y}.png
+#这里需要在router/index.js 文件中进行判断cockpitComponent;
+#VUE_APP_HOME_COM="../views/admin/cockpitManage/Index.vue"
+VUE_APP_THEM="green"
+VUE_APP_ISSHOWHD='default'
+VUE_APP_UPLOAD="http://192.168.50.235/energy-manage-service/api/check/upload"
+VUE_APP_TITLE='机组功率曲线异常检测数据分析系统'

+ 13 - 0
.env.hd

@@ -0,0 +1,13 @@
+###
+ # @Author: your name
+ # @Date: 2025-07-17 14:13:20
+ # @LastEditTime: 2025-07-17 14:54:48
+ # @LastEditors: bogon
+ # @Description: In User Settings Edit
+ # @FilePath: /performance-test/.env.hd
+### 
+VUE_APP_MAPVIEW=http://192.168.0.1/tiles/{z}/{x}/{y}.png
+VUE_APP_THEM="blue"
+VUE_APP_ISSHOWHD='HD'
+VUE_APP_UPLOAD="http://192.168.0.1/energy-manage-service/api/check/upload"
+VUE_APP_TITLE='风电机组健康诊断平台'

+ 2 - 2
.gitignore

@@ -5,8 +5,8 @@ package-lock.json
 
 
 # local env files
-.env.local
-.env.*.local
+# .env.local
+# .env.*.local
 
 # Log files
 npm-debug.log*

+ 4 - 2
package.json

@@ -3,8 +3,10 @@
   "version": "0.1.0",
   "private": true,
   "scripts": {
-    "serve": "vue-cli-service serve",
-    "build": "vue-cli-service build"
+    "serve:dev": "vue-cli-service serve --mode dev",
+    "serve:hd": "vue-cli-service serve --mode hd",
+    "build:dev": "vue-cli-service build --mode dev",
+    "build:hd": "vue-cli-service build --mode hd"
   },
   "dependencies": {
     "@jiaminghi/data-view": "^2.10.0",

+ 2 - 1
src/components/map/index.vue

@@ -261,8 +261,9 @@ export default {
             // 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.0.1/tiles/{z}/{x}/{y}.png", //华电
             // url: "http://192.168.50.235/tiles/{z}/{x}/{y}.png", //中广核
+            url: process.env.VUE_APP_MAPVIEW,
           }),
         }),
         new VectorLayer({

+ 13 - 6
src/router/index.js

@@ -3,7 +3,18 @@ import VueRouter from "vue-router";
 import Home from "../views/home/Index.vue";
 
 Vue.use(VueRouter);
-
+let cockpitComponent;
+if (process.env.VUE_APP_ISSHOWHD === "default") {
+  cockpitComponent = () =>
+    import(
+      /* webpackChunkName:'home-cockpitManage-huadian' */ "../views/admin/cockpitManage/Index.vue"
+    );
+} else if (process.env.VUE_APP_ISSHOWHD === "HD") {
+  cockpitComponent = () =>
+    import(
+      /* webpackChunkName:'home-cockpitManage-guodian' */ "../views/admin/cockpitManage/HD.vue"
+    );
+}
 const createRouter = () =>
   new VueRouter({
     mode: "history",
@@ -26,11 +37,7 @@ const createRouter = () =>
             path: "cockpitManage",
             name: "驾驶舱",
             iconName: "gps",
-            component: () =>
-              import(
-                // /*webpackChunkName:'home-cockpitManage'*/ "../views/admin/cockpitManage/Index.vue"
-                /*webpackChunkName:'home-cockpitManage'*/ "../views/admin/cockpitManage/HD.vue" //华电选择这个
-              ),
+            component: cockpitComponent,
           },
           {
             // 电子地图

+ 2 - 2
src/store/themes.js

@@ -3,7 +3,7 @@ import { theme } from "tailwindcss/stubs/defaultConfig.stub";
 /*
  * @Author: your name
  * @Date: 2024-05-27 15:09:27
- * @LastEditTime: 2025-07-14 10:23:56
+ * @LastEditTime: 2025-07-17 14:34:41
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/store/themes.js
@@ -13,7 +13,7 @@ export default {
   namespaced: true,
   state: {
     // theme: localStorage.getItem("theme") || "green",
-    theme: localStorage.getItem("theme") || "blue", //华电默认主题色
+    theme: localStorage.getItem("theme") || process.env.VUE_APP_THEM, //华电默认主题色
     themeColor: [...colorSchemes[0].colors],
   },
   mutations: {

+ 5 - 3
src/views/home/Index.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="homeWrap" v-loading="loading">
-    <el-container v-if="isShowHd">
+    <!-- 华电 -->
+    <el-container v-if="menuShow === 'HD'">
       <el-main>
         <el-header>
           <div class="headerHDBox">
@@ -20,7 +21,8 @@
         </transition>
       </el-main>
     </el-container>
-    <el-container v-else="!isShowHd">
+    <!-- 默认 -->
+    <el-container v-else="menuShow === 'default'">
       <Menu></Menu>
       <el-main>
         <HeaderCom class="headerBox" @setLoding="setLoding"></HeaderCom>
@@ -51,8 +53,8 @@ export default {
   },
   data() {
     return {
+      menuShow: process.env.VUE_APP_ISSHOWHD,
       loading: false,
-      isShowHd: true, //true 则展示华电的菜单样式,false 则展示默认的左侧边栏菜单
     };
   },
   methods: {

+ 9 - 6
src/views/home/components/MenuHD.vue

@@ -4,7 +4,7 @@
       collapse-transition
       ref="menu"
       mode="horizontal"
-      class="mt-3 el-menu-vertical-demo my-menu-wrapper"
+      :class="`mt-3 el-menu-vertical-demo my-menu-wrapper ${isDefault}`"
       @open="handleOpen"
       @close="handleClose"
       :router="true"
@@ -142,6 +142,9 @@ export default {
         }
       });
     },
+    isDefault() {
+      return process.env.VUE_APP_ISSHOWHD;
+    },
   },
   watch: {
     currentMenuIndex: {
@@ -408,17 +411,17 @@ export default {
 }
 
 // 非华电公司放开这个注释下面的
-// .el-submenu__title * {
+// .default .el-submenu__title * {
 //   font-size: 16px;
 // }
-// .el-menu-item * {
+// .default .el-menu-item * {
 //   font-size: 16px;
 // }
 </style>
 
 <!-- /* 华电时的菜单打开这个 */ -->
 <style lang="scss">
-.el-menu--popup {
+.HD .el-menu--popup {
   width: 100% !important;
   min-width: 120px !important;
   .el-menu-item {
@@ -428,10 +431,10 @@ export default {
     padding: 0 5px !important;
   }
 }
-.el-submenu__title * {
+.HD .el-submenu__title * {
   font-size: 20px;
 }
-.el-menu-item * {
+.HD .el-menu-item * {
   font-size: 20px;
 }
 </style>

+ 2 - 2
src/views/ledger/component/windsiteup.vue

@@ -68,11 +68,10 @@
         </span>
       </div>
       <div v-if="resourceShow">
-        <!-- action="http://192.168.50.235/energy-manage-service/api/check/upload" -->
         <el-upload
           class="uploaddemo2"
           :file-list="resourcefileList"
-          action="http://192.168.0.1/energy-manage-service/api/check/upload"
+          :action="uploadUrl"
           :multiple="false"
           :before-upload="resourcebeforeUpload"
           :limit="1"
@@ -132,6 +131,7 @@ export default {
   data() {
     return {
       superior: "",
+      uploadUrl: process.env.VUE_APP_UPLOAD,
       superiorOptions: [
         {
           value: "1",

+ 3 - 1
src/views/login/Index.vue

@@ -4,7 +4,8 @@
       <div class="leftLogin">
         <!-- <h1>机组功率曲线异常检测数据分析系统</h1> -->
         <!-- 华电 -->
-        <h1>风电机组健康诊断平台</h1>
+        <!-- <h1>风电机组健康诊断平台</h1> -->
+        <h1>{{ title }}</h1>
         <el-divider></el-divider>
         <div class="loginText">
           <el-form
@@ -59,6 +60,7 @@ export default {
         userName: "",
         password: "",
       },
+      title: process.env.VUE_APP_TITLE,
       loadingView: false,
       rules: {
         userName: [

+ 3 - 3
vue.config.js

@@ -64,9 +64,9 @@ module.exports = {
     proxy: {
       "/api": {
         // 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://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://106.120.102.238:16700", // 外网16700  生产16600
         // target: "http://10.96.137.5",