zmc
2023-08-29 b77599ace9fc1c68bacd0e37ddb2e83812660ae3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 
<!-- 异常类型复选框组件  
    自动获取扬尘历史表中不同异常类型
    将选中的多个异常以数组形式返回给父组件 
 
    **
    在父组件中设置
   <ExceptionType @submit-value="(n)=>form.exceptionName=n"></ExceptionType>
-->
 
<script>
  export default {
    emits:['submitValue'],
    data() {
      return{
        // 返回的所有异常类型
        exceptionType:[],
        //已勾选的异常
        checkedList: []
      }
    },
    mounted() {
        this.getExceptionType()
    },
    methods: {
        // 获取不同的异常名称
        getExceptionType(){
            this.$http.get('/dust/exceptiontype').then(response=>{   
                this.exceptionType = response.data.data
            })
        }
     }
}
</script>
 
<template>
  <div class="excption">
    <span class="exception-text">异常类型:</span>
    <el-checkbox-group  v-model="checkedList"  @change="$emit('submitValue',checkedList)">
    <el-checkbox :label="item.exceptionType"  v-for="item in exceptionType" :key="item">
      <template #default>
        <span v-if="item.exceptionType == '0'">断电或断网</span>
        <span v-else-if="item.exceptionType == '1'">数据超低</span>
        <span v-else-if="item.exceptionType == '2'">超标</span>
        <span v-else-if="item.exceptionType == '3'">数据长时段无波动</span>
        <span v-else-if="item.exceptionType == '4'">量级突变异常</span>
        <span v-else-if="item.exceptionType == '5'">临近超标异常</span>
        <span v-else-if="item.exceptionType == '6'">单日超标次数临界异常</span>
        <span v-else-if="item.exceptionType == '7'">滑动平均值突变</span>
      </template>
    </el-checkbox>
  </el-checkbox-group>
  </div>
</template>
 
<style lang="scss" scoped>
.excption {
    display: flex;  
}
.exception-text {
  font-weight: bold;
  margin-top: 5px;
    margin-right: 7px;
}
.el-checkbox-group {
  margin-top: 5px;
}
</style>