HealthTab1.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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. export default {
  110. components: { SvgIcon, Panel, VertivalBarLineChart, HealthReport },
  111. data() {
  112. return {
  113. infoList: [
  114. // {title: '24小时健康趋势', svgid: 'svg-24-houre', active: false, type: 'houre'},
  115. { title: "7日健康趋势", svgid: "svg-h-day", active: true, type: "day" },
  116. {
  117. title: "30日健康趋势",
  118. svgid: "svg-h-month",
  119. active: false,
  120. type: "month",
  121. },
  122. ],
  123. bardata: { area: [], legend: [], data: [] }, // 损失电量分析echart数值
  124. lineData: [],
  125. recommenList: [], // 健康报告推荐
  126. recommenIndex: 1, // 记录当前是那个推荐
  127. reportshow: false, //是否显示健康报告
  128. reportparams: undefined,
  129. };
  130. },
  131. created() {
  132. this.requestCoulometry(2);
  133. this.requestRecommen("recommen/getRecommenmainDay1");
  134. },
  135. methods: {
  136. // 页面跳转
  137. jumpUrl(item) {
  138. const wpid = item.wpid;
  139. const wtid = item.wtid;
  140. this.$router.push(`/health/health0/${wpid}/${wtid}`)
  141. },
  142. // 未确认缺陷按钮下的健康趋势选项
  143. onClickInfo(item) {
  144. this.infoList.forEach((element) => {
  145. if (item.type == element.type) {
  146. item.active = true;
  147. switch (item.type) {
  148. case "day":
  149. this.requestCoulometry(2);
  150. break;
  151. case "month":
  152. this.requestCoulometry(3);
  153. }
  154. } else {
  155. element.active = false;
  156. }
  157. });
  158. },
  159. // 健康报告推荐
  160. onClickRecommon(day) {
  161. this.recommenIndex = day;
  162. switch (day) {
  163. case 1:
  164. this.requestRecommen("recommen/getRecommenmainDay1");
  165. break;
  166. case 2:
  167. this.requestRecommen("recommen/getRecommenmainDay3");
  168. break;
  169. case 3:
  170. this.requestRecommen("recommen/getRecommenmainDay7");
  171. break;
  172. }
  173. },
  174. // 查看健康报告
  175. onClickReport(item) {
  176. let recorddate = new Date(item.createdate).formatDate("yyyy-MM-dd");
  177. this.reportshow = true;
  178. this.reportparams = {
  179. wtId: item.wtid,
  180. recorddate: recorddate,
  181. };
  182. this.$refs.eport.getReport(item.wtid, recorddate);
  183. },
  184. // 关闭健康报告
  185. closed() {
  186. this.reportshow = false;
  187. },
  188. // 健康推荐提交
  189. onClickCofirm(item) {
  190. let that = this;
  191. that
  192. .$confirm("确认提交?")
  193. .then((_) => {
  194. that.requestOption("recommen/confirpush", item.rid);
  195. })
  196. .catch((_) => {});
  197. },
  198. // 健康推荐取消
  199. onClickIgnore(item) {
  200. this.requestOption("recommen/ignorepush", item.rid);
  201. },
  202. // 健康推荐提交全部
  203. onClickCofirmAll() {
  204. let that = this;
  205. that
  206. .$confirm("确认全部提交?")
  207. .then((_) => {
  208. that.requestOptionAll("recommen/confirpushAll");
  209. })
  210. .catch((_) => {});
  211. },
  212. // 健康推荐取消全部
  213. onClickIgnoreAll() {
  214. let that = this;
  215. that
  216. .$confirm("确认全部取消?")
  217. .then((_) => {
  218. that.requestOptionAll("recommen/ignorepushAll");
  219. })
  220. .catch((_) => {});
  221. },
  222. // 健康报告推荐
  223. requestRecommen(url) {
  224. let that = this;
  225. that.API.requestData({
  226. method: "POST",
  227. subUrl: url,
  228. success(res) {
  229. if (res.code == 200) that.recommenList = res.data;
  230. },
  231. });
  232. },
  233. // 操作推荐内容(提交/取消)
  234. requestOption(url, rid) {
  235. let that = this;
  236. that.API.requestData({
  237. method: "POST",
  238. subUrl: url,
  239. data: { rid: rid },
  240. success(res) {
  241. if (res.code == 200) that.onClickRecommon(that.recommenIndex);
  242. },
  243. });
  244. },
  245. // 操作推荐内容全部(提交/取消)
  246. requestOptionAll(url) {
  247. let that = this;
  248. that.API.requestData({
  249. method: "POST",
  250. subUrl: url,
  251. data: { typeid: that.recommenIndex },
  252. success(res) {
  253. if (res.code == 200) that.onClickRecommon(that.recommenIndex);
  254. },
  255. });
  256. },
  257. // 损失电量分析 type:1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势
  258. requestCoulometry(type) {
  259. let that = this;
  260. that.API.requestData({
  261. method: "POST",
  262. timeout: 8000,
  263. subUrl: "recommen/findAllChartjz",
  264. data: { wpId: 0, type: type },
  265. success(res) {
  266. if (res.code == 200) {
  267. that.bardata.legend = ["优数量", "良数量", "差数量"];
  268. that.lineData = res.data.lvchart;
  269. that.bardata.area = res.data.datechart;
  270. that.bardata.data[2] = res.data.cslchart;
  271. that.bardata.data[1] = res.data.lslchart;
  272. that.bardata.data[0] = res.data.yslchart;
  273. }
  274. },
  275. });
  276. },
  277. },
  278. };
  279. </script>
  280. <style lang="less" scope>
  281. .health-tab-1 {
  282. .power-info {
  283. display: flex;
  284. .info-tab {
  285. flex: 0 0 156px;
  286. display: flex;
  287. flex-direction: column;
  288. height: 350px;
  289. margin-right: 1.4815vh;
  290. .tab {
  291. position: relative;
  292. flex: 0 0 auto;
  293. text-align: center;
  294. line-height: 33px;
  295. margin-right: 8px;
  296. color: @gray-l;
  297. font-size: 12px;
  298. background: fade(@gray, 20);
  299. border: 1px solid fade(@gray, 20);
  300. display: flex;
  301. align-items: center;
  302. i {
  303. margin: 0 1.4815vh;
  304. svg use {
  305. fill: @gray-l;
  306. }
  307. }
  308. &:hover,
  309. &.active {
  310. background: fade(@green, 20);
  311. border: 1px solid @green;
  312. color: @green;
  313. cursor: pointer;
  314. i svg use {
  315. fill: @green;
  316. }
  317. }
  318. &.active::after {
  319. box-sizing: content-box;
  320. width: 0px;
  321. height: 0px;
  322. position: absolute;
  323. right: -19px;
  324. padding: 0;
  325. border-bottom: 9px solid @green;
  326. border-top: 9px solid transparent;
  327. border-left: 9px solid transparent;
  328. border-right: 9px solid transparent;
  329. display: block;
  330. content: "";
  331. z-index: 10;
  332. transform: rotate(90deg);
  333. }
  334. &.active::before {
  335. box-sizing: content-box;
  336. width: 0px;
  337. height: 0px;
  338. position: absolute;
  339. right: -17px;
  340. padding: 0;
  341. border-bottom: 9px solid #063319;
  342. border-top: 9px solid transparent;
  343. border-left: 9px solid transparent;
  344. border-right: 9px solid transparent;
  345. display: block;
  346. content: "";
  347. z-index: 12;
  348. transform: rotate(90deg);
  349. }
  350. & + .tab {
  351. margin-top: 0.7407vh;
  352. }
  353. &:last-child {
  354. text-align: center;
  355. justify-content: center;
  356. }
  357. }
  358. .empty {
  359. flex: 1 0 auto;
  360. }
  361. }
  362. .info-chart {
  363. flex: 1 0 auto;
  364. }
  365. }
  366. .health-report {
  367. // 健康报告 按钮样式
  368. .actions {
  369. display: flex;
  370. .item {
  371. flex: 0 0 102px;
  372. text-align: center;
  373. line-height: 33px;
  374. margin-right: 8px;
  375. color: fade(@white, 75);
  376. font-size: @fontsize-s;
  377. cursor: pointer;
  378. &.green {
  379. background: @green;
  380. }
  381. &.purple {
  382. background: @purple;
  383. }
  384. &.gray {
  385. background: @gray;
  386. }
  387. }
  388. .active {
  389. background: fade(@green, 20);
  390. border: 1px solid @green;
  391. color: @green;
  392. cursor: pointer;
  393. }
  394. }
  395. .report-items {
  396. display: flex;
  397. flex-wrap: wrap;
  398. height: calc(100vh - 592px);
  399. .item {
  400. flex: 0 0 calc(100% / 6 - 16px);
  401. margin-bottom: 16px;
  402. & + .item {
  403. margin-left: 16px;
  404. }
  405. &:nth-child(6n + 1) {
  406. margin-left: 0px;
  407. }
  408. .title {
  409. background: fade(@gray, 40);
  410. // color: fade(@white, 75);
  411. color: @gray-l;
  412. line-height: 37px;
  413. padding-left: 16px;
  414. padding-right: 16px;
  415. font-size: @fontsize-s;
  416. display: flex;
  417. flex-direction: row;
  418. justify-content: space-between;
  419. cursor: pointer;
  420. span {
  421. cursor: pointer;
  422. }
  423. }
  424. .info {
  425. background: fade(@gray, 20);
  426. padding: 16px;
  427. font-size: @fontsize-s;
  428. color: @font-color;
  429. line-height: 1.5;
  430. p {
  431. margin: 0;
  432. line-height: 2;
  433. overflow: hidden;
  434. text-overflow: ellipsis;
  435. display: -webkit-box;
  436. -webkit-box-orient: vertical;
  437. -webkit-line-clamp: 2;
  438. }
  439. .actions {
  440. display: flex;
  441. align-items: center;
  442. justify-content: center;
  443. .success {
  444. border-color: #05bb4c;
  445. color: #05bb4c;
  446. background: rgba(5, 187, 76, 0.2);
  447. }
  448. }
  449. }
  450. }
  451. }
  452. }
  453. }
  454. </style>