Browse Source

优化工联院跳转获取信息的逻辑/更换回项目的默认配置

lph 1 year ago
parent
commit
ed803d811a

+ 3 - 4
zkqy-ui/src/layout/index.vue

@@ -18,7 +18,7 @@
               <span style="">
                 <span class="jianbiase">{{ username || "默认用户" }}</span>
               </span>
-              <img :src="avatar" class="user-avatar"/>
+              <img :src="avatar" class="user-avatar" />
               <!-- <i class="el-icon-caret-bottom" /> -->
             </div>
             <el-dropdown-menu slot="dropdown" style="margin-top: -20px">
@@ -156,8 +156,7 @@ export default {
     },
     getlogo() {
       let logo = sessionStorage.getItem("logo");
-      // this.title = sessionStorage.getItem("title") || "工业应用操作系统";
-      // this.title = sessionStorage.getItem("title") || "智能制造平台";
+      // this.title = sessionStorage.getItem("title") || "智能制造平台"; //工联院
       this.title = sessionStorage.getItem("title") || "工业应用引擎";
       if (logo) {
         this.logo = process.env.VUE_APP_BASE_API + logo;
@@ -220,7 +219,7 @@ export default {
   /* width: 120px; */
   height: 37px;
   /* height: 25px; */
- /*  background: linear-gradient(
+  /*  background: linear-gradient(
       128.13deg,
       rgba(82, 79, 255, 1) 0%,
       rgba(255, 74, 74, 1) 100%

+ 3 - 3
zkqy-ui/src/views/adminLogin.vue

@@ -383,9 +383,9 @@ export default {
   /* box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25); */
   opacity: 1;
   // 工联院 样式
-  // background-size: contain;
-  // background-repeat: no-repeat;
-  // background-position: center;
+  background-size: contain;
+  background-repeat: no-repeat;
+  background-position: center;
 }
 .login {
   display: flex;

+ 195 - 160
zkqy-ui/src/views/index.vue

@@ -50,7 +50,7 @@
     </el-row> -->
     <div class="info-content">
       <!-- <div class="header" @click="toPersonalCenter"> -->
-        <!-- <img :src="avatar" class="user-avatar" /> -->
+      <!-- <img :src="avatar" class="user-avatar" /> -->
       <!-- </div> -->
       <!-- <div class="name">{{ nickName }}</div>
       <div class="tenant-name">{{ tenantName }}</div>
@@ -81,11 +81,15 @@
         <div class="swiper-container">
           <div class="swiper-scrollbar"></div>
           <div class="swiper-wrapper">
-            <div class="swiper-slide" v-for="(item,index) in swiperList" :key="index">
-              <div >
+            <div
+              class="swiper-slide"
+              v-for="(item, index) in swiperList"
+              :key="index"
+            >
+              <div>
                 <span class="name">{{ item.oper_name }}</span>
-                <span class="ip">{{ item.oper_ip }}</span>      
-              </div>   
+                <span class="ip">{{ item.oper_ip }}</span>
+              </div>
             </div>
           </div>
         </div>
@@ -104,8 +108,8 @@
 import { formatDate } from "@/utils";
 import { getToken } from "@/utils/auth";
 import { mapGetters, mapState } from "vuex";
-import 'swiper/css/swiper.css'; 
-import Swiper from 'swiper';
+import "swiper/css/swiper.css";
+import Swiper from "swiper";
 import {
   getProcess,
   getOperation,
@@ -181,51 +185,52 @@ export default {
   },
   methods: {
     initData() {
+      console.log(1111);
       //工业流&审批流
       getProcess().then((response) => {
-        if(response.code == 200){
+        if (response.code == 200) {
           this.processList = response.data;
           console.log(response.data);
           this.chartObj.myChart1.setOption({
             series: [
               {
-                data: response.data
-              }
-            ]
-          })
+                data: response.data,
+              },
+            ],
+          });
         } else {
           console.log(response);
           this.$message.error("获取数据失败");
         }
-      })
-      
+      });
+
       //登录次数统计
-      getLogin().then(response => {
-        if(response.code == 200){
-          let xAxisData = response.data[0].date
+      getLogin().then((response) => {
+        if (response.code == 200) {
+          let xAxisData = response.data[0].date;
           xAxisData = xAxisData.map(function (dateStr) {
             var date = new Date(dateStr);
             return date.getMonth() + 1 + "月" + date.getDate() + "日";
           });
-          let loginList = response.data.map((item)  => item.name);
+          let loginList = response.data.map((item) => item.name);
           this.chartObj.myChart2.setOption({
             xAxis: {
-              data: xAxisData
+              data: xAxisData,
             },
             legend: {
-              data: loginList
+              data: loginList,
             },
-            series: response.data
-          })
+            series: response.data,
+          });
         } else {
           console.log(response);
           this.$message.error("获取数据失败");
         }
-      })
+      });
 
       //登录统计信息
