Browse Source

2023-03-06 update

1. fix allMatrices页 风机排序不正确的问题
2. setting页 新增保存设置时需确认是否登录
moccus 2 years ago
parent
commit
f510e8b47b
3 changed files with 51 additions and 14 deletions
  1. 24 6
      src/components/allMatrices.vue
  2. 13 0
      src/components/setting.vue
  3. 14 8
      src/components/unpaidMatrixBlockPv.vue

+ 24 - 6
src/components/allMatrices.vue

@@ -383,14 +383,22 @@ export default {
         stationObj[val] = this.cache[val];
       }
 
-      let list = Object.keys(stationObj).sort();
+      let list = Object.keys(stationObj);
       for (const id of list) {
-        stationArr.push(stationObj[id]);
+        stationArr.push(stationObj[id].sort((a,b)=>{
+          let aSubString = '0', bSubString = '0'
+          if(a.windturbineId && b.windturbineId){
+            aSubString = a.windturbineId.substring(a.windturbineId.lastIndexOf('_')+1)
+            bSubString = b.windturbineId.substring(b.windturbineId.lastIndexOf('_')+1)
+          }else if(a.id && b.id){
+            aSubString = a.id.substring(a.id.lastIndexOf('_')+1)
+            bSubString = b.id.substring(b.id.lastIndexOf('_')+1)
+          }
+          return parseInt(aSubString) - parseInt(bSubString)
+        }));
       }
       this.stationObj = stationObj;
       this.stationArr = stationArr;
-      console.log('stationArr======>>>>>', this.stationArr)
-      debugger
     },
     //风场回调
     handleDetial(itm) {
@@ -772,9 +780,19 @@ export default {
             this.current === "all" &&
                 (this.cache = JSON.parse(JSON.stringify(this.stationObj)));
             // let list = Object.keys(this.stationObj).sort();
-            let list = Object.keys(this.stationObj);
+            let list = Object.keys(this.stationObj)
             for (const id of list) {
-                stationArr.push(this.stationObj[id]);
+                stationArr.push(this.stationObj[id].sort((a,b)=>{
+                  let aSubString = '0', bSubString = '0'
+                  if(a.windturbineId && b.windturbineId){
+                    aSubString = a.windturbineId.substring(a.windturbineId.lastIndexOf('_')+1)
+                    bSubString = b.windturbineId.substring(b.windturbineId.lastIndexOf('_')+1)
+                  }else if(a.id && b.id){
+                    aSubString = a.id.substring(a.id.lastIndexOf('_')+1)
+                    bSubString = b.id.substring(b.id.lastIndexOf('_')+1)
+                  }
+                  return parseInt(aSubString) - parseInt(bSubString)
+                }))
             }
             // this.stationArr = stationArr;
             this.stationArr = this.sortStarionArr(stationArr);

+ 13 - 0
src/components/setting.vue

@@ -472,6 +472,7 @@
   
 <script>
 import api from "api/index";
+import BackgroundData from "utils/BackgroundData";
 // import mnIcon1 from '../assets/img/RecommendedArea/background.png'
 export default {
     data() {
@@ -741,6 +742,18 @@ export default {
             });
         },
         updateSettings() {
+            let bd = BackgroundData.getInstance();
+            if (!bd.LoginUser) {
+              this.$notify({
+                title: "请登录",
+                message: "修改设置需要先登录!",
+                type: "warning",
+                position: "bottom-right",
+                offset: 60,
+                duration: 3000,
+              });
+              return;
+            }
             api.updateSettings({
               stationId: this.stationId,
               modelId: this.modelId,

+ 14 - 8
src/components/unpaidMatrixBlockPv.vue

@@ -15,8 +15,8 @@
               item.active ? 'left-' + item.status : 'unleft-' + item.status
             "
           >
-            <div>{{ getName(item, 'top') }}</div>
-            <div>{{ getName(item, 'bot') }}</div><!-- item.id.slice(5) -->
+            <div style="white-space:nowrap">{{ getName(item, 'top') }}</div>
+            <div style="white-space:nowrap">{{ getName(item, 'bot') }}</div><!-- item.id.slice(5) -->
 
             <!-- <div>{{ item.windturbineId.slice(0, 2) }}</div>
             <div>{{ item.code }}</div> -->
@@ -108,9 +108,11 @@ export default {
             if (item.station.indexOf('HZJ') > -1) {
                 // debugger
                 if (type === 'top') {
-                    name = item.code.slice(0, item.code.indexOf('-'))
+                    // name = item.code.slice(0, item.code.indexOf('-'))
+                    name = item.code
                 } else {
-                    name = item.code.slice(item.code.indexOf('-')+1)
+                    // name = item.code.slice(item.code.indexOf('-')+1)
+                    name = ''
                 }
             } else {
                 if (type === 'top') {
@@ -289,7 +291,8 @@ export default {
   border-top: 1px solid rgba(75, 85, 174, 1);
 }
 .left-1 {
-  width: 35%;
+  // width: 35%;
+  width: 50%;
   height: 100%;
   font-size: 12px;
   color: rgba(75, 85, 174, 1);
@@ -302,7 +305,8 @@ export default {
 }
 
 .unleft-1 {
-  width: 37%;
+  // width: 37%;
+  width: 50%;
   height: 100%;
   font-size: 12px;
   color: rgba(75, 85, 174, 1);
@@ -315,7 +319,8 @@ export default {
 }
 
 .right-1 {
-  width: 69%;
+  // width: 69%;
+  width: 55%;
   height: 100%;
   font-size: 12px;
   color: rgba(75, 85, 174, 1);
@@ -326,7 +331,8 @@ export default {
 }
 
 .unright-1 {
-  width: 65%;
+  // width: 65%;
+  width: 55%;
   height: 100%;
   font-size: 12px;
   color: rgba(75, 85, 174, 1);