Browse Source

Merge branch '2024-10-24/fetaure-AES' into dataAsset

sunxiao 2 weeks ago
parent
commit
e2cf38dc0e

+ 1 - 0
.env.development

@@ -6,6 +6,7 @@ VITE_APP_ENV = 'development'
 
 # 管理系统/开发环境
 VITE_APP_BASE_API =  http://10.0.0.28:8080/
+# VITE_APP_BASE_API = 'http://192.168.9.54:8080/'
 
 VITE_APP_BASE_TEST = http://10.0.0.28:8080/
 VITE_APP_BASE_PROD = http://192.168.9.54:8080/

+ 1 - 0
package.json

@@ -24,6 +24,7 @@
     "@vueup/vue-quill": "1.2.0",
     "@vueuse/core": "10.6.1",
     "axios": "0.27.2",
+    "crypto-js": "^4.2.0",
     "echarts": "^5.5.0",
     "element-plus": "2.4.3",
     "file-saver": "2.0.5",

+ 12 - 1
src/store/modules/user.js

@@ -1,6 +1,17 @@
 import { login, logout, getInfo } from '@/api/login'
 import { getToken, setToken, removeToken } from '@/utils/auth'
 import defAva from '@/assets/images/profile.jpg'
+import CryptoJS from 'crypto-js';
+
+const SECRET_KEY = 'qwertasdfg159753'
+function AES_ECB_ENCRYPT(text) {
+  var keyHex = CryptoJS.enc.Utf8.parse(SECRET_KEY);
+  var messageHex = CryptoJS.enc.Utf8.parse(text);
+  var encrypted = CryptoJS.AES.encrypt(messageHex, keyHex, {
+    "mode": CryptoJS.mode.ECB
+  });
+  return encrypted.toString();
+}
 
 const useUserStore = defineStore(
   'user',
@@ -17,7 +28,7 @@ const useUserStore = defineStore(
       // 登录
       login(userInfo) {
         const username = userInfo.username.trim()
-        const password = userInfo.password
+        const password = AES_ECB_ENCRYPT(userInfo.password)
         const code = userInfo.code
         const uuid = userInfo.uuid
         return new Promise((resolve, reject) => {

+ 40 - 8
src/views/business/comparison/components/echartConfig.js

@@ -1,18 +1,48 @@
-export const getEchartLineOption = ({ xAxisData, echartData }) => {
-  const series = echartData.map(({ name, val: data }) => ({
+export const getEchartLineOption = ({ xAxisData, echartData, specificData }) => {
+  const colors = ["#5B8FF9", "#82c370", "#ffbf59"];
+  const series = echartData.map(({ name, val: data }, index) => ({
     name,
     data,
     type: "line",
     showSymbol: false,
+    lineStyle: {
+      width: 2,
+      color: colors[index],
+    },
     smooth: true,
+    xAxisIndex: 0,
   }));
 
+  series.push({
+    tooltip: {
+      show: false
+    },
+    type: "line",
+    symbolSize: 8,
+    itemStyle: {
+      color: "red",
+    },
+    itemStyle: {
+      color: colors[0],
+    },
+    xAxisIndex: 0,
+    data: specificData,
+  });
+
   const option = {
+    dataZoom: [{
+      bottom: 10,
+      height: 20,
+      show: true,
+      start: 0,
+      end: 100,
+      xAxisIndex: [0],
+    }],
     grid: {
       left: "5%",
       top: "2%",
       right: "12%",
-      bottom: "2%",
+      bottom: 30,
       containLabel: true,
     },
     legend: {
@@ -39,11 +69,13 @@ export const getEchartLineOption = ({ xAxisData, echartData }) => {
     tooltip: {
       trigger: "axis",
     },
-    xAxis: {
-      type: "category",
-      boundaryGap: false,
-      data: xAxisData,
-    },
+    xAxis: [
+      {
+        type: "category",
+        boundaryGap: false,
+        data: xAxisData,
+      },
+    ],
     yAxis: {
       type: "value",
     },

+ 35 - 14
src/views/business/comparison/index.vue

@@ -188,7 +188,11 @@ export default {
         { label: "PO₄³⁻ ", value: 'zlsy' },
         { label: "NH₃-N ", value: 'nh3' },
         { label: "COD ", value: 'cod' },
-        { label: "SS ", value: 'ss' }
+        { label: "SS ", value: 'ss' },
+        { label: "#1缺氧硝酸盐 ", value: 'qyxsy1' },
+        { label: "#2缺氧硝酸盐 ", value: 'qyxsy2' },
+        { label: "#1缺氧氨氮 ", value: 'qynh31' },
+        { label: "#2缺氧氨氮 ", value: 'qynh32' }
       ],
       // 查询参数
       queryParams: {
@@ -244,17 +248,28 @@ export default {
       }
       
       const data = await getEchartData({ category: this.activeItem.value, timeBegin, timeEnd });
-      console.log(data);
+      
+      Object.keys(data).forEach(key => {
+        const len = data[key].data.length;
+        console.log( data[key].data[len - 1] );
+        if ( !data[key].data[len - 1] ) {
+          data[key].data.pop()
+        }
+      })
+
+      const reusltData = data.hs.data.splice(data.real.data.length, data.hs.data.length - data.real.data.length);
+      // const reusltTime = data.hs.time.splice(data.real.time.length, data.hs.time.length - data.real.time.length);
+      // console.log( reusltData, reusltTime );
       let xAxisData = [];
-      const realOneList = [];
-      const realTwoList = [];
-      const realThreeList = [];
-      const hsForecastOneList = [];
-      const hsForecastTwoList = [];
-      const hsForecastThreeList = [];
-      const yyForecastOneList = [];
-      const yyForecastTwoList = [];
-      const yyForecastThreeList = [];
+      // const realOneList = [];
+      // const realTwoList = [];
+      // const realThreeList = [];
+      // const hsForecastOneList = [];
+      // const hsForecastTwoList = [];
+      // const hsForecastThreeList = [];
+      // const yyForecastOneList = [];
+      // const yyForecastTwoList = [];
+      // const yyForecastThreeList = [];
 
       // data.map(item => {
       //   const {
@@ -275,10 +290,10 @@ export default {
       //   yyForecastThreeList.push(yyForecastThree);
       // })
     
-      xAxisData = data.yy.time
+      xAxisData = [...data.yy.time];
 
       const echartData = [
-        { name: 'TFT', val: data.hs.data },
+        { name: 'TFT', val: [...data.hs.data, ...reusltData] },
         { name: '真实值', val: data.real.data },
         { name: 'LSTM', val: data.yy.data },
         // { name: 'TFTpre_1', val: hsForecastOneList },
@@ -289,7 +304,9 @@ export default {
         // { name: 'LSTMpre_3', val: yyForecastThreeList }
       ]
 
-      const option = getEchartLineOption({ xAxisData, echartData });
+      const specificData = new Array(data.hs.data.length).fill(null).concat( reusltData );
+
+      const option = getEchartLineOption({ xAxisData, echartData, specificData:specificData });
 
       echart.setOption(option);
 
@@ -356,6 +373,10 @@ export default {
           nh3: 'NH₃',
           cod: 'COD',
           ss: 'SS',
+          qyxsy1: '#1缺氧硝酸盐',
+          qyxsy2: '#2缺氧硝酸盐',
+          qynh31: '#1缺氧氨氮',
+          qynh32: '#2缺氧氨氮'
         }
         this.comparisonList = response.rows.map(item => ({ ...item, category: whiteList[item.category] }));
         this.total = response.total;