Ver Fonte

LIU 3.25

liu85600613 há 3 anos atrás
pai
commit
cfefcdf538

+ 1 - 0
ui/src/assets/styles/index.scss

@@ -205,6 +205,7 @@ aside {
     background-position: center center;
     background-repeat: repeat;
     width: 3300px;
+    height: 100%;
   }
 
   .host-body {

+ 47 - 4
ui/src/views/sems/specanalysis/index.vue

@@ -6,7 +6,12 @@
           <div class="topElevator">
             <div class="bg-color-spec">
               <div style="text-align: center; padding-top: 0.3rem">
-                <el-select v-model="plantIds" @change="handleCommand" multiple collapse-tags :placeholder="$t('请选择') + $t('装置')">
+                <el-select v-model="plantIds"  @change="handleCommand" multiple collapse-tags :placeholder="$t('请选择') + $t('装置')">
+                  <el-option
+                    key="ALL"
+                    label="ALL"
+                    value="ALL">
+                  </el-option>
                   <el-option
                     v-for="item in plantList"
                     :key="item.name"
@@ -359,6 +364,7 @@ export default {
         colors: ['#32ecec', '#6591d7']
       },
       options: [],
+      oldOptions:[],
       form: {},
       plantList: [],
       plantIds: [],
@@ -367,7 +373,6 @@ export default {
     }
   },
   mounted() {
-
   },
   created() {
     this.getPlantList()
@@ -383,6 +388,8 @@ export default {
           return obj.name;
         }).join(",").split(',')
         this.plantIds = arrnew
+        this.plantIds.push("ALL")
+        this.oldOptions = this.plantIds
         this.getUnitList()
       });
     },
@@ -424,14 +431,50 @@ export default {
         this.devGlPerData()
       });
     },
-    handleCommand(plantIds) {
-      this.plantIds = plantIds
+    handleCommand(val) {
       this.unitIds = []
       this.getUnitList()
       if (this.plantIds.length == 0) {
         this.plantIds = ['']
       }
       this.devData()
+      let allnames = []
+      //保留所有值
+      for (let item of this.plantList) {
+        allnames.push(item.name)
+      }
+      // 用来储存上一次的值,可以进行对比
+      const oldVal = this.oldOptions
+      // 若是全部选择
+      if (val.includes('ALL') && !oldVal.includes('ALL')) {
+        console.log(this.plantList + " -----")
+        this.plantIds = this.plantList.map((obj, index) => {
+          return obj.name;
+        }).join(",").split(',')
+        this.plantIds.push("ALL")
+        this.oldOptions = this.plantIds
+      }
+      // 取消全部选中  上次有 当前没有 表示取消全选
+      if (oldVal.includes('ALL') && !val.includes('ALL')) {
+        this.plantIds = []
+        this.oldOptions = this.plantIds
+      }
+      // 点击非全部选中  需要排除全部选中 以及 当前点击的选项
+      // 新老数据都有全部选中
+      // if (oldVal.includes('ALL') && val.includes('ALL')) {
+      //   const index = val.indexOf('ALL')
+      //   val.splice(index, 1) // 排除全选选项
+      //   this.plantIds = val
+      //   //全选未选 但是其他选项全部选上 则全选选上 上次和当前 都没有全选
+      //   if (!oldVal.includes('ALL') && !val.includes('ALL')) {
+      //     console.log(11)
+      //     if (val.length === allnames.length - 1) {
+      //       this.plantIds = ['ALL'].concat(val)}
+      //   }
+      //   //储存当前最后的结果 作为下次的老数据
+      //   this.oldOptions[0] = this.plantIds
+      // }
+
     },
     handleCommandUnit(unitIds) {
       this.unitIds = unitIds