-      getOperation().then(response => {
-        if(response.code == 200){
+      getOperation().then((response) => {
+        if (response.code == 200) {
           this.swiperList = response.data;
           console.log(this.swiperList);
           this.$nextTick(() => {
@@ -233,7 +238,7 @@ export default {
               direction: "vertical",
               loop: true,
               autoplay: {
-                delay: 1000, 
+                delay: 1000,
                 disableOnInteraction: false,
               },
               scrollbar: {
@@ -248,46 +253,46 @@ export default {
           console.log(response);
           this.$message.error("获取数据失败");
         }
-      })
+      });
 
       // 表格统计
-      getTabular().then(response => {
-        if(response.code == 200){
-          let tabularList = response.data
-          tabularList.push({ name: '多表数量', value: 30 })
-          let labelList = response.data.map((item) => item.name)
+      getTabular().then((response) => {
+        if (response.code == 200) {
+          let tabularList = response.data;
+          tabularList.push({ name: "多表数量", value: 30 });
+          let labelList = response.data.map((item) => item.name);
           this.chartObj.myChart3.setOption({
             yAxis: {
-              data: labelList, 
+              data: labelList,
             },
             series: [
               {
-                data: response.data
-              }
-            ]
-          })
+                data: response.data,
+              },
+            ],
+          });
         } else {
           console.log(response);
           this.$message.error("获取数据失败");
         }
-      })
+      });
 
       //数据建模数量
-      getData().then(response => {
-        if(response.code == 200){
+      getData().then((response) => {
+        if (response.code == 200) {
           console.log(response.data);
           this.chartObj.myChart4.setOption({
             series: [
               {
-                data: [response.data]
-              }
-            ]
-          })
+                data: [response.data],
+              },
+            ],
+          });
         } else {
           console.log(response);
           this.$message.error("获取数据失败");
         }
-      })
+      });
     },
 
     initChart1() {
@@ -296,232 +301,262 @@ export default {
       let option = {
         color: ["#9370db", "#ffd700", "#00ccff", "#ff6600", "#ff9900"],
         title: {
-          text: '流程统计',
-          left: 'left',
+          text: "流程统计",
+          left: "left",
           textStyle: {
             fontSize: 16,
-            fontWeight: 'normal',
-            color: '#696969'
+            fontWeight: "normal",
+            color: "#696969",
           },
         },
         tooltip: {
-          trigger: 'item'
+          trigger: "item",
         },
         legend: {
-          left: '60%',
-          top: '60%',
+          left: "60%",
+          top: "60%",
         },
         series: [
           {
-            type: 'pie',
-            radius: ['40%', '100%'],
+            type: "pie",
+            radius: ["40%", "100%"],
             avoidLabelOverlap: false,
             itemStyle: {
               // borderRadius: 10,
-              borderColor: '#fff',
-              borderWidth: 2
+              borderColor: "#fff",
+              borderWidth: 2,
             },
-            right: '40%',
-            top: '50%',
+            right: "40%",
+            top: "50%",
             data: [
-              { value: 10, name: '工艺流' },
-              { value: 20, name: '审批流' },
+              { value: 10, name: "工艺流" },
+              { value: 20, name: "审批流" },
             ],
             label: {
               show: false,
-              position: 'center'
+              position: "center",
             },
             labelLine: {
-              show: false
+              show: false,
             },
             emphasis: {
               label: {
                 show: true,
                 fontSize: 20,
-                fontWeight: 'bold'
-              }
-            }
-          }
-        ]
+                fontWeight: "bold",
+              },
+            },
+          },
+        ],
       };
       this.chartObj.myChart1.setOption(option);
     },
