energy.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249
  1. <template>
  2. <div class="content-box">
  3. <div class="left">
  4. <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
  5. <span class="cameratxt">能耗管理</span>
  6. </div>
  7. <div class="middle">
  8. <div class="echarts">
  9. <div class="echarts1">
  10. <div class="title">水电量统计</div>
  11. <div id="annulus"></div>
  12. <div class="quantity_title">
  13. <div class="quantity">
  14. <div class="dosage">用电量</div>
  15. <div class="num">
  16. <!-- <el-col>
  17. <el-statistic title="" :value="getWaterTj" />
  18. </el-col> -->
  19. <span class="unit">{{ getElcTj }}</span>
  20. <div class="units">kw·h</div>
  21. </div>
  22. </div>
  23. <div class="quantity">
  24. <div class="dosage">用水量</div>
  25. <div class="num">
  26. <!-- <el-col>
  27. <el-statistic title="" :value="getElcTj" />
  28. </el-col> -->
  29. <span class="unit">{{ getWaterTj }}</span>
  30. <div class="units">L</div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="echarts1 echarts2">
  36. <div class="title">区域统计</div>
  37. <div id="areaTJ"></div>
  38. <div class="quantity_title">
  39. <div class="btn">
  40. <div
  41. class="btn_li"
  42. :class="areaInd == 1 ? 'btn_active' : ''"
  43. @click="areaStatistics(1)"
  44. >
  45. </div>
  46. <div
  47. class="btn_li"
  48. :class="areaInd == 2 ? 'btn_active' : ''"
  49. @click="areaStatistics(2)"
  50. >
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="table">
  57. <div class="table1">
  58. <div class="title">区域能耗统计</div>
  59. <div class="table1Data">
  60. <div class="selInput">
  61. <span>月份 : </span>
  62. <!-- <el-select
  63. v-model="tableSearch1"
  64. class="m-2"
  65. placeholder="请选择月份"
  66. >
  67. <el-option label="1月" value="1" />
  68. <el-option label="2月" value="2" />
  69. </el-select> -->
  70. <el-date-picker
  71. v-model="tableSearch1"
  72. type="month"
  73. placeholder="请选择月份"
  74. format="YYYY-MM"
  75. value-format="YYYY-MM"
  76. @change="energyDissipation"
  77. />
  78. </div>
  79. <el-table
  80. :row-class-name="tableRowClassName"
  81. :data="table1Data.list"
  82. style="width: 100%"
  83. :header-cell-style="{
  84. background: 'rgba(240, 243, 247, 1)',
  85. height: '40px',
  86. border: 0,
  87. }"
  88. >
  89. <el-table-column
  90. align="center "
  91. type="index"
  92. width="80"
  93. label="序号"
  94. />
  95. <el-table-column align="center" prop="eNum" label="电(kw/h)" />
  96. <el-table-column align="center" prop="wNum" label="水(L)" />
  97. <el-table-column align="center" prop="name" label="楼栋" />
  98. <el-table-column align="center" prop="date" label="月份" />
  99. </el-table>
  100. <!-- 分页组件 -->
  101. <div class="pageSize">
  102. <span></span>
  103. <el-pagination
  104. small
  105. background
  106. :current-page="currentPage1"
  107. :page-size="pageSize1"
  108. layout="total, prev, pager, next, jumper, slot"
  109. :total="total1"
  110. @update:current-page="handleCurrentChange1"
  111. />
  112. </div>
  113. </div>
  114. </div>
  115. <div class="table1 table2">
  116. <div class="title">实时抄表</div>
  117. <div class="table1Data">
  118. <div class="selInput">
  119. <el-button-group style="margin-right:15px">
  120. <el-button @click="table2Change(0)" :type="table2Type==0?'primary':''">水</el-button>
  121. <el-button @click="table2Change(1)" :type="table2Type==1?'primary':''">电</el-button>
  122. </el-button-group>
  123. <span>通讯时间 : </span>
  124. <el-date-picker
  125. v-model="tableSearch2"
  126. type="date"
  127. format="YYYY-MM-DD"
  128. value-format="YYYY-MM-DD"
  129. :prefix-icon="Calendar"
  130. placeholder="请选择日期"
  131. @change="meterReading"
  132. />
  133. </div>
  134. <el-table
  135. :row-class-name="tableRowClassName"
  136. :data="table2Data.list"
  137. style="width: 100%"
  138. :header-cell-style="{
  139. background: 'rgba(240, 243, 247, 1)',
  140. height: '40px',
  141. border: 0,
  142. }"
  143. >
  144. <el-table-column
  145. align="center "
  146. width="80"
  147. type="index"
  148. label="序号"
  149. />
  150. <el-table-column align="center" prop="buildAddress" label="楼栋" />
  151. <el-table-column align="center" prop="address" label="位置" />
  152. <el-table-column align="center" prop="meterPower" :label="table2Type==0?'水(吨)':'电(度)'" />
  153. <el-table-column align="center" prop="meterNo" label="表号" />
  154. <el-table-column align="center" prop="createTime" label="通讯时间" />
  155. </el-table>
  156. <!-- 分页组件 -->
  157. <div class="pageSize">
  158. <span></span>
  159. <el-pagination
  160. small
  161. background
  162. :current-page="currentPage2"
  163. :page-size="pageSize2"
  164. layout="total, prev, pager, next, jumper, slot"
  165. :total="total2"
  166. @update:current-page="handleCurrentChange2"
  167. />
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <!-- 编辑按钮 -->
  175. <el-dialog
  176. class="editDialog"
  177. v-model="editVisible"
  178. :close-on-click-modal="false"
  179. :close-on-press-escape="false"
  180. :title="titleDialog"
  181. align-center
  182. width="600"
  183. :before-close="cancelEdit"
  184. >
  185. <el-form
  186. ref="editRef"
  187. :model="editRuleForm"
  188. :rules="editRules"
  189. label-width="90px"
  190. class="demo-ruleForm"
  191. :size="formSize"
  192. label-position="left"
  193. status-icon
  194. >
  195. <el-form-item label="用户部门 :" prop="userDepartment">
  196. <el-input
  197. v-model="editRuleForm.userDepartment"
  198. placeholder="请输入用户部门"
  199. clearable
  200. style="width: 500px"
  201. />
  202. </el-form-item>
  203. <el-form-item label="用户名 :" prop="userName">
  204. <el-input
  205. v-model="editRuleForm.userName"
  206. placeholder="请输入用户名"
  207. clearable
  208. style="width: 500px"
  209. />
  210. </el-form-item>
  211. <el-form-item label="用户角色 :" prop="userRoles">
  212. <el-select
  213. v-model="editRuleForm.userRoles"
  214. class="m-2"
  215. placeholder="请选择用户角色"
  216. style="width: 500px"
  217. >
  218. <el-option label="清洁工" value="1" />
  219. <el-option label="洗碗工" value="2" />
  220. </el-select>
  221. </el-form-item>
  222. <el-form-item label="微校卡号 :" prop="schoolCard">
  223. <el-input
  224. v-model="editRuleForm.schoolCard"
  225. placeholder="请输入微校卡号"
  226. clearable
  227. style="width: 500px"
  228. />
  229. </el-form-item>
  230. <el-form-item label="身份证号 :" prop="idNumber">
  231. <el-input
  232. v-model="editRuleForm.idNumber"
  233. placeholder="请输入身份证号"
  234. style="width: 500px"
  235. >
  236. <template #append>
  237. <div @click="readCard">读卡</div>
  238. </template>
  239. </el-input>
  240. </el-form-item>
  241. <el-form-item label="指纹 :" prop="fingerprint">
  242. <el-input
  243. v-model="editRuleForm.fingerprint"
  244. placeholder="请输入指纹"
  245. style="width: 500px"
  246. >
  247. <template #append>
  248. <div @click="entering">录入</div>
  249. </template>
  250. </el-input>
  251. </el-form-item>
  252. <el-form-item class="options">
  253. <el-button
  254. color="rgba(41, 109, 227, 1)"
  255. class="queding"
  256. type="primary"
  257. @click="confirmEdit(editRef)"
  258. >
  259. 保存
  260. </el-button>
  261. <el-button @click="cancelEdit(editRef)">取消</el-button>
  262. </el-form-item>
  263. </el-form>
  264. </el-dialog>
  265. </template>
  266. <script setup>
  267. import * as echarts from "echarts";
  268. import {
  269. ref,
  270. shallowRef,
  271. reactive,
  272. watch,
  273. nextTick,
  274. onMounted,
  275. onUnmounted,
  276. } from "vue";
  277. import { useRouter } from "vue-router";
  278. import { ElMessage, ElMessageBox } from "element-plus";
  279. import { Calendar } from "@element-plus/icons-vue";
  280. import { dayjs } from "element-plus";
  281. import eds from "@/utils/eds.js";
  282. import lodash from "lodash";
  283. import axios from "axios";
  284. import { useStore } from "vuex";
  285. const store = useStore();
  286. const api = ref("");
  287. const router = useRouter();
  288. // 用户类别占比
  289. const category = shallowRef();
  290. const getWaterTj = ref(); // 水
  291. const getElcTj = ref(); // 电
  292. // 区域统计
  293. const areaTJEcharts = shallowRef();
  294. const areaInd = ref(1); // 默认水
  295. const areaData = ref();
  296. const monthList = ref([]); // 月份
  297. const monthTypeValue = ref([]); // 数据
  298. // 区域能耗统计
  299. const tableSearch1 = ref(); // 月份搜索
  300. const table1Data = reactive({
  301. list: [],
  302. });
  303. const currentPage1 = ref(1); // 当前页
  304. const pageSize1 = ref(4);
  305. const total1 = ref(5); // 当前总数
  306. // 实时抄表
  307. const table2Type=ref(0); // 切换 0水 或 1电
  308. const tableSearch2 = ref(); // 月份搜索
  309. const table2Data = reactive({
  310. list: [],
  311. });
  312. const currentPage2 = ref(1); // 当前页
  313. const pageSize2 = ref(4);
  314. const total2 = ref(5); // 当前总数
  315. // 用户类别占比
  316. const echarts1 = async () => {
  317. category.value = echarts.init(document.getElementById("annulus"));
  318. category.value.setOption({
  319. // tooltip: {
  320. // trigger: "item",
  321. // },
  322. // legend: {
  323. // orient: "horizontal",
  324. // bottom: "16%",
  325. // left: "22%",
  326. // itemGap: 20,
  327. // itemWidth: 15,
  328. // itemHeight: 15,
  329. // },
  330. // series: [
  331. // {
  332. // name: "用户类别占比",
  333. // type: "pie",
  334. // radius: ["70%", "90%"],
  335. // center: ["30%", "60%"],
  336. // // adjust the start angle
  337. // startAngle: 180,
  338. // label: {
  339. // show: true,
  340. // formatter(param) {
  341. // // correct the percentage
  342. // return param.name + " (" + param.percent * 2 + "%)";
  343. // },
  344. // },
  345. // data: [
  346. // {
  347. // value: getElcTj.value, // getElcTj.value
  348. // name: "用电",
  349. // itemStyle: {
  350. // color: "rgba(67, 181, 244, 1)",
  351. // },
  352. // },
  353. // {
  354. // value: getWaterTj.value, // getWaterTj.value
  355. // name: "用水",
  356. // itemStyle: {
  357. // color: "#D4EDFB",
  358. // },
  359. // },
  360. // {
  361. // // make an record to fill the bottom 50%
  362. // value: getElcTj.value + getWaterTj.value, // getElcTj.value + getWaterTj.value
  363. // itemStyle: {
  364. // // stop the chart from rendering this piece
  365. // color: "none",
  366. // decal: {
  367. // symbol: "none",
  368. // },
  369. // },
  370. // label: {
  371. // show: false,
  372. // },
  373. // },
  374. // ],
  375. // },
  376. // ],
  377. tooltip: {
  378. formatter: (params) => {
  379. if (params.name != "") {
  380. return (
  381. params.name +
  382. " : " +
  383. params.value +
  384. "\n" +
  385. "(" +
  386. params.percent +
  387. "%)"
  388. );
  389. }
  390. },
  391. },
  392. legend: {
  393. orient: "horizontal",
  394. bottom: "15%",
  395. left: "27%",
  396. itemGap: 20,
  397. itemWidth: 15,
  398. itemHeight: 15,
  399. },
  400. series: [
  401. {
  402. type: "pie",
  403. radius: ["40%", "56%"],
  404. center: ["35%", "35%"],
  405. color: ["rgba(67, 181, 244, 1)", "#D4EDFB"],
  406. hoverAnimation: false,
  407. startAngle: 70,
  408. selectedMode: "single",
  409. itemStyle: {
  410. normal: {
  411. // borderWidth: 8,
  412. // borderColor: "#021a24",
  413. },
  414. },
  415. label: {
  416. show: true,
  417. formatter: "{b}" + " " + "{c}",
  418. },
  419. data: [
  420. {
  421. name: "用电量",
  422. value: getElcTj.value,
  423. },
  424. {
  425. name: "用水量",
  426. value: getWaterTj.value,
  427. },
  428. ],
  429. },
  430. ],
  431. });
  432. };
  433. // 根据页面缩放重置echarts图表
  434. const resizeChart = () => {
  435. category.value.resize();
  436. areaTJEcharts.value.resize();
  437. };
  438. // 获取用电量和用水量 (11111111111111111)
  439. const getWaterElc = async () => {
  440. let res = await axios({
  441. method: "post",
  442. url: api.value + "/wanzai/api/wechat/getWaterTj",
  443. headers: {
  444. token: sessionStorage.getItem("token"),
  445. user_head: sessionStorage.getItem("userhead"),
  446. },
  447. data: data,
  448. });
  449. console.log(res, JSON.parse(eds.decryptDes(res.data.data)).num, "用水量");
  450. if (res.data.code == 200) {
  451. getWaterTj.value = JSON.parse(eds.decryptDes(res.data.data)).num;
  452. } else {
  453. ElMessage({
  454. type: "error",
  455. showClose: true,
  456. message: res.data.nessage,
  457. center: true,
  458. });
  459. }
  460. let ress = await axios({
  461. method: "post",
  462. url: api.value + "/wanzai/api/wechat/getElcTj",
  463. headers: {
  464. token: sessionStorage.getItem("token"),
  465. user_head: sessionStorage.getItem("userhead"),
  466. },
  467. data: data,
  468. });
  469. console.log(ress, JSON.parse(eds.decryptDes(ress.data.data)).num, "用电量");
  470. if (ress.data.code == 200) {
  471. getElcTj.value = JSON.parse(eds.decryptDes(ress.data.data)).num;
  472. } else {
  473. ElMessage({
  474. type: "error",
  475. showClose: true,
  476. message: res.data.nessage,
  477. center: true,
  478. });
  479. }
  480. nextTick(() => {
  481. echarts1();
  482. });
  483. };
  484. // 获取区域统计数据 (22222222222222222222222)
  485. // 切换水/电
  486. const areaStatistics = (ind) => {
  487. areaInd.value = ind;
  488. getMonWaterElc();
  489. };
  490. const getMonWaterElc = async () => {
  491. let res = "";
  492. if (areaInd.value == 1) {
  493. res = await axios({
  494. method: "post",
  495. url: api.value + "/wanzai/api/wechat/getMonWater",
  496. headers: {
  497. token: sessionStorage.getItem("token"),
  498. user_head: sessionStorage.getItem("userhead"),
  499. },
  500. data: data,
  501. });
  502. } else {
  503. res = await axios({
  504. method: "post",
  505. url: api.value + "/wanzai/api/wechat/getMonElc",
  506. headers: {
  507. token: sessionStorage.getItem("token"),
  508. user_head: sessionStorage.getItem("userhead"),
  509. },
  510. data: data,
  511. });
  512. }
  513. console.log(
  514. res,
  515. JSON.parse(eds.decryptDes(res.data.data)),
  516. "水、电 区域统计"
  517. );
  518. if (res.data.code == 200) {
  519. if (areaInd.value == 1) {
  520. areaData.value = JSON.parse(eds.decryptDes(res.data.data));
  521. monthList.value = []; // 横坐标月份
  522. monthTypeValue.value = []; // 月份对应数据
  523. let arr1 = [];
  524. let arr2 = [];
  525. let arr3 = [];
  526. monthTypeValue.value = [
  527. {
  528. name: "探问楼",
  529. type: "bar",
  530. data: arr1,
  531. itemStyle: {
  532. color: "rgb(67, 181, 244)",
  533. },
  534. barGap: "0%", // 同一列柱子的间距
  535. barWidth: 20, // 柱子的宽度
  536. emphasis: {
  537. focus: "series",
  538. },
  539. },
  540. {
  541. name: "探理楼",
  542. type: "bar",
  543. data: arr2,
  544. itemStyle: {
  545. color: "rgb(158, 207, 142)",
  546. },
  547. barGap: "0%", // 同一列柱子的间距
  548. barWidth: 20, // 柱子的宽度
  549. emphasis: {
  550. focus: "series",
  551. },
  552. },
  553. {
  554. name: "探学楼",
  555. type: "bar",
  556. data: arr3,
  557. itemStyle: {
  558. color: "rgb(242, 204, 118)",
  559. },
  560. barGap: "0%", // 同一列柱子的间距
  561. barWidth: 20, // 柱子的宽度
  562. emphasis: {
  563. focus: "series",
  564. },
  565. },
  566. ];
  567. areaData.value.forEach((item) => {
  568. if (item.lt.length > 0) {
  569. item.lt.forEach((i) => {
  570. if (i.name == "探问楼") {
  571. arr1.push(i.num);
  572. }
  573. if (i.name == "探理楼") {
  574. arr2.push(i.num);
  575. }
  576. if (i.name == "探学楼") {
  577. arr3.push(i.num);
  578. }
  579. });
  580. } else {
  581. arr1.push(0);
  582. arr2.push(0);
  583. arr3.push(0);
  584. }
  585. });
  586. console.log(monthTypeValue.value, "水 数据整合 区域统计");
  587. areaData.value.forEach((item) => {
  588. monthList.value.push(item.date);
  589. });
  590. }else {
  591. areaData.value = JSON.parse(eds.decryptDes(res.data.data));
  592. monthList.value = []; // 横坐标月份
  593. monthTypeValue.value = []; // 月份对应数据
  594. let arr1 = [];
  595. let arr2 = [];
  596. let arr3 = [];
  597. monthTypeValue.value = [
  598. {
  599. name: "探问楼",
  600. type: "bar",
  601. data: arr1,
  602. itemStyle: {
  603. color: "rgb(67, 181, 244)",
  604. },
  605. barGap: "0%", // 同一列柱子的间距
  606. barWidth: 20, // 柱子的宽度
  607. emphasis: {
  608. focus: "series",
  609. },
  610. },
  611. {
  612. name: "探理楼",
  613. type: "bar",
  614. data: arr2,
  615. itemStyle: {
  616. color: "rgb(158, 207, 142)",
  617. },
  618. barGap: "0%", // 同一列柱子的间距
  619. barWidth: 20, // 柱子的宽度
  620. emphasis: {
  621. focus: "series",
  622. },
  623. },
  624. ];
  625. areaData.value.forEach((item) => {
  626. if (item.lt.length > 0) {
  627. item.lt.forEach((i) => {
  628. if (i.name == "探问楼") {
  629. arr1.push(i.num);
  630. }
  631. if (i.name == "探理楼") {
  632. arr2.push(i.num);
  633. }
  634. });
  635. } else {
  636. arr1.push(0);
  637. arr2.push(0);
  638. }
  639. });
  640. console.log(monthTypeValue.value, "电 数据整合 区域统计");
  641. areaData.value.forEach((item) => {
  642. monthList.value.push(item.date);
  643. });
  644. }
  645. if(areaTJEcharts.value){
  646. areaTJEcharts.value.dispose();
  647. }
  648. nextTick(() => {
  649. echarts2();
  650. });
  651. } else {
  652. ElMessage({
  653. type: "error",
  654. showClose: true,
  655. message: res.data.nessage,
  656. center: true,
  657. });
  658. }
  659. };
  660. // 区域统计图表
  661. const echarts2 = async () => {
  662. areaTJEcharts.value = echarts.init(document.getElementById("areaTJ"));
  663. areaTJEcharts.value.setOption({
  664. legend: {
  665. orient: "horizontal",
  666. bottom: "5%",
  667. left: "center",
  668. itemGap: 20,
  669. itemWidth: 15,
  670. itemHeight: 15,
  671. },
  672. tooltip: {
  673. trigger: "axis",
  674. axisPointer: {
  675. type: "shadow",
  676. },
  677. },
  678. grid: {
  679. show: false,
  680. top: "10%", // 一下数值可为百分比也可为具体像素值
  681. right: "8%",
  682. bottom: "25%",
  683. left: "10%",
  684. },
  685. dataZoom: [
  686. {
  687. type: "slider",
  688. realtime: true,
  689. start: 40,
  690. end: 100, // 数据窗口范围的结束百分比。范围是:0 ~ 100。
  691. height: 5, // 组件高度
  692. left: 5, // 左边的距离
  693. right: 5, // 右边的距离
  694. bottom: 2, // 下边的距离
  695. show: true, // 是否展示
  696. fillerColor: "rgba(180, 226, 251, 1)", // 滚动条颜色
  697. borderColor: "rgba(180, 226, 251, 0.12)",
  698. handleSize: 0, // 两边手柄尺寸
  699. showDetail: false, // 拖拽时是否展示滚动条两侧的文字
  700. zoomLock: true, // 是否只平移不缩放
  701. moveOnMouseMove: false, // 鼠标移动能触发数据窗口平移
  702. zoomOnMouseWheel: true, // 鼠标移动能触发数据窗口缩放
  703. },
  704. {
  705. type: "inside", // 支持内部鼠标滚动平移
  706. start: 0,
  707. end: 70,
  708. zoomOnMouseWheel: false, // 关闭滚轮缩放
  709. moveOnMouseWheel: true, // 开启滚轮平移
  710. moveOnMouseMove: true, // 鼠标移动能触发数据窗口平移
  711. },
  712. ],
  713. // dataset: {
  714. // source: [
  715. // ["product", "2015", "2016", "2017"],
  716. // ["教学楼", 43.3, 85.8, 93.7],
  717. // ["行政楼", 83.1, 73.4, 55.1],
  718. // ["食堂", 86.4, 65.2, 82.5],
  719. // ["其他", 72.4, 53.9, 39.1],
  720. // ],
  721. // },
  722. xAxis: {
  723. type: "category",
  724. axisLine: {
  725. show: true,
  726. //这是x轴文字颜色
  727. lineStyle: {
  728. color: "##5B5B5B",
  729. },
  730. },
  731. axisTick: {
  732. show: false,
  733. },
  734. data: monthList.value,
  735. },
  736. yAxis: {
  737. name: "吨/度",
  738. nameTextStyle: {
  739. color: "#aaa",
  740. nameLocation: "start",
  741. },
  742. axisLine: {
  743. //这是x轴文字颜色
  744. show: true,
  745. lineStyle: {
  746. color: "##5B5B5B",
  747. },
  748. },
  749. splitLine: {
  750. //x轴的网格 样式
  751. lineStyle: {
  752. color: "#F0EEEE",
  753. width: 1,
  754. type: "dashed",
  755. },
  756. },
  757. },
  758. // Declare several bar series, each will be mapped
  759. // to a column of dataset.source by default.
  760. series: monthTypeValue.value,
  761. });
  762. // areaTJEcharts.value.setOption({
  763. // legend: {},
  764. // tooltip: {},
  765. // dataset: {
  766. // source: [
  767. // ["product", "2015", "2016", "2017"],
  768. // ["Matcha Latte", 43.3, 85.8, 93.7],
  769. // ["Milk Tea", 83.1, 73.4, 55.1],
  770. // ["Cheese Cocoa", 86.4, 65.2, 82.5],
  771. // ["Walnut Brownie", 72.4, 53.9, 39.1],
  772. // ],
  773. // },
  774. // xAxis: { type: "category" },
  775. // yAxis: {},
  776. // // Declare several bar series, each will be mapped
  777. // // to a column of dataset.source by default.
  778. // series: [{ type: "bar" }, { type: "bar" }, { type: "bar" }],
  779. // });
  780. };
  781. // 区域能耗统计 (333333333333333333333333)
  782. const energyDissipation = async () => {
  783. let paramsData = {
  784. currentPage: currentPage1.value,
  785. pageCount: pageSize1.value,
  786. };
  787. let data = {
  788. date: tableSearch1.value,
  789. };
  790. let res = await axios({
  791. method: "post",
  792. url: api.value + "/wanzai/api/wechat/getMeterMonthPage",
  793. headers: {
  794. token: sessionStorage.getItem("token"),
  795. user_head: sessionStorage.getItem("userhead"),
  796. },
  797. params: paramsData,
  798. data: data,
  799. });
  800. console.log(res, JSON.parse(eds.decryptDes(res.data.data)), "区域能耗统计");
  801. if (res.data.code == 200) {
  802. table1Data.list = JSON.parse(eds.decryptDes(res.data.data)).list;
  803. total1.value = JSON.parse(eds.decryptDes(res.data.data)).total;
  804. // ElMessage({
  805. // type: "success",
  806. // showClose: true,
  807. // message: res.data.nessage,
  808. // center: true,
  809. // });
  810. } else {
  811. ElMessage({
  812. type: "error",
  813. showClose: true,
  814. message: res.data.nessage,
  815. center: true,
  816. });
  817. }
  818. };
  819. const handleCurrentChange1 = (value) => {
  820. // console.log(value);
  821. currentPage1.value = value;
  822. energyDissipation();
  823. };
  824. // 实时抄表 (44444444444444444444444444)
  825. const table2Change=(flag)=>{
  826. table2Type.value=flag
  827. meterReading()
  828. }
  829. const meterReading = async () => {
  830. let paramsData = {
  831. currentPage: currentPage2.value,
  832. pageCount: pageSize2.value,
  833. };
  834. let data = {
  835. date: tableSearch2.value,
  836. type:table2Type.value
  837. };
  838. let res = await axios({
  839. method: "post",
  840. url: api.value + "/wanzai/api/wechat/getMeterDayPage",
  841. headers: {
  842. token: sessionStorage.getItem("token"),
  843. user_head: sessionStorage.getItem("userhead"),
  844. },
  845. params: paramsData,
  846. data: data,
  847. });
  848. console.log(res,JSON.parse(eds.decryptDes(res.data.data)), "实时抄表");
  849. if (res.data.code == 200) {
  850. table2Data.list = JSON.parse(eds.decryptDes(res.data.data)).list;
  851. total2.value = JSON.parse(eds.decryptDes(res.data.data)).total;
  852. // ElMessage({
  853. // type: "success",
  854. // showClose: true,
  855. // message: res.data.nessage,
  856. // center: true,
  857. // });
  858. } else {
  859. ElMessage({
  860. type: "error",
  861. showClose: true,
  862. message: res.data.nessage,
  863. center: true,
  864. });
  865. }
  866. };
  867. const handleCurrentChange2 = (value) => {
  868. // console.log(value);
  869. currentPage2.value = value;
  870. meterReading();
  871. };
  872. // 表格斑马纹颜色修改
  873. const tableRowClassName = ({ row, rowIndex }) => {
  874. if (rowIndex % 2 === 0) {
  875. return "even";
  876. } else if (rowIndex % 2 !== 0) {
  877. return "odd";
  878. }
  879. return "";
  880. };
  881. onMounted(() => {
  882. api.value = store.state.user.api;
  883. getWaterElc(); // 用户类别占比
  884. getMonWaterElc(); // 区域统计
  885. energyDissipation(); // 区域能耗
  886. meterReading(); //实时抄表
  887. window.addEventListener("resize", resizeChart);
  888. });
  889. onUnmounted(() => {
  890. category.value.dispose();
  891. areaTJEcharts.value.dispose();
  892. });
  893. </script>
  894. <style scoped lang="scss">
  895. .content-box {
  896. min-width: 800px;
  897. width: calc(100vw - 260px);
  898. height: calc(100vh - 105px);
  899. border-radius: 8px;
  900. margin: 20px auto;
  901. background-color: #fff;
  902. // color: #fff;
  903. display: flex;
  904. flex-direction: column;
  905. box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);
  906. .left {
  907. // width: calc(100wh - 40px);
  908. display: flex;
  909. align-items: center;
  910. height: 60px;
  911. margin: 0 30px;
  912. border-bottom: 1px solid #ccc;
  913. color: rgb(0, 0, 0);
  914. font-size: 18px;
  915. font-weight: 600;
  916. span {
  917. margin-right: 20px;
  918. }
  919. .is_active {
  920. color: rgba(111, 182, 184, 1);
  921. }
  922. }
  923. .middle {
  924. width: 100%;
  925. height: calc(100% - 61px);
  926. overflow: auto;
  927. margin: 0 auto;
  928. color: #000;
  929. display: flex;
  930. flex-direction: column;
  931. align-items: center;
  932. .echarts {
  933. // flex: 1;
  934. height: 345px;
  935. width: calc(100% - 40px);
  936. margin: 10px 0 15px 0;
  937. display: flex;
  938. .echarts1 {
  939. width: 50%;
  940. // min-width: 500px;
  941. height: 100%;
  942. // height: 500px;
  943. margin-right: 20px;
  944. border-radius: 8px;
  945. box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);
  946. position: relative;
  947. .title {
  948. font-size: 18px;
  949. font-weight: 700;
  950. margin: 16px 30px;
  951. }
  952. #annulus {
  953. width: 100%;
  954. height: 300px;
  955. // height: calc(100% - 56px);
  956. }
  957. .quantity_title {
  958. position: absolute;
  959. z-index: 999;
  960. top: 87px;
  961. right: 47px;
  962. color: rgba(91, 91, 91, 1);
  963. font-size: 20px;
  964. .quantity {
  965. margin-bottom: 20px;
  966. .num {
  967. display: flex;
  968. color: rgba(42, 42, 42, 1);
  969. .el-col {
  970. flex: none;
  971. display: flex;
  972. align-items: center;
  973. :deep(.el-statistic__number) {
  974. font-size: 30px;
  975. font-weight: 600;
  976. }
  977. }
  978. .unit {
  979. font-size: 26px;
  980. font-weight: 800;
  981. }
  982. .units {
  983. transform: translate(5px, 5px);
  984. }
  985. }
  986. }
  987. }
  988. }
  989. .echarts2 {
  990. margin-right: 0;
  991. #areaTJ {
  992. width: 100%;
  993. height: calc(100% - 56px);
  994. // height: 300px;
  995. }
  996. .quantity_title {
  997. position: absolute;
  998. z-index: 999;
  999. top: 20px;
  1000. right: 80px;
  1001. font-size: 18px;
  1002. color: rgba(0, 97, 255, 1);
  1003. .btn {
  1004. display: flex;
  1005. .btn_li {
  1006. width: 65px;
  1007. height: 28px;
  1008. border-radius: 5px;
  1009. background: rgba(235, 242, 255, 1);
  1010. text-align: center;
  1011. line-height: 28px;
  1012. margin-right: 15px;
  1013. cursor: pointer;
  1014. }
  1015. .btn_active {
  1016. background: rgba(0, 97, 255, 1);
  1017. color: #fff;
  1018. }
  1019. }
  1020. }
  1021. }
  1022. }
  1023. .table {
  1024. // flex: 1;
  1025. height: 360px;
  1026. width: calc(100% - 40px);
  1027. display: flex;
  1028. justify-content: space-between;
  1029. .table1 {
  1030. width: 50%;
  1031. // min-width: 500px;
  1032. height: 100%;
  1033. // height: 500px;
  1034. margin-right: 20px;
  1035. border-radius: 8px;
  1036. box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);
  1037. position: relative;
  1038. .title {
  1039. font-weight: 700;
  1040. margin: 16px 30px 10px;
  1041. font-size: 18px;
  1042. }
  1043. .table1Data {
  1044. margin: 0 30px;
  1045. height: calc(100% - 51px);
  1046. .selInput {
  1047. margin-bottom: 10px;
  1048. font-size: 14px;
  1049. }
  1050. .el-table--fit {
  1051. height: 65%;
  1052. :deep(.el-table__header-wrapper) {
  1053. background-color: #000;
  1054. font-size: 14px;
  1055. tr {
  1056. color: #000;
  1057. }
  1058. }
  1059. :deep(.el-table__row) {
  1060. height: 40px;
  1061. font-size: 14px;
  1062. color: #000;
  1063. &:hover {
  1064. td {
  1065. background-color: rgba(223, 236, 254, 1);
  1066. }
  1067. }
  1068. }
  1069. :deep(.el-table__row):nth-child(2n) {
  1070. .el-table-fixed-column--right {
  1071. background-color: rgba(240, 243, 247, 1);
  1072. }
  1073. }
  1074. :deep(.el-table__row td) {
  1075. padding: 0;
  1076. border: 0;
  1077. }
  1078. .el-button--primary {
  1079. margin-left: 5px;
  1080. }
  1081. :deep(.el-table__body .even) {
  1082. background-color: #fff;
  1083. }
  1084. :deep(.el-table__body .odd) {
  1085. background-color: rgba(240, 243, 247, 1);
  1086. }
  1087. :deep(.edit) {
  1088. display: flex;
  1089. align-items: center;
  1090. justify-content: center;
  1091. color: rgba(111, 182, 184, 1);
  1092. }
  1093. :deep(.look) {
  1094. padding: 0 10px;
  1095. cursor: pointer;
  1096. color: rgba(30, 125, 251, 1);
  1097. }
  1098. .del {
  1099. padding: 0 10px;
  1100. color: rgba(212, 48, 48, 1);
  1101. cursor: pointer;
  1102. }
  1103. // :deep(.look):hover {
  1104. // color: red;
  1105. // }
  1106. // :deep(.del):hover {
  1107. // color: red;
  1108. // }
  1109. }
  1110. .pageSize {
  1111. display: flex;
  1112. align-items: center;
  1113. justify-content: space-between;
  1114. margin: 18px 0 0;
  1115. span {
  1116. color: #000;
  1117. }
  1118. .el-pagination {
  1119. // width: 1600px;
  1120. :deep(.el-pagination__total) {
  1121. color: #000;
  1122. }
  1123. :deep(.el-pagination__goto) {
  1124. color: #000;
  1125. }
  1126. :deep(.el-pagination__classifier) {
  1127. color: #000;
  1128. }
  1129. :deep(.el-input__wrapper) {
  1130. border: 1px solid rgba(0, 0, 0, 1);
  1131. border-radius: 5px;
  1132. box-shadow: none;
  1133. }
  1134. :deep(.el-pager li) {
  1135. margin: 0 5px;
  1136. border: 1px solid rgba(0, 0, 0, 1);
  1137. border-radius: 5px;
  1138. background-color: transparent;
  1139. }
  1140. :deep(.el-pager li.is-active) {
  1141. // background-color: rgba(0, 97, 255, 0.8);
  1142. border: 1px solid rgba(0, 97, 255, 1);
  1143. color: rgba(0, 97, 255, 1);
  1144. }
  1145. :deep(.btn-prev) {
  1146. margin-right: 5px;
  1147. border: 1px solid rgba(0, 0, 0, 1);
  1148. border-radius: 5px;
  1149. background-color: transparent;
  1150. }
  1151. :deep(.btn-next) {
  1152. margin-left: 5px;
  1153. border: 1px solid rgba(0, 0, 0, 1);
  1154. border-radius: 5px;
  1155. background-color: transparent;
  1156. }
  1157. }
  1158. }
  1159. }
  1160. }
  1161. .table2 {
  1162. margin: 0;
  1163. }
  1164. }
  1165. }
  1166. // 编辑按钮
  1167. :deep(.editDialog) {
  1168. // height: 420px;
  1169. border-radius: 11px;
  1170. .el-dialog__header {
  1171. border-radius: 11px 11px 0 0;
  1172. background: rgba(237, 241, 245, 1);
  1173. font-weight: 600;
  1174. margin: 0;
  1175. .el-dialog__headerbtn {
  1176. outline: none;
  1177. }
  1178. }
  1179. .el-dialog__body {
  1180. padding: 30px 30px 10px 30px;
  1181. .el-form-item__content {
  1182. width: 200px;
  1183. .el-input-group__append {
  1184. background-color: rgba(222, 234, 252, 1);
  1185. color: rgba(0, 97, 255, 1);
  1186. cursor: pointer;
  1187. user-select: none;
  1188. }
  1189. }
  1190. .options {
  1191. margin: 30px 20px 20px 0;
  1192. width: 100%;
  1193. .el-form-item__content {
  1194. display: flex;
  1195. flex-direction: row-reverse;
  1196. }
  1197. .queding {
  1198. color: #fff;
  1199. margin-left: 15px;
  1200. }
  1201. }
  1202. }
  1203. }
  1204. }
  1205. </style>