Info.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <div class="wind-site-info">
  3. <div class="wind-site-menu">
  4. <div class="wind-site-title">选择风机</div>
  5. <div class="wind-site-body">
  6. <collapse-list :list="WindSites" @click="clickMenu" />
  7. </div>
  8. </div>
  9. <div class="wind-site-info-body">
  10. <div class="info-menu mg-b-16">
  11. <div class="info-menu-item" v-for="(item, index) in InfoBtns.data" :key="item" :class="{ active: InfoBtns.activeIndex == index }"
  12. @click="onInfoMenuItemClick(item, index)">{{ item.text }}</div>
  13. </div>
  14. <el-row>
  15. <el-col :span="16" class="pd-r-16" style="text-align: center;">
  16. <!-- 基本信息 使用 v-if 每次点击重新加载 -->
  17. <!-- 使用 v-show 首次全部加载 之后隐藏 点击后显示 -->
  18. <base-info v-show="InfoBtns.activeIndex == 0" :data="sourceMap" />
  19. <!-- <base-info v-if="InfoBtns.activeIndex == 2" /> -->
  20. <StandAloneImg class="sai" v-show="InfoBtns.activeIndex != 0" :activeIndex="InfoBtns.activeIndex" @selectSvg="selectSvg"></StandAloneImg>
  21. <generator class="saig" v-show="InfoBtns.activeIndex == 1"></generator>
  22. <gearbox class="saig" v-show="InfoBtns.activeIndex == 2"></gearbox>
  23. </el-col>
  24. <el-col :span="8">
  25. <warning :data="WarnData" />
  26. </el-col>
  27. </el-row>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import collapseList from "@/components/coms/collapse/collapse-list.vue";
  33. import BaseInfo from "./Base-Info.vue";
  34. import Warning from "./Warning.vue";
  35. import StandAloneImg from "./StandAloneImg.vue";
  36. import generator from "./pages/generator.vue";
  37. import gearbox from "./pages/gear-box.vue";
  38. export default {
  39. components: { collapseList, BaseInfo, Warning, StandAloneImg, generator, gearbox },
  40. props: {
  41. id: {
  42. type: String,
  43. default: "",
  44. },
  45. },
  46. data () {
  47. return {
  48. timmer: null, // 计时器
  49. wtId: "", // 风机ID
  50. sourceMap: {},
  51. WarnData: {},
  52. WindSites: [],
  53. InfoBtns: {
  54. activeIndex: 0,
  55. data: [
  56. {
  57. id: "base-info",
  58. text: "基本信息",
  59. },
  60. {
  61. id: "generator",
  62. text: "发电机",
  63. },
  64. {
  65. id: "gear-box",
  66. text: "齿轮箱",
  67. },
  68. {
  69. id: "pitch",
  70. text: "变桨",
  71. },
  72. {
  73. id: "yaw",
  74. text: "偏航",
  75. },
  76. {
  77. id: "hydraulic-pressure",
  78. text: "液压",
  79. },
  80. {
  81. id: "cabin-info",
  82. text: "机舱信息",
  83. },
  84. {
  85. id: "principal-axis",
  86. text: "主轴",
  87. },
  88. ],
  89. },
  90. };
  91. },
  92. methods: {
  93. onInfoMenuItemClick (item, index) {
  94. this.InfoBtns.activeIndex = index;
  95. },
  96. selectSvg (index) {
  97. this.InfoBtns.activeIndex = index;
  98. },
  99. // 根据风机状态码返回对应 class
  100. getColor (fjzt) {
  101. switch (fjzt) {
  102. case 0:
  103. return "green";
  104. break;
  105. case 1:
  106. return "blue";
  107. break;
  108. case 2:
  109. return "red";
  110. break;
  111. case 3:
  112. return "gray";
  113. break;
  114. case 4:
  115. return "orange";
  116. break;
  117. case 5:
  118. return "purple";
  119. break;
  120. case 6:
  121. return "write";
  122. break;
  123. }
  124. },
  125. // 请求服务
  126. requestData (showLoading) {
  127. this.getSimpleMatrixAll(showLoading);
  128. },
  129. // 获取场列表
  130. getSimpleMatrixAll (showLoading) {
  131. let that = this;
  132. that.API.requestData({
  133. showLoading,
  134. method: "POST",
  135. subUrl: "matrix/findSimpleMatrixAll",
  136. data: {
  137. wpId: "MHS_FDC"
  138. },
  139. success (res) {
  140. let WindSites = [];
  141. res.data.forEach((ele, index) => {
  142. WindSites.push({
  143. id: String(index),
  144. text: ele.wpName,
  145. children: []
  146. });
  147. });
  148. res.data.forEach((pEle, pIndex) => {
  149. pEle.fjls[0].forEach(cEle => {
  150. WindSites[pIndex].children.push({
  151. id: cEle.wtId,
  152. text: cEle.wtnum,
  153. color: that.getColor(cEle.fjzt)
  154. });
  155. });
  156. });
  157. that.WindSites = WindSites;
  158. if (res.data.length) {
  159. that.wtId = that.wtId || res.data[0].fjls[0][0].wtId;
  160. that.getWtInfo();
  161. }
  162. }
  163. });
  164. },
  165. // 获取风机信息
  166. getWtInfo () {
  167. let that = this;
  168. that.API.requestData({
  169. method: "POST",
  170. subUrl: "monitorwt/findWtInfo",
  171. data: {
  172. wtId: that.wtId
  173. },
  174. success (res) {
  175. that.sourceMap = res.data;
  176. that.getWarnInfo();
  177. }
  178. });
  179. },
  180. // 获取报警信息
  181. getWarnInfo () {
  182. let that = this;
  183. that.API.requestData({
  184. method: "POST",
  185. subUrl: "monitorwt/findWtWarnInfo",
  186. data: {
  187. wtId: that.wtId
  188. },
  189. success (res) {
  190. that.WarnData = res.data;
  191. }
  192. });
  193. },
  194. // 点击左侧菜单
  195. clickMenu (res) {
  196. this.wtId = res.id;
  197. this.getWtInfo();
  198. }
  199. },
  200. created () {
  201. let that = this;
  202. that.$nextTick(() => {
  203. that.requestData(false);
  204. that.timmer = setInterval(() => {
  205. that.requestData(false);
  206. }, that.$store.state.websocketTimeSec);
  207. });
  208. },
  209. unmounted () {
  210. clearInterval(this.timmer);
  211. this.timmer = null;
  212. },
  213. };
  214. </script>
  215. <style lang="less" scoped>
  216. .wind-site-info {
  217. display: flex;
  218. .sai {
  219. width: 70%;
  220. }
  221. .saig {
  222. margin-top: -100px;
  223. }
  224. .wind-site-menu {
  225. flex: 0 0 13.889vh;
  226. color: @gray;
  227. background: fade(@darkgray, 10);
  228. height: calc(100vh - 8.519vh);
  229. .wind-site-title {
  230. font-size: 1.667vh;
  231. font-weight: 600;
  232. padding: 1.481vh;
  233. }
  234. }
  235. .wind-site-info-body {
  236. flex: auto;
  237. padding-left: 1.481vh;
  238. .info-menu {
  239. .info-menu-item {
  240. display: inline-block;
  241. padding: 0.741vh 1.481vh;
  242. border: 1px solid fade(@darkgray, 80);
  243. border-radius: 4px;
  244. color: @gray;
  245. font-size: @fontsize-s;
  246. font-weight: 600;
  247. letter-spacing: 1px;
  248. cursor: pointer;
  249. &.active {
  250. color: @white;
  251. background: fade(@purple, 80);
  252. }
  253. & + .info-menu-item {
  254. margin-left: 0.741vh;
  255. }
  256. }
  257. }
  258. }
  259. }
  260. </style>