فهرست منبع

风机数据问题修改

xujuanning 11 ساعت پیش
والد
کامیت
948692587c

+ 25 - 8
src/views/economicsOperation/windTurbineMonitor/componentsDetail.vue

@@ -4,7 +4,7 @@
       <div class="station">
         <el-input v-model="windComponent" placeholder="输入测点名称进行搜索"></el-input>
       </div>
-      <el-button round size="mini" class="searchColor" @click="getTableData">搜 索</el-button>
+      <el-button round size="mini" class="searchColor" @click="funGetComponents('seach')">搜 索</el-button>
       
     </div>
     <p style="color: #fff ">注: 最多可选10个测点进行查看</p>
@@ -15,7 +15,7 @@
     </div>
     <div class="componentsValue">
       <div class="component-info">
-        <div class="info-item" v-for="(it,index) in componentsData" :key="index" @click="addTags(it)">
+        <div class="info-item" v-for="(it,index) in componentsDataS" :key="index" @click="addTags(it)">
           <div class="text">{{it.description}}</div>
         </div>
       </div>
@@ -44,24 +44,31 @@ export default {
   },
   data() {
     return {
-      tags: []
+      tags: [],
+      componentsDataS: [],
+      windComponent: ""
     }
   },
   mounted() {
-    this.tags = this.componentsData.slice(0, 10);
+    // this.tags = this.componentsData.slice(0, 10);
+    // this.componentsDataS = this.componentsData
+    this.funGetComponents()
   },
   methods: {
     //获取测点
-    funGetComponents() {
+    funGetComponents(type) {
       let that = this;
+      that.componentsDataS = []
       let params = {
         modelId: that.windModel,
         query: that.windComponent
       }
       getComponentsData(params).then((res) => {
         if (res) {
-          that.componentsData = res
-          that.selectComponentsData = res.slice(0, 10)
+          if (!type) {
+            this.tags = res.slice(0, 10);
+          }
+          this.componentsDataS = res
         }
       });
     },
@@ -70,7 +77,17 @@ export default {
     },
     addTags(data) {
       if (this.tags.length < 10) {
-        this.tags.push(data)
+        let isPush = false
+        this.tags.forEach(it => {
+          if (it.uniformCode === data.uniformCode) {
+            isPush = true
+          }
+        })
+        if (isPush) {
+          ElMessage({ message: "该测点已选择!", type: 'error' })
+        } else {
+          this.tags.push(data)
+        }
       } else {
         ElMessage({ message: "最多可选10个测点!", type: 'error' })
       }

+ 1 - 1
src/views/economicsOperation/windTurbineMonitor/index.vue

@@ -91,9 +91,9 @@
         </div>
       </template>
       <div style="height: 100%">
+          <!-- :componentsData="componentsData" -->
         <components-detail
           ref="componentsDetail"
-          :componentsData="componentsData"
           :windModel="windModel"
           @selectTags="selectTags"
         >