tab3.vue 10 KB

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