index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <template>
  2. <div class="health-6">
  3. <div class="header-info mg-b-16">
  4. <div class="selections">
  5. <div
  6. class="item"
  7. @click="tabSelect('1')"
  8. :class="{ active: type === '1' }"
  9. >
  10. <i class="svg-icon svg-icon-sm">
  11. <svg-icon :svgid="'svg-wind-site'" />
  12. </i>
  13. <span>风场</span>
  14. </div>
  15. <div
  16. class="item"
  17. @click="tabSelect('2')"
  18. :class="{ active: type === '2' }"
  19. >
  20. <i class="svg-icon svg-icon-sm">
  21. <svg-icon :svgid="'svg-h-project'" />
  22. </i>
  23. <span>项目</span>
  24. </div>
  25. </div>
  26. <div class="state" v-if="false">
  27. <div class="state-item green">
  28. <div class="dot"></div>
  29. <div class="text">良好数量:</div>
  30. <div class="value">999</div>
  31. </div>
  32. <div class="state-item purple">
  33. <div class="dot"></div>
  34. <div class="text">正常数量:</div>
  35. <div class="value">999</div>
  36. </div>
  37. <div class="state-item yellow">
  38. <div class="dot"></div>
  39. <div class="text">注意数量:</div>
  40. <div class="value">999</div>
  41. </div>
  42. <div class="state-item orange">
  43. <div class="dot"></div>
  44. <div class="text">严重数量:</div>
  45. <div class="value">999</div>
  46. </div>
  47. </div>
  48. </div>
  49. <row :type="'flex'" class="mg-b-16">
  50. <Col :span="12">
  51. <panel :title="'报警统计图'" :showLine="false">
  52. <!-- <dual-pie-chart
  53. :innerData="healPieData"
  54. :outerData="healPieData"
  55. :height="'150px'"
  56. /> -->
  57. <dual-pie-chart :series="healPieData" :height="'150px'" />
  58. </panel>
  59. </Col>
  60. <Col :span="12">
  61. <panel :title="'故障统计图'" :showLine="false">
  62. <!-- <dual-pie-chart
  63. :innerData="stopPieData"
  64. :outerData="stopPieData"
  65. :height="'150px'"
  66. /> -->
  67. <dual-pie-chart :series="stopPieData" :height="'150px'" />
  68. </panel>
  69. </Col>
  70. <!-- <Col :span="16">
  71. <panel :title="'矩阵'" :showLine="false">
  72. <div class="matrix">
  73. <div class="item green">1号</div>
  74. <div class="item purple">2号</div>
  75. <div class="item orange">3号</div>
  76. <div class="item" v-for="index of 150" :key="index">{{ index + 3 }}号</div>
  77. <div class="blank" v-for="index of 30" :key="index"></div>
  78. </div>
  79. </panel>
  80. </Col> -->
  81. </row>
  82. <div class="mg-b-16">
  83. <panel :title="'健康状态占比'" :showLine="false">
  84. <bar-line-chart
  85. :bardata="barData"
  86. :lineData="[]"
  87. :height="'390px'"
  88. :pageSize="10"
  89. />
  90. </panel>
  91. </div>
  92. <div class="mg-b-16 curStyle">
  93. <panel :title="'健康趋势'" :showLine="false">
  94. <MultipleLineChart :list="statusData" :units="['']" :height="'260px'" />
  95. </panel>
  96. <div class="selections">
  97. <div
  98. class="item"
  99. @click="changeStatus('1')"
  100. :class="{ green: status === '1' }"
  101. >
  102. 良好
  103. </div>
  104. <div
  105. class="item"
  106. @click="changeStatus('2')"
  107. :class="{ green: status === '2' }"
  108. >
  109. 注意
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import BarLineChart from "@/components/chart/combination/bar-line-chart.vue";
  117. import MultipleLineChart from "@/components/chart/line/double-line-chart.vue";
  118. import DualPieChart from "@/components/chart/pie/dual-pie-chart.vue";
  119. import Col from "@/components/coms/grid/col.vue";
  120. import Row from "@/components/coms/grid/row.vue";
  121. import SvgIcon from "@/components/coms/icon/svg-icon.vue";
  122. import Panel from "@/components/coms/panel/panel.vue";
  123. import api from "@api/wisdomOverhaul/health/index.js";
  124. export default {
  125. name: "overview",
  126. setup() {},
  127. components: {
  128. SvgIcon,
  129. Panel,
  130. MultipleLineChart,
  131. BarLineChart,
  132. Row,
  133. Col,
  134. DualPieChart,
  135. },
  136. data() {
  137. return {
  138. type: "2",
  139. status: "1",
  140. healPieData: [],
  141. stopPieData: [],
  142. statusData: [],
  143. barData: {
  144. area: [],
  145. legend: [],
  146. data: [],
  147. },
  148. };
  149. },
  150. created() {
  151. this.requestData();
  152. },
  153. methods: {
  154. requestData() {
  155. this.getWpwarn();
  156. this.getStop();
  157. this.getWpOrProStatus();
  158. this.getStatus();
  159. },
  160. // 获取健康走势图
  161. getWpwarn() {
  162. api
  163. .healthoperationCountWpwarn({
  164. type: this.type,
  165. })
  166. .then((res) => {
  167. let healPieData = [];
  168. res.data.forEach((ele) => {
  169. healPieData.push({
  170. value: ele.value,
  171. unit: "次",
  172. name: ele.name,
  173. });
  174. });
  175. this.healPieData = healPieData;
  176. });
  177. // let that = this;
  178. // that.API.requestData({
  179. // method: "POST",
  180. // subUrl: "healthoperation/countWpwarn",
  181. // data: {
  182. // type: that.type,
  183. // },
  184. // success(res) {
  185. // let healPieData = [];
  186. // res.data.forEach((ele) => {
  187. // healPieData.push({
  188. // value: ele.value,
  189. // unit: "次",
  190. // name: ele.name,
  191. // });
  192. // });
  193. // that.healPieData = healPieData;
  194. // },
  195. // });
  196. },
  197. // 获取故障统计图
  198. getStop() {
  199. api
  200. .healthoperationCountStop({
  201. type: this.type,
  202. })
  203. .then((res) => {
  204. let stopPieData = [];
  205. res.data.forEach((ele) => {
  206. stopPieData.push({
  207. value: ele.value,
  208. unit: "次",
  209. name: ele.name,
  210. });
  211. });
  212. this.stopPieData = stopPieData;
  213. });
  214. // let that = this;
  215. // that.API.requestData({
  216. // method: "POST",
  217. // subUrl: "healthoperation/countStop",
  218. // data: {
  219. // type: that.type,
  220. // },
  221. // success(res) {
  222. // let stopPieData = [];
  223. // res.data.forEach((ele) => {
  224. // stopPieData.push({
  225. // value: ele.value,
  226. // unit: "次",
  227. // name: ele.name,
  228. // });
  229. // });
  230. // that.stopPieData = stopPieData;
  231. // },
  232. // });
  233. },
  234. // 获取健康状态占比
  235. getWpOrProStatus() {
  236. api
  237. .healthoperationCountWpOrProStatus({
  238. type: this.type,
  239. })
  240. .then((res) => {
  241. let barData = {
  242. area: res.data.name,
  243. legend: ["良好数量", "合格数量", "注意数量", "严重数量"],
  244. data: [],
  245. };
  246. barData.data.push(
  247. res.data.lhList,
  248. res.data.hgList,
  249. res.data.zyList,
  250. res.data.yzList
  251. );
  252. this.barData = barData;
  253. });
  254. },
  255. // 获取健康状态
  256. getStatus() {
  257. api
  258. .healthoperationFindWpOrProStatusForHistory({
  259. type: this.type,
  260. status: this.status,
  261. })
  262. .then((res) => {
  263. let statusData = [];
  264. const time = res.data.time;
  265. for (let key in res.data) {
  266. if (key !== "name" && key !== "time") {
  267. let item = res.data[key];
  268. let statusItem = {
  269. title: res.data.name[0][key],
  270. smooth: true,
  271. value: [],
  272. };
  273. time.forEach((text, index) => {
  274. statusItem.value.push({
  275. text: text,
  276. value: item[index],
  277. });
  278. });
  279. statusData.push(statusItem);
  280. }
  281. }
  282. this.statusData = statusData;
  283. });
  284. // let that = this;
  285. // that.API.requestData({
  286. // method: "POST",
  287. // subUrl: "healthoperation/findWpOrProStatusForHistory",
  288. // data: {
  289. // type: that.type,
  290. // status: that.status,
  291. // },
  292. // success(res) {
  293. // let statusData = [];
  294. // const time = res.data.time;
  295. // for (let key in res.data) {
  296. // if (key !== "name" && key !== "time") {
  297. // let item = res.data[key];
  298. // let statusItem = {
  299. // title: res.data.name[0][key],
  300. // smooth: true,
  301. // value: [],
  302. // };
  303. // time.forEach((text, index) => {
  304. // statusItem.value.push({
  305. // text: text,
  306. // value: item[index],
  307. // });
  308. // });
  309. // statusData.push(statusItem);
  310. // }
  311. // }
  312. // that.statusData = statusData;
  313. // },
  314. // });
  315. },
  316. tabSelect(type) {
  317. this.type = type;
  318. this.requestData();
  319. },
  320. changeStatus(status) {
  321. this.status = status;
  322. this.getStatus();
  323. },
  324. },
  325. };
  326. </script>
  327. <style lang="less">
  328. .health-6 {
  329. height: 100%;
  330. padding: 0 20px;
  331. padding-bottom: 10px;
  332. .curStyle {
  333. position: relative;
  334. .selections {
  335. position: absolute;
  336. display: flex;
  337. right: 0;
  338. top: 0;
  339. width: 50%;
  340. justify-content: flex-end;
  341. color: @gray;
  342. .item {
  343. margin-right: 15px;
  344. cursor: pointer;
  345. // flex: 0 0 80px;
  346. // text-align: center;
  347. // line-height: 33px;
  348. // margin-right: 8px;
  349. // color: @font-color;
  350. // font-size: @fontsize-s;
  351. // background: fade(@gray, 20);
  352. // border: 1px solid fade(@gray, 20);
  353. // display: flex;
  354. // justify-content: center;
  355. // align-items: center;
  356. // cursor: pointer;
  357. .green {
  358. color: @green;
  359. }
  360. &:hover,
  361. &.active {
  362. // background: fade(@green, 20);
  363. // border: 1px solid @green;
  364. color: @green;
  365. // cursor: pointer;
  366. i svg use {
  367. fill: @green;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. .header-info {
  374. display: flex;
  375. .selections {
  376. display: flex;
  377. flex: 0 0 200px;
  378. .item {
  379. flex: 0 0 80px;
  380. text-align: center;
  381. height: 33px;
  382. line-height: 33px;
  383. margin-right: 8px;
  384. color: @font-color;
  385. font-size: @fontsize-s;
  386. background: fade(@gray, 20);
  387. border: 1px solid fade(@gray, 20);
  388. display: flex;
  389. justify-content: center;
  390. align-items: center;
  391. i {
  392. margin-right: 8px;
  393. svg use {
  394. fill: @gray;
  395. }
  396. }
  397. &:hover,
  398. &.active {
  399. background: fade(@green, 20);
  400. border: 1px solid @green;
  401. color: @green;
  402. cursor: pointer;
  403. i svg use {
  404. fill: @green;
  405. }
  406. }
  407. }
  408. }
  409. .state {
  410. display: flex;
  411. .state-item {
  412. display: flex;
  413. height: 32px;
  414. align-items: center;
  415. .dot {
  416. width: 8px;
  417. height: 8px;
  418. margin-right: 8px;
  419. }
  420. .text {
  421. margin-left: 8px;
  422. }
  423. .value {
  424. height: 32px;
  425. line-height: 32px;
  426. background: fade(@gray, 20);
  427. padding: 0 16px;
  428. }
  429. &.green {
  430. .dot {
  431. background: @green;
  432. }
  433. }
  434. &.purple {
  435. .dot {
  436. background: @purple;
  437. }
  438. }
  439. &.yellow {
  440. .dot {
  441. background: @yellow;
  442. }
  443. }
  444. &.orange {
  445. .dot {
  446. background: @orange;
  447. }
  448. }
  449. & + .state-item {
  450. margin-left: 16px;
  451. }
  452. }
  453. }
  454. }
  455. .matrix {
  456. display: flex;
  457. flex-wrap: wrap;
  458. .item {
  459. flex: 1 0 calc(100% / 20 - 4px);
  460. line-height: 26px;
  461. background: fade(@gray, 20);
  462. color: @gray-l;
  463. font-size: 12px;
  464. margin-bottom: 4px;
  465. text-align: center;
  466. border: 1px solid transparent;
  467. & + .item {
  468. margin-left: 4px;
  469. }
  470. &:nth-child(20n + 1) {
  471. margin-left: 0px;
  472. }
  473. &.green {
  474. color: @green;
  475. background: fade(@green, 20);
  476. border-color: @green;
  477. }
  478. &.purple {
  479. color: @purple;
  480. background: fade(@purple, 20);
  481. border-color: @purple;
  482. }
  483. &.orange {
  484. color: @orange;
  485. background: fade(@orange, 20);
  486. border-color: @orange;
  487. }
  488. &.red {
  489. color: @red;
  490. background: fade(@red, 20);
  491. border-color: @red;
  492. }
  493. }
  494. .blank {
  495. flex: 1 0 calc(100% / 20 - 4px);
  496. margin-left: 4px;
  497. }
  498. }
  499. }
  500. </style>