HealthTab1.vue 11 KB

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