HealthTab1.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <div class="health-tab-1">
  3. <div class="power-info mg-b-16">
  4. <div class="info-tab">
  5. <div
  6. class="tab"
  7. v-for="(item, index) in infoList"
  8. :key="index"
  9. :class="item.active ? 'active' : ''"
  10. @click="onClickInfo(item)"
  11. >
  12. <i class="svg-icon svg-icon svg-icon-sm">
  13. <svg-icon :svgid="item.svgid" />
  14. </i>
  15. <span> {{ item.title }} </span>
  16. </div>
  17. <div class="empty"></div>
  18. </div>
  19. <div class="info-chart">
  20. <panel class="info-chart-panel" :title="'健康趋势'">
  21. <vertival-bar-line-chart
  22. :height="'310px'"
  23. :bardata="bardata"
  24. :lineData="lineData"
  25. />
  26. </panel>
  27. </div>
  28. </div>
  29. <div class="health-report">
  30. <panel
  31. class="health-report-panel"
  32. :title="'推荐检修风机'"
  33. :showLine="false"
  34. >
  35. <div class="actions mg-b-16">
  36. <button
  37. class="btn"
  38. :class="{ active: recommenIndex == 1 }"
  39. @click="onClickRecommon(1)"
  40. >
  41. 当日内推荐
  42. </button>
  43. <button
  44. class="btn"
  45. :class="{ active: recommenIndex == 2 }"
  46. @click="onClickRecommon(2)"
  47. >
  48. 三日内推荐
  49. </button>
  50. <button
  51. class="btn"
  52. :class="{ active: recommenIndex == 3 }"
  53. @click="onClickRecommon(3)"
  54. >
  55. 超三日推荐
  56. </button>
  57. <div style="margin-left: 450px">
  58. <button class="btn" @click="onClickCofirmAll()">全部确认</button>
  59. <button class="btn" @click="onClickIgnoreAll()">全部忽略</button>
  60. </div>
  61. </div>
  62. <div class="report-items scroll">
  63. <div class="item" v-for="(item, index) in recommenList" :key="index">
  64. <div class="title">
  65. <div @click="jumpUrl(item)">风机编号:{{ item.wtid }}</div>
  66. <span @click="onClickReport(item)">健康报告</span>
  67. </div>
  68. <div class="info">
  69. <p>推荐理由:{{ item.reason }}</p>
  70. <p>
  71. 推荐检修时间:{{
  72. new Date(item.recodedate).formatDate("yyyy-MM-dd hh:mm:ss")
  73. }}
  74. </p>
  75. <p>推荐时间对应风速:{{ item.speed }} m/s</p>
  76. <p>
  77. 判断时间:{{
  78. new Date(item.createdate).formatDate("yyyy-MM-dd hh:mm:ss")
  79. }}
  80. </p>
  81. <div class="actions mg-t-16">
  82. <button class="btn success" @click="onClickCofirm(item)">
  83. <i class="fa fa-check"></i>
  84. 提交
  85. </button>
  86. <button class="btn" @click="onClickIgnore(item)">
  87. <i class="fa fa-close"></i>
  88. 取消
  89. </button>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </panel>
  95. </div>
  96. <health-report
  97. :show="reportshow"
  98. :params="reportparams"
  99. @closed="closed"
  100. ref="eport"
  101. />
  102. </div>
  103. </template>
  104. <script>
  105. import VertivalBarLineChart from "../../components/chart/combination/health-bar-line-chart.vue";
  106. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  107. import Panel from "../../components/coms/panel/panel.vue";
  108. import HealthReport from "../../components/other/healthReport/index.vue";
  109. import api from "@api/wisdomOverhaul/health/index.js";
  110. export default {
  111. components: { SvgIcon, Panel, VertivalBarLineChart, HealthReport },
  112. data() {
  113. return {
  114. infoList: [
  115. // {title: '24小时健康趋势', svgid: 'svg-24-houre', active: false, type: 'houre'},
  116. { title: "7日健康趋势", svgid: "svg-h-day", active: true, type: "day" },
  117. {
  118. title: "30日健康趋势",
  119. svgid: "svg-h-month",
  120. active: false,
  121. type: "month",
  122. },
  123. ],
  124. bardata: { area: [], legend: [], data: [] }, // 损失电量分析echart数值
  125. lineData: [],
  126. recommenList: [], // 健康报告推荐
  127. recommenIndex: 1, // 记录当前是那个推荐
  128. reportshow: false, //是否显示健康报告
  129. reportparams: undefined,
  130. };
  131. },
  132. created() {
  133. this.requestCoulometry(2);
  134. this.requestRecommen("recommen/getRecommenmainDay1");
  135. },
  136. methods: {
  137. // 页面跳转
  138. jumpUrl(item) {
  139. const wpid = item.wpid;
  140. const wtid = item.wtid;
  141. this.$router.push(`/health/health0/${wpid}/${wtid}`);
  142. },
  143. // 未确认缺陷按钮下的健康趋势选项
  144. onClickInfo(item) {
  145. this.infoList.forEach((element) => {
  146. if (item.type == element.type) {
  147. item.active = true;
  148. switch (item.type) {
  149. case "day":
  150. this.requestCoulometry(2);
  151. break;
  152. case "month":
  153. this.requestCoulometry(3);
  154. }
  155. } else {
  156. element.active = false;
  157. }
  158. });
  159. },
  160. // 健康报告推荐
  161. onClickRecommon(day) {
  162. this.recommenIndex = day;
  163. switch (day) {
  164. case 1:
  165. this.requestRecommen("recommen/getRecommenmainDay1");
  166. break;
  167. case 2:
  168. this.requestRecommen("recommen/getRecommenmainDay3");
  169. break;
  170. case 3:
  171. this.requestRecommen("recommen/getRecommenmainDay7");
  172. break;
  173. }
  174. },
  175. // 查看健康报告
  176. onClickReport(item) {
  177. let recorddate = new Date(item.createdate).formatDate("yyyy-MM-dd");
  178. this.reportshow = true;
  179. this.reportparams = {
  180. wtId: item.wtid,
  181. recorddate: recorddate,
  182. };
  183. this.$refs.eport.getReport(item.wtid, recorddate);
  184. },
  185. // 关闭健康报告
  186. closed() {
  187. this.reportshow = false;
  188. },
  189. // 健康推荐提交
  190. onClickCofirm(item) {
  191. let that = this;
  192. that
  193. .$confirm("确认提交?")
  194. .then((_) => {
  195. that.requestOption("recommen/confirpush", item.rid);
  196. })
  197. .catch((_) => {});
  198. },
  199. // 健康推荐取消
  200. onClickIgnore(item) {
  201. this.requestOption("recommen/ignorepush", item.rid);
  202. },
  203. // 健康推荐提交全部
  204. onClickCofirmAll() {
  205. let that = this;
  206. that
  207. .$confirm("确认全部提交?")
  208. .then((_) => {
  209. that.requestOptionAll("recommen/confirpushAll");
  210. })
  211. .catch((_) => {});
  212. },
  213. // 健康推荐取消全部
  214. onClickIgnoreAll() {
  215. let that = this;
  216. that
  217. .$confirm("确认全部取消?")
  218. .then((_) => {
  219. that.requestOptionAll("recommen/ignorepushAll");
  220. })
  221. .catch((_) => {});
  222. },
  223. // 健康报告推荐
  224. requestRecommen(url) {
  225. api
  226. .requestRecommen({
  227. url: url,
  228. })
  229. .then((res) => {
  230. if (res.code == 200) this.recommenList = res.data;
  231. });
  232. },
  233. // 操作推荐内容(提交/取消)
  234. requestOption(url, rid) {
  235. let data = {
  236. rid: rid,
  237. };
  238. api.recommen(url, data).then((res) => {
  239. if (res.code == 200) this.onClickRecommon(this.recommenIndex);
  240. });
  241. },
  242. // 操作推荐内容全部(提交/取消)
  243. requestOptionAll(url) {
  244. let data = { typeid: this.recommenIndex };
  245. api.recommenALL(url, data).then((res) => {
  246. if (res.code == 200) this.onClickRecommon(this.recommenIndex);
  247. });
  248. },
  249. // 损失电量分析 type:1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势
  250. requestCoulometry(type) {
  251. api
  252. .findAllChartjz({
  253. wpId: 0,
  254. type: type,
  255. })
  256. .then((res) => {
  257. if (res.code == 200) {
  258. this.bardata.legend = ["优数量", "良数量", "差数量"];
  259. this.lineData = res.data.lvchart;
  260. this.bardata.area = res.data.datechart;
  261. this.bardata.data[2] = res.data.cslchart;
  262. this.bardata.data[1] = res.data.lslchart;
  263. this.bardata.data[0] = res.data.yslchart;
  264. }
  265. });
  266. },
  267. },
  268. };
  269. </script>
  270. <style lang="less" scope>
  271. .health-tab-1 {
  272. .power-info {
  273. display: flex;
  274. .info-tab {
  275. flex: 0 0 156px;
  276. display: flex;
  277. flex-direction: column;
  278. height: 350px;
  279. margin-right: 1.4815vh;
  280. .tab {
  281. position: relative;
  282. flex: 0 0 auto;
  283. text-align: center;
  284. line-height: 33px;
  285. margin-right: 8px;
  286. color: @gray-l;
  287. font-size: 12px;
  288. background: fade(@gray, 20);
  289. border: 1px solid fade(@gray, 20);
  290. display: flex;
  291. align-items: center;
  292. i {
  293. margin: 0 1.4815vh;
  294. svg use {
  295. fill: @gray-l;
  296. }
  297. }
  298. &:hover,
  299. &.active {
  300. background: fade(@green, 20);
  301. border: 1px solid @green;
  302. color: @green;
  303. cursor: pointer;
  304. i svg use {
  305. fill: @green;
  306. }
  307. }
  308. &.active::after {
  309. box-sizing: content-box;
  310. width: 0px;
  311. height: 0px;
  312. position: absolute;
  313. right: -19px;
  314. padding: 0;
  315. border-bottom: 9px solid @green;
  316. border-top: 9px solid transparent;
  317. border-left: 9px solid transparent;
  318. border-right: 9px solid transparent;
  319. display: block;
  320. content: "";
  321. z-index: 10;
  322. transform: rotate(90deg);
  323. }
  324. &.active::before {
  325. box-sizing: content-box;
  326. width: 0px;
  327. height: 0px;
  328. position: absolute;
  329. right: -17px;
  330. padding: 0;
  331. border-bottom: 9px solid #063319;
  332. border-top: 9px solid transparent;
  333. border-left: 9px solid transparent;
  334. border-right: 9px solid transparent;
  335. display: block;
  336. content: "";
  337. z-index: 12;
  338. transform: rotate(90deg);
  339. }
  340. & + .tab {
  341. margin-top: 0.7407vh;
  342. }
  343. &:last-child {
  344. text-align: center;
  345. justify-content: center;
  346. }
  347. }
  348. .empty {
  349. flex: 1 0 auto;
  350. }
  351. }
  352. .info-chart {
  353. flex: 1 0 auto;
  354. }
  355. }
  356. .health-report {
  357. // 健康报告 按钮样式
  358. .actions {
  359. display: flex;
  360. .item {
  361. flex: 0 0 102px;
  362. text-align: center;
  363. line-height: 33px;
  364. margin-right: 8px;
  365. color: fade(@white, 75);
  366. font-size: @fontsize-s;
  367. cursor: pointer;
  368. &.green {
  369. background: @green;
  370. }
  371. &.purple {
  372. background: @purple;
  373. }
  374. &.gray {
  375. background: @gray;
  376. }
  377. }
  378. .active {
  379. background: fade(@green, 20);
  380. border: 1px solid @green;
  381. color: @green;
  382. cursor: pointer;
  383. }
  384. }
  385. .report-items {
  386. display: flex;
  387. flex-wrap: wrap;
  388. height: calc(100vh - 592px);
  389. .item {
  390. flex: 0 0 calc(100% / 6 - 16px);
  391. margin-bottom: 16px;
  392. & + .item {
  393. margin-left: 16px;
  394. }
  395. &:nth-child(6n + 1) {
  396. margin-left: 0px;
  397. }
  398. .title {
  399. background: fade(@gray, 40);
  400. // color: fade(@white, 75);
  401. color: @gray-l;
  402. line-height: 37px;
  403. padding-left: 16px;
  404. padding-right: 16px;
  405. font-size: @fontsize-s;
  406. display: flex;
  407. flex-direction: row;
  408. justify-content: space-between;
  409. cursor: pointer;
  410. span {
  411. cursor: pointer;
  412. }
  413. }
  414. .info {
  415. background: fade(@gray, 20);
  416. padding: 16px;
  417. font-size: @fontsize-s;
  418. color: @font-color;
  419. line-height: 1.5;
  420. p {
  421. margin: 0;
  422. line-height: 2;
  423. overflow: hidden;
  424. text-overflow: ellipsis;
  425. display: -webkit-box;
  426. -webkit-box-orient: vertical;
  427. -webkit-line-clamp: 2;
  428. }
  429. .actions {
  430. display: flex;
  431. align-items: center;
  432. justify-content: center;
  433. .success {
  434. border-color: #05bb4c;
  435. color: #05bb4c;
  436. background: rgba(5, 187, 76, 0.2);
  437. }
  438. }
  439. }
  440. }
  441. }
  442. }
  443. }
  444. </style>