index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <div class="dataAnalysisAngleAna" :class="!theme ? 'themeDark' : 'themeLight'">
  3. <div class="dataAnalysisAngleAnaMain">
  4. <div class="main_top">
  5. <p class="topPsty">浆距角分析</p>
  6. </div>
  7. <div class="main">
  8. <div class="treeDataMain">
  9. <tree-cop :data="treeData" :height="treeHeight" @currentChange="funCurrentChange"
  10. @refresh="funGetTree">
  11. </tree-cop>
  12. </div>
  13. <div class="excelDataMain">
  14. <excel-cop :data="excelList" :height="excelHeight" :theme="theme" @excelChange="funExcelChange">
  15. </excel-cop>
  16. </div>
  17. <div class="tableDataMain">
  18. <div class="px-[10px] shadow rounded-[6px] shadow-blue-500 ">
  19. <CurrentScatterChart ref="chartRef" width="100%" :height="`calc( ${tableHeight})`"
  20. :chartTitle="''" :xAxisData="xAxisData" :yAxisData="{ splitLine: { show: false } }"
  21. :seriesData="seriesData" :seriesAllData="seriesAllData" :showLegend="true"
  22. :brushSelected="false" :dataSet="dataSet" :theme="theme" :echartsTheme="echartsTheme"
  23. @getSelected="funChartSelect" />
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </template>
  30. <script setup name="prepare">
  31. import excelCop from '@/components/generatingCapacityComponent/excel.vue'
  32. import treeCop from '@/components/generatingCapacityComponent/tree.vue'
  33. import {
  34. ElMessage
  35. } from 'element-plus';
  36. import {
  37. onMounted,
  38. ref,
  39. onActivated,
  40. watch
  41. } from 'vue'
  42. import {
  43. useStore
  44. } from 'vuex';
  45. import CurrentScatterChart from './components/current-scatter-chart.vue'
  46. import httpRequest from '@/utils/request.js'
  47. /**配置参数 */
  48. const tableHeight = ref(window.innerHeight - 120 + 'px')
  49. const treeHeight = ref(window.innerHeight - 120 + 'px') //tree高度
  50. const excelHeight = ref(window.innerHeight - 120 + 'px') //excel高度
  51. /**excel 开始 */
  52. const excelList = ref([])
  53. const funExcelChange = async (obj) => { //点击excel项时
  54. funSubmit({
  55. ids: obj.id
  56. })
  57. }
  58. /**tree 开始 */
  59. const treeData = ref([])
  60. const actTreeNode = ref(null) //当前激活的treeNode
  61. const funRepeatMap = (arr, type) => {
  62. return arr.map(o => {
  63. if (o.children) {
  64. const findIndex = o.children.findIndex(p => !!p.type)
  65. if (findIndex !== -1) {
  66. o.childs = o.children
  67. o.children = []
  68. if (!actTreeNode.value && type === 'prepare') { //判断当且仅有process获取tree时 赋值
  69. actTreeNode.value = o
  70. }
  71. }
  72. }
  73. return {
  74. ...o,
  75. children: o.children.length ? funRepeatMap(o.children, type) : []
  76. }
  77. })
  78. }
  79. const funGetTree = async () => {
  80. const res = await httpRequest.get("/power/prepare/tree")
  81. treeData.value = funRepeatMap(res.data, 'prepare')
  82. excelList.value = []
  83. if (actTreeNode.value) {
  84. funCurrentChange({
  85. current: actTreeNode.value,
  86. currentNode: null
  87. })
  88. const child = actTreeNode.value.childs[0]
  89. const obj = {
  90. id: child.id,
  91. interval: child.interval,
  92. path: child.path,
  93. prepareid: child.prepareid,
  94. station: child.station,
  95. time: child.time,
  96. type: child.type,
  97. windturbine: child.windturbine,
  98. name: child.path.substring(child.path.indexOf(child.station + '_') + (child.station + '_')
  99. .length)
  100. }
  101. funExcelChange(obj)
  102. }
  103. }
  104. const funCurrentChange = ({
  105. current,
  106. currentNode
  107. }) => {
  108. if (current.childs) {
  109. excelList.value = current.childs.map(o => {
  110. return {
  111. id: o.id,
  112. interval: o.interval,
  113. path: o.path,
  114. prepareid: o.prepareid,
  115. station: o.station,
  116. time: o.time,
  117. type: o.type,
  118. windturbine: o.windturbine,
  119. name: o.path.substring(o.path.indexOf(o.station + '_') + (o.station + '_').length)
  120. }
  121. })
  122. if (excelList.value.length > 0) {
  123. funExcelChange(excelList.value[0])
  124. }
  125. } else {
  126. excelList.value = []
  127. }
  128. }
  129. /**table 开始 */
  130. const tableShowId = ref('')
  131. const tableName = ref('')
  132. const tableColumn = ref([])
  133. const tableLoading = ref(false)
  134. const tableData = ref([])
  135. /**tab */
  136. const activeTab = ref('1')
  137. /**chart Data */
  138. const xAxisData = ref([])
  139. const chartRef = ref() //chart 的ref
  140. const seriesData = ref([])
  141. const seriesAllData = ref([])
  142. const dataSet = ref('')
  143. const funChartSelect = async (batch) => {
  144. return false
  145. }
  146. /**submit */
  147. const funSubmit = async (params) => {
  148. const res = await httpRequest.get('/blade/angle', {
  149. params: params
  150. })
  151. if (res.code !== 200) {
  152. return false
  153. }
  154. let exTime = []
  155. let yp1 = [],
  156. yp2 = [],
  157. yp3 = []
  158. res.data.bw.forEach(it => {
  159. exTime.push(it.time)
  160. yp1.push(it.yp1)
  161. yp2.push(it.yp2)
  162. yp3.push(it.yp3)
  163. })
  164. seriesAllData.value = res.data.bw
  165. // res.data.bw.forEach(it => {
  166. // yp2.push(it.yp2)
  167. // })
  168. xAxisData.value = exTime
  169. seriesData.value = [
  170. // {
  171. // name: "并网(绿)/停机(红)",
  172. // type: "line",
  173. // symbol: "line", //设定为实心点
  174. // symbolSize: 0, //设定实心点的大小
  175. // smooth: false, //这个是把线变成曲线
  176. // data: yp1,
  177. // xAxisIndex: 0,
  178. // },
  179. {
  180. name: "叶片1",
  181. type: "line",
  182. symbol: "line", //设定为实心点
  183. symbolSize: 0, //设定实心点的大小
  184. smooth: false, //这个是把线变成曲线
  185. data: yp1,
  186. xAxisIndex: 0,
  187. },
  188. {
  189. name: "叶片2",
  190. type: "line",
  191. symbol: "line", //设定为实心点
  192. symbolSize: 0, //设定实心点的大小
  193. smooth: false, //这个是把线变成曲线
  194. data: yp2,
  195. xAxisIndex: 0,
  196. },
  197. {
  198. name: "叶片3",
  199. type: "line",
  200. symbol: "line", //设定为实心点
  201. symbolSize: 0, //设定实心点的大小
  202. smooth: false, //这个是把线变成曲线
  203. data: yp3,
  204. xAxisIndex: 0,
  205. }
  206. ]
  207. }
  208. /**created */
  209. // funGetTree()
  210. const theme = ref(null)
  211. const echartsTheme = ref('')
  212. const store = useStore()
  213. watch(() => store.state.theme, (newVal, oldVal) => {
  214. theme.value = newVal
  215. echartsTheme.value = !newVal ? 'dark' : ''
  216. funGetTree()
  217. }, {
  218. deep: true
  219. })
  220. /**mounted */
  221. onMounted(() => {
  222. funGetTree()
  223. theme.value = store.state.theme
  224. echartsTheme.value = !theme.value ? 'dark' : ''
  225. tableHeight.value = window.innerHeight - 120 + 'px'
  226. excelHeight.value = window.innerHeight - 120 + 'px'
  227. treeHeight.value = window.innerHeight - 120 + 'px'
  228. window.addEventListener('resize', () => {
  229. tableHeight.value = window.innerHeight - 120 + 'px'
  230. excelHeight.value = window.innerHeight - 120 + 'px'
  231. treeHeight.value = window.innerHeight - 120 + 'px'
  232. })
  233. })
  234. /**activated */
  235. onActivated(() => {
  236. // funGetTree()
  237. // funSubmit()
  238. })
  239. </script>
  240. <style lang="less" scoped>
  241. .dataAnalysisAngleAna {
  242. height: 100%;
  243. .dataAnalysisAngleAnaMain {
  244. height: 100%;
  245. .main_top {
  246. height: 40px;
  247. display: flex;
  248. align-items: center;
  249. .topPsty {
  250. position: relative;
  251. top: 5px;
  252. padding: 7px 20px;
  253. font-size: 12px;
  254. font-weight: 600;
  255. margin-left: 10px;
  256. border-radius: 3px;
  257. }
  258. }
  259. .main {
  260. display: flex;
  261. width: 100%;
  262. .treeDataMain,
  263. .excelDataMain,
  264. .tableDataMain {
  265. border-radius: 10px;
  266. }
  267. .treeDataMain {
  268. margin-right: 10px;
  269. padding: 10px 0 10px 10px;
  270. width: calc(19% - 20px);
  271. }
  272. .excelDataMain {
  273. margin-right: 10px;
  274. padding: 10px 0 10px 10px;
  275. width: calc(15% - 20px);
  276. }
  277. .tableDataMain {
  278. padding: 10px;
  279. width: calc(66% - 20px);
  280. position: relative;
  281. .butten_com {
  282. position: absolute;
  283. right: 20px;
  284. z-index: 111111;
  285. }
  286. }
  287. }
  288. }
  289. }
  290. .themeDark {
  291. .dataAnalysisAngleAnaMain {
  292. .main_top {
  293. .topPsty {
  294. color: #1C99FF;
  295. background: #1E2126;
  296. }
  297. }
  298. .main {
  299. background: #13171e;
  300. .treeDataMain {
  301. background: transparent;
  302. }
  303. .excelDataMain {
  304. background: #313233;
  305. }
  306. .tableDataMain {
  307. margin-top: 5px;
  308. background: #212223;
  309. }
  310. }
  311. }
  312. }
  313. .themeLight {
  314. padding: 0;
  315. .dataAnalysisAngleAnaMain {
  316. .main_top {
  317. .topPsty {
  318. color: #2778FF;
  319. background: #FFFFFF;
  320. }
  321. }
  322. .main {
  323. background: #E6E8F2;
  324. .treeDataMain {
  325. background: transparent;
  326. }
  327. .excelDataMain {
  328. background: #F4F6FB;
  329. }
  330. .tableDataMain {
  331. background: #fff;
  332. margin-top: 5px;
  333. }
  334. }
  335. }
  336. }
  337. </style>