Decision1.vue 11 KB

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