PersonStatistics.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <template>
  2. <div class="page_container">
  3. <base-title title="进出人员" />
  4. <div class="page_content">
  5. <div class="person_title">人员信息</div>
  6. <div class="person_num_box">
  7. <vue-seamless
  8. :data="personList"
  9. class="seamless-warp"
  10. :class-option="scrollOption"
  11. ref="seamlessScroll"
  12. :key="seamLessTimeKey"
  13. >
  14. <div v-if="personList.length">
  15. <div class="item" v-for="item of personList" :key="item.id">
  16. <div class="left">
  17. <img
  18. src="~@/assets/imgs/stationMap/img_无照片.png"
  19. @click="openPersonInfo"
  20. />
  21. </div>
  22. <div class="divider"></div>
  23. <div class="right">
  24. <div class="position">{{ item.type }}</div>
  25. <div class="rymain">
  26. <div class="row">
  27. <div style="width: 40%">
  28. <span>姓名:</span>
  29. <span class="val">{{ item.name }}</span>
  30. </div>
  31. <div>
  32. <span>电话号码:</span>
  33. <span class="val" style="color: #00e0ff">{{
  34. item.phone
  35. }}</span>
  36. </div>
  37. </div>
  38. <div class="row">
  39. <div>
  40. <span>人员类型:</span>
  41. <span class="val">{{ item.personType }}</span>
  42. </div>
  43. </div>
  44. <div class="row">
  45. <div>
  46. <span>岗位名称:</span>
  47. <span class="val">{{ item.posi }}</span>
  48. </div>
  49. </div>
  50. <div class="row">
  51. <div>
  52. <span>所属单位:</span>
  53. <span class="val">{{ item.comp }}</span>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div v-else>暂无数据</div>
  61. </vue-seamless>
  62. </div>
  63. <div class="person_type_box">
  64. <div class="person_title">类型统计</div>
  65. <div class="type_content">
  66. <div class="left_part">
  67. <img
  68. :src="require('@/assets/imgs/panels/img_personnel_01@2x.png')"
  69. alt=""
  70. @click="openPersonList()"
  71. />
  72. <span class="totle">{{ total }}</span>
  73. <span class="text">总数</span>
  74. </div>
  75. <div class="right_part">
  76. <div
  77. class="row_item"
  78. v-for="(item, index) in personTypeCount"
  79. :key="index"
  80. >
  81. <img
  82. v-if="item.name === '员工'"
  83. :src="require('@/assets/imgs/panels/icon_staff@2x.png')"
  84. alt=""
  85. />
  86. <img
  87. v-if="item.name === '访客'"
  88. :src="require('@/assets/imgs/panels/icon_visitor@2x.png')"
  89. alt=""
  90. />
  91. <img
  92. v-if="item.name === '施工'"
  93. :src="require('@/assets/imgs/panels/icon_construction@2x.png')"
  94. alt=""
  95. />
  96. <div class="row_main">
  97. <img
  98. :src="require('@/assets/imgs/panels/icon_arrow@2x.png')"
  99. alt=""
  100. />
  101. <span class="name">{{ item.name }}</span>
  102. <div class="line"></div>
  103. <span class="num">{{ item.value }}</span>
  104. <span class="unit">人</span>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </template>
  113. <script>
  114. import BaseTitle from "./BaseTitle.vue";
  115. import VueSeamless from "vue-seamless-scroll";
  116. import { getPersonTypeList, getAccessInfo } from "@/API/positioning";
  117. export default {
  118. name: "PersonStatistics",
  119. components: { BaseTitle, VueSeamless },
  120. data() {
  121. return {
  122. total: 4,
  123. seamLessTimeKey: new Date().getTime(),
  124. personTypeCount: [
  125. {
  126. name: "员工",
  127. value: 2,
  128. },
  129. {
  130. name: "访客",
  131. value: 1,
  132. },
  133. {
  134. name: "施工",
  135. value: 1,
  136. },
  137. ],
  138. personRiskCount: [
  139. {
  140. code: "306001",
  141. name: "3万方汽油罐区",
  142. value: 0,
  143. },
  144. {
  145. code: "306002",
  146. name: "8万方汽油罐区",
  147. value: 0,
  148. },
  149. {
  150. code: "306003",
  151. name: "20万方柴油油罐区",
  152. value: 0,
  153. },
  154. {
  155. code: "306004",
  156. name: "500方泄压罐",
  157. value: 0,
  158. },
  159. ],
  160. scrollOption: {
  161. limitMoveNum: 2,
  162. singleHeight: 173,
  163. waitTime: 5000,
  164. openWatch: true,
  165. },
  166. personList: [
  167. {
  168. id: "1",
  169. name: "张某某",
  170. pic: "",
  171. type: "值班干部",
  172. posi: "主任",
  173. personType: "员工",
  174. comp: "XXXXX公司",
  175. phone: 15500001111,
  176. imgUrl: "~@/assets/imgs/stationMap/img_无照片.png",
  177. },
  178. {
  179. id: "2",
  180. name: "王某某",
  181. pic: "",
  182. type: "值班门卫",
  183. posi: "运维操作工",
  184. personType: "员工",
  185. comp: "XXXXX公司",
  186. phone: 15500001111,
  187. imgUrl: "~@/assets/imgs/stationMap/img_无照片.png",
  188. },
  189. {
  190. id: "3",
  191. name: "李某某",
  192. pic: "",
  193. type: "施工人员",
  194. posi: "门卫",
  195. personType: "施工",
  196. comp: "XXXXX公司",
  197. phone: 15500001111,
  198. imgUrl: "~@/assets/imgs/stationMap/img_无照片.png",
  199. },
  200. {
  201. id: "4",
  202. name: "高某某",
  203. pic: "",
  204. type: "访客",
  205. posi: "工程师",
  206. personType: "访客",
  207. comp: "XXXXX公司",
  208. phone: 15500001111,
  209. imgUrl: "~@/assets/imgs/stationMap/img_无照片.png",
  210. },
  211. ],
  212. };
  213. },
  214. created() {
  215. this.openPersonInfo();
  216. },
  217. mounted() {
  218. // this.getPersonTypeList();
  219. // this.startMqtt();
  220. },
  221. methods: {
  222. async openPersonInfo() {
  223. try {
  224. const res = await getAccessInfo({ id: "789185626355277824" });
  225. const data = res.data;
  226. console.log("门禁信息", data);
  227. if (data.remark) {
  228. const c = data.remark.split(":");
  229. if (c.length == 3) {
  230. this.personTypeCount[0].value = c[0];
  231. this.personTypeCount[1].value = c[1];
  232. this.personTypeCount[2].value = c[2];
  233. this.total = Number(c[0]) + Number(c[1]) + Number(c[2]);
  234. }
  235. }
  236. } catch (err) {
  237. console.log(err);
  238. }
  239. },
  240. openPersonList() {
  241. // this.$store.dispatch("globalConfig/setPersonListDialog", {
  242. // show: true,
  243. // dialogMsg: this.personList,
  244. // type: "All",
  245. // });
  246. },
  247. async getPersonTypeList() {
  248. try {
  249. const p = {};
  250. const res = await getPersonTypeList(p);
  251. console.log(res.data);
  252. } catch (err) {
  253. console.log(err);
  254. }
  255. },
  256. startMqtt() {
  257. const topics = [
  258. "CountArea/AllCount/All",
  259. "CountArea/RiskCount/All",
  260. "CountArea/PersonTypeCount/All",
  261. ];
  262. const _this = this;
  263. this.$store.dispatch("mqtt/subscribe", {
  264. topic: topics,
  265. onMessage: (topic, message, packet) => {
  266. const content = message.toString();
  267. if (topic === "CountArea/AllCount/All") {
  268. this.total = content;
  269. } else if (topic === "CountArea/RiskCount/All") {
  270. const data = JSON.parse(content);
  271. this.personRiskCount.forEach((item) => {
  272. item.value = data[item.code];
  273. });
  274. } else if (topic === "CountArea/PersonTypeCountDic/All") {
  275. const data = JSON.parse(content);
  276. }
  277. },
  278. });
  279. this.$once("hook:beforeDestroy", () => {
  280. this.$store.dispatch("mqtt/unsubscribe", topics);
  281. });
  282. },
  283. },
  284. };
  285. </script>
  286. <style lang="less" scoped>
  287. .page_container {
  288. width: 410px;
  289. z-index: 2;
  290. .page_content {
  291. width: 100%;
  292. height: 62%;
  293. .person_title {
  294. margin-top: 4px;
  295. padding-left: 20px;
  296. height: 24px;
  297. line-height: 24px;
  298. background: url(~@/assets/imgs/panels/title_bg_01@2x.png) no-repeat;
  299. background-size: 100% 100%;
  300. font-family: MicrosoftYaHei-Bold;
  301. font-size: 14px;
  302. color: #e0f3ff;
  303. letter-spacing: 0.88px;
  304. text-shadow: 0 0 10px #1162ff;
  305. font-weight: 700;
  306. }
  307. .person_type_box {
  308. width: 100%;
  309. height: 154px;
  310. .person_title {
  311. margin-top: 10px;
  312. }
  313. .type_content {
  314. margin-top: 4px;
  315. width: 100%;
  316. height: 126px;
  317. display: flex;
  318. justify-content: space-between;
  319. align-items: center;
  320. .left_part {
  321. width: 110px;
  322. height: 100%;
  323. display: flex;
  324. flex-direction: column;
  325. justify-content: center;
  326. align-items: center;
  327. img {
  328. width: 64px;
  329. height: 64px;
  330. }
  331. .totle {
  332. font-size: 30px;
  333. color: #ffffff;
  334. letter-spacing: 1.26px;
  335. text-shadow: 0 0 10px rgba(0, 180, 255, 0.5);
  336. font-weight: 700;
  337. }
  338. .text {
  339. font-size: 14px;
  340. color: #ffffff;
  341. letter-spacing: 0;
  342. text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  343. font-weight: 400;
  344. }
  345. }
  346. }
  347. }
  348. .person_num_box {
  349. width: 100%;
  350. height: 340px;
  351. overflow: hidden;
  352. .num_content {
  353. width: 100%;
  354. height: 168px;
  355. display: flex;
  356. justify-content: space-between;
  357. align-items: center;
  358. .left_part {
  359. width: 110px;
  360. height: 100%;
  361. display: flex;
  362. flex-direction: column;
  363. justify-content: center;
  364. align-items: center;
  365. img {
  366. width: 80px;
  367. height: 80px;
  368. }
  369. }
  370. }
  371. .seamless-warp {
  372. .item {
  373. margin-top: 9px;
  374. height: 48%;
  375. display: flex;
  376. position: relative;
  377. .left {
  378. width: 25%;
  379. height: 100%;
  380. text-align: center;
  381. margin-right: 8px;
  382. img {
  383. // width: 100%;
  384. height: 100%;
  385. }
  386. }
  387. .divider {
  388. width: 5%;
  389. }
  390. .right {
  391. width: 70%;
  392. min-height: 163px;
  393. position: relative;
  394. .position {
  395. font-family: 优设标题黑;
  396. font-size: 18px;
  397. color: #ffffff;
  398. letter-spacing: 1.29px;
  399. position: absolute;
  400. z-index: 99;
  401. background-image: linear-gradient(180deg, #eeeeee, #5cd5ff);
  402. -webkit-background-clip: text;
  403. background-clip: text;
  404. color: transparent;
  405. font-weight: 400;
  406. padding-left: 10px;
  407. }
  408. .rymain {
  409. width: 100%;
  410. height: calc(100% - 14px);
  411. position: absolute;
  412. bottom: 0;
  413. opacity: 0.9;
  414. background-image: linear-gradient(
  415. 270deg,
  416. rgba(0, 24, 46, 0.1) 0%,
  417. #00487b 98%
  418. );
  419. display: flex;
  420. flex-direction: column;
  421. justify-content: space-around;
  422. font-size: 12px;
  423. color: #b3c0d4;
  424. // padding-top: 12px;
  425. .row {
  426. display: flex;
  427. padding-left: 5px;
  428. font-family: MicrosoftYaHei;
  429. .val {
  430. color: #ffffff;
  431. }
  432. }
  433. .row:nth-child(2) {
  434. margin-top: -8px;
  435. }
  436. }
  437. }
  438. }
  439. }
  440. }
  441. .right_part {
  442. width: 300px;
  443. display: flex;
  444. flex-direction: column;
  445. justify-content: space-between;
  446. align-items: center;
  447. .row_item {
  448. width: 300px;
  449. height: 30px;
  450. display: flex;
  451. justify-content: space-between;
  452. align-items: center;
  453. margin-bottom: 8px;
  454. &:last-child {
  455. margin-bottom: 0;
  456. }
  457. img {
  458. width: 30px;
  459. height: 30px;
  460. }
  461. .row_main {
  462. width: 260px;
  463. height: 30px;
  464. display: flex;
  465. justify-content: space-between;
  466. align-items: center;
  467. background-color: rgba(51, 125, 206, 0.27);
  468. padding-right: 10px;
  469. .name {
  470. flex-shrink: 0;
  471. text-align: center;
  472. font-size: 13px;
  473. color: #ffffff;
  474. letter-spacing: 0;
  475. font-weight: 400;
  476. }
  477. .line {
  478. margin: 0 10px;
  479. width: 100%;
  480. height: 1px;
  481. border-top: 1px dashed #fff;
  482. opacity: 0.4;
  483. }
  484. .num {
  485. flex-shrink: 0;
  486. font-size: 18px;
  487. color: #ffffff;
  488. letter-spacing: 0;
  489. font-weight: 700;
  490. }
  491. .unit {
  492. opacity: 0.4;
  493. font-family: MicrosoftYaHei;
  494. font-size: 12px;
  495. color: #ffffff;
  496. letter-spacing: 0;
  497. font-weight: 400;
  498. }
  499. }
  500. }
  501. }
  502. }
  503. }
  504. </style>