zhengpz
2021-08-18 e8f9a6ab3d258c028da4fdc4a51c3985a9eba67c
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<template>
  <div class="page1">
    <el-row>
      <el-col :span="24">
        <div class="rowContent first-menu">
          <div class="rowTitle">
            <img src="../../../public/img/bajgxt/u1618.png" />
            <span>数据概览</span>
 
            <el-select class="select0" v-model="value0" placeholder="请选择">
              <el-option
                v-for="item in options0"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
            <el-select class="select1" v-model="value1" placeholder="请选择" @change="fenjuChange">
              <el-option
                v-for="item in options1"
                :key="item.id"
                :label="item.title"
                :value="item.id"
              ></el-option>
            </el-select>
            <el-select class="select2" v-model="value2" placeholder="请选择" @change="changeCompanys">
              <el-option
                v-for="item in options2"
                :key="item.departmentid"
                :label="item.enterpriseName"
                :value="item.departmentid"
              ></el-option>
            </el-select>
            <el-button @click="toOperationTable">进入数据统计表</el-button>
          </div>
 
          <div class="col-content">
            <div class="box-card">
              <span>总保安数</span>
              <span>{{card.baoanTotal}}</span>
              <span>较上月增加{{card.addbaoanTotal}}人</span>
            </div>
            <div class="box-card">
              <span>正常保安员</span>
              <span>{{card.zcBaoan}}</span>
              <span>较上月增加{{card.addzcBaoan}}人</span>
            </div>
            <div class="box-card">
              <span>持证保安员</span>
              <span>{{card.czBaoan}}</span>
              <span>较上月增加{{card.addczBaoan}}人</span>
            </div>
            <div class="box-card">
              <span>过考保安员</span>
              <span>{{card.gkBaoan}}</span>
              <span>较上月增加{{card.addgkBaoan}}人</span>
            </div>
            <div class="box-card">
              <span>服务客户</span>
              <span>{{card.kh}}</span>
              <span>较上月增加{{card.addkh}}家</span>
            </div>
            <div class="box-card">
              <span>缴纳社保</span>
              <span>{{card.sheb}}</span>
              <span>较上月增加{{card.addsheb}}人</span>
            </div>
            <div class="box-card">
              <span>保安派遣</span>
              <span>{{card.baoanPq}}</span>
              <span>较上月增加{{card.addbaoanPq}}人</span>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="16">
        <div class="rowContent">
          <span class="span-title">保安类数据统计</span>
          <div id="middleEchart1"></div>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="rowContent">
          <span class="span-title">服务客户</span>
          <div id="middleEchart2"></div>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <div class="rowContent">
          <span class="span-title">公司运营趋势</span>
          <div id="bottomEchart"></div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
 
