HealthTab1.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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.nemCode }}</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.recordDate).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. ref="eport"
  100. @closed="closed"
  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. this.$refs.eport.getReport(
  178. item.wtId,
  179. new Date(item.createDate).formatDate("yyyy-MM-dd")
  180. );
  181. this.reportshow = true;
  182. },
  183. // 关闭健康报告
  184. closed() {
  185. this.reportshow = false;
  186. },
  187. // 健康推荐提交
  188. onClickCofirm(item) {
  189. let that = this;
  190. that
  191. .$confirm("确认提交?")
  192. .then((_) => {
  193. that.requestOption("recommen/confirpush", item.rid);
  194. })
  195. .catch((_) => {});
  196. },
  197. // 健康推荐取消
  198. onClickIgnore(item) {
  199. this.requestOption("recommen/ignorepush", item.rid);
  200. },
  201. // 健康推荐提交全部
  202. onClickCofirmAll() {
  203. let that = this;
  204. that
  205. .$confirm("确认全部提交?")
  206. .then((_) => {
  207. that.requestOptionAll("recommen/confirpushAll");
  208. })
  209. .catch((_) => {});
  210. },
  211. // 健康推荐取消全部
  212. onClickIgnoreAll() {
  213. let that = this;
  214. that
  215. .$confirm("确认全部取消?")
  216. .then((_) => {
  217. that.requestOptionAll("recommen/ignorepushAll");
  218. })
  219. .catch((_) => {});
  220. },
  221. // 健康报告推荐
  222. requestRecommen(url) {
  223. api
  224. .requestRecommen({
  225. url: url,
  226. })
  227. .then((res) => {
  228. if (res.code == 200) this.recommenList = res.data;
  229. });
  230. },
  231. // 操作推荐内容(提交/取消)
  232. requestOption(url, rid) {
  233. let data = {
  234. rid: rid,
  235. };
  236. api.recommen(url, data).then((res) => {
  237. if (res.code == 200) this.onClickRecommon(that.recommenIndex);
  238. });
  239. },
  240. // 操作推荐内容全部(提交/取消)
  241. requestOptionAll(url) {
  242. let data = { typeid: this.recommenIndex };
  243. api.recommen(url, data).then((res) => {
  244. if (res.code == 200) this.onClickRecommon(that.recommenIndex);
  245. });
  246. },
  247. // 损失电量分析 type:1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势
  248. requestCoulometry(type) {
  249. api
  250. .findAllChartjz({
  251. wpId: 0,
  252. type: type,
  253. })
  254. .then((res) => {
  255. if (res.code == 200) {
  256. this.bardata.legend = ["优数量", "良数量", "差数量"];
  257. this.lineData = res.data.lvchart;
  258. this.bardata.area = res.data.datechart;
  259. this.bardata.data[2] = res.data.cslchart;
  260. this.bardata.data[1] = res.data.lslchart;
  261. this.bardata.data[0] = res.data.yslchart;
  262. }
  263. });
  264. },
  265. },
  266. };
  267. </script>
  268. <style lang="less" scope>
  269. .health-tab-1 {
  270. .power-info {
  271. display: flex;
  272. .info-tab {
  273. flex: 0 0 156px;
  274. display: flex;
  275. flex-direction: column;
  276. height: 350px;
  277. margin-right: 1.4815vh;
  278. .tab {
  279. position: relative;
  280. flex: 0 0 auto;
  281. text-align: center;
  282. line-height: 33px;
  283. margin-right: 8px;
  284. color: @gray-l;
  285. font-size: 12px;
  286. background: fade(@gray, 20);
  287. border: 1px solid fade(@gray, 20);
  288. display: flex;
  289. align-items: center;
  290. i {
  291. margin: 0 1.4815vh;
  292. svg use {
  293. fill: @gray-l;
  294. }
  295. }
  296. &:hover,
  297. &.active {
  298. background: fade(@green, 20);
  299. border: 1px solid @green;
  300. color: @green;
  301. cursor: pointer;
  302. i svg use {
  303. fill: @green;
  304. }
  305. }
  306. &.active::after {
  307. box-sizing: content-box;
  308. width: 0px;
  309. height: 0px;
  310. position: absolute;
  311. right: -19px;
  312. padding: 0;
  313. border-bottom: 9px solid @green;
  314. border-top: 9px solid transparent;
  315. border-left: 9px solid transparent;
  316. border-right: 9px solid transparent;
  317. display: block;
  318. content: "";
  319. z-index: 10;
  320. transform: rotate(90deg);
  321. }
  322. &.active::before {
  323. box-sizing: content-box;
  324. width: 0px;
  325. height: 0px;
  326. position: absolute;
  327. right: -17px;
  328. padding: 0;
  329. border-bottom: 9px solid #063319;
  330. border-top: 9px solid transparent;
  331. border-left: 9px solid transparent;
  332. border-right: 9px solid transparent;
  333. display: block;
  334. content: "";
  335. z-index: 12;
  336. transform: rotate(90deg);
  337. }
  338. & + .tab {
  339. margin-top: 0.7407vh;
  340. }
  341. &:last-child {
  342. text-align: center;
  343. justify-content: center;
  344. }
  345. }
  346. .empty {
  347. flex: 1 0 auto;
  348. }
  349. }
  350. .info-chart {
  351. flex: 1 0 auto;
  352. }
  353. }
  354. .health-report {
  355. // 健康报告 按钮样式
  356. .actions {
  357. display: flex;
  358. .item {
  359. flex: 0 0 102px;
  360. text-align: center;
  361. line-height: 33px;
  362. margin-right: 8px;
  363. color: fade(@white, 75);
  364. font-size: @fontsize-s;
  365. cursor: pointer;
  366. &.green {
  367. background: @green;
  368. }
  369. &.purple {
  370. background: @purple;
  371. }
  372. &.gray {
  373. background: @gray;
  374. }
  375. }
  376. .active {
  377. background: fade(@green, 20);
  378. border: 1px solid @green;
  379. color: @green;
  380. cursor: pointer;
  381. }
  382. }
  383. .report-items {
  384. display: flex;
  385. flex-wrap: wrap;
  386. height: calc(100vh - 592px);
  387. .item {
  388. flex: 0 0 calc(100% / 6 - 16px);
  389. margin-bottom: 16px;
  390. & + .item {
  391. margin-left: 16px;
  392. }
  393. &:nth-child(6n + 1) {
  394. margin-left: 0px;
  395. }
  396. .title {
  397. background: fade(@gray, 40);
  398. // color: fade(@white, 75);
  399. color: @gray-l;
  400. line-height: 37px;
  401. padding-left: 16px;
  402. padding-right: 16px;
  403. font-size: @fontsize-s;
  404. display: flex;
  405. flex-direction: row;
  406. justify-content: space-between;
  407. cursor: pointer;
  408. span {
  409. cursor: pointer;
  410. }
  411. }
  412. .info {
  413. background: fade(@gray, 20);
  414. padding: 16px;
  415. font-size: @fontsize-s;
  416. color: @font-color;
  417. line-height: 1.5;
  418. p {
  419. margin: 0;
  420. line-height: 2;
  421. overflow: hidden;
  422. text-overflow: ellipsis;
  423. display: -webkit-box;
  424. -webkit-box-orient: vertical;
  425. -webkit-line-clamp: 2;
  426. }
  427. .actions {
  428. display: flex;
  429. align-items: center;
  430. justify-content: center;
  431. .success {
  432. border-color: #05bb4c;
  433. color: #05bb4c;
  434. background: rgba(5, 187, 76, 0.2);
  435. }
  436. }
  437. }
  438. }
  439. }
  440. }
  441. }
  442. </style>