index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. <template>
  2. <div>
  3. <el-tabs
  4. type="border-card"
  5. v-model.trim="selectedTab"
  6. @tab-click="clickTab"
  7. >
  8. <el-tab-pane
  9. :label="item.deptName"
  10. v-for="(item, index) in brigade"
  11. :key="index"
  12. :name="item.id"
  13. >
  14. </el-tab-pane>
  15. </el-tabs>
  16. <div class="nav-data">
  17. <div v-for="(item, index) in navData" :key="index" class="nav-data-item">
  18. <img :src="item.imgs" alt="" class="nav-img" />
  19. <div class="text">
  20. <div>{{ item.name }}</div>
  21. <div>{{ item.count }}</div>
  22. </div>
  23. </div>
  24. </div>
  25. <!-- 统计图 -->
  26. <div class="chart">
  27. <!-- 左侧版块 -->
  28. <div class="left-chart">
  29. <div class="first-line">
  30. <bar-chart :watcherList="watcherList" />
  31. <unitbart-chart :watcherList="watcherList" />
  32. </div>
  33. <div class="two-line">
  34. <div v-for="(item, index) in scanCode" :key="index">
  35. <div class="total">{{ item.count }}</div>
  36. <div class="item-name">{{ item.name }}</div>
  37. </div>
  38. </div>
  39. <div class="two-line three-line">
  40. <div
  41. v-for="(item, index) in threeChart"
  42. :key="index"
  43. style="color: #657398"
  44. >
  45. <img :src="item.imgs" alt="" class="nav-img" />
  46. <div>{{ item.name }}</div>
  47. <div class="date">{{ item.count }}</div>
  48. </div>
  49. </div>
  50. <div class="four-line" style="position: relative">
  51. <div class="title">单位活跃数</div>
  52. <div
  53. class="date-picker"
  54. style="
  55. position: absolute;
  56. top: 0;
  57. right: 16px;
  58. z-index: 999;
  59. margin-top: 10px;
  60. "
  61. >
  62. <el-date-picker
  63. v-model="selectedMonths"
  64. type="month"
  65. placeholder="选择月份"
  66. format="M"
  67. value-format="M"
  68. @change="handleChange"
  69. >
  70. </el-date-picker>
  71. </div>
  72. <div style="display: flex; align-items: center">
  73. <div class="fire">
  74. <div class="imgs">
  75. <img src="../../../assets/images/fire11.png" alt="" />
  76. </div>
  77. <div class="count">3218</div>
  78. <div>当前活跃单位数</div>
  79. </div>
  80. <unit-active :reportData="reportData"> </unit-active>
  81. </div>
  82. </div>
  83. </div>
  84. <!-- 右侧版块 -->
  85. <div class="right-chart">
  86. <div class="first-line">
  87. <div class="table-title">单位质态列表</div>
  88. <el-table highlight-current-row :data="list" height="360px">
  89. <el-table-column label="序号" type="index" width="50px" />
  90. <el-table-column label="单位名称" align="center" prop="orgName">
  91. </el-table-column>
  92. <el-table-column label="质态" align="center" prop="policeId">
  93. </el-table-column>
  94. </el-table>
  95. <!-- 分页组件 -->
  96. <pagination
  97. v-show="total > 0"
  98. :total="total"
  99. :pager-count="5"
  100. :page.sync="queryRader.pageNo"
  101. :limit.sync="queryRader.pageSize"
  102. layout="total, prev, pager, next, jumper"
  103. @pagination="getData"
  104. />
  105. </div>
  106. <div class="two-line">
  107. <div class="left">
  108. <div style="background: #fff">
  109. <div class="table-title">设备类型扫码量排行(TOP10)</div>
  110. <el-table
  111. highlight-current-row
  112. :data="devscanorderList"
  113. height="376px"
  114. >
  115. <el-table-column label="序号" type="index" width="50px" />
  116. <el-table-column
  117. label="消防设备类型"
  118. align="center"
  119. prop="inspecttype"
  120. >
  121. </el-table-column>
  122. <el-table-column label="扫码数量" align="center" prop="sort">
  123. </el-table-column>
  124. </el-table>
  125. </div>
  126. <div style="background: #fff; margin-top: 16px">
  127. <div class="table-title">隐患类型排行</div>
  128. <el-table
  129. highlight-current-row
  130. :data="dengertypeorderList"
  131. height="332px"
  132. style="margin-top: 16px"
  133. >
  134. <el-table-column label="序号" type="index" width="50px" />
  135. <el-table-column
  136. label="隐患类型"
  137. align="center"
  138. prop="dengertype"
  139. >
  140. </el-table-column>
  141. <el-table-column label="数量" align="center" prop="sort">
  142. </el-table-column>
  143. </el-table>
  144. </div>
  145. </div>
  146. <div class="right" style="background: #fff">
  147. <div class="table-title">监督员</div>
  148. <el-table
  149. highlight-current-row
  150. :data="watcherOrgData"
  151. height="782px"
  152. >
  153. <el-table-column label="序号" type="index" width="50px" />
  154. <el-table-column label="监督单位" align="center" prop="org_name">
  155. </el-table-column>
  156. <el-table-column
  157. label="监督员"
  158. align="center"
  159. prop="watcher_name"
  160. >
  161. </el-table-column>
  162. </el-table>
  163. </div>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. </template>
  169. <script>
  170. import {
  171. getDdlist,
  172. getPoliceId,
  173. tongjiBroad,
  174. tongjiDevscanorder,
  175. tongjiDengertypeorder,
  176. watcherPage,
  177. watcherorglist,
  178. } from "@/api/backend/statistics";
  179. import { getActdateTongjiPage } from "@/api/backend/actdateTongji";
  180. import { currentReport } from "@/api/backend/taskInfo";
  181. import barChart from "./component/barChart.vue";
  182. import unitbartChart from "./component/unitbartChart.vue";
  183. import unitActive from "./component/unitActive.vue";
  184. import { getOrgPage } from "@/api/backend/org";
  185. import { DICT_TYPE, getDictDatas } from "@/utils/dict";
  186. export default {
  187. components: {
  188. barChart,
  189. unitbartChart,
  190. unitActive,
  191. },
  192. data() {
  193. return {
  194. brigade: [],
  195. selectedTab: 0,
  196. selectedMonths: "",
  197. reportData: {},
  198. list: [], //单位质态列表
  199. navData: [
  200. {
  201. name: "已初始化单位数",
  202. code: 1,
  203. imgs: require("@/assets/images/fire1.png"),
  204. },
  205. {
  206. name: "发现隐患数",
  207. code: 2,
  208. imgs: require("@/assets/images/fire2.png"),
  209. },
  210. {
  211. name: "整改隐患数",
  212. code: 3,
  213. imgs: require("@/assets/images/fire3.png"),
  214. },
  215. {
  216. name: "隐患整改率",
  217. code: 4,
  218. imgs: require("@/assets/images/fire4.png"),
  219. },
  220. ],
  221. scanCode: [
  222. { name: "巡查扫码总数", code: 1 },
  223. { name: "日均扫码总数", code: 2 },
  224. { name: "人均扫码总数", code: 3 },
  225. { name: "单位扫码总数", code: 4 },
  226. { name: "隐患整改平均时间(天)", code: 5 },
  227. { name: "日均扫描设备类型数", code: 6 },
  228. ],
  229. threeChart: [
  230. {
  231. name: "今日扫码",
  232. code: 1,
  233. imgs: require("@/assets/images/fire5.png"),
  234. },
  235. {
  236. name: "今日活跃人数",
  237. code: 2,
  238. imgs: require("@/assets/images/fire6.png"),
  239. },
  240. {
  241. name: "上周缺查单位",
  242. code: 3,
  243. imgs: require("@/assets/images/fire7.png"),
  244. },
  245. {
  246. name: "设备类型数",
  247. code: 4,
  248. imgs: require("@/assets/images/fire8.png"),
  249. },
  250. {
  251. name: "设备类型覆盖率",
  252. code: 5,
  253. imgs: require("@/assets/images/fire9.png"),
  254. },
  255. ],
  256. total: 0,
  257. queryRader: {
  258. pageSize: 10,
  259. pageNo: 1,
  260. },
  261. deptId: 0,
  262. tongjiData: null, //找到对应大队下的统计数字数据
  263. allNumber: null,
  264. devscanorderList: null, //排行列表
  265. dengertypeorderList: null, //隐患类型排行榜
  266. watcherList: null, //监督员质态统计
  267. watcherOrgData: null, //监督员
  268. actList: null, //单位活跃数
  269. actdate: [],
  270. };
  271. },
  272. // 监听 Element UI 中的筛选月份变化
  273. watch: {
  274. //选择月份
  275. selectedMonths: function (newVal) {
  276. this.fetchData();
  277. },
  278. },
  279. created() {
  280. this.getList();
  281. this.fetchData();
  282. this.getData();
  283. this.navList();
  284. this.Devscanorder();
  285. this.Dengertypeorder();
  286. this.getWatcher();
  287. this.getWatcherorg();
  288. this.getActdateTong();
  289. },
  290. methods: {
  291. //得到所有的数字数据
  292. navList() {
  293. tongjiBroad({ pageNo: 1, pageSize: 9999 }).then((response) => {
  294. if (response.data) {
  295. this.allNumber = response.data.list;
  296. this.tongjiData = this.allNumber.filter((item) => {
  297. return item.deptid == this.deptId;
  298. });
  299. console.log(" this.tongjiData", this.tongjiData);
  300. if (this.tongjiData.length > 0) {
  301. this.detaulData();
  302. console.log("111", 111);
  303. } else {
  304. console.log("222", 222);
  305. this.navData.forEach((item) => {
  306. item.count = 0;
  307. });
  308. this.scanCode.forEach((item) => {
  309. item.count = 0;
  310. });
  311. this.threeChart.forEach((item) => {
  312. item.count = 0;
  313. });
  314. }
  315. this.$forceUpdate();
  316. }
  317. });
  318. },
  319. // 处理得到的数字数据
  320. detaulData() {
  321. const datas = this.tongjiData[0];
  322. this.navData.forEach((item) => {
  323. switch (item.code) {
  324. case 1:
  325. item.count = datas.initorgtotal; //
  326. break;
  327. case 2:
  328. item.count = datas.peradjust; //
  329. break;
  330. case 3:
  331. item.count = datas.peradjust;
  332. break;
  333. case 4:
  334. item.count = datas.peradjust;
  335. break;
  336. default:
  337. break;
  338. }
  339. });
  340. this.scanCode.forEach((item) => {
  341. switch (item.code) {
  342. case 1:
  343. item.count = datas.patroltotal; //修改客户信息
  344. break;
  345. case 2:
  346. item.count = datas.avgdate; //红号变更
  347. break;
  348. case 3:
  349. item.count = datas.avgperson;
  350. break;
  351. case 4:
  352. item.count = datas.scantotal;
  353. break;
  354. case 5:
  355. item.count = datas.dengerfixavg;
  356. break;
  357. case 6:
  358. item.count = datas.avgdatedevtype;
  359. break;
  360. default:
  361. break;
  362. }
  363. });
  364. this.threeChart.forEach((item) => {
  365. switch (item.code) {
  366. case 1:
  367. item.count = datas.todayscantotal; //修改客户信息
  368. break;
  369. case 2:
  370. item.count = datas.todayhottotal; //红号变更
  371. break;
  372. case 3:
  373. item.count = datas.lastweektotal;
  374. break;
  375. case 4:
  376. item.count = datas.devtypetotal;
  377. break;
  378. case 5:
  379. item.count = datas.devcover;
  380. break;
  381. default:
  382. break;
  383. }
  384. });
  385. console.log("this.threeChart", this.threeChart);
  386. },
  387. getList() {
  388. // 执行查询
  389. getDdlist().then((response) => {
  390. this.brigade = response.data;
  391. this.brigade.unshift({ deptName: "所有大队", id: "0" });
  392. });
  393. },
  394. //切换tab
  395. clickTab(e) {
  396. this.deptId = e.name;
  397. this.navList();
  398. this.Devscanorder();
  399. this.Dengertypeorder();
  400. this.getWatcher();
  401. this.getWatcherorg();
  402. this.getActdateTong();
  403. this.$forceUpdate();
  404. },
  405. async fetchData() {
  406. const time = this.selectedMonths;
  407. const month = this.selectedMonths
  408. ? this.selectedMonths
  409. : new Date().getMonth() + 1; // 如果已选择月份使用已选择的月份,否则默认为当前月份
  410. const res = await currentReport({ month: month });
  411. this.reportData = res.data;
  412. },
  413. handleChange(val) {
  414. //选择月份
  415. this.selectedMonths = val;
  416. this.selectedMonth = val;
  417. },
  418. //质态表格
  419. getData() {
  420. getOrgPage(this.queryRader).then((response) => {
  421. this.list = response.data.list;
  422. this.total = response.data.total;
  423. });
  424. },
  425. //top扫码排行
  426. Devscanorder() {
  427. tongjiDevscanorder({
  428. pageNo: 1,
  429. pageSize: 999,
  430. deptId: this.deptId,
  431. }).then((response) => {
  432. this.devscanorderList = response.data.list;
  433. const type = this.getDictDatas(DICT_TYPE.DICT_FIRE_DECIVE_TYPE);
  434. type.map((item) => {
  435. this.devscanorderList.forEach((key) => {
  436. if (item.value == key.inspecttype) {
  437. key.inspecttype = item.label;
  438. }
  439. });
  440. });
  441. });
  442. },
  443. //隐患排行
  444. Dengertypeorder() {
  445. tongjiDengertypeorder({
  446. pageNo: 1,
  447. pageSize: 999,
  448. deptId: this.deptId,
  449. }).then((response) => {
  450. this.dengertypeorderList = response.data.list;
  451. const type = this.getDictDatas(DICT_TYPE.DANGER_TYPE);
  452. type.map((item) => {
  453. this.dengertypeorderList.forEach((key) => {
  454. if (item.value == key.dengertype) {
  455. key.dengertype = item.label;
  456. }
  457. });
  458. });
  459. });
  460. },
  461. //监督员质态统计
  462. getWatcher() {
  463. watcherPage({ pageNo: 1, pageSize: 20, deptId: this.deptId }).then(
  464. (response) => {
  465. this.watcherList = response.data.list;
  466. }
  467. );
  468. },
  469. //监督员
  470. getWatcherorgs() {
  471. watcherorglist({ pageNo: 1, pageSize: 20, deptId: this.deptId }).then(
  472. (response) => {
  473. this.watcherOrgData = response.data.records;
  474. }
  475. );
  476. },
  477. //单位活跃数
  478. getActdateTong() {
  479. getActdateTongjiPage({
  480. pageNo: 1,
  481. pageSize: 100,
  482. actdate: this.actdate,
  483. deptId: this.deptId,
  484. }).then((response) => {
  485. this.actList = response.data.list;
  486. });
  487. },
  488. },
  489. };
  490. </script>
  491. <style lang="scss" scoped>
  492. .tabs {
  493. margin-bottom: 12px;
  494. }
  495. ::v-deep .el-tabs--border-card > .el-tabs__content {
  496. padding: 0 !important;
  497. }
  498. .nav {
  499. width: 100%;
  500. display: flex;
  501. justify-content: space-between;
  502. overflow-x: auto;
  503. cursor: pointer;
  504. }
  505. .nav-img {
  506. width: 50px;
  507. height: 50px;
  508. margin: 0 32px 0 40px;
  509. }
  510. .text {
  511. font-size: 18px;
  512. display: flex;
  513. flex-direction: column;
  514. justify-content: space-between;
  515. & > div:first-child {
  516. color: #657398;
  517. margin-bottom: 20px;
  518. }
  519. & > div:last-child {
  520. font-weight: 600;
  521. }
  522. }
  523. .nav-data {
  524. display: flex;
  525. margin-top: 16px;
  526. justify-content: space-around;
  527. }
  528. .nav-data-item {
  529. display: flex;
  530. align-items: center;
  531. background: #fff;
  532. width: 25%;
  533. height: 132px;
  534. margin-right: 16px;
  535. }
  536. .nav-data-item:last-child {
  537. margin-right: 0;
  538. }
  539. .chart {
  540. display: flex;
  541. .left-chart {
  542. width: 58%;
  543. .first-line {
  544. display: flex;
  545. justify-content: space-between;
  546. margin-top: 16px;
  547. }
  548. .two-line {
  549. margin-top: 16px;
  550. display: flex;
  551. justify-content: space-between;
  552. align-items: center;
  553. & > div {
  554. width: 144px;
  555. margin-right: 16px;
  556. height: 200px;
  557. background: #fff;
  558. position: relative;
  559. .total {
  560. position: absolute;
  561. left: 50%;
  562. text-align: center;
  563. line-height: 90px;
  564. font-size: 30px;
  565. font-weight: 600;
  566. transform: translateX(-50%);
  567. top: 30px;
  568. width: 106px;
  569. height: 106px;
  570. opacity: 1;
  571. border-radius: 50%;
  572. box-sizing: border-box;
  573. }
  574. }
  575. & > div:nth-child(even) {
  576. color: #01bceb;
  577. .total {
  578. border: 9px solid #01bceb;
  579. }
  580. }
  581. & > div:nth-child(odd) {
  582. color: #0147eb;
  583. .total {
  584. border: 9px solid #0147eb;
  585. }
  586. }
  587. & > div:last-child {
  588. margin-right: 0;
  589. }
  590. .item-name {
  591. color: #657398;
  592. display: flex;
  593. align-items: center;
  594. justify-content: center;
  595. line-height: 330px;
  596. }
  597. }
  598. .three-line {
  599. display: flex;
  600. & > div {
  601. display: flex;
  602. flex-direction: column;
  603. justify-content: space-around;
  604. .nav-img,
  605. div {
  606. margin: 0;
  607. margin-left: 28px;
  608. }
  609. }
  610. .date {
  611. font-size: 30px;
  612. font-weight: 600;
  613. color: #0f2b4c;
  614. }
  615. }
  616. .four-line {
  617. margin-top: 16px;
  618. background: #fff;
  619. .title {
  620. height: 40px;
  621. font-size: 18px;
  622. color: #0f2b4c;
  623. padding: 10px 0 0 10px;
  624. }
  625. ::v-deep .el-date-editor.el-input__inner {
  626. width: 121px !important;
  627. }
  628. ::v-deep .el-input__prefix {
  629. color: #0147eb;
  630. }
  631. ::v-deep .el-input__inner {
  632. border: 1px solid #0147eb;
  633. color: #0147eb;
  634. }
  635. .fire {
  636. width: 144px;
  637. height: 212px;
  638. font-size: 15px;
  639. color: #657398;
  640. background: #fff url("~@/assets/images/fire10.png") no-repeat center;
  641. margin-left: 16px;
  642. display: flex;
  643. flex-direction: column;
  644. align-items: center;
  645. justify-content: space-around;
  646. .imgs {
  647. width: 64px;
  648. height: 64px;
  649. background-color: #fff;
  650. display: flex;
  651. align-items: center;
  652. justify-content: center;
  653. & > img {
  654. width: 48px;
  655. height: 48px;
  656. }
  657. }
  658. .count {
  659. font-size: 30px;
  660. color: #0f2b4c;
  661. font-weight: 600;
  662. }
  663. }
  664. }
  665. }
  666. .right-chart {
  667. margin-left: 1%;
  668. width: 41%;
  669. .first-line {
  670. background: #fff;
  671. height: 464px;
  672. margin-top: 16px;
  673. }
  674. .two-line {
  675. display: flex;
  676. justify-content: space-between;
  677. margin-top: 16px;
  678. .left {
  679. flex-basis: 48%;
  680. }
  681. .right {
  682. height: 100%;
  683. flex-basis: 48%;
  684. margin-left: 16px;
  685. }
  686. }
  687. }
  688. }
  689. .table-title {
  690. color: #0f2b4c;
  691. font-size: 16px;
  692. padding: 10px;
  693. }
  694. </style>