tab2.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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 v-model="wpId" clearable placeholder="请选择" popper-class="select" @change="(wpId) => { getWt(wpId, true); }">
  9. <el-option v-for="item in wpArray" :key="item.id" :value="item.id" :label="item.name" />
  10. </el-select>
  11. </div>
  12. </div>
  13. <div class="query-item">
  14. <div class="lable">风机:</div>
  15. <div class="search-input">
  16. <el-select v-model="wtId" clearable placeholder="请选择" popper-class="select">
  17. <el-option v-for="item in wtArray" :key="item.id" :value="item.id" :label="item.name" />
  18. </el-select>
  19. </div>
  20. </div>
  21. <div class="query-item">
  22. <div class="lable">日期:</div>
  23. <div class="search-input">
  24. <el-date-picker v-model="recorddate" type="date"
  25. value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  26. </el-date-picker>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="query-actions">
  31. <button class="btn green" @click="search">搜索</button>
  32. </div>
  33. </div>
  34. <div class="df-table">
  35. <ComTable height="35vh" :data="tableData"></ComTable>
  36. </div>
  37. <Mlc height="300px" :list="chartData" :units="chartUnit" :showLegend="true" />
  38. <el-dialog title="月风电功率编辑" v-model="dialogShow" width="85%" top="10vh" custom-class="modal" :close-on-click-modal="true">
  39. <el-form class="mg-b-16" label-width="100px" inline>
  40. <el-form-item class="mg-b-8" label="风机编号:">
  41. <el-input v-model="wtId" readonly placeholder=""></el-input>
  42. </el-form-item>
  43. <el-form-item class="mg-b-8" label="年份:">
  44. <el-input v-model="editItem._year" readonly placeholder=""></el-input>
  45. </el-form-item>
  46. <el-form-item class="mg-b-8" label="月份:">
  47. <el-input v-model="editItem._month" readonly placeholder=""></el-input>
  48. </el-form-item>
  49. <el-form-item class="mg-b-8" label="风速:">
  50. <el-input v-model="editItem.speed" readonly placeholder=""></el-input>
  51. </el-form-item>
  52. <el-form-item class="mg-b-8" label="实际拟合:">
  53. <el-input v-model="editItem.actualpower" placeholder="请输入"></el-input>
  54. </el-form-item>
  55. <el-form-item class="mg-b-8" label="最优拟合:">
  56. <el-input v-model="editItem.optimalpower" placeholder="请输入"></el-input>
  57. </el-form-item>
  58. </el-form>
  59. <button style="width:100%;" class="btn" @click="editWtInfo">修改</button>
  60. </el-dialog>
  61. </div>
  62. </template>
  63. <script>
  64. import ComTable from "@com/coms/table/table.vue";
  65. import Mlc from "@com/chart/line/multiple-line-chart.vue";
  66. export default {
  67. // 名称
  68. name: "cutAnalyse",
  69. // 使用组件
  70. components: {
  71. ComTable,
  72. Mlc
  73. },
  74. // 数据
  75. data () {
  76. const that = this;
  77. return {
  78. isAsc: "asc",
  79. wpArray: [],
  80. wtArray: [],
  81. wpId: "",
  82. wtId: "",
  83. editItem:{},
  84. dialogShow:false,
  85. recorddate:new Date((new Date().getTime() - 3600 * 1000 * 24)).formatDate("yyyy-MM-dd"),
  86. tableData: {
  87. column: [
  88. {
  89. name: "风机",
  90. field: "windturbineid",
  91. is_num: false,
  92. is_light: false,
  93. sortable: true
  94. },
  95. {
  96. name: "风速",
  97. field: "speed",
  98. is_num: false,
  99. is_light: false,
  100. sortable: true
  101. },
  102. {
  103. name: "实际拟合功率",
  104. field: "actualpower",
  105. is_num: false,
  106. is_light: false,
  107. sortable: true
  108. },
  109. {
  110. name: "最优拟合功率",
  111. field: "optimalpower",
  112. is_num: false,
  113. is_light: false,
  114. sortable: true
  115. },
  116. // {
  117. // name: "操作",
  118. // field: "",
  119. // is_num: false,
  120. // is_light: false,
  121. // template() {
  122. // return "<el-button type='text' style='cursor: pointer;'>修改</el-button>";
  123. // },
  124. // click(e, row){
  125. // that.editItem = row;
  126. // that.editItem._year = new Date(that.recorddate).getFullYear();
  127. // that.editItem._month = (new Date(that.recorddate).getMonth() + 1);
  128. // that.dialogShow = true;
  129. // }
  130. // }
  131. ],
  132. data: [],
  133. },
  134. chartData: [{
  135. title: "",
  136. yAxisIndex: 0,
  137. value: []
  138. }],
  139. // chartUnit: ["功率(MW)", "(m/s)"]
  140. chartUnit: ["功率(MW)"]
  141. };
  142. },
  143. // 函数
  144. methods: {
  145. // 获取风场
  146. getWp (reGetWp) {
  147. let that = this;
  148. that.API.requestData({
  149. method: "GET",
  150. subUrl: "powercompare/windfarmAjax",
  151. success (res) {
  152. that.wpArray = res.data;
  153. that.wpId = res.data[0].id;
  154. that.getWt(that.wpId, reGetWp);
  155. }
  156. });
  157. },
  158. // 获取风机
  159. getWt (wpid, reGetWp) {
  160. let that = this;
  161. if (that.wpId) {
  162. that.API.requestData({
  163. method: "GET",
  164. baseURL: "http://10.155.32.4:9001",
  165. subUrl: "benchmarking/wtList",
  166. data: {
  167. wpid
  168. },
  169. success (res) {
  170. that.wtArray = res.data;
  171. that.wtId = res.data[0].id;
  172. if (!reGetWp) {
  173. that.getTabData();
  174. }
  175. }
  176. });
  177. }
  178. },
  179. getTabData () {
  180. let that = this;
  181. that.API.requestData({
  182. method: "POST",
  183. subUrl: "powersaturation/powersaturationmonthlist",
  184. data: {
  185. wtId: that.wtId,
  186. year: new Date(that.recorddate).getFullYear(),
  187. month: (new Date(that.recorddate).getMonth() + 1)
  188. },
  189. success (res) {
  190. that.tableData.data = res.data.list;
  191. that.getChartData();
  192. }
  193. });
  194. },
  195. // 获取图表数据
  196. getChartData () {
  197. let that = this;
  198. that.API.requestData({
  199. method: "POST",
  200. subUrl: "powersaturation/powersaturationmonthchart",
  201. data: {
  202. wtId: that.wtId,
  203. year: new Date(that.recorddate).getFullYear(),
  204. month: (new Date(that.recorddate).getMonth() + 1)
  205. },
  206. success (res) {
  207. const keyArray = [
  208. // {
  209. // key: "value1",
  210. // title: "风速"
  211. // },
  212. {
  213. key: "value2",
  214. title: "实际拟合功率"
  215. }, {
  216. key: "value3",
  217. title: "最优拟合功率"
  218. }, {
  219. key: "value4",
  220. title: "保证功率"
  221. }];
  222. let chartData = [
  223. // {
  224. // title: "风速",
  225. // // yAxisIndex: 1,
  226. // yAxisIndex: 0,
  227. // value: []
  228. // },
  229. {
  230. title: "实际拟合功率",
  231. yAxisIndex: 0,
  232. value: []
  233. }, {
  234. title: "最优拟合功率",
  235. yAxisIndex: 0,
  236. value: []
  237. }, {
  238. title: "保证功率",
  239. yAxisIndex: 0,
  240. value: []
  241. }];
  242. keyArray.forEach((keyEle, keyIndex) => {
  243. res.data.forEach(ele => {
  244. chartData[keyIndex].value.push({
  245. text: "",
  246. value: ele[keyEle.key]
  247. });
  248. });
  249. });
  250. that.chartData = chartData;
  251. }
  252. });
  253. },
  254. // 编辑
  255. editWtInfo(){
  256. let that = this;
  257. that.editItem.actualpower += "";
  258. that.editItem.optimalpower += "";
  259. if(!that.editItem.actualpower || !that.editItem.optimalpower){
  260. that.BASE.showMsg({
  261. msg:"实际拟合与最优拟合不可为空"
  262. });
  263. }else{
  264. }
  265. },
  266. search () {
  267. if (!this.wpId || !this.wtId) {
  268. this.BASE.showMsg({
  269. msg: '场站与风机为必选项'
  270. });
  271. } else {
  272. this.getTabData();
  273. }
  274. }
  275. },
  276. created () {
  277. this.getWp();
  278. },
  279. mounted () { },
  280. unmounted () { },
  281. };
  282. </script>
  283. <style lang="less" scoped>
  284. .draught-fan-list {
  285. width: 100%;
  286. height: 100%;
  287. display: flex;
  288. flex-direction: column;
  289. .btn-group-tabs {
  290. display: flex;
  291. flex-direction: row;
  292. .photovoltaic {
  293. margin-left: 1.481vh;
  294. }
  295. }
  296. .df-table {
  297. border: 0.093vh solid fade(@darkgray, 50%);
  298. position: relative;
  299. overflow: auto;
  300. flex-grow: 1;
  301. margin-top: 1.481vh;
  302. height: 30vh;
  303. &:before {
  304. content: '';
  305. width: 0.37vh;
  306. height: 0.37vh;
  307. background: @write;
  308. position: absolute;
  309. left: 0.278vh;
  310. top: 0.278vh;
  311. }
  312. tbody {
  313. height: calc(100vh - 166px);
  314. }
  315. }
  316. }
  317. </style>