-    
-    initChart2(){
+
+    initChart2() {
       this.chartObj.myChart2 = this.$echarts.init(this.$refs.lineChart);
       let option = {
         color: ["#FF88E0", "#9FE080"],
         title: {
-          text: '用户登录统计',
+          text: "用户登录统计",
           textStyle: {
             fontSize: 16,
-            fontWeight: 'normal',
-            color: '#696969'
+            fontWeight: "normal",
+            color: "#696969",
           },
         },
         tooltip: {
-          trigger: 'axis'
+          trigger: "axis",
         },
         legend: {
-          data: ['客户端11', '工具端11']
+          data: ["客户端11", "工具端11"],
         },
         grid: {
-          left: '3%',
-          right: '4%',
-          top: '20%',
-          bottom: '0%',
-          containLabel: true
+          left: "3%",
+          right: "4%",
+          top: "20%",
+          bottom: "0%",
+          containLabel: true,
         },
         xAxis: {
-          type: 'category',
+          type: "category",
           boundaryGap: false,
           data: [
-                  '01\nMon', '02\nTue', '03\nWed', '04\nThu', '05\nFri', '06\nSat', '07\nSun',
-                  '08\nMon', '09\nTue', '10\nWed', '11\nThu', '12\nFri', '13\nSat', '14\nSun',
-                  '15\nMon', '16\nTue', '17\nWed', '18\nThu', '19\nFri', '20\nSat', '21\nSun',
-                  '22\nMon', '23\nTue', '24\nWed', '25\nThu', '26\nFri', '27\nSat', '28\nSun',
-                  '29\nMon', '30\nTue', 
-                ]
+            "01\nMon",
+            "02\nTue",
+            "03\nWed",
+            "04\nThu",
+            "05\nFri",
+            "06\nSat",
+            "07\nSun",
+            "08\nMon",
+            "09\nTue",
+            "10\nWed",
+            "11\nThu",
+            "12\nFri",
+            "13\nSat",
+            "14\nSun",
+            "15\nMon",
+            "16\nTue",
+            "17\nWed",
+            "18\nThu",
+            "19\nFri",
+            "20\nSat",
+            "21\nSun",
+            "22\nMon",
+            "23\nTue",
+            "24\nWed",
+            "25\nThu",
+            "26\nFri",
+            "27\nSat",
+            "28\nSun",
+            "29\nMon",
+            "30\nTue",
+          ],
         },
         yAxis: {
-          type: 'value'
+          type: "value",
         },
         series: [
           {
-            name: '客户端',
-            type: 'line',
+            name: "客户端",
+            type: "line",
             smooth: true,
-            data: [10, 23, 42, 13, 30, 25, 40, 30, 42, 55, 40, 28, 20, 30, 45, 25, 20, 30, 40, 33, 35, 40, 46, 31, 13, 34, 20, 10, 36, 43]
+            data: [
+              10, 23, 42, 13, 30, 25, 40, 30, 42, 55, 40, 28, 20, 30, 45, 25,
+              20, 30, 40, 33, 35, 40, 46, 31, 13, 34, 20, 10, 36, 43,
+            ],
           },
           {
-            name: '工具端',
-            type: 'line',
+            name: "工具端",
+            type: "line",
             smooth: true,
-            data: [20, 30, 29, 40, 55, 33, 30, 26, 36, 45, 50, 34, 38, 25, 28, 43, 16, 30, 45, 52, 40, 46, 33, 57, 50, 33, 40, 59, 56, 56]
+            data: [
+              20, 30, 29, 40, 55, 33, 30, 26, 36, 45, 50, 34, 38, 25, 28, 43,
+              16, 30, 45, 52, 40, 46, 33, 57, 50, 33, 40, 59, 56, 56,
+            ],
           },
-        ]
-      }
+        ],
+      };
       this.chartObj.myChart2.setOption(option);
     },
 
