HealthTab1.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  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.requestRecommen({
  226. url:url
  227. }).then(res =>{
  228. if (res.code == 200) this.recommenList = res.data;
  229. })
  230. // let that = this;
  231. // that.API.requestData({
  232. // method: "POST",
  233. // subUrl: url,
  234. // success(res) {
  235. // if (res.code == 200) that.recommenList = res.data;
  236. // },
  237. // });
  238. },
  239. // 操作推荐内容(提交/取消)
  240. requestOption(url, rid) {
  241. let data ={
  242. rid: rid
  243. }
  244. api.recommen(url,data).then(res =>{
  245. if (res.code == 200) this.onClickRecommon(that.recommenIndex);
  246. })
  247. // let that = this;
  248. // that.API.requestData({
  249. // method: "POST",
  250. // subUrl: url,
  251. // data: { rid: rid },
  252. // success(res) {
  253. // if (res.code == 200) that.onClickRecommon(that.recommenIndex);
  254. // },
  255. // });
  256. },
  257. // 操作推荐内容全部(提交/取消)
  258. requestOptionAll(url) {
  259. let data = { typeid: this.recommenIndex }
  260. api.recommen(url,data).then(res =>{
  261. if (res.code == 200) this.onClickRecommon(that.recommenIndex);
  262. })
  263. // let that = this;
  264. // that.API.requestData({
  265. // method: "POST",
  266. // subUrl: url,
  267. // data: { typeid: that.recommenIndex },
  268. // success(res) {
  269. // if (res.code == 200) that.onClickRecommon(that.recommenIndex);
  270. // },
  271. // });
  272. },
  273. // 损失电量分析 type:1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势
  274. requestCoulometry(type) {
  275. api.findAllChartjz({
  276. wpId: 0,
  277. type: type
  278. }).then(res =>{
  279. if (res.code == 200) {
  280. this.bardata.legend = ["优数量", "良数量", "差数量"];
  281. this.lineData = res.data.lvchart;
  282. this.bardata.area = res.data.datechart;
  283. this.bardata.data[2] = res.data.cslchart;
  284. this.bardata.data[1] = res.data.lslchart;
  285. this.bardata.data[0] = res.data.yslchart;
  286. }
  287. })
  288. // let that = this;
  289. // that.API.requestData({
  290. // method: "POST",
  291. // timeout: 8000,
  292. // subUrl: "recommen/findAllChartjz",
  293. // data: { wpId: 0, type: type },
  294. // success(res) {
  295. // if (res.code == 200) {
  296. // that.bardata.legend = ["优数量", "良数量", "差数量"];
  297. // that.lineData = res.data.lvchart;
  298. // that.bardata.area = res.data.datechart;
  299. // that.bardata.data[2] = res.data.cslchart;
  300. // that.bardata.data[1] = res.data.lslchart;
  301. // that.bardata.data[0] = res.data.yslchart;
  302. // }
  303. // },
  304. // });
  305. },
  306. },
  307. };
  308. </script>
  309. <style lang="less" scope>
  310. .health-tab-1 {
  311. .power-info {
  312. display: flex;
  313. .info-tab {
  314. flex: 0 0 156px;
  315. display: flex;
  316. flex-direction: column;
  317. height: 350px;
  318. margin-right: 1.4815vh;
  319. .tab {
  320. position: relative;
  321. flex: 0 0 auto;
  322. text-align: center;
  323. line-height: 33px;
  324. margin-right: 8px;
  325. color: @gray-l;
  326. font-size: 12px;
  327. background: fade(@gray, 20);
  328. border: 1px solid fade(@gray, 20);
  329. display: flex;
  330. align-items: center;
  331. i {
  332. margin: 0 1.4815vh;
  333. svg use {
  334. fill: @gray-l;
  335. }
  336. }
  337. &:hover,
  338. &.active {
  339. background: fade(@green, 20);
  340. border: 1px solid @green;
  341. color: @green;
  342. cursor: pointer;
  343. i svg use {
  344. fill: @green;
  345. }
  346. }
  347. &.active::after {
  348. box-sizing: content-box;
  349. width: 0px;
  350. height: 0px;
  351. position: absolute;
  352. right: -19px;
  353. padding: 0;
  354. border-bottom: 9px solid @green;
  355. border-top: 9px solid transparent;
  356. border-left: 9px solid transparent;
  357. border-right: 9px solid transparent;
  358. display: block;
  359. content: "";
  360. z-index: 10;
  361. transform: rotate(90deg);
  362. }
  363. &.active::before {
  364. box-sizing: content-box;
  365. width: 0px;
  366. height: 0px;
  367. position: absolute;
  368. right: -17px;
  369. padding: 0;
  370. border-bottom: 9px solid #063319;
  371. border-top: 9px solid transparent;
  372. border-left: 9px solid transparent;
  373. border-right: 9px solid transparent;
  374. display: block;
  375. content: "";
  376. z-index: 12;
  377. transform: rotate(90deg);
  378. }
  379. & + .tab {
  380. margin-top: 0.7407vh;
  381. }
  382. &:last-child {
  383. text-align: center;
  384. justify-content: center;
  385. }
  386. }
  387. .empty {
  388. flex: 1 0 auto;
  389. }
  390. }
  391. .info-chart {
  392. flex: 1 0 auto;
  393. }
  394. }
  395. .health-report {
  396. // 健康报告 按钮样式
  397. .actions {
  398. display: flex;
  399. .item {
  400. flex: 0 0 102px;
  401. text-align: center;
  402. line-height: 33px;
  403. margin-right: 8px;
  404. color: fade(@white, 75);
  405. font-size: @fontsize-s;
  406. cursor: pointer;
  407. &.green {
  408. background: @green;
  409. }
  410. &.purple {
  411. background: @purple;
  412. }
  413. &.gray {
  414. background: @gray;
  415. }
  416. }
  417. .active {
  418. background: fade(@green, 20);
  419. border: 1px solid @green;
  420. color: @green;
  421. cursor: pointer;
  422. }
  423. }
  424. .report-items {
  425. display: flex;
  426. flex-wrap: wrap;
  427. height: calc(100vh - 592px);
  428. .item {
  429. flex: 0 0 calc(100% / 6 - 16px);
  430. margin-bottom: 16px;
  431. & + .item {
  432. margin-left: 16px;
  433. }
  434. &:nth-child(6n + 1) {
  435. margin-left: 0px;
  436. }
  437. .title {
  438. background: fade(@gray, 40);
  439. // color: fade(@white, 75);
  440. color: @gray-l;
  441. line-height: 37px;
  442. padding-left: 16px;
  443. padding-right: 16px;
  444. font-size: @fontsize-s;
  445. display: flex;
  446. flex-direction: row;
  447. justify-content: space-between;
  448. cursor: pointer;
  449. span {
  450. cursor: pointer;
  451. }
  452. }
  453. .info {
  454. background: fade(@gray, 20);
  455. padding: 16px;
  456. font-size: @fontsize-s;
  457. color: @font-color;
  458. line-height: 1.5;
  459. p {
  460. margin: 0;
  461. line-height: 2;
  462. overflow: hidden;
  463. text-overflow: ellipsis;
  464. display: -webkit-box;
  465. -webkit-box-orient: vertical;
  466. -webkit-line-clamp: 2;
  467. }
  468. .actions {
  469. display: flex;
  470. align-items: center;
  471. justify-content: center;
  472. .success {
  473. border-color: #05bb4c;
  474. color: #05bb4c;
  475. background: rgba(5, 187, 76, 0.2);
  476. }
  477. }
  478. }
  479. }
  480. }
  481. }
  482. }
  483. </style>