马宇豪
2023-03-10 e5e9b84b800f1623f85be45a3565689917898c78
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<template>
    <div id="descCont" class="dark-desc">
      <div class="des-tit">
        <div>隐患等级分布与隐患整改率</div>
        <dv-decoration8 :color="lineColor" :reverse="true" style="width:100%;" />
      </div>
      <div class="des-main">
        <div>
          <h4 v-if="descContent.detail && descContent.detail.heavyRiskCount">
            重大隐患数量:{{descContent.detail.heavyRiskCount}}
          </h4>
          <h4 v-else>
            重大隐患数量:0
          </h4>
        </div>
        <div>
          <h4 v-if="descContent.detail && descContent.detail.heavyRiskCount && descContent.detail.heavyRiskFinishCount">
            已完成整改:{{descContent.detail.heavyRiskCount == 0 ? 0 + '%' : Math.round(descContent.detail.heavyRiskFinishCount / descContent.detail.heavyRiskCount * 10000) / 100.00 + '%'}}
          </h4>
          <h4 v-else>
            已完成整改:0%
          </h4>
        </div>
<!--        <div>-->
<!--          <h4>整改中:8%;</h4>-->
<!--        </div>-->
<!--        <div>-->
<!--          <h4>暂未整改:3%;</h4>-->
<!--        </div>-->
        <div>
          <h4 v-if="descContent.detail && descContent.detail.lightRiskCount">
            一般隐患数量:{{descContent.detail.lightRiskCount}}
          </h4>
          <h4 v-else>
            一般隐患数量:0
          </h4>
        </div>
        <div>
          <h4 v-if="descContent.detail && descContent.detail.lightRiskCount && descContent.detail.lightRiskFinishCount">
            已完成整改:{{descContent.detail.lightRiskCount == 0 ? 0 + '%' : Math.round(descContent.detail.lightRiskFinishCount / descContent.detail.lightRiskCount * 10000) / 100.00 + '%'}}
          </h4>
          <h4 v-else>
            已完成整改:0%
          </h4>
        </div>
<!--        <div>-->
<!--          <h4>整改中:19%;</h4>-->
<!--        </div>-->
<!--        <div>-->
<!--          <h4>暂未整改:6%;</h4>-->
<!--        </div>-->
      </div>
    </div>
</template>
<script lang="ts">
  import screenfull from 'screenfull';
  import {
    toRefs,
    reactive,
    ref,
    onMounted,
    defineComponent,
    defineAsyncComponent,
    nextTick,
    onUnmounted,
    watchEffect
  } from 'vue';
  import '/@/theme/bigScreen.css'
  import {useScreenTheme} from "/@/stores/screenTheme"
  import {storeToRefs} from "pinia";
 
  // 定义接口来定义对象的类型
  interface stateType {
    descContent: Object;
    lineColor: Array<string>;
  }
  export default defineComponent({
    name: 'danDesc',
    components: {},
    props:{
      content: Object || null
    },
    setup(props) {
      const screenThemes = useScreenTheme()
      const { screenTheme } = storeToRefs(screenThemes);
      const state = reactive<stateType>({
        descContent: {
 
        },
        lineColor: ['#11FEEE'],
      });
 
      const getTheme =()=>{
        if(screenTheme.value.isDark){
          window.document.getElementById('descCont').setAttribute( "class", 'dark-desc' );
          state.lineColor = ['#11FEEE']
        }else{
          window.document.getElementById('descCont').setAttribute( "class", 'light-desc' );
          state.lineColor = ['#333','#ccc']
        }
      }
 
      watchEffect(() => {
        if(props.content && props.content.dangerData && props.content.dangerData[0]){
          state.descContent = props.content.dangerData[0]
        }
      })
 
      // 页面载入时执行方法
      onMounted(() => {
        getTheme();
      });
      return {
        ...toRefs(state)
      };
    }
  });
</script>
 
<style scoped lang="scss">
  .dark-desc{
    width: 100%;
    height: 100%;
 
    .des-tit{
      width: 100%;
      &>div{
        font-size: 1.5rem;
        height: 2.2rem;
        line-height: 2.2rem;
        text-align: center;
        font-weight: bolder;
        color: #11FEEE;
      }
    }
    .des-main{
      width: 100%;
      height: calc(96% - 2.2rem);
      padding: 1rem;
      overflow: auto;
      color: #11FEEE;
 
      &::-webkit-scrollbar { width: 0; height: 0; color: transparent; }
      &::scrollbar { width: 0; height: 0; color: transparent; }
 
      &>div{
        margin-bottom: 1rem;
        &>h4{
          font-size: 1.25rem;
          display: flex;
          align-items: center;
 
          span{
            margin-right: 10px;
          }
          &:first-of-type{
            margin-bottom: 10px;
          }
        }
 
        &>p{
          font-size: 1rem;
          margin-top: 10px;
        }
      }
    }
  }
  .light-desc{
    width: 100%;
    height: 100%;
 
    .des-tit{
      width: 100%;
      &>div{
        font-size: 1.5rem;
        height: 2.2rem;
        line-height: 2.2rem;
        text-align: center;
        font-weight: bolder;
        color: #333;
      }
    }
    .des-main{
      width: 100%;
      height: calc(96% - 2.2rem);
      padding: 1rem;
      overflow: auto;
      color: #333;
 
      &::-webkit-scrollbar { width: 0; height: 0; color: transparent; }
      &::scrollbar { width: 0; height: 0; color: transparent; }
 
      &>div{
        margin-bottom: 1rem;
        &>h4{
          font-size: 1.25rem;
          display: flex;
          align-items: center;
 
          span{
            margin-right: 10px;
          }
          &:first-of-type{
            margin-bottom: 10px;
          }
        }
 
        &>p{
          font-size: 1rem;
          margin-top: 10px;
        }
      }
    }
  }
</style>