Decision1.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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 -->
  77. <Table :data="tableData" :pageSize="20" @onPagging="onChangePage" :height="'calc(100vh - 32vh)'"></Table>
  78. <!-- <Table :data="tableData"></Table> -->
  79. </div>
  80. </panel>
  81. </el-col>
  82. </el-row>
  83. </div>
  84. </template>
  85. <script>
  86. import BarLineChart from "../../components/chart/combination/bar-line-chart.vue";
  87. import Panel from "../../components/coms/panel/panel.vue";
  88. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  89. import ToolbarPanel from "../../components/coms/panel/toolbar-panel.vue";
  90. import Table from "../../components/coms/table/table.vue";
  91. import partten from "@/helper/partten.js";
  92. export default {
  93. components: {
  94. ToolbarPanel,
  95. BarLineChart,
  96. Panel,
  97. Table,
  98. partten,
  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: "fjhjx",
  140. is_num: false,
  141. is_light: false,
  142. sortable:true
  143. },
  144. {
  145. name: "计划检修",
  146. field: "jhjx",
  147. is_num: false,
  148. is_light: false,
  149. sortable:true
  150. },
  151. {
  152. name: "受累",
  153. field: "sl",
  154. is_num: false,
  155. is_light: true,
  156. sortable:true
  157. },
  158. {
  159. name: "限电",
  160. field: "xd",
  161. is_num: false,
  162. is_light: false,
  163. sortable:true
  164. },
  165. {
  166. name: "性能",
  167. field: "xn",
  168. is_num: false,
  169. is_light: false,
  170. sortable:true
  171. },
  172. {
  173. name: "风能利用率%",
  174. field: "fnlly",
  175. is_num: false,
  176. is_light: false,
  177. sortable:true
  178. }
  179. ],
  180. data: [],
  181. },
  182. ChangZhan: [], //场站
  183. XiangMu: [], //项目
  184. XianLu: [], //线路
  185. value1: [],
  186. value2: [],
  187. value3: [],
  188. value4: "",
  189. value5: "",
  190. barColor: [partten.getColor("green"), partten.getColor("orange"), partten.getColor("yellow"), partten.getColor("red"), partten.getColor("purple"), partten.getColor("blue")],
  191. TypeClass: 1, //风场,项目,集电线路 的按钮颜色,默认第一个
  192. bardata: [],
  193. lineData: [],
  194. };
  195. },
  196. created() {
  197. this.ChangZhanVal();
  198. this.value4 = this.getTime(1);
  199. this.value5 = this.getTime(2);
  200. this.AjaxCommon();
  201. },
  202. methods: {
  203. ChangZhanVal() {
  204. var that = this;
  205. that.API.requestData({
  206. method: "GET",
  207. baseURL : "http://10.155.32.4:9001/",
  208. subUrl: "benchmarking/wplist",
  209. success(res) {
  210. that.ChangZhan = res.data;
  211. }
  212. });
  213. },
  214. ChangZhanChange(val) {
  215. this.TypeClass = "";
  216. this.value1 = val;
  217. this.value2 = [];
  218. this.value3 = [];
  219. this.AjaxCommon();
  220. this.XiangMuVal(val);
  221. },
  222. XiangMuVal(val) {
  223. var that = this;
  224. that.API.requestData({
  225. method: "GET",
  226. baseURL : "http://10.155.32.4:9001/",
  227. subUrl: "benchmarking/projectList",
  228. data: {
  229. wpids: val
  230. },
  231. success(res) {
  232. that.XiangMu = res.data;
  233. }
  234. });
  235. },
  236. XiangMuChange(val) {
  237. this.TypeClass = "";
  238. this.value2 = val;
  239. this.value3 = [];
  240. this.AjaxCommon();
  241. this.XianLuVal(val);
  242. },
  243. XianLuVal(val) {
  244. var that = this;
  245. that.API.requestData({
  246. method: "GET",
  247. baseURL : "http://10.155.32.4:9001/",
  248. subUrl: "benchmarking/lineList",
  249. data: {
  250. projects: val
  251. },
  252. success(res) {
  253. that.XianLu = res.data;
  254. }
  255. });
  256. },
  257. XianLuChange(val) {
  258. this.TypeClass = "";
  259. this.value3 = val;
  260. this.AjaxCommon();
  261. },
  262. BeginChange(val) {
  263. this.value4 = val;
  264. this.AjaxCommon();
  265. },
  266. EndChange(val) {
  267. this.value5 = val;
  268. this.AjaxCommon();
  269. },
  270. TypeClick(val) {
  271. if (val != this.TypeClass && this.TypeClass) {
  272. this.TypeClass = val;
  273. // 重置状态start
  274. this.value1 = [];
  275. this.value2 = [];
  276. this.value3 = [];
  277. this.value4 = this.getTime(1);
  278. this.value5 = this.getTime(2);
  279. this.AjaxCommon();
  280. // 重置状态end
  281. }
  282. },
  283. getTime(val) { //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  284. var date = new Date();
  285. var year = date.getFullYear(),
  286. month = date.getMonth() + 1,
  287. day = date.getDate();
  288. month >= 1 && month <= 9 ? (month = '0' + month) : '';
  289. day >= 0 && day <= 9 ? (day = '0' + day) : '';
  290. var begin = year + '-' + month + '-01';
  291. var end = year + '-' + month + '-' + day;
  292. if (val == 1) {
  293. return begin;
  294. } else if (val == 2) {
  295. return end;
  296. }
  297. },
  298. AjaxCommon() {
  299. var that = this;
  300. that.API.requestData({
  301. method: "GET",
  302. baseURL : "http://10.155.32.4:9001/",
  303. subUrl: "benchmarking/fjjxb",
  304. data: {
  305. wpids: that.value1,
  306. projectids: that.value2,
  307. lineids: that.value3,
  308. beginDate: that.value4,
  309. endDate: that.value5,
  310. type: that.TypeClass,
  311. target: '',
  312. sort: ''
  313. },
  314. success(res) {
  315. console.log(res)
  316. var name = [],
  317. data = [],
  318. llfdl = [],
  319. legend = ["实际电量", "计划检修损失", "非计划检修损失", "限电损失", "受累损失", "性能损失"],
  320. data2 = []; //项目列表
  321. res.data.forEach((item, index) => {
  322. name.push(item.name);
  323. data.push([item.sjfdl, item.jhjx, item.fjhjx, item.xd, item.sl, item.xn])
  324. llfdl.push(item.llfdl);
  325. data2.push({
  326. index: index + 1,
  327. name: item.name,
  328. llfdl: item.llfdl,
  329. sjfdl: item.sjfdl,
  330. speed: item.speed,
  331. fjhjx: item.fjhjx,
  332. jhjx: item.jhjx,
  333. sl: item.sl,
  334. xd: item.xd,
  335. xn: item.xn,
  336. fnlly: item.fnlly,
  337. is_light: false
  338. })
  339. })
  340. name.pop();
  341. data.pop();
  342. llfdl.pop();
  343. if (data.length > 0) {
  344. let arr1 = [];
  345. const length = data[0].length;
  346. for (var i = 0; i < length; i++) {
  347. let arr2 = [];
  348. data.forEach(ele => {
  349. arr2.push(ele[i])
  350. });
  351. arr1.push(arr2);
  352. }
  353. that.lineData = llfdl;
  354. that.bardata = {
  355. area: name,
  356. legend: legend,
  357. data: arr1
  358. };
  359. }
  360. that.tableData.data = data2;
  361. }
  362. });
  363. },
  364. mxClick() {
  365. this.$router.push("/decision/decision1Mx")
  366. },
  367. onChangePage(params) {
  368. console.log(params);
  369. },
  370. }
  371. };
  372. </script>
  373. <style lang="less">
  374. .decision-page-1 {
  375. .com-panel .panel-title {
  376. line-height: 3.4259vh;
  377. }
  378. .tools {
  379. display: flex;
  380. line-height: 3.4259vh;
  381. .tool-block {
  382. display: flex;
  383. align-items: center;
  384. margin-left: 0.741vh;
  385. .legend {
  386. flex: auto;
  387. width: 0.741vh;
  388. height: 0.741vh;
  389. margin-right: 0.741vh;
  390. &.long {
  391. width: 2.963vh;
  392. height: 0.37vh;
  393. }
  394. }
  395. .legend-text {
  396. color: @gray-l;
  397. font-size: @fontsize-s;
  398. }
  399. }
  400. }
  401. .project-table {
  402. overflow: auto;
  403. tbody {
  404. height: calc(100vh - 24.5vh);
  405. }
  406. td {
  407. color: #b2bdc0;
  408. }
  409. }
  410. .contentMx {
  411. width: 100%;
  412. overflow-x: auto;
  413. }
  414. .activeMx {
  415. width: 150%;
  416. }
  417. }
  418. </style>