tab2.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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="10vh"
  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: 11,
  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. .powersaturationPowersaturationmonthlist({
  250. wtId: this.wtId,
  251. year: new Date(this.recorddate).getFullYear(),
  252. month: new Date(this.recorddate).getMonth() + 1,
  253. pageNum: this.currentPage,
  254. pageSize: 11,
  255. })
  256. .then((res) => {
  257. if (res.data) this.tableData.data = res.data.records;
  258. this.total = res.data.total;
  259. this.getChartData();
  260. });
  261. },
  262. // 获取图表数据
  263. getChartData() {
  264. api
  265. .powersaturationPowersaturationmonthchart({
  266. wtId: this.wtId,
  267. year: new Date(this.recorddate).getFullYear(),
  268. month: new Date(this.recorddate).getMonth() + 1,
  269. })
  270. .then((res) => {
  271. if (res.data) {
  272. const keyArray = [
  273. // {
  274. // key: "value1",
  275. // title: "风速"
  276. // },
  277. {
  278. key: "value2",
  279. title: "实际拟合功率",
  280. },
  281. {
  282. key: "value3",
  283. title: "最优拟合功率",
  284. },
  285. {
  286. key: "value4",
  287. title: "保证功率",
  288. },
  289. ];
  290. let chartData = [
  291. // {
  292. // title: "风速",
  293. // // yAxisIndex: 1,
  294. // yAxisIndex: 0,
  295. // value: []
  296. // },
  297. {
  298. title: "实际拟合功率",
  299. yAxisIndex: 0,
  300. value: [],
  301. },
  302. {
  303. title: "最优拟合功率",
  304. yAxisIndex: 0,
  305. value: [],
  306. },
  307. {
  308. title: "保证功率",
  309. yAxisIndex: 0,
  310. value: [],
  311. },
  312. ];
  313. keyArray.forEach((keyEle, keyIndex) => {
  314. res.data.forEach((ele) => {
  315. chartData[keyIndex].value.push({
  316. text: "",
  317. value: ele[keyEle.key],
  318. });
  319. });
  320. });
  321. this.chartData = chartData;
  322. }
  323. });
  324. },
  325. // 编辑
  326. editWtInfo() {
  327. let that = this;
  328. that.editItem.actualpower += "";
  329. that.editItem.optimalpower += "";
  330. if (!that.editItem.actualpower || !that.editItem.optimalpower) {
  331. that.BASE.showMsg({
  332. msg: "实际拟合与最优拟合不可为空",
  333. });
  334. } else {
  335. }
  336. },
  337. currentChange(currentPage) {
  338. this.currentPage = currentPage;
  339. this.getTabData();
  340. },
  341. search() {
  342. if (!this.wpId || !this.wtId) {
  343. this.BASE.showMsg({
  344. msg: "场站与风机为必选项",
  345. });
  346. } else {
  347. this.getTabData();
  348. }
  349. },
  350. },
  351. created() {
  352. this.getWp();
  353. },
  354. mounted() {},
  355. unmounted() {},
  356. };
  357. </script>
  358. <style lang="less" scoped>
  359. .draught-fan-list {
  360. width: 100%;
  361. height: 100%;
  362. display: flex;
  363. flex-direction: column;
  364. .df-table {
  365. border: 1px solid fade(@darkgray, 50%);
  366. position: relative;
  367. overflow: auto;
  368. flex-grow: 1;
  369. height: calc(100% - 51px - 350px);
  370. padding-bottom: 10px;
  371. margin-bottom: 10px;
  372. &:before {
  373. content: "";
  374. width: 3px;
  375. height: 3px;
  376. background: @write;
  377. position: absolute;
  378. left: 3px;
  379. top: 3px;
  380. }
  381. .com-table {
  382. height: calc(100% - 44px);
  383. .el-scrollbar {
  384. height: calc(100% - 33px);
  385. }
  386. }
  387. .paginationBox {
  388. width: 100%;
  389. display: flex;
  390. justify-content: flex-end;
  391. align-items: center;
  392. }
  393. }
  394. }
  395. </style>