Decision1.vue 10 KB

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