Decision1.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <div class="decision-page-1">
  3. <!-- 查询样式统一处理 样式在 assets/styles/form.less 文件中 -->
  4. <div class="query mg-b-8">
  5. <div class="query-items">
  6. <div class="query-item">
  7. <div class="lable">场站:</div>
  8. <div class="search-input">
  9. <el-select v-model="value1" @change="ChangZhanChange(value1)" clearable placeholder="请选择"
  10. popper-class="select">
  11. <el-option v-for="item in ChangZhan" :key="item.id" :value="item.id" :label="item.name">
  12. </el-option>
  13. </el-select>
  14. </div>
  15. </div>
  16. <div class="query-item">
  17. <div class="lable">项目:</div>
  18. <div class="search-input">
  19. <el-select v-model="value2" @change="XiangMuChange(value2)" multiple placeholder="请选择"
  20. popper-class="select">
  21. <el-option v-for="item in XiangMu" :key="item.id" :value="item.id" :label="item.name">
  22. </el-option>
  23. </el-select>
  24. </div>
  25. </div>
  26. <div class="query-item">
  27. <div class="lable">线路:</div>
  28. <div class="search-input">
  29. <el-select v-model="value3" @change="XianLuChange(value3)" multiple placeholder="请选择"
  30. popper-class="select">
  31. <el-option v-for="item in XianLu" :key="item.id" :label="item.name" :value="item.id">
  32. </el-option>
  33. </el-select>
  34. </div>
  35. </div>
  36. <div class="query-item">
  37. <div class="lable">开始日期:</div>
  38. <div class="search-input">
  39. <el-date-picker v-model="value4" @change="BeginChange(value4)" type="date"
  40. value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  41. </el-date-picker>
  42. </div>
  43. </div>
  44. <div class="query-item">
  45. <div class="lable">结束日期:</div>
  46. <div class="search-input">
  47. <el-date-picker v-model="value5" @change="EndChange(value5)" type="date"
  48. value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  49. </el-date-picker>
  50. <div class="unit svg-icon svg-icon-gray">
  51. <svg-icon :svgid="''" />
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="query-actions">
  57. <button class="btn green">搜索</button>
  58. <button class="btn" @click="mxClick()">明细信息</button>
  59. <button class="btn">导出</button>
  60. </div>
  61. </div>
  62. <div class="actions mg-b-8">
  63. <button class="btn" :class="TypeClass==1?'green':''" @click="TypeClick(1)">风场</button>
  64. <button class="btn" :class="TypeClass==2?'green':''" @click="TypeClick(2)">项目</button>
  65. <button class="btn" :class="TypeClass==3?'green':''" @click="TypeClick(3)">集电线路</button>
  66. </div>
  67. <el-row :type="'flex'" class="content">
  68. <el-col :span="12" class="pd-r-8">
  69. <toolbar-panel title="风机绩效榜" :showLine="false">
  70. <bar-line-chart :height="'calc(100vh - 200px)'" :bardata="bardata" :lineData="lineData" :color="barColor" lineName="理论发电量"/>
  71. </toolbar-panel>
  72. </el-col>
  73. <el-col :span="12" class="pd-l-8">
  74. <panel :title="'项目列表'" :showLine="false">
  75. <div class="project-table">
  76. <Table :data="tableData">
  77. <template v-slot:tr v-if="tableData.data.length > 0">
  78. <tr slot="tr">
  79. <td>
  80. {{tableDataEnd.index}}
  81. </td>
  82. <td>
  83. {{tableDataEnd.name}}
  84. </td>
  85. <td>
  86. {{tableDataEnd.llfdl}}
  87. </td>
  88. <td>
  89. {{tableDataEnd.sjfdl}}
  90. </td>
  91. <td>
  92. {{tableDataEnd.speed}}
  93. </td>
  94. <td>
  95. {{tableDataEnd.fjhjx}}
  96. </td>
  97. <td>
  98. {{tableDataEnd.jhjx}}
  99. </td>
  100. <td>
  101. {{tableDataEnd.sl}}
  102. </td>
  103. <td>
  104. {{tableDataEnd.xd}}
  105. </td>
  106. <td>
  107. {{tableDataEnd.xn}}
  108. </td>
  109. <td>
  110. {{tableDataEnd.fnlly}}
  111. </td>
  112. </tr>
  113. </template>
  114. </Table>
  115. </div>
  116. </panel>
  117. </el-col>
  118. </el-row>
  119. </div>
  120. </template>
  121. <script>
  122. import BarLineChart from "../../components/chart/combination/bar-line-chart.vue";
  123. import Panel from "../../components/coms/panel/panel.vue";
  124. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  125. import ToolbarPanel from "../../components/coms/panel/toolbar-panel.vue";
  126. import Table from "../../components/coms/table/table.vue";
  127. import partten from "@/helper/partten.js";
  128. export default {
  129. components: {
  130. ToolbarPanel,
  131. BarLineChart,
  132. Panel,
  133. Table,
  134. partten,
  135. SvgIcon
  136. },
  137. data() {
  138. return {
  139. tableData: {
  140. column: [{
  141. name: "",
  142. field: "index",
  143. is_num: false,
  144. is_light: false
  145. },
  146. {
  147. name: "名称",
  148. field: "name",
  149. is_num: false,
  150. is_light: false,
  151. },
  152. {
  153. name: "理论发电量",
  154. field: "llfdl",
  155. is_num: false,
  156. is_light: false,
  157. sortable:true
  158. },
  159. {
  160. name: "SCADA发电量",
  161. field: "sjfdl",
  162. is_num: false,
  163. is_light: false,
  164. sortable:true
  165. },
  166. {
  167. name: "风速",
  168. field: "speed",
  169. is_num: false,
  170. is_light: false,
  171. sortable:true
  172. },
  173. {
  174. name: "非计划检修",
  175. field: "fjhjx",
  176. is_num: false,
  177. is_light: false,
  178. sortable:true
  179. },
  180. {
  181. name: "计划检修",
  182. field: "jhjx",
  183. is_num: false,
  184. is_light: false,
  185. sortable:true
  186. },
  187. {
  188. name: "受累",
  189. field: "sl",
  190. is_num: false,
  191. is_light: false,
  192. sortable:true
  193. },
  194. {
  195. name: "限电",
  196. field: "xd",
  197. is_num: false,
  198. is_light: false,
  199. sortable:true
  200. },
  201. {
  202. name: "性能",
  203. field: "xn",
  204. is_num: false,
  205. is_light: false,
  206. sortable:true
  207. },
  208. {
  209. name: "风能利用率%",
  210. field: "fnlly",
  211. is_num: false,
  212. is_light: false,
  213. sortable:true
  214. }
  215. ],
  216. data: [],
  217. },
  218. tableDataEnd:[],//合计
  219. ChangZhan: [], //场站
  220. XiangMu: [], //项目
  221. XianLu: [], //线路
  222. value1: [],
  223. value2: [],
  224. value3: [],
  225. value4: "",
  226. value5: "",
  227. barColor: [partten.getColor("purple"), partten.getColor("green"), partten.getColor("pink"), partten.getColor("red"), partten.getColor("orange"), partten.getColor("grayl")],
  228. TypeClass: 1, //风场,项目,集电线路 的按钮颜色,默认第一个
  229. bardata: [],
  230. lineData: [],
  231. };
  232. },
  233. created() {
  234. this.ChangZhanVal();
  235. this.value4 = this.getTime(1);
  236. this.value5 = this.getTime(2);
  237. this.AjaxCommon();
  238. },
  239. methods: {
  240. ChangZhanVal() {
  241. var that = this;
  242. that.API.requestData({
  243. method: "GET",
  244. baseURL : "http://10.155.32.4:9001/",
  245. subUrl: "benchmarking/wplist",
  246. success(res) {
  247. that.ChangZhan = res.data;
  248. }
  249. });
  250. },
  251. ChangZhanChange(val) {
  252. this.TypeClass = "";
  253. this.value1 = val;
  254. this.value2 = [];
  255. this.value3 = [];
  256. this.AjaxCommon();
  257. this.XiangMuVal(val);
  258. },
  259. XiangMuVal(val) {
  260. var that = this;
  261. that.API.requestData({
  262. method: "GET",
  263. baseURL : "http://10.155.32.4:9001/",
  264. subUrl: "benchmarking/projectList",
  265. data: {
  266. wpids: val
  267. },
  268. success(res) {
  269. that.XiangMu = res.data;
  270. }
  271. });
  272. },
  273. XiangMuChange(val) {
  274. this.TypeClass = "";
  275. this.value2 = val;
  276. this.value3 = [];
  277. this.AjaxCommon();
  278. this.XianLuVal(val);
  279. },
  280. XianLuVal(val) {
  281. var that = this;
  282. that.API.requestData({
  283. method: "GET",
  284. baseURL : "http://10.155.32.4:9001/",
  285. subUrl: "benchmarking/lineList",
  286. data: {
  287. projects: val
  288. },
  289. success(res) {
  290. that.XianLu = res.data;
  291. }
  292. });
  293. },
  294. XianLuChange(val) {
  295. this.TypeClass = "";
  296. this.value3 = val;
  297. this.AjaxCommon();
  298. },
  299. BeginChange(val) {
  300. this.value4 = val;
  301. this.AjaxCommon();
  302. },
  303. EndChange(val) {
  304. this.value5 = val;
  305. this.AjaxCommon();
  306. },
  307. TypeClick(val) {
  308. this.TypeClass = val;
  309. // 重置状态start
  310. this.value1 = [];
  311. this.value2 = [];
  312. this.value3 = [];
  313. this.value4 = this.getTime(1);
  314. this.value5 = this.getTime(2);
  315. this.AjaxCommon();
  316. // 重置状态end
  317. },
  318. getTime(val) { //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  319. var date = new Date();
  320. var year = date.getFullYear(),
  321. month = date.getMonth() + 1,
  322. day = date.getDate();
  323. month >= 1 && month <= 9 ? (month = '0' + month) : '';
  324. day >= 0 && day <= 9 ? (day = '0' + day) : '';
  325. var begin = year + '-' + month + '-01';
  326. var end = year + '-' + month + '-' + day;
  327. if (val == 1) {
  328. return begin;
  329. } else if (val == 2) {
  330. return end;
  331. }
  332. },
  333. AjaxCommon() {
  334. var that = this;
  335. that.API.requestData({
  336. method: "GET",
  337. baseURL : "http://10.155.32.4:9001/",
  338. subUrl: "benchmarking/fjjxb",
  339. data: {
  340. wpids: that.value1,
  341. projectids: that.value2,
  342. lineids: that.value3,
  343. beginDate: that.value4,
  344. endDate: that.value5,
  345. type: that.TypeClass,
  346. target: '',
  347. sort: ''
  348. },
  349. success(res) {
  350. console.log(res)
  351. var name = [],
  352. data = [],
  353. llfdl = [],
  354. legend = ["实际电量", "计划检修损失", "非计划检修损失", "限电损失", "受累损失", "性能损失"],
  355. data2 = []; //项目列表
  356. res.data.forEach((item, index) => {
  357. name.push(item.name);
  358. data.push([item.sjfdl, item.jhjx, item.fjhjx, item.xd, item.sl, item.xn])
  359. llfdl.push(item.llfdl);
  360. data2.push({
  361. index: index + 1,
  362. name: item.name,
  363. llfdl: item.llfdl,
  364. sjfdl: item.sjfdl,
  365. speed: item.speed,
  366. fjhjx: item.fjhjx,
  367. jhjx: item.jhjx,
  368. sl: item.sl,
  369. xd: item.xd,
  370. xn: item.xn,
  371. fnlly: item.fnlly,
  372. is_light: false
  373. })
  374. })
  375. name.pop();
  376. data.pop();
  377. llfdl.pop();
  378. if (data.length > 0) {
  379. let arr1 = [];
  380. const length = data[0].length;
  381. for (var i = 0; i < length; i++) {
  382. let arr2 = [];
  383. data.forEach(ele => {
  384. arr2.push(ele[i])
  385. });
  386. arr1.push(arr2);
  387. }
  388. that.lineData = llfdl;
  389. that.bardata = {
  390. area: name,
  391. legend: legend,
  392. data: arr1
  393. };
  394. }
  395. that.tableDataEnd = data2[data2.length - 1];
  396. data2.pop();
  397. that.tableData.data = data2;
  398. }
  399. });
  400. },
  401. mxClick() {
  402. this.$router.push("/decision/decision1Mx")
  403. }
  404. }
  405. };
  406. </script>
  407. <style lang="less">
  408. .decision-page-1 {
  409. .com-panel .panel-title {
  410. line-height: 3.4259vh;
  411. }
  412. .tools {
  413. display: flex;
  414. line-height: 3.4259vh;
  415. .tool-block {
  416. display: flex;
  417. align-items: center;
  418. margin-left: 0.741vh;
  419. .legend {
  420. flex: auto;
  421. width: 0.741vh;
  422. height: 0.741vh;
  423. margin-right: 0.741vh;
  424. &.long {
  425. width: 2.963vh;
  426. height: 0.37vh;
  427. }
  428. }
  429. .legend-text {
  430. color: @gray-l;
  431. font-size: @fontsize-s;
  432. }
  433. }
  434. }
  435. .project-table {
  436. overflow: auto;
  437. // height: calc(100vh - 24.5vh);
  438. tbody {
  439. height: calc(100vh - 24.5vh);
  440. }
  441. td {
  442. color: #b2bdc0;
  443. }
  444. }
  445. .contentMx {
  446. width: 100%;
  447. overflow-x: auto;
  448. }
  449. .activeMx {
  450. width: 150%;
  451. }
  452. }
  453. </style>