index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <div class="knowledge-2">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">场站:</div>
  7. <div class="search-input">
  8. <el-select
  9. v-model="wpId"
  10. clearable
  11. placeholder="请选择"
  12. popper-class="select"
  13. >
  14. <el-option
  15. v-for="item in wpArray"
  16. :key="item.id"
  17. :value="item.id"
  18. :label="item.name"
  19. />
  20. </el-select>
  21. </div>
  22. </div>
  23. <div class="query-item">
  24. <div class="lable">样本类型:</div>
  25. <div class="search-input">
  26. <el-select
  27. v-model="sampleValue"
  28. clearable
  29. placeholder="请选择"
  30. popper-class="select"
  31. style="width: 130px; margin-left: 20px"
  32. >
  33. <el-option
  34. v-for="item in sampleList"
  35. :key="item.value"
  36. :value="item.value"
  37. :label="item.label"
  38. />
  39. </el-select>
  40. </div>
  41. </div>
  42. <div class="query-item" style="width: 445px">
  43. <div class="lable">起止时间:</div>
  44. <div class="search-input">
  45. <el-date-picker
  46. class="picker"
  47. @change="changes"
  48. v-model="timeValue"
  49. type="datetimerange"
  50. range-separator="至"
  51. start-placeholder="开始日期"
  52. end-placeholder="结束日期"
  53. >
  54. </el-date-picker>
  55. </div>
  56. </div>
  57. <div class="query-item" style="width: 250px">
  58. <div class="lable">时间间隔:</div>
  59. <div class="search-input">
  60. <el-select
  61. v-model="interval"
  62. collapse-tags
  63. placeholder="请选择"
  64. popper-class="select"
  65. >
  66. <el-option
  67. v-for="item in intervals"
  68. :key="item.value"
  69. :value="item.value"
  70. :label="item.label"
  71. >
  72. </el-option>
  73. </el-select>
  74. </div>
  75. </div>
  76. <div class="query-actions">
  77. <button class="btn" @click="getData()">查询</button>
  78. </div>
  79. </div>
  80. </div>
  81. <el-row :type="'flex'" class="content">
  82. <el-col :span="5">
  83. <div class="left">
  84. <el-tree
  85. class="filter-tree"
  86. :data="showData"
  87. :props="defaultProps"
  88. :filter-node-method="filterNode"
  89. node-key="id"
  90. :default-expanded-keys="[0]"
  91. :default-checked-keys="[ids]"
  92. ref="tree"
  93. highlight-current
  94. @node-click="handleChange"
  95. >
  96. </el-tree>
  97. </div>
  98. </el-col>
  99. <el-col :span="19">
  100. <el-row>
  101. <el-col :span="15">
  102. <div class="charts">
  103. <div class="titles">性能分析图</div>
  104. <PerformanceEcharts id="chartsData" :showTime="true" :data="scatterLineData" width="100%" height="70vh"></PerformanceEcharts>
  105. </div>
  106. </el-col>
  107. <el-col :span="9">
  108. <div class="charts" v-if="warningTimeList.length > 0">
  109. <div class="titles">预警饼状图</div>
  110. <PieCharts id="pie" width="100%" height="70vh" :warningTimeList="warningTimeList"></PieCharts>
  111. </div>
  112. </el-col>
  113. </el-row>
  114. </el-col>
  115. </el-row>
  116. </div>
  117. </template>
  118. <script>
  119. import PerformanceEcharts from "../performance/performanceEcharts.vue";
  120. import PieCharts from "./pieCharts.vue";
  121. import BASE from "@tools/basicTool.js";
  122. export default {
  123. components: {
  124. PerformanceEcharts,
  125. PieCharts,
  126. },
  127. created() {
  128. if (this.timeValue.length === 0) {
  129. let date = new Date();
  130. this.timeValue[0] = 1622476800000;
  131. this.timeValue[1] = 1630252800000;
  132. }
  133. this.getData();
  134. this.getWp();
  135. },
  136. data() {
  137. return {
  138. timeValue: [],
  139. ids:'',
  140. wpId: "NSS_FDC",
  141. wpArray: [],
  142. sampleValue: "0",
  143. sampleList: [
  144. {
  145. label: "正样本",
  146. value: "0",
  147. },
  148. {
  149. label: "负样本",
  150. value: "1",
  151. },
  152. ],
  153. interval: "5-1008",
  154. intervals: [
  155. {
  156. label: "小于30分钟",
  157. value: "0-0.5",
  158. },
  159. {
  160. label: "30分钟-1小时",
  161. value: "0.5-1",
  162. },
  163. {
  164. label: "1小时-2小时",
  165. value: "1-2",
  166. },
  167. {
  168. label: "2小时-5小时",
  169. value: "2-5",
  170. },
  171. {
  172. //42天
  173. label: "大于5小时",
  174. value: "5-1008",
  175. },
  176. ],
  177. defaultProps: {
  178. children: "children",
  179. label: "windturbineId",
  180. },
  181. showData: [],
  182. warningTimeList: [],
  183. scatterLineData:{},
  184. warningList: [
  185. {
  186. label: "变桨系统",
  187. value: "BJXT",
  188. },
  189. {
  190. label: "测风系统",
  191. value: "CFXT",
  192. },
  193. {
  194. label: "发电机",
  195. value: "FDJ",
  196. },
  197. {
  198. label: "传动链",
  199. value: "CDL",
  200. },
  201. {
  202. label: "齿轮箱",
  203. value: "CLX",
  204. },
  205. {
  206. label: "机舱",
  207. value: "JC",
  208. },
  209. {
  210. label: "液压系统",
  211. value: "YYXT",
  212. },
  213. {
  214. label: "偏航系统",
  215. value: "PHXT",
  216. },
  217. {
  218. label: "塔底柜",
  219. value: "TDG",
  220. },
  221. ],
  222. };
  223. },
  224. methods: {
  225. // 获取风场
  226. getWp() {
  227. let that = this;
  228. that.API.requestData({
  229. baseURL: "http://10.155.32.4:8082/",
  230. subUrl: "powercompare/windfarmAjax",
  231. success(res) {
  232. that.wpArray = res.data;
  233. that.wpId = res.data[1].id;
  234. },
  235. });
  236. },
  237. getData() {
  238. let that = this;
  239. that.showData = [];
  240. this.API.requestData({
  241. method: "GET",
  242. subUrl: "http://192.168.1.18:9002/analyse/basic",
  243. data: {
  244. station: this.wpId,
  245. intervals: this.interval,
  246. tag: this.sampleValue,
  247. st: new Date(this.timeValue[0]).formatDate("yyyy-MM-dd hh:mm:ss"),
  248. et: new Date(this.timeValue[1]).formatDate("yyyy-MM-dd hh:mm:ss"),
  249. },
  250. success(res) {
  251. if (res) {
  252. that.ids = res.data[0].children[0].id
  253. that.showData = res.data;
  254. that.handleChange(res.data[0].children[0])
  255. }
  256. },
  257. });
  258. },
  259. async handleChange(val) {
  260. if (val.st) {
  261. BASE.showLoading({ text: "加载中..." });
  262. let warningList = [];
  263. let that = this;
  264. await this.API.requestData({
  265. method: "GET",
  266. subUrl: "http://192.168.1.18:8075/alarm/history/page",
  267. data: {
  268. pagenum: 1,
  269. pagesize: 20000,
  270. starttime: val.st,
  271. endtime: val.et,
  272. stationid: this.wpId,
  273. windturbineid: val.wtId,
  274. },
  275. success(res) {
  276. if (res.records) {
  277. res.records.forEach((item) => {
  278. if (
  279. warningList.filter((val) => val.label === item.category3)
  280. .length > 0
  281. ) {
  282. warningList.filter((val) => val.label === item.category3)[0]
  283. .num++;
  284. } else {
  285. let obj = {
  286. label: item.category3,
  287. name: that.warningList.filter(
  288. (val) => val.value === item.category3
  289. )[0].label,
  290. num: 1,
  291. };
  292. warningList.push(obj);
  293. }
  294. });
  295. that.warningTimeList = warningList;
  296. }
  297. },
  298. });
  299. await that.API.requestData({
  300. method: "GET",
  301. baseURL: "http://192.168.1.18:9002/",
  302. // baseURL: "http://192.168.10.4:9002/",
  303. subUrl: "case/performance/line",
  304. data: {
  305. id: val.id,
  306. interval: 30,
  307. },
  308. success(res) {
  309. if (res.code == 200) {
  310. that.scatterLineData = res.data;
  311. BASE.closeLoading();
  312. }
  313. },
  314. });
  315. }
  316. },
  317. },
  318. };
  319. </script>
  320. <style lang="less" scoped>
  321. .charts {
  322. display: flex;
  323. flex-direction: column;
  324. justify-content: center;
  325. }
  326. .titles{
  327. font-size: 16px;
  328. margin: 20px 0 40px 10px;
  329. }
  330. body .el-tree {
  331. height: 85vh;
  332. padding-left: 30px;
  333. overflow-y: auto;
  334. }
  335. </style>