qxpclfx.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <div>
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div
  6. class="newspan"
  7. v-for="(item, index) of optionData"
  8. :key="index"
  9. :class="{ active: cur == index }"
  10. @click="handleOpen(item, index)"
  11. >
  12. {{ item }}
  13. </div>
  14. </div>
  15. </div>
  16. <div class="query mg-b-8">
  17. <div class="query-items">
  18. <div class="query-item">
  19. <div class="lable">场站:</div>
  20. <div class="search-input">
  21. <el-select
  22. v-model="value1"
  23. clearable
  24. placeholder="请选择"
  25. popper-class="select"
  26. >
  27. <el-option
  28. v-for="item in ChangZhan"
  29. :key="item.id"
  30. :value="item.id"
  31. :label="item.name"
  32. >
  33. </el-option>
  34. </el-select>
  35. </div>
  36. </div>
  37. <div class="query-item" v-if="shows == true">
  38. <div class="lable">年月:</div>
  39. <div class="search-input">
  40. <el-date-picker
  41. v-model="date"
  42. type="month"
  43. placeholder="选择年月"
  44. popper-class="date-select"
  45. value-format="YYYY-MM"
  46. >
  47. </el-date-picker>
  48. </div>
  49. </div>
  50. <div class="query-item" v-else>
  51. <div class="lable">日期:</div>
  52. <div class="search-input">
  53. <el-date-picker
  54. v-model="date2"
  55. type="date"
  56. placeholder="选择日期"
  57. popper-class="date-select"
  58. value-format="YYYY-MM-DD"
  59. >
  60. </el-date-picker>
  61. </div>
  62. </div>
  63. <div class="query-actions">
  64. <button class="btn green" @click="handleSubmit">查询</button>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="table-box">
  69. <div class="title">{{ showTitle }}</div>
  70. <ComTable
  71. :data="tableData"
  72. :pageSize="20"
  73. height="73vh"
  74. v-loading="tableLoading"
  75. element-loading-text="拼命加载中.."
  76. element-loading-background="rgba(0, 0, 0, 0.8)"
  77. ></ComTable>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import ComTable from "@/components/coms/table/table-qc.vue";
  83. import thermometerVue from "../../components/chart/bar/thermometer.vue";
  84. export default {
  85. name: "qxpclfx",
  86. components: { ComTable },
  87. data() {
  88. return {
  89. cur: 0,
  90. optionData: ["月曲线偏差率排行榜", "日曲线偏差率排行榜"],
  91. ChangZhan: [],
  92. value1: "MHS_FDC",
  93. date: "",
  94. date2: "",
  95. shows: true,
  96. showTitle: "月曲线偏差率排行榜",
  97. tableLoading: true,
  98. tableData: {
  99. column: [
  100. {
  101. name: "风机",
  102. field: "fj",
  103. is_num: false,
  104. is_light: false,
  105. sortable: thermometerVue
  106. },
  107. {
  108. name: "实际 / 保证(%)",
  109. field: "sjbz",
  110. is_num: false,
  111. is_light: false,
  112. sortable: true,
  113. id: "id"
  114. },
  115. {
  116. name: "实际 / 最优(%)",
  117. field: "sjzy",
  118. is_num: false,
  119. is_light: false,
  120. sortable: true,
  121. id: "id"
  122. },
  123. {
  124. name: "最优 / 保证(%)",
  125. field: "zybz",
  126. is_num: false,
  127. is_light: false,
  128. sortable: true,
  129. id: "id"
  130. },
  131. {
  132. name: "环比",
  133. field: "hb",
  134. is_num: false,
  135. is_light: false,
  136. sortable: true,
  137. id: "id"
  138. },
  139. {
  140. name: "同比",
  141. field: "tb",
  142. is_num: false,
  143. is_light: false,
  144. sortable: true,
  145. id: "id"
  146. },
  147. {
  148. name: "比标杆风机",
  149. field: "bbgfj",
  150. is_num: false,
  151. is_light: false,
  152. sortable: true,
  153. id: "id"
  154. }
  155. ],
  156. data: []
  157. },
  158. tableId: ""
  159. };
  160. },
  161. created() {
  162. this.ChangZhanVal();
  163. this.date = this.getDate(1);
  164. this.date2 = this.getDate(2);
  165. this.getTable(this.date);
  166. },
  167. methods: {
  168. // 获取表格数据
  169. getTable(date) {
  170. let that = this;
  171. that.tableLoading = true;
  172. that.API.requestData({
  173. timeout:60000,
  174. method: "POST",
  175. subUrl: "/leaderboard/curvefittingmainList",
  176. data: {
  177. isAsc: "asc",
  178. wpId: that.value1,
  179. recorddate: date
  180. },
  181. success(res) {
  182. that.tableLoading = false;
  183. if (res.code === 200) {
  184. // that.tableData.data = res.data
  185. var data = [];
  186. res.data.forEach((item, index) => {
  187. data[index] = {
  188. fj: item.windturbineid,
  189. sjbz: item.deviationrate2,
  190. sjzy: item.deviationrate1,
  191. zybz: item.deviationrate3,
  192. hb: item.monthdeviationrate,
  193. tb: item.yeardeviationrate,
  194. bbgfj: item.standarddeviationrate
  195. };
  196. });
  197. that.tableData.data = data;
  198. }
  199. },
  200. Error(res) {
  201. console.log("tag", res);
  202. }
  203. });
  204. },
  205. // tab
  206. handleOpen(vl, index) {
  207. this.$nextTick(() => {
  208. this.cur = index;
  209. this.showTitle = vl;
  210. if (index == 0) {
  211. this.getDate(1);
  212. this.shows = true;
  213. } else {
  214. this.getDate(2);
  215. this.shows = false;
  216. }
  217. });
  218. },
  219. // 场站
  220. ChangZhanVal() {
  221. var that = this;
  222. that.API.requestData({
  223. method: "GET",
  224. baseURL: "http://10.155.32.4:9001/",
  225. subUrl: "benchmarking/wplist",
  226. success(res) {
  227. that.ChangZhan = res.data;
  228. that.value1 = res.data[0].id;
  229. }
  230. });
  231. },
  232. // 查询
  233. handleSubmit() {
  234. if (this.shows == true) {
  235. // alert(this.date);
  236. this.getTable(this.date);
  237. } else {
  238. // alert(this.date2);
  239. this.getTable(this.date2);
  240. }
  241. },
  242. // 获取日期
  243. getDate(vl) {
  244. //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  245. var date = new Date();
  246. var year = date.getFullYear(),
  247. month = date.getMonth() + 1,
  248. day = date.getDate() - 1;
  249. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  250. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  251. var begin = year + "-" + month;
  252. var end = year + "-" + month + "-" + day;
  253. if (vl == 1) {
  254. return begin;
  255. } else if (vl == 2) {
  256. return end;
  257. }
  258. },
  259. }
  260. };
  261. </script>
  262. <style scoped>
  263. .newsDiv {
  264. color: rgba(255, 255, 255, 0.75);
  265. background-color: rgba(255, 255, 255, 0.1);
  266. margin-bottom: 8px;
  267. line-height: 3.4259vh;
  268. padding: 0 15px;
  269. }
  270. .newspan {
  271. line-height: 30px;
  272. cursor: pointer;
  273. padding: 0 1vw;
  274. margin: 0 2px;
  275. color: #9ca5a8;
  276. transition: color 0.2s ease-in-out;
  277. position: relative;
  278. }
  279. .newspan:hover {
  280. background: linear-gradient(
  281. to top,
  282. rgba(5, 187, 76, 0.5),
  283. rgba(5, 187, 76, 0)
  284. );
  285. color: white;
  286. position: relative;
  287. }
  288. .newspan:hover::after {
  289. content: "";
  290. position: absolute;
  291. width: 100%;
  292. height: 0.463vh;
  293. border: 0.093vh solid #05bb4c;
  294. border-top: 0;
  295. left: 0;
  296. bottom: 0;
  297. box-sizing: border-box;
  298. }
  299. .active {
  300. background: linear-gradient(
  301. to top,
  302. rgba(5, 187, 76, 0.5),
  303. rgba(5, 187, 76, 0)
  304. );
  305. color: white;
  306. position: relative;
  307. }
  308. .active::after {
  309. content: "";
  310. position: absolute;
  311. width: 100%;
  312. height: 0.463vh;
  313. border: 0.093vh solid #05bb4c;
  314. border-top: 0;
  315. left: 0;
  316. bottom: 0;
  317. box-sizing: border-box;
  318. }
  319. .title {
  320. background: rgba(255, 255, 255, 0.1);
  321. margin-bottom: 8px;
  322. padding: 1vh;
  323. }
  324. </style>