Decision1Mx.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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">搜索</button>
  58. <button class="btn green" @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. <div class="contentMx">
  68. <div class="activeMx">
  69. <el-row :type="'flex'" class="content">
  70. <el-col :span="12" class="pd-r-8">
  71. <toolbar-panel title="风机绩效榜明细" :showLine="false">
  72. <bar-line-chart :height="'calc(100vh - 200px)'" :bardata="bardata" :lineData="lineData" :color="barColor" lineName="理论发电量"/>
  73. </toolbar-panel>
  74. </el-col>
  75. <el-col :span="12" class="pd-l-8">
  76. <panel :title="'项目列表'" :showLine="false">
  77. <div class="project-table">
  78. <Table :data="tableData"></Table>
  79. </div>
  80. </panel>
  81. </el-col>
  82. </el-row>
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. import BarLineChart from "../../components/chart/combination/bar-line-chart.vue";
  89. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  90. import Panel from "../../components/coms/panel/panel.vue";
  91. import ToolbarPanel from "../../components/coms/panel/toolbar-panel.vue";
  92. import Table from "../../components/coms/table/table.vue";
  93. export default {
  94. components: {
  95. ToolbarPanel,
  96. BarLineChart,
  97. Panel,
  98. Table,
  99. SvgIcon
  100. },
  101. data() {
  102. return {
  103. tableData: {
  104. column: [{
  105. name: "",
  106. field: "index",
  107. is_num: false,
  108. is_light: false,
  109. },
  110. {
  111. name: "名称",
  112. field: "name",
  113. is_num: false,
  114. is_light: false,
  115. },
  116. {
  117. name: "理论发电量",
  118. field: "llfdl",
  119. is_num: false,
  120. is_light: false,
  121. sortable:true
  122. },
  123. {
  124. name: "SCADA发电量",
  125. field: "sjfdl",
  126. is_num: false,
  127. is_light: false,
  128. sortable:true
  129. },
  130. {
  131. name: "风速",
  132. field: "speed",
  133. is_num: false,
  134. is_light: false,
  135. sortable:true
  136. },
  137. {
  138. name: "故障损失",
  139. field: "fjhjx1",
  140. is_num: false,
  141. is_light: false,
  142. sortable:true
  143. },
  144. {
  145. name: "故障受累",
  146. field: "fjhjx2",
  147. is_num: false,
  148. is_light: false,
  149. sortable:true
  150. },
  151. {
  152. name: "检修损失",
  153. field: "jhjx1",
  154. is_num: false,
  155. is_light: false,
  156. sortable:true
  157. },
  158. {
  159. name: "检修受累",
  160. field: "jhjx2",
  161. is_num: false,
  162. is_light: false,
  163. sortable:true
  164. },
  165. {
  166. name: "电网受累",
  167. field: "sl1",
  168. is_num: false,
  169. is_light: false,
  170. sortable:true
  171. },
  172. {
  173. name: "天气受累",
  174. field: "sl2",
  175. is_num: false,
  176. is_light: false,
  177. sortable:true
  178. },
  179. {
  180. name: "限电降出",
  181. field: "xd1",
  182. is_num: false,
  183. is_light: false,
  184. sortable:true
  185. },
  186. {
  187. name: "限电停机",
  188. field: "xd2",
  189. is_num: false,
  190. is_light: false,
  191. sortable:true
  192. },
  193. {
  194. name: "待风损失",
  195. field: "xn1",
  196. is_num: false,
  197. is_light: false,
  198. sortable:true
  199. },
  200. {
  201. name: "手动停机",
  202. field: "xn2",
  203. is_num: false,
  204. is_light: false,
  205. sortable:true
  206. },
  207. {
  208. name: "正常发电",
  209. field: "xn3",
  210. is_num: false,
  211. is_light: false,
  212. sortable:true
  213. },
  214. {
  215. name: "缺陷降出",
  216. field: "xn4",
  217. is_num: false,
  218. is_light: false,
  219. sortable:true
  220. },
  221. {
  222. name: "风能利用率%",
  223. field: "fnlly",
  224. is_num: false,
  225. is_light: false,
  226. sortable:true
  227. }
  228. ],
  229. data: [],
  230. },
  231. ChangZhan: [], //场站
  232. XiangMu: [], //项目
  233. XianLu: [], //线路
  234. value1: [],
  235. value2: [],
  236. value3: [],
  237. value4: "",
  238. value5: "",
  239. TypeClass: 1, //风场,项目,集电线路 的按钮颜色,默认第一个
  240. bardata: [],
  241. lineData: [],
  242. };
  243. },
  244. created() {
  245. this.ChangZhanVal();
  246. this.value4 = this.getTime(1);
  247. this.value5 = this.getTime(2);
  248. this.AjaxCommon();
  249. // var that = this;
  250. // that.API.requestData({
  251. // method: "GET",
  252. // subUrl: "benchmarking/fjjxb",
  253. // data: {
  254. // wpids: that.value1,
  255. // projectids: that.value2,
  256. // lineids: that.value3,
  257. // beginDate: that.value4,
  258. // endDate: that.value5,
  259. // type: that.TypeClass,
  260. // target: 'llfdl',//当前点击的名称
  261. // sort: 1//1或2
  262. // },
  263. // success(res) {
  264. // console.log(JSON.stringify(res))
  265. // }
  266. // });
  267. // http://10.155.32.33:9001/
  268. },
  269. methods: {
  270. ChangZhanVal() {
  271. var that = this;
  272. that.API.requestData({
  273. method: "GET",
  274. subUrl: "benchmarking/wplist",
  275. success(res) {
  276. that.ChangZhan = res.data;
  277. }
  278. });
  279. },
  280. ChangZhanChange(val) {
  281. this.TypeClass = "";
  282. this.value1 = val;
  283. this.value2 = [];
  284. this.value3 = [];
  285. this.AjaxCommon();
  286. this.XiangMuVal(val);
  287. },
  288. XiangMuVal(val) {
  289. var that = this;
  290. that.API.requestData({
  291. method: "GET",
  292. subUrl: "benchmarking/projectList",
  293. data: {
  294. wpids: val
  295. },
  296. success(res) {
  297. that.XiangMu = res.data;
  298. }
  299. });
  300. },
  301. XiangMuChange(val) {
  302. this.TypeClass = "";
  303. this.value2 = val;
  304. this.value3 = [];
  305. this.AjaxCommon();
  306. this.XianLuVal(val);
  307. },
  308. XianLuVal(val) {
  309. var that = this;
  310. that.API.requestData({
  311. method: "GET",
  312. subUrl: "benchmarking/lineList",
  313. data: {
  314. projects: val
  315. },
  316. success(res) {
  317. that.XianLu = res.data;
  318. }
  319. });
  320. },
  321. XianLuChange(val) {
  322. this.TypeClass = "";
  323. this.value3 = val;
  324. this.AjaxCommon();
  325. },
  326. BeginChange(val) {
  327. this.value4 = val;
  328. this.AjaxCommon();
  329. },
  330. EndChange(val) {
  331. this.value5 = val;
  332. this.AjaxCommon();
  333. },
  334. TypeClick(val) {
  335. if (val != this.TypeClass && this.TypeClass) {
  336. this.TypeClass = val;
  337. // 重置状态start
  338. this.value1 = [];
  339. this.value2 = [];
  340. this.value3 = [];
  341. this.value4 = this.getTime(1);
  342. this.value5 = this.getTime(2);
  343. this.AjaxCommon();
  344. // 重置状态end
  345. }
  346. },
  347. getTime(val) { //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  348. var date = new Date();
  349. var year = date.getFullYear(),
  350. month = date.getMonth() + 1,
  351. day = date.getDate();
  352. month >= 1 && month <= 9 ? (month = '0' + month) : '';
  353. day >= 0 && day <= 9 ? (day = '0' + day) : '';
  354. var begin = year + '-' + month + '-01';
  355. var end = year + '-' + month + '-' + day;
  356. if (val == 1) {
  357. return begin;
  358. } else if (val == 2) {
  359. return end;
  360. }
  361. },
  362. AjaxCommon() {
  363. var that = this;
  364. that.API.requestData({
  365. method: "GET",
  366. subUrl: "benchmarking/fjjxb",
  367. data: {
  368. wpids: that.value1,
  369. projectids: that.value2,
  370. lineids: that.value3,
  371. beginDate: that.value4,
  372. endDate: that.value5,
  373. type: that.TypeClass,
  374. target: '',
  375. sort: ''
  376. },
  377. success(res) {
  378. console.log(res)
  379. var name = [],
  380. data = [],
  381. llfdl = [],
  382. legend = ["实际电量", "故障损失", "故障受累", "检修受累", "电网受累", "天气受累", "限电降出", "限电停机", "待风损失",
  383. "手动停机", "正常发电", "缺陷降出"
  384. ],
  385. data2 = []; //项目列表
  386. res.data.forEach((item, index) => {
  387. name.push(item.name);
  388. llfdl.push(item.llfdl);
  389. data.push([item.sjfdl, item.fjhjx1, item.fjhjx2, item.jhjx1, item.jhjx2, item
  390. .sl1, item.sl2, item.xd1, item.xd2, item.xn1, item.xn2, item.xn3,
  391. item.xn4
  392. ])
  393. data2.push({
  394. index: index + 1,
  395. name: item.name,
  396. llfdl: item.llfdl,
  397. sjfdl: item.sjfdl,
  398. speed: item.speed,
  399. fjhjx1: item.fjhjx1,
  400. fjhjx2: item.fjhjx2,
  401. jhjx1: item.jhjx1,
  402. jhjx2: item.jhjx2,
  403. sl1: item.sl1,
  404. sl2: item.sl2,
  405. xd1: item.xd1,
  406. xd2: item.xd2,
  407. xn1: item.xn1,
  408. xn2: item.xn2,
  409. xn3: item.xn3,
  410. xn4: item.xn4,
  411. fnlly: item.fnlly,
  412. is_light: false
  413. })
  414. })
  415. name.pop();
  416. data.pop();
  417. llfdl.pop();
  418. if (data.length > 0) {
  419. let arr1 = [];
  420. const length = data[0].length;
  421. for (var i = 0; i < length; i++) {
  422. let arr2 = [];
  423. data.forEach(ele => {
  424. arr2.push(ele[i])
  425. });
  426. arr1.push(arr2);
  427. }
  428. that.lineData = llfdl;
  429. that.bardata = {
  430. area: name,
  431. legend: legend,
  432. data: arr1
  433. };
  434. }
  435. that.tableData.data = data2;
  436. }
  437. });
  438. },
  439. mxClick() {
  440. this.$router.push("/decision/decision1")
  441. },
  442. thClick: function(i) {
  443. console.log(i) // 当子组件触发按钮时,msg获取值为 哈哈啊哈哈
  444. }
  445. }
  446. };
  447. </script>
  448. <style lang="less">
  449. .decision-page-1 {
  450. .com-panel .panel-title {
  451. line-height: 3.4259vh;
  452. }
  453. .tools {
  454. display: flex;
  455. line-height: 3.4259vh;
  456. .tool-block {
  457. display: flex;
  458. align-items: center;
  459. margin-left: 0.741vh;
  460. .legend {
  461. flex: auto;
  462. width: 0.741vh;
  463. height: 0.741vh;
  464. margin-right: 0.741vh;
  465. &.long {
  466. width: 2.963vh;
  467. height: 0.37vh;
  468. }
  469. }
  470. .legend-text {
  471. color: @gray-l;
  472. font-size: @fontsize-s;
  473. }
  474. }
  475. }
  476. .project-table {
  477. overflow: auto;
  478. tbody {
  479. height: calc(100vh - 24.5vh);
  480. }
  481. td {
  482. color: #b2bdc0;
  483. }
  484. }
  485. .contentMx {
  486. width: 100%;
  487. overflow-x: auto;
  488. }
  489. .activeMx {
  490. width: 130%;
  491. }
  492. }
  493. .main {
  494. overflow: auto;
  495. }
  496. // .main .main-body{height: calc(100vh - 6.63vh);}
  497. .bg-olive {
  498. background-color: #8dc63f;
  499. color: #ffffff;
  500. }
  501. .bg-cyan {
  502. background-color: #1cbbb4;
  503. }
  504. .bg-mauve {
  505. background-color: #9c26b0;
  506. }
  507. .bg-pink {
  508. background-color: #e03997;
  509. }
  510. .bg-brown {
  511. background-color: #a5673f;
  512. }
  513. .bg-pink2 {
  514. background-color: #FF0099;
  515. }
  516. .bg-blue2 {
  517. background-color: #07ABF5;
  518. }
  519. .bg-green2 {
  520. background-color: #1D3638;
  521. }
  522. </style>