tab1.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <div class="draught-fan-list">
  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. @change="
  14. (wpId) => {
  15. getWt(wpId, true);
  16. }
  17. "
  18. >
  19. <el-option
  20. v-for="item in wpArray"
  21. :key="item.id"
  22. :value="item.id"
  23. :label="item.name"
  24. />
  25. </el-select>
  26. </div>
  27. </div>
  28. <div class="query-item">
  29. <div class="lable">风机:</div>
  30. <div class="search-input">
  31. <el-select
  32. v-model="wtId"
  33. clearable
  34. placeholder="请选择"
  35. popper-class="select"
  36. >
  37. <el-option
  38. v-for="item in wtArray"
  39. :key="item.id"
  40. :value="item.id"
  41. :label="item.nemCode"
  42. />
  43. </el-select>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="query-actions">
  48. <button class="btn green" @click="search">搜索</button>
  49. </div>
  50. </div>
  51. <div class="df-table">
  52. <ComTable height="35vh" :data="tableData"></ComTable>
  53. </div>
  54. <Mlc
  55. height="300px"
  56. :list="chartData"
  57. :units="chartUnit"
  58. :showLegend="true"
  59. />
  60. </div>
  61. </template>
  62. <script>
  63. import ComTable from "@com/coms/table/table.vue";
  64. import Mlc from "@com/chart/line/multiple-line-chart.vue";
  65. import api1 from "@api/economic/index.js";
  66. import api from "@api/wisdomOverhaul/energy/index.js";
  67. export default {
  68. // 名称
  69. name: "cutAnalyse",
  70. // 使用组件
  71. components: {
  72. ComTable,
  73. Mlc,
  74. },
  75. // 数据
  76. data() {
  77. return {
  78. isAsc: "asc",
  79. wpArray: [],
  80. wtArray: [],
  81. wpId: "",
  82. wtId: "",
  83. tableData: {
  84. column: [
  85. {
  86. name: "风机",
  87. field: "windturbineId",
  88. is_num: false,
  89. is_light: false,
  90. sortable: true,
  91. },
  92. {
  93. name: "风速(m/s)",
  94. field: "speed",
  95. is_num: false,
  96. is_light: false,
  97. sortable: true,
  98. },
  99. {
  100. name: "实际拟合功率(kW)",
  101. field: "actualPower",
  102. is_num: false,
  103. is_light: false,
  104. sortable: true,
  105. },
  106. {
  107. name: "最优拟合功率(kW)",
  108. field: "optimalPower",
  109. is_num: false,
  110. is_light: false,
  111. sortable: true,
  112. },
  113. ],
  114. data: [],
  115. },
  116. chartData: [
  117. {
  118. title: "",
  119. yAxisIndex: 0,
  120. value: [],
  121. },
  122. ],
  123. // chartUnit: ["功率(MW)", "(m/s)"]
  124. chartUnit: ["功率(MW)"],
  125. };
  126. },
  127. // 函数
  128. methods: {
  129. // 获取风场
  130. getWp(reGetWp) {
  131. api1
  132. .getWpList({
  133. type: "-1",
  134. })
  135. .then((res) => {
  136. if (res.data.code === 200) {
  137. this.wpArray = res.data.data;
  138. this.wpId = res.data.data[0].id;
  139. this.getWt(this.wpId, reGetWp);
  140. }
  141. });
  142. },
  143. // 获取风机
  144. getWt(wpid, reGetWp) {
  145. if (wpid) {
  146. api1
  147. .getWtList({
  148. wpId: wpid,
  149. })
  150. .then((res) => {
  151. if (res.code === 200) {
  152. this.wtArray = res.data;
  153. this.wtId = res.data[0].id;
  154. if (!reGetWp) {
  155. this.getTabData();
  156. this.getChartData();
  157. }
  158. }
  159. });
  160. }
  161. },
  162. getTabData() {
  163. api
  164. .powersaturationPowersaturationamonutlist({
  165. wtId: this.wtId,
  166. pageNum: 1,
  167. pageSize: 5,
  168. })
  169. .then((res) => {
  170. if (res.data) this.tableData.data = res.data.records;
  171. this.getChartData();
  172. });
  173. },
  174. // 获取图表数据
  175. getChartData() {
  176. api
  177. .powersaturationPowersaturationamonutchart({
  178. wtId: this.wtId,
  179. })
  180. .then((res) => {
  181. const keyArray = [
  182. // {
  183. // key: "value1",
  184. // title: "风速"
  185. // },
  186. {
  187. key: "value2",
  188. title: "实际拟合功率",
  189. },
  190. {
  191. key: "value3",
  192. title: "最优拟合功率",
  193. },
  194. {
  195. key: "value4",
  196. title: "保证功率",
  197. },
  198. ];
  199. let chartData = [
  200. // {
  201. // title: "风速",
  202. // // yAxisIndex: 1,
  203. // yAxisIndex: 0,
  204. // value: []
  205. // },
  206. {
  207. title: "实际拟合功率",
  208. yAxisIndex: 0,
  209. value: [],
  210. },
  211. {
  212. title: "最优拟合功率",
  213. yAxisIndex: 0,
  214. value: [],
  215. },
  216. {
  217. title: "保证功率",
  218. yAxisIndex: 0,
  219. value: [],
  220. },
  221. ];
  222. keyArray.forEach((keyEle, keyIndex) => {
  223. res?.data?.forEach((ele) => {
  224. chartData[keyIndex].value.push({
  225. text: "",
  226. value: ele[keyEle.key],
  227. });
  228. });
  229. });
  230. this.chartData = chartData;
  231. });
  232. // let that = this;
  233. // that.API.requestData({
  234. // method: "POST",
  235. // subUrl: "powersaturation/powersaturationamonutchart",
  236. // data: {
  237. // wtId: that.wtId,
  238. // },
  239. // success(res) {
  240. // const keyArray = [
  241. // // {
  242. // // key: "value1",
  243. // // title: "风速"
  244. // // },
  245. // {
  246. // key: "value2",
  247. // title: "实际拟合功率",
  248. // },
  249. // {
  250. // key: "value3",
  251. // title: "最优拟合功率",
  252. // },
  253. // {
  254. // key: "value4",
  255. // title: "保证功率",
  256. // },
  257. // ];
  258. // let chartData = [
  259. // // {
  260. // // title: "风速",
  261. // // // yAxisIndex: 1,
  262. // // yAxisIndex: 0,
  263. // // value: []
  264. // // },
  265. // {
  266. // title: "实际拟合功率",
  267. // yAxisIndex: 0,
  268. // value: [],
  269. // },
  270. // {
  271. // title: "最优拟合功率",
  272. // yAxisIndex: 0,
  273. // value: [],
  274. // },
  275. // {
  276. // title: "保证功率",
  277. // yAxisIndex: 0,
  278. // value: [],
  279. // },
  280. // ];
  281. // keyArray.forEach((keyEle, keyIndex) => {
  282. // res.data.forEach((ele) => {
  283. // chartData[keyIndex].value.push({
  284. // text: "",
  285. // value: ele[keyEle.key],
  286. // });
  287. // });
  288. // });
  289. // that.chartData = chartData;
  290. // },
  291. // });
  292. },
  293. search() {
  294. if (!this.wpId || !this.wtId) {
  295. this.BASE.showMsg({
  296. msg: "场站与风机为必选项",
  297. });
  298. } else {
  299. this.getTabData();
  300. }
  301. },
  302. },
  303. created() {
  304. this.getWp();
  305. },
  306. mounted() {},
  307. unmounted() {},
  308. };
  309. </script>
  310. <style lang="less" scoped>
  311. .draught-fan-list {
  312. width: 100%;
  313. height: 100%;
  314. display: flex;
  315. flex-direction: column;
  316. .btn-group-tabs {
  317. display: flex;
  318. flex-direction: row;
  319. .photovoltaic {
  320. margin-left: 1.481vh;
  321. }
  322. }
  323. .df-table {
  324. border: 0.093vh solid fade(@darkgray, 50%);
  325. position: relative;
  326. overflow: auto;
  327. flex-grow: 1;
  328. margin-top: 1.481vh;
  329. height: 30vh;
  330. &:before {
  331. content: "";
  332. width: 0.37vh;
  333. height: 0.37vh;
  334. background: @write;
  335. position: absolute;
  336. left: 0.278vh;
  337. top: 0.278vh;
  338. }
  339. tbody {
  340. height: calc(100vh - 166px);
  341. }
  342. }
  343. }
  344. </style>