Decision3Db.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. <template>
  2. <div class="decision-page-3">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">场站:</div>
  7. <div class="search-input">
  8. <el-select v-model="value1" @change="ChangZhanChange(value1)" clearable placeholder="请选择"
  9. popper-class="select">
  10. <el-option v-for="item in ChangZhan" :key="item.id" :value="item.id" :label="item.name">
  11. </el-option>
  12. </el-select>
  13. </div>
  14. </div>
  15. <div class="query-item">
  16. <div class="lable">风机:</div>
  17. <div class="search-input">
  18. <el-select v-model="value2" @change="XiangMuChange(value2)" multiple multiple-limit="5"
  19. placeholder="请选择" popper-class="select">
  20. <el-option v-for="item in XiangMu" :key="item.id" :value="item.id" :label="item.name">
  21. </el-option>
  22. </el-select>
  23. </div>
  24. </div>
  25. <div class="query-item">
  26. <div class="lable">开始日期:</div>
  27. <div class="search-input">
  28. <el-date-picker v-model="value4" @change="BeginChange(value4)" type="date"
  29. value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  30. </el-date-picker>
  31. </div>
  32. </div>
  33. <div class="query-actions">
  34. <button class="btn" @click="reset">重置</button>
  35. </div>
  36. </div>
  37. <div class="actions mg-b-8">
  38. <button class="btn" :class="TypeClass==0?'green':''" @click="TypeClick(0)">日风电机对比</button>
  39. <button class="btn" :class="TypeClass==1?'green':''" @click="TypeClick(1)">月风电机对比</button>
  40. <button class="btn" :class="TypeClass==2?'green':''" @click="TypeClick(2)">年风电机对比</button>
  41. </div>
  42. </div>
  43. <!-- 列表 -->
  44. <toolbar-panel title="单机横向对比" :showLine="false"></toolbar-panel>
  45. <div class="info">
  46. <div class="mg-b-16">
  47. <div class="project-table">
  48. <Table :data="tableData"></Table>
  49. </div>
  50. </div>
  51. <!-- 风资源列表 -->
  52. <div class="direction-info mg-b-16">
  53. <table class="com-table">
  54. <tbody>
  55. <tr>
  56. <td v-for="(col, i) of tableData.column" :key="i">
  57. <div v-if="i == 0">22</div>
  58. <div v-if="i == 1">风资源</div>
  59. <div v-if="i != 0 && i != 1">
  60. <div class="direction-title">{{listName[i - 2]}}</div>
  61. <div class="direction-chart" :class="(i-2) < fzyData.length?'':'hide'">
  62. <normal-radar-chart :width="'70%'" :height="'232px'" :value="fzyData[i-2]" />
  63. </div>
  64. </div>
  65. </td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. </div>
  70. <!-- 日功率曲线 -->
  71. <div>
  72. <toolbar-panel :title="'日功率曲线'">
  73. <template v-slot:tools>
  74. <div class="tools">
  75. <div class="tool-block" v-for="(item , index) in listName">
  76. <div class="legend" :class="'bg-'+(index + 1)"></div>
  77. <div class="legend-text">{{item}}</div>
  78. </div>
  79. </div>
  80. </template>
  81. <double-line-chart :height="'200px'" :list="list" />
  82. </toolbar-panel>
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. import DoubleLineChart from "../../components/chart/line/double-line-chart.vue";
  89. import NormalRadarChart from "../../components/chart/radar/normal-radar-chart.vue";
  90. import SvgIcon from "../../components/coms/icon/svg-icon.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. Table,
  96. SvgIcon,
  97. ToolbarPanel,
  98. DoubleLineChart,
  99. NormalRadarChart
  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: "data1",
  119. is_num: false,
  120. is_light: false,
  121. },
  122. {
  123. name: "",
  124. field: "data2",
  125. is_num: false,
  126. is_light: false,
  127. },
  128. {
  129. name: "",
  130. field: "data3",
  131. is_num: false,
  132. is_light: false,
  133. },
  134. {
  135. name: "",
  136. field: "data4",
  137. is_num: false,
  138. is_light: false,
  139. }, {
  140. name: "",
  141. field: "data5",
  142. is_num: false,
  143. is_light: false,
  144. }
  145. ],
  146. data: [],
  147. },
  148. ChangZhan: [], //场站
  149. XiangMu: [], //项目
  150. value1: [],
  151. value2: [],
  152. value4: "",
  153. fzyData: [],
  154. list: [{value: [{text: "",value: 0,}]}],
  155. listName: [],
  156. TypeClass:0,
  157. ajaxArr:['daydjhxdbtop','monthdjhxdbtop','yeardjhxdbtop'],
  158. ajaxName:'daydjhxdbtop'
  159. };
  160. },
  161. created() {
  162. this.ChangZhanVal();
  163. this.value4 = this.getTime(1);
  164. this.AjaxCommon();
  165. },
  166. methods: {
  167. ChangZhanVal() {
  168. var that = this;
  169. that.API.requestData({
  170. method: "GET",
  171. baseURL: "http://10.155.32.4:9001/",
  172. subUrl: "benchmarking/wplist",
  173. success(res) {
  174. that.ChangZhan = res.data;
  175. }
  176. });
  177. },
  178. ChangZhanChange(val) {
  179. this.value1 = val;
  180. this.value2 = [];
  181. this.AjaxCommon();
  182. this.XiangMuVal(val);
  183. },
  184. XiangMuVal(val) {
  185. var that = this;
  186. that.API.requestData({
  187. method: "GET",
  188. baseURL: "http://10.155.32.4:9001/",
  189. subUrl: "benchmarking/wtList",
  190. data: {
  191. wpid: val
  192. },
  193. success(res) {
  194. that.XiangMu = res.data;
  195. }
  196. });
  197. },
  198. XiangMuChange(val) {
  199. var that = this;
  200. that.value2 = val;
  201. that.AjaxCommon();
  202. },
  203. getTime(val) { //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  204. var date = new Date();
  205. var year = date.getFullYear(),
  206. month = date.getMonth() + 1,
  207. day = date.getDate();
  208. month >= 1 && month <= 9 ? (month = '0' + month) : '';
  209. day >= 0 && day <= 9 ? (day = '0' + day) : '';
  210. var begin = year + '-' + month + '-01';
  211. var end = year + '-' + month + '-' + day;
  212. if (val == 1) {
  213. return begin;
  214. } else if (val == 2) {
  215. return end;
  216. }
  217. },
  218. AjaxCommon() {
  219. var that = this;
  220. that.API.requestData({
  221. method: "GET",
  222. baseURL: "http://10.155.32.4:9001/",
  223. subUrl: "benchmarking/"+that.ajaxName,
  224. data: {
  225. wpid: that.value1,
  226. wtids: that.value2,
  227. date: that.value4,
  228. target: '',
  229. sort: ''
  230. },
  231. success(res) {
  232. var data = res.data,
  233. data2 = [],
  234. chart = [],
  235. fzy = [],
  236. fzyArr = [],
  237. jfpl = [],
  238. jfplArr = [];
  239. let thisItem = [];
  240. jfpl = data.pop(); //静风频率
  241. fzy = data.pop(); //风资源
  242. if(fzy['1'] == null){
  243. that.BASE.showMsg({
  244. msg:'此风机无数据',
  245. type:'success'
  246. });
  247. return false;
  248. }
  249. data.forEach((ele, index) => {
  250. for (let key in ele) {
  251. if (key !== "name") {
  252. thisItem.push(ele[key])
  253. }
  254. }
  255. })
  256. var count = thisItem.length / data.length;
  257. data.forEach((item, index) => {
  258. data2.push({
  259. index: index + 1,
  260. name: item.name,
  261. data1: thisItem[index * count],
  262. data2: count >= 2 ? thisItem[index * count + 1] : [],
  263. data3: count >= 3 ? thisItem[index * count + 2] : [],
  264. data4: count >= 4 ? thisItem[index * count + 3] : [],
  265. data5: count >= 5 ? thisItem[index * count + 4] : [],
  266. is_light: false
  267. })
  268. })
  269. Object.keys(fzy).map((key) => {
  270. fzyArr.push(fzy[key])
  271. })
  272. Object.keys(jfpl).map((key) => {
  273. jfplArr.push(jfpl[key])
  274. })
  275. fzyArr.pop();
  276. var jfplName = jfplArr.pop();
  277. var indicator = ["北", "北北西", "北西", "西北西", "西", "西南西", "南西", "南南西", "南", "南南东", "东南", "东南东",
  278. "东", "东北东", "北东", "北北东"
  279. ];
  280. var fzyDataArr = [];
  281. fzyArr.forEach((item, index) => {
  282. var arr = [];
  283. item.forEach((e, i) => {
  284. arr.push(e.value)
  285. });
  286. fzyDataArr.push([{
  287. indicator: indicator,
  288. data: [{
  289. value: arr
  290. }],
  291. name: jfplArr[index]
  292. }])
  293. });
  294. that.fzyData = fzyDataArr;
  295. that.tableData.data = data2;
  296. }
  297. });
  298. that.API.requestData({
  299. method: "GET",
  300. baseURL: "http://10.155.32.4:9001/",
  301. subUrl: "benchmarking/djhxdbbottom",
  302. data: {
  303. wpid: that.value1,
  304. wtids: that.value2,
  305. date: that.value4
  306. },
  307. success(res) {
  308. var data = res.data;
  309. var arrName = [],
  310. arrKey = [],
  311. arrData = [],
  312. tempArray = [];
  313. data.forEach(ele => {
  314. for (let key in ele) {
  315. if (key !== "name") {
  316. arrKey.push(key)
  317. arrData.push(ele[key])
  318. } else {
  319. arrName.push(ele[key])
  320. }
  321. }
  322. });
  323. that.listName = arrName;
  324. for (var i = 0; i < arrKey.length - 1; i++) { //冒泡排序
  325. for (var j = 0; j < arrKey.length - 1 - i; j++) {
  326. if (parseInt(arrKey[j]) > parseInt(arrKey[j + 1])) {
  327. var temp = arrKey[j];
  328. arrKey[j] = arrKey[j + 1];
  329. arrKey[j + 1] = temp;
  330. var temp2 = arrData[j];
  331. arrData[j] = arrData[j + 1];
  332. arrData[j + 1] = temp2;
  333. }
  334. }
  335. }
  336. for (var i = 0; i < data.length; i++) {
  337. var arr = [];
  338. arrData.forEach((e, index) => {
  339. if ((index * data.length + i) < arrData.length) {
  340. arr.push({
  341. text: arrKey[index * data.length + i],
  342. value: arrData[index * data.length + i],
  343. })
  344. }
  345. })
  346. tempArray.push({
  347. title: arrName[i],
  348. value: arr
  349. })
  350. }
  351. that.list = tempArray
  352. }
  353. });
  354. },
  355. reset() { //重置
  356. this.value1 = [];
  357. this.value2 = [];
  358. this.value4 = this.getTime(1);
  359. this.AjaxCommon();
  360. },
  361. TypeClick(val) {
  362. this.TypeClass = val;
  363. // 重置状态start
  364. this.value1 = [];
  365. this.value2 = [];
  366. this.value4 = this.getTime(1);
  367. this.ajaxName=this.ajaxArr[val];
  368. this.AjaxCommon();
  369. // 重置状态end
  370. },
  371. }
  372. };
  373. </script>
  374. <style lang="less">
  375. .decision-page-3 {
  376. .com-panel {
  377. .panel-title {
  378. color: @gray-l;
  379. }
  380. .tools {
  381. display: flex;
  382. .tool-block {
  383. display: flex;
  384. align-items: center;
  385. margin-left: 0.741vh;
  386. .legend {
  387. flex: auto;
  388. width: 0.741vh;
  389. height: 0.741vh;
  390. margin-right: 0.741vh;
  391. &.long {
  392. width: 2.963vh;
  393. height: 0.37vh;
  394. }
  395. }
  396. .legend-text {
  397. color: @gray-l;
  398. font-size: @fontsize-s;
  399. }
  400. }
  401. }
  402. }
  403. .info {
  404. overflow: auto;
  405. height: calc(100vh - 150px);
  406. }
  407. .project-table {
  408. overflow: auto;
  409. .com-table {
  410. tbody {
  411. padding-right: 0px;
  412. }
  413. th,
  414. td {
  415. color: #b2bdc0;
  416. &:nth-child(1) {
  417. width: 32px;
  418. }
  419. &:nth-child(2) {
  420. width: 183px;
  421. }
  422. }
  423. }
  424. }
  425. .direction-info {
  426. .com-table {
  427. tbody {
  428. padding-right: 0px;
  429. }
  430. th,
  431. td {
  432. color: #b2bdc0;
  433. padding: 0;
  434. &:nth-child(1) {
  435. width: 32px;
  436. background-color: fade(#536268, 20);
  437. }
  438. &:nth-child(2) {
  439. width: 183px;
  440. background-color: fade(#536268, 40);
  441. }
  442. .direction-title {
  443. background-color: fade(#536268, 20);
  444. font-size: @fontsize-s;
  445. line-height: 2.963vh;
  446. }
  447. .direction-chart {
  448. padding-top: 48px;
  449. .legend {
  450. display: flex;
  451. align-items: center;
  452. justify-content: center;
  453. margin-top: 32px;
  454. margin-bottom: 16px;
  455. .dot {
  456. width: 7px;
  457. height: 7px;
  458. background: @green;
  459. display: inline-block;
  460. margin-right: 8px;
  461. }
  462. }
  463. }
  464. }
  465. }
  466. }
  467. }
  468. .hide {
  469. opacity: 0;
  470. }
  471. .bg-1 {
  472. background: #05bb4c
  473. }
  474. .bg-2 {
  475. background: #f8de5b
  476. }
  477. .bg-3 {
  478. background: #4b55ae
  479. }
  480. .bg-4 {
  481. background: #fa8c16
  482. }
  483. .bg-5 {
  484. background: #1DA0D7
  485. }
  486. </style>