hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
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
<template>
  <div class='safety'>
    <v-header title="安全工作"></v-header>
    <div class="tool clearfix">
      <section
        class="w_col_6"
        v-for="(i,j) in tab"
        :key="j+'-s'"
      >
        <p class="name">{{i.text}}</p>
        <p class="time"></p>
        <p class="val" v-if="i.text === '巡查次数'">{{statisticsData.patrolRecordTotal || 0}}个</p>
        <p class="val" v-if="i.text === '安全工作记录'">{{statisticsData.safetyWorkTotal || 0}}个</p>
        <p class="val" v-if="i.text === '隐患报告'">{{statisticsData.dangerTotal || 0}}个</p>
        <p class="val" v-if="i.text === '已处理隐患'">{{statisticsData.handledDangerTotal || 0}}个</p>
      </section>
    </div>
    <div class="a">
      <div class="b">
        <div id="i1"></div>
      </div>
      <div class="c">
        <div id="i2"></div>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  props: {},
  components: {},
  data() {
    return {
      tab: [
        { text: "巡查次数", time: "", num: "984210" },
        { text: "安全工作记录", time: "", num: "8745120" },
        { text: "隐患报告", time: "", num: "510465" },
        { text: "已处理隐患", time: "", num: "5000" },
      ],
      chart1: null,
      chart2: null,
      statisticsData:{},
    };
  },
  watch: {},
  methods: {
    toNum(v) {
      return v > 1e5 ? +(v / 1e5).toFixed(2) + "万" : v;
    },
 
    statisticsInit() {
      this.$api.get("patrolRecord/patrolRecordStatistics", {}, (e) => {
        this.statisticsData = e;
        this.initchart();
      });
    },
 
    initchart() {
      let a = [
        { name: "防火巡查", value: this.statisticsData.huoTotal },
        { name: "防汛巡查", value: this.statisticsData.xunTotal  },
        { name: "防疫巡查", value: this.statisticsData.yiTotal  },
      ];
      let b = [
        { name: "火灾隐患", y: this.statisticsData.huoHandledDangerTotal, n: this.statisticsData.huoHandlingDangerTotal },
        { name: "汛情隐患", y:this.statisticsData.xunHandledDangerTotal, n: this.statisticsData.xunHandlingDangerTotal },
        { name: "疫情隐患", y: this.statisticsData.yiHandledDangerTotal, n: this.statisticsData.yiHandlingDangerTotal },
      ];
      this.chart1 = echarts.init(demo.$.id("i1"));
      this.chart2 = echarts.init(demo.$.id("i2"));
      this.chart1.setOption(this.$js.chart.pie1(a, "巡查统计"));
      this.chart2.setOption(
        this.$js.chart.bar1(b, "隐患统计", { y: "已整改", n: "待整改" })
      );
    }
  },
  mounted() {
    this.statisticsInit();
 
 
 
  },
 
};
</script>
<style lang='less' scoped>
.safety {
  overflow-y: auto;
  .tool {
    height: 200px;
    border: 1px solid #999;
    border-radius: 3px;
    width: calc(100% - 50px);
    section {
      box-sizing: border-box;
      padding: 20px;
      font-size: 14px;
      color: #333;
      .name {
        font-weight: 650;
        line-height: 30px;
        height: 30px;
      }
      .time {
        text-indent: 20px;
        font-size: 12px;
        height: 15px;
      }
      .val {
        height: 100px;
        line-height: 100px;
        text-align: center;
        font-size: 40px;
        font-weight: 600;
      }
    }
  }
  .a {
    height: 300px;
    margin-top: 35px;
    display: flex;
    .c,
    .b {
      height: 300px;
      border: 1px solid #eee;
      box-sizing: border-box;
      border-radius: 3px;
      > div {
        width: 100%;
        height: 100%;
      }
    }
    .b {
      width: 300px;
      margin-right: 20px;
    }
    .c {
      width: calc(100% - 370px);
    }
  }
}
</style>