1
0

tab3.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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 class="query-item">
  47. <div class="lable">日期:</div>
  48. <div class="search-input">
  49. <el-date-picker
  50. v-model="recorddate"
  51. type="date"
  52. value-format="YYYY-MM-DD"
  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. <div class="df-table">
  65. <ComTable height="35vh" :data="tableData"></ComTable>
  66. </div>
  67. <Mlc
  68. height="300px"
  69. :list="chartData"
  70. :units="chartUnit"
  71. :showLegend="true"
  72. />
  73. <el-dialog
  74. title="月风电功率编辑"
  75. v-model="dialogShow"
  76. width="85%"
  77. top="10vh"
  78. custom-class="modal"
  79. :close-on-click-modal="true"
  80. >
  81. <el-form class="mg-b-16" label-width="100px" inline>
  82. <el-form-item class="mg-b-8" label="风机编号:">
  83. <el-input v-model="wtId" readonly placeholder=""></el-input>
  84. </el-form-item>
  85. <el-form-item class="mg-b-8" label="年份:">
  86. <el-input v-model="editItem._year" readonly placeholder=""></el-input>
  87. </el-form-item>
  88. <el-form-item class="mg-b-8" label="月份:">
  89. <el-input
  90. v-model="editItem._month"
  91. readonly
  92. placeholder=""
  93. ></el-input>
  94. </el-form-item>
  95. <el-form-item class="mg-b-8" label="风速:">
  96. <el-input v-model="editItem.speed" readonly placeholder=""></el-input>
  97. </el-form-item>
  98. <el-form-item class="mg-b-8" label="实际拟合:">
  99. <el-input
  100. v-model="editItem.actualpower"
  101. placeholder="请输入"
  102. ></el-input>
  103. </el-form-item>
  104. <el-form-item class="mg-b-8" label="最优拟合:">
  105. <el-input
  106. v-model="editItem.optimalpower"
  107. placeholder="请输入"
  108. ></el-input>
  109. </el-form-item>
  110. </el-form>
  111. <button style="width: 100%" class="btn" @click="editWtInfo">修改</button>
  112. </el-dialog>
  113. </div>
  114. </template>
  115. <script>
  116. import ComTable from "@com/coms/table/table.vue";
  117. import Mlc from "@com/chart/line/multiple-line-chart.vue";
  118. import api1 from "@api/economic/index.js";
  119. import api from "@api/wisdomOverhaul/energy/index.js";
  120. export default {
  121. // 名称
  122. name: "cutAnalyse",
  123. // 使用组件
  124. components: {
  125. ComTable,
  126. Mlc,
  127. },
  128. // 数据
  129. data() {
  130. const that = this;
  131. return {
  132. isAsc: "asc",
  133. wpArray: [],
  134. wtArray: [],
  135. wpId: "",
  136. wtId: "",
  137. editItem: {},
  138. dialogShow: false,
  139. recorddate: new Date(new Date().getTime() - 3600 * 1000 * 24).formatDate(
  140. "yyyy-MM-dd"
  141. ),
  142. tableData: {
  143. column: [
  144. {
  145. name: "风机",
  146. field: "windturbineId",
  147. is_num: false,
  148. is_light: false,
  149. sortable: true,
  150. },
  151. {
  152. name: "风速(m/s)",
  153. field: "speed",
  154. is_num: false,
  155. is_light: false,
  156. sortable: true,
  157. },
  158. {
  159. name: "实际拟合功率(kW)",
  160. field: "actualPower",
  161. is_num: false,
  162. is_light: false,
  163. sortable: true,
  164. },
  165. {
  166. name: "最优拟合功率(kW)",
  167. field: "optimalPower",
  168. is_num: false,
  169. is_light: false,
  170. sortable: true,
  171. },
  172. // {
  173. // name: "操作",
  174. // field: "",
  175. // is_num: false,
  176. // is_light: false,
  177. // template() {
  178. // return "<el-button type='text' style='cursor: pointer;'>修改</el-button>";
  179. // },
  180. // click(e, row){
  181. // that.editItem = row;
  182. // that.editItem._year = new Date(that.recorddate).getFullYear();
  183. // that.editItem._month = (new Date(that.recorddate).getMonth() + 1);
  184. // that.dialogShow = true;
  185. // }
  186. // }
  187. ],
  188. data: [],
  189. },
  190. chartData: [
  191. {
  192. title: "",
  193. yAxisIndex: 0,
  194. value: [],
  195. },
  196. ],
  197. // chartUnit: ["功率(MW)", "(m/s)"]
  198. chartUnit: ["功率(MW)"],
  199. };
  200. },
  201. // 函数
  202. methods: {
  203. // 获取风场
  204. getWp(reGetWp) {
  205. api1
  206. .getWpList({
  207. type: "-1",
  208. })
  209. .then((res) => {
  210. if (res.data.code === 200) {
  211. this.wpArray = res.data.data;
  212. this.wpId = res.data.data[0].id;
  213. this.getWt(this.wpId, reGetWp);
  214. }
  215. });
  216. },
  217. // 获取风机
  218. getWt(wpid, reGetWp) {
  219. if (wpid) {
  220. api1
  221. .getWtList({
  222. wpId: wpid,
  223. })
  224. .then((res) => {
  225. if (res.code === 200) {
  226. this.wtArray = res.data;
  227. this.wtId = res.data[0].id;
  228. if (!reGetWp) {
  229. this.getTabData();
  230. this.getChartData();
  231. }
  232. }
  233. });
  234. }
  235. },
  236. getTabData() {
  237. api
  238. .powersaturationPowersaturationlist({
  239. wtId: this.wtId,
  240. recorddate: this.recorddate,
  241. pageNum: 1,
  242. pageSize: 5,
  243. })
  244. .then((res) => {
  245. if (res.data) this.tableData.data = res.data.records;
  246. this.getChartData();
  247. });
  248. },
  249. // 获取图表数据
  250. getChartData() {
  251. api
  252. .powersaturationPowersaturationchart({
  253. wtId: this.wtId,
  254. recorddate: this.recorddate,
  255. })
  256. .then((res) => {
  257. if (res.data) {
  258. const keyArray = [
  259. // {
  260. // key: "value1",
  261. // title: "风速"
  262. // },
  263. {
  264. key: "value2",
  265. title: "实际拟合功率",
  266. },
  267. {
  268. key: "value3",
  269. title: "最优拟合功率",
  270. },
  271. {
  272. key: "value4",
  273. title: "保证功率",
  274. },
  275. ];
  276. let chartData = [
  277. // {
  278. // title: "风速",
  279. // // yAxisIndex: 1,
  280. // yAxisIndex: 0,
  281. // value: []
  282. // },
  283. {
  284. title: "实际拟合功率",
  285. yAxisIndex: 0,
  286. value: [],
  287. },
  288. {
  289. title: "最优拟合功率",
  290. yAxisIndex: 0,
  291. value: [],
  292. },
  293. {
  294. title: "保证功率",
  295. yAxisIndex: 0,
  296. value: [],
  297. },
  298. ];
  299. keyArray.forEach((keyEle, keyIndex) => {
  300. res.data.forEach((ele) => {
  301. chartData[keyIndex].value.push({
  302. text: "",
  303. value: ele[keyEle.key],
  304. });
  305. });
  306. });
  307. this.chartData = chartData;
  308. }
  309. });
  310. },
  311. // 编辑
  312. editWtInfo() {
  313. let that = this;
  314. that.editItem.actualpower += "";
  315. that.editItem.optimalpower += "";
  316. if (!that.editItem.actualpower || !that.editItem.optimalpower) {
  317. that.BASE.showMsg({
  318. msg: "实际拟合与最优拟合不可为空",
  319. });
  320. } else {
  321. }
  322. },
  323. search() {
  324. if (!this.wpId || !this.wtId) {
  325. this.BASE.showMsg({
  326. msg: "场站与风机为必选项",
  327. });
  328. } else {
  329. this.getTabData();
  330. }
  331. },
  332. },
  333. created() {
  334. this.getWp();
  335. },
  336. mounted() {},
  337. unmounted() {},
  338. };
  339. </script>
  340. <style lang="less" scoped>
  341. .draught-fan-list {
  342. width: 100%;
  343. height: 100%;
  344. display: flex;
  345. flex-direction: column;
  346. .btn-group-tabs {
  347. display: flex;
  348. flex-direction: row;
  349. .photovoltaic {
  350. margin-left: 1.481vh;
  351. }
  352. }
  353. .df-table {
  354. border: 0.093vh solid fade(@darkgray, 50%);
  355. position: relative;
  356. overflow: auto;
  357. flex-grow: 1;
  358. margin-top: 1.481vh;
  359. height: 30vh;
  360. &:before {
  361. content: "";
  362. width: 0.37vh;
  363. height: 0.37vh;
  364. background: @write;
  365. position: absolute;
  366. left: 0.278vh;
  367. top: 0.278vh;
  368. }
  369. tbody {
  370. height: calc(100vh - 166px);
  371. }
  372. }
  373. }
  374. </style>