-    initChart3(){
+    initChart3() {
       this.chartObj.myChart3 = this.$echarts.init(this.$refs.gaugeChart);
       let option = {
-        color: ["#00ccff", "#ff6600", "#ff9900","#9370db", "#ffd700"],
+        color: ["#00ccff", "#ff6600", "#ff9900", "#9370db", "#ffd700"],
         title: {
-          text: '表格统计',
-          left: 'left',
+          text: "表格统计",
+          left: "left",
           textStyle: {
             fontSize: 16,
-            fontWeight: 'normal',
-            color: '#696969'
+            fontWeight: "normal",
+            color: "#696969",
           },
         },
         tooltip: {
           trigger: "axis",
           axisPointer: {
-            type: "shadow"
-          }
+            type: "shadow",
+          },
         },
         grid: {
-          left: '0%',
-          right: '3%',
-          top: '20%',
-          bottom: '0%',
-          containLabel: true
+          left: "0%",
+          right: "3%",
+          top: "20%",
+          bottom: "0%",
+          containLabel: true,
         },
         xAxis: {
-          type: 'value',
-          nameLocation: 'middle',
+          type: "value",
+          nameLocation: "middle",
           nameTextStyle: {
-            align: 'center'
+            align: "center",
           },
           splitLine: {
-            show: false
+            show: false,
           },
         },
-        
+
         yAxis: {
-          type: 'category',
-          data: ['表单', '表格', '三级联动', '多表数量'], 
+          type: "category",
+          data: ["表单", "表格", "三级联动", "多表数量"],
           inverse: true, // 使类目从右向左排列
         },
 
         series: [
           {
-            type: 'bar',
-            barWidth: '18', 
-            orientation: 'horizontal', 
+            type: "bar",
+            barWidth: "18",
+            orientation: "horizontal",
             data: [
-              { value: 88, name: '表单' },
-              { value: 66, name: '表格' },
-              { value: 33, name: '三级联动' },
-              { value: 55, name: '多表数量' },
+              { value: 88, name: "表单" },
+              { value: 66, name: "表格" },
+              { value: 33, name: "三级联动" },
+              { value: 55, name: "多表数量" },
             ],
             showBackground: true,
             backgroundStyle: {
-              color: '#F0F8FF'
-            }
-          }
-        ]
-      }
+              color: "#F0F8FF",
+            },
+          },
+        ],
+      };
       this.chartObj.myChart3.setOption(option);
     },
 
-    initChart4(){
+    initChart4() {
       this.chartObj.myChart4 = this.$echarts.init(this.$refs.barChart);
       let option = {
         color: ["#5D84FE"],
         title: {
-          text: '数据建模统计',
+          text: "数据建模统计",
           textStyle: {
             fontSize: 16,
-            fontWeight: 'normal',
-            color: '#696969'
+            fontWeight: "normal",
+            color: "#696969",
           },
         },
         tooltip: {
           trigger: "axis",
           axisPointer: {
-            type: "shadow"
-          }
+            type: "shadow",
+          },
         },
         xAxis: {
-          type: 'category',
-          data: ['数据建模'],
+          type: "category",
+          data: ["数据建模"],
         },
         yAxis: {
-          type: 'value',
+          type: "value",
           min: 0,
-          max: 100, 
+          max: 100,
           interval: 20,
           splitLine: {
-            show: false // 关闭y轴的水平分割线
+            show: false, // 关闭y轴的水平分割线
           },
         },
         grid: {
-          left: '5%',
-          right: '5%',
-          top: '30%',
-          bottom: '0%',
-          containLabel: true
+          left: "5%",
+          right: "5%",
+          top: "30%",
+          bottom: "0%",
+          containLabel: true,
         },
         series: [
           {
             data: [20],
-            type: 'bar',
-            barWidth: '30', // 设置柱体宽度
+            type: "bar",
+            barWidth: "30", // 设置柱体宽度
             showBackground: true,
             backgroundStyle: {
-              color: '#E8EFFF'
-            }
-          }
-        ]
-      }
+              color: "#E8EFFF",
+            },
+          },
+        ],
+      };
       this.chartObj.myChart4.setOption(option);
     },
 
-
     /** 导入按钮操作 */
     handleImport() {
       this.upload.title = "用户导入";
@@ -578,9 +613,9 @@ export default {
       return formatDate(new Date());
     },
   },
-  mounted() {
-    this.title = sessionStorage.getItem("title") || "智能制造平台";
-  },
+  // mounted() {
+  //   this.title = sessionStorage.getItem("title") || "智能制造平台";
+  // },
 };
 </script>
 
