付延余
2022-05-20 73a9ae225888adae528d9b06233f65da04d883db
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
<template>
    <div class="zhigongshebaoForm">
      <el-dialog
        :visible.sync="dialogVisible"
        width="86%"
        :before-close="handleClose">
        <div class="zhigongshebaoEcharts" ref="zhigongshebaoEcharts"></div>
      </el-dialog>
    </div>
</template>
 
<script>
  import {getSecurityDetailChart} from '@/api/shehuiBaozhang'
    import echarts from "echarts/lib/echarts";
    import nowSize from '../../../libs/nowSize'
    export default {
        name: "zhigongshebaoForm",
        data() {
            return {
                dialogVisible: false,
                xdata:[],
                totalData: [],
                inJobData: [],
                outJobData: []
            }
        },
        methods: {
            init(type,area) {
                this.dialogVisible = true
                this.$nextTick(() => {
                    this.getSecurityDetailChart(type,area)
                })
            },
            getSecurityDetailChart(type,area) {
                getSecurityDetailChart({type:type,area:area}).then(res => {
                    if(res.code == 1000) {
                        this.xdata = res.obj.data
                        this.totalData = res.obj.total
                        this.inJobData = res.obj.inJob
                        this.outJobData = res.obj.outJob
                        this.zhigongshebaoEcharts()
                    }
                })
            },
            zhigongshebaoEcharts() {
                let myEchart = this.$echarts.init(this.$refs.zhigongshebaoEcharts)
                let option = {
                    color : ['#FF5151','#51FF5D','#FFD151'],
                    title: {
                        text: '近一年全市企业职工养老保险参保人数趋势图',
                        left: 'center',
                        top: '5%',
                        textStyle: {
                            color: '#FFFFFF',
                            fontSize: nowSize(30)
                        },
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: ['总数', '在职职工', '离退休'],
                        itemWidth: nowSize(30),
                        itemHeight: nowSize(4),
                        itemGap: nowSize(20),
                        right:'8%',
                        top: '5%',
                        textStyle: {
                            color: '#FFFFFF',
                            fontSize: nowSize(24),
                        }
                    },
                    grid: {
                        top: '10%',
                        left: '3%',
                        right: '5%',
                        bottom: '6%',
                        containLabel: true
                    },
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        data: this.xdata,
                        axisLabel: {
                            show: true,
                            textStyle: {
                                color: "#fff",
                                fontSize:nowSize(24)
                            }
                        },
                        axisLine: {
                            lineStyle: {
                                color: "#999999",
                                width: 1,
                                type: "solid"
                            }
                        },
                        splitLine: {
                            show: false
                        }
                    },
                    yAxis: {
                        type: 'value',
                        axisLabel: {
                            show: true,
                            textStyle: {
                                color: "#fff",
                                fontSize:nowSize(24)
                            }
                        },
                        axisLine: {
                          lineStyle: {
                              color: "#999999",
                              width: 1,
                              type: "solid"
                          }
                        },
                        splitLine: {
                            show: false
                        }
                    },
                    series: [
                        {
                            name: '总数',
                            type: 'line',
                            stack: 'Total',
                            data: this.totalData
                        },
                        {
                            name: '在职职工',
                            type: 'line',
                            data: this.inJobData
                        },
                        {
                            name: '离退休',
                            type: 'line',
                            data: this.outJobData
                        }
                    ]
                };
                myEchart.setOption(option)
                window.addEventListener('resize',function () {
                    myEchart.resize()
                })
            },
            handleClose() {
                this.dialogVisible = false
            }
        }
    }
</script>
 
<style lang="scss">
  // dialog对话框
  .zhigongshebaoForm {
    .el-dialog__wrapper {
      background: rgba(0, 0, 0, 0.9);
    }
    .el-dialog {
      background: url(../../../assets/images/businessPolicy/dialog@2x.png)
      no-repeat center;
      background-size: 100% 100%;
      height: 4.375rem;
    }
    .el-icon-close:before {
      content: '';
      display: inline-block;
      width: 0.1875rem  /* 48/256 */;
      height: 0.1875rem;
      background:url(../../../assets/images/businessPolicy/dialogClose@2x.png) no-repeat center;
      background-size: 100% 100%;
      z-index: 9999;
    }
    .el-dialog__headerbtn{
      position: absolute;
      top: 0.234375rem  /* 60/256 */;
      right: 0.3125rem  /* 80/256 */;
    }
    .el-dialog__header {
      padding: 0;
      width: 0;
      height: 0;
    }
    .el-dialog__body {
      text-align: center;
      color: #eeeeee;
      h1 {
        margin-top: 0.4375rem;
        font-size: 0.1563rem;
      }
      span {
        font-size: 0.1094rem;
      }
    }
    .el-divider {
      margin: 0;
      background-color: #eeeeee;
    }
  }
</style>
 
<style lang="scss" scoped>
  .zhigongshebaoEcharts{
     width:calc(100% - 0.15625rem  /* 40/256 */);
     height: 3.75rem  /* 960/256 */;
     margin: 0.234375rem  /* 60/256 */ auto 0;
  }
</style>