index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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.name"
  42. />
  43. </el-select>
  44. </div>
  45. </div>
  46. <div class="query-item">
  47. <div class="lable">日期:</div>
  48. <div class="search-input">
  49. <el-date-picker
  50. v-model="recorddate"
  51. type="month"
  52. value-format="YYYY-MM"
  53. placeholder="选择日期"
  54. popper-class="date-select"
  55. >
  56. </el-date-picker>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="query-actions">
  61. <button class="btn green" @click="search">搜索</button>
  62. </div>
  63. </div>
  64. <ScatterLineChart
  65. xTitle="风速)m/s("
  66. yTitle="功率(kw)"
  67. :height="'calc(100vh - 40px)'"
  68. :lineData="chartLineData"
  69. :data="chartData"
  70. />
  71. </div>
  72. </template>
  73. <script>
  74. import ScatterLineChart from "@com/chart/combination/scatter-line-chart.vue";
  75. export default {
  76. // 名称
  77. name: "cutAnalyse",
  78. // 使用组件
  79. components: {
  80. ScatterLineChart,
  81. },
  82. // 数据
  83. data() {
  84. return {
  85. isAsc: "asc",
  86. wpArray: [],
  87. wtArray: [],
  88. wpId: "",
  89. wtId: "",
  90. recorddate: new Date(new Date().getTime() - 3600 * 1000 * 24).formatDate(
  91. "yyyy-MM"
  92. ),
  93. chartLineData: {
  94. xTitle: "风速",
  95. yTitle: "功率",
  96. legends: [],
  97. data: [],
  98. },
  99. chartData: [
  100. {
  101. title: "",
  102. value: [],
  103. },
  104. ],
  105. };
  106. },
  107. // 函数
  108. methods: {
  109. // 获取风场
  110. getWp(reGetWp) {
  111. let that = this;
  112. that.API.requestData({
  113. method: "GET",
  114. subUrl: "powercompare/windfarmAjax",
  115. success(res) {
  116. that.wpArray = res.data;
  117. that.wpId = res.data[0].id;
  118. that.getWt(that.wpId, reGetWp);
  119. },
  120. });
  121. },
  122. // 获取风机
  123. getWt(wpid, reGetWp) {
  124. let that = this;
  125. if (that.wpId) {
  126. that.API.requestData({
  127. method: "GET",
  128. baseURL: "http://10.155.32.4:9001",
  129. subUrl: "benchmarking/wtList",
  130. data: {
  131. wpid,
  132. },
  133. success(res) {
  134. that.wtArray = res.data;
  135. that.wtId = res.data[0].id;
  136. if (!reGetWp) {
  137. that.getChartData();
  138. }
  139. },
  140. });
  141. }
  142. },
  143. // 获取图表数据
  144. getChartData() {
  145. let that = this;
  146. that.API.requestData({
  147. method: "POST",
  148. subUrl: "scatter/scatterWtAjax",
  149. data: {
  150. wtId: that.wtId,
  151. year: that.recorddate.split("-")[0],
  152. month: that.recorddate.split("-")[1],
  153. },
  154. success(res) {
  155. let chartLineData = {
  156. xTitle: "风速",
  157. yTitle: "功率",
  158. legends: [],
  159. data: [[], []],
  160. };
  161. res.data.line.forEach((ele) => {
  162. chartLineData.data[0].push(ele[0]);
  163. chartLineData.data[1].push(ele[1]);
  164. });
  165. let chartData = [
  166. {
  167. title: "功率曲线拟合",
  168. value: res.data.scatter,
  169. },
  170. ];
  171. that.chartLineData = chartLineData;
  172. that.chartData = chartData;
  173. },
  174. });
  175. },
  176. search() {
  177. if (!this.wpId || !this.wtId) {
  178. this.BASE.showMsg({
  179. msg: "场站与风机为必选项",
  180. });
  181. } else {
  182. this.getChartData();
  183. }
  184. },
  185. },
  186. created() {
  187. this.getWp();
  188. },
  189. mounted() {},
  190. unmounted() {},
  191. };
  192. </script>
  193. <style lang="less" scoped>
  194. .draught-fan-list {
  195. width: 100%;
  196. height: 100%;
  197. display: flex;
  198. flex-direction: column;
  199. .btn-group-tabs {
  200. display: flex;
  201. flex-direction: row;
  202. .photovoltaic {
  203. margin-left: 1.481vh;
  204. }
  205. }
  206. .df-table {
  207. border: 0.093vh solid fade(@darkgray, 50%);
  208. position: relative;
  209. overflow: auto;
  210. flex-grow: 1;
  211. margin-top: 1.481vh;
  212. height: 30vh;
  213. &:before {
  214. content: "";
  215. width: 0.37vh;
  216. height: 0.37vh;
  217. background: @write;
  218. position: absolute;
  219. left: 0.278vh;
  220. top: 0.278vh;
  221. }
  222. tbody {
  223. height: calc(100vh - 166px);
  224. }
  225. }
  226. }
  227. </style>