@@ -601,7 +636,7 @@ export default {
       height: 280px;
       margin: auto;
       padding: 20px 15px;
-      box-shadow: 10px 10px 5px #E0E0E0;
+      box-shadow: 10px 10px 5px #e0e0e0;
       background-color: #fff;
       border-radius: 10px;
       .pieChart {
@@ -642,7 +677,7 @@ export default {
       height: 280px;
       margin: auto;
       padding: 20px 15px;
-      box-shadow: 10px 10px 5px #E0E0E0;
+      box-shadow: 10px 10px 5px #e0e0e0;
       background-color: #fff;
       border-radius: 10px;
       margin-right: 30px;
@@ -656,7 +691,7 @@ export default {
       height: 200px;
       margin: auto;
       padding: 20px 15px;
-      box-shadow: 10px 10px 5px #E0E0E0;
+      box-shadow: 10px 10px 5px #e0e0e0;
       background-color: #fff;
       border-radius: 10px;
       margin-top: 20px;
@@ -665,7 +700,7 @@ export default {
       }
       .title {
         font-size: 16px;
-        color: '#696969'
+        color: "#696969";
       }
       .text {
         display: flex;
@@ -709,7 +744,7 @@ export default {
       height: 200px;
       margin: auto;
       padding: 20px 15px;
-      box-shadow: 10px 10px 5px #E0E0E0;
+      box-shadow: 10px 10px 5px #e0e0e0;
       background-color: #fff;
       border-radius: 10px;
       margin-top: 20px;
@@ -723,7 +758,7 @@ export default {
       height: 200px;
       margin: auto;
       padding: 20px 15px;
-      box-shadow: 10px 10px 5px #E0E0E0;
+      box-shadow: 10px 10px 5px #e0e0e0;
       background-color: #fff;
       border-radius: 10px;
       margin-top: 20px;

+ 10 - 2
zkqy-ui/src/views/loading.vue

@@ -35,9 +35,13 @@ export default {
       } = config;
       if (loginPageTitle) {
         window.sessionStorage.setItem("title", loginPageTitle);
+      } else {
+        window.sessionStorage.removeItem("title");
       }
       if (loginPageLogo) {
         window.sessionStorage.setItem("logo", loginPageLogo);
+      } else {
+        window.sessionStorage.removeItem("logo");
       }
     },
 
@@ -46,14 +50,18 @@ export default {
       if (tenantCode != null) {
         // 得到tenantId 查询裤中是否存在该租户
         let res = await isTenantExist({ tenantCode: tenantCode });
+        console.log("isTenantExist", res);
         if (res == undefined) {
           this.$router.push({ path: "/401" });
-        } else if (res.data?.tenantId) {
+        } else if (res?.data?.tenantId) {
           // 判断当前编号是否存在库中
           // this.tenantId = res.data.tenantId;
           // this.loginForm.tenantID = this.tenantId;
-          if (res.data?.loginPageConfiguration) {
+          if (res?.data?.loginPageConfiguration) {
             this.setConfig(res.data.loginPageConfiguration || {});
+          } else {
+            window.sessionStorage.removeItem("title");
+            window.sessionStorage.removeItem("logo");
           }
         } else {
           console.log("租户有问题!");

+ 8 - 4
zkqy-ui/src/views/login.vue

@@ -139,10 +139,14 @@ export default {
     },
   },
   created() {
+    this.clearSession();
     this.validateTenantId();
     this.getCode();
   },
   methods: {
+    clearSession() {
+      sessionStorage.clear();
+    },
     handleBlur(event) {
       if (event.target.value.toLowerCase() === "admin") {
         this.loginForm.username = "";
@@ -420,16 +424,16 @@ export default {
   margin-top: 49px;
   width: 200px;
   height: 70px;
-  // background: url(../assets/images/mes412.png);//工联院
+  // background: url(../assets/images/mes412.png); //工联院
   background: url(../assets/images/mecos-logo1.jpg);
   background-size: cover;
   // background: url(../assets/images/comp.png);
   /* box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25); */
   opacity: 1;
   // 工联院样式
-  // background-size: contain;
-  // background-repeat: no-repeat;
-  // background-position: center;
+  background-size: contain;
+  background-repeat: no-repeat;
+  background-position: center;
 }
 
 .login {