<script>
import * as echarts from "echarts";
import echartJs from "./securityEchart.js";
import { lazyTreeJu } from "../../api/index/index";
import {
  queryCounts,
  getCompanys,
  queryYearKh,
  queryYearG
} from "../../api/securityUnitOperation/securityUnitOperation";
export default {
  data() {
    return {
      value1: "",
      value2: "",
      value0: "2012",
      card: {
        baoanTotal: 0,
        addbaoanTotal: 0,
        zcBaoan: 0,
        addzcBaoan: 0,
        czBaoan: 0,
        addczBaoan: 0,
        gkBaoan: 0,
        addgkBaoan: 0,
        kh: 0,
        addkh: 0,
        sheb: 0,
        addsheb: 0,
        baoanPq: 0,
        addbaoanPq: 0
      },
      options0: [
        {
          value: "2012",
          label: "2012年"
        },
        {
          value: "2011",
          label: "2011年"
        },
        {
          value: "2010",
          label: "2010年"
        },
        {
          value: "2009",
          label: "2009年"
        },
        {
          value: "2008",
          label: "2008年"
        },
        {
          value: "2007",
          label: "2007年"
        }
      ],
      options1: [],
      options2: []
    };
  },
  methods: {
    setEchart() {
      let data = [];
      let bottomEchart = echarts.init(document.getElementById("bottomEchart"));
      bottomEchart.setOption(echartJs.bottomOption1(data));
    },
    toOperationTable() {
      this.$router.push({ path: "/securityUnitOperation/operationTable" });
    },
    getFenju() {
      this.options1 = [];
      this.value1 = "";
      lazyTreeJu().then(res => {
        if (res.data.code === 200) {
          this.options1 = res.data.data;
          this.value1 = this.options1[0] ? this.options1[0].id : "";
          this.getCompanys();
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    fenjuChange() {
      this.getCompanys();
    },
    getCompanys() {
      getCompanys({ jurisdiction: this.value1 }).then(res => {
        if (res.data.code === 200) {
          this.options2 = res.data.data;
          this.value2 = this.options2[0] ? this.options2[0].departmentid : "";
          this.changeCompanys();
        }
      });
    },
    getQueryCounts() {
      let params = {
        jurisdiction: this.value1,
        deptid: this.value2
      };
      queryCounts(params).then(res => {
        if (res.data.code === 200) {
          let data = res.data.data[0];
          this.card = {
            baoanTotal: data.baoan.thisnum,
            addbaoanTotal: data.baoan.thisnum - data.baoan.lastnum,
            zcBaoan: data.zcbaoan.thisnum,
            addzcBaoan: data.zcbaoan.thisnum - data.zcbaoan.lastnum,
            czBaoan: data.czbaoan.thisnum,
            addczBaoan: data.czbaoan.thisnum - data.czbaoan.lastnum,
            gkBaoan: 0,
            addgkBaoan: 0,
            kh: data.kh.thisnum,
            addkh: data.kh.thisnum - data.kh.lastnum,
            sheb: data.sheb.thisnum,
            addsheb: data.sheb.thisnum - data.sheb.lastnum,
            baoanPq: data.paiq.thisnum,
            addbaoanPq: data.paiq.thisnum - data.paiq.lastnum
          };
        }
      });
    },
    getQueryYearKh() {
      let params = {
        jurisdiction: this.value1,
        deptid: this.value2
      };
      queryYearKh(params).then(res => {
        if (res.data.code === 200) {
          let middleEchart2 = echarts.init(
            document.getElementById("middleEchart2")
          );
          middleEchart2.setOption(echartJs.middleOption2(res.data.data));
        }
      });
    },
    getQueryYearG() {
      let params = {
        jurisdiction: this.value1,
        deptid: this.value2
      };
      queryYearG().then(res => {
        if (res.data.code === 200) {
          let middleEchart1 = echarts.init(
            document.getElementById("middleEchart1")
          );
          middleEchart1.setOption(echartJs.middleOption1(res.data.data));
        }
      });
    },
    // 清空之前的查询结果
    clear() {
      this.card = {
        baoanTotal: 0,
        addbaoanTotal: 0,
        zcBaoan: 0,
        addzcBaoan: 0,
        czBaoan: 0,
        addczBaoan: 0,
        gkBaoan: 0,
        addgkBaoan: 0,
        kh: 0,
        addkh: 0,
        sheb: 0,
        addsheb: 0,
        baoanPq: 0,
        addbaoanPq: 0
      };
    },
    changeCompanys() {
      this.clear();
      this.getQueryCounts();
      this.getQueryYearKh();
      this.getQueryYearG();
    }
  },
  mounted() {
    this.setEchart();
    this.getFenju();
  }
};
</script>
<style lang="scss" scoped>
.page1 {
  height: 100%;
  width: 100%;
}
#bottomEchart,
#middleEchart1,
#middleEchart2 {
  height: calc(100% - 40px);
  width: 100%;
}
.el-row:first-child {
  height: calc(40% - 80px);
  margin-bottom: 20px;
}
.el-row:nth-child(2) {
  margin-bottom: 20px;
}
.el-row:nth-child(2),
.el-row:nth-child(3) {
  height: 30%;
}
.el-col {
  height: 100%;
}
.rowContent {
  padding: 5px 20px 0px 10px;
  height: calc(100% - 5px);
  width: calc(100% - 30px);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0px 0px 1px #fff;
  .span-title {
    color: #fff;
    font-size: 17px;
    margin-left: 35px;
    font-weight: 600;
  }
}
.box-card {
  width: 150px;
  background: #00aaf1;
  height: 135px;
  text-align: center;
  margin-right: 66px;
  box-shadow: 5px 5px 5px rgba($color: #000, $alpha: 0.35);
  line-height: 40px;
}
.box-card span {
  display: block;
  width: 100%;
  color: #fff;
}
.box-card span:nth-child(2) {
  color: #06ffff;
  font-size: 34px;
}
.rowTitle {
  height: 40px;
  display: flex;
  line-height: 40px;
  img {
    width: 30px;
    height: 30px;
    margin-top: 5px;
  }
  span {
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    margin-left: 11px;
  }
  .select0 {
    position: absolute;
    right: 443px;
  }
  .select1 {
    position: absolute;
    right: 302px;
  }
  .select2 {
    position: absolute;
    right: 159px;
  }
  .el-button {
    position: absolute;
    right: 0px;
  }
  /deep/ .el-input__inner {
    width: 120px;
  }
}
.col-content {
  display: flex;
  margin-top: 15px;
  margin-left: 36px;
}
</style>