stationIndex.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <view class="stationreport">
  3. <view class="box-bg">
  4. <uni-nav-bar :fixed="true" dark left-icon="left" background-color='#202246' :title="stationName"
  5. @clickLeft="back" />
  6. </view>
  7. <view class="report_main">
  8. <view class="report_DataAll" v-for="(item,index) in reportProgressData" :key="index">
  9. <uni-row class="report_Data flex justify-between">
  10. <uni-col :span="8" class="report_Data_1 flex">
  11. <image src="../../static/jnImage/indexPage/windIcon.png" mode=""></image>
  12. <text>{{item.inPower}}</text>
  13. </uni-col>
  14. <uni-col :span="8" class="report_Data_2">
  15. <text>{{item.name}}</text>
  16. </uni-col>
  17. <uni-col :span="8" class="report_Data_3 flex justify-end">
  18. <text>{{item.allPower}}</text>
  19. </uni-col>
  20. </uni-row>
  21. <view class="report_Data_msg">
  22. <view class="show_msg" :style="showProgress(item)">
  23. </view>
  24. </view>
  25. </view>
  26. <view class="yearTab">
  27. <text v-for="(item,index) in yearData" :key="index" @click="changeYearTab(item)"
  28. :style="item.showColor ? 'background: #4287FF;color:#fff': ''">{{item.nameZN}}</text>
  29. </view>
  30. <view class="reportTable">
  31. <uni-table ref="table" border emptyText="暂无更多数据" width="100%">
  32. <uni-tr>
  33. <uni-th align="center">性能指标</uni-th>
  34. <uni-th width="125" align="center">数据</uni-th>
  35. </uni-tr>
  36. <uni-tr v-for="(item, index) in tableData" :key="index">
  37. <uni-td>{{ item.name }}</uni-td>
  38. <uni-td align="center">{{ item.value }}</uni-td>
  39. </uni-tr>
  40. </uni-table>
  41. </view>
  42. </view>
  43. <station-bar ref="stationBar"></station-bar>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. bulletinappBulletinApi
  49. } from '../../api/report.js'
  50. import stationBar from '../common/stationTab.vue'
  51. export default {
  52. onLoad: function() {},
  53. components: {
  54. stationBar
  55. },
  56. data() {
  57. return {
  58. stationWpid: '',
  59. stationName: '',
  60. reportProgressData: [],
  61. yearTab: 'day',
  62. yearData: [],
  63. tableData: [],
  64. reportDataAll: []
  65. }
  66. },
  67. created() {
  68. this.stationName = uni.getStorageSync('stationName')
  69. this.stationWpid = uni.getStorageSync('stationWpid')
  70. this.getReportData()
  71. this.yearData = [{
  72. nameZN: '日简报',
  73. nameEN: 'day',
  74. showColor: true
  75. },
  76. {
  77. nameZN: '月简报',
  78. nameEN: 'month',
  79. showColor: false
  80. },
  81. {
  82. nameZN: '年简报',
  83. nameEN: 'year',
  84. showColor: false
  85. }
  86. ]
  87. },
  88. mounted() {
  89. this.$refs.stationBar.showTab = '数据简报'
  90. },
  91. methods: {
  92. back() {
  93. this.$tab.switchTab('/pages/home/index')
  94. },
  95. showProgress(item) {
  96. return `width: ${item.progress};`
  97. },
  98. changeMsg() {
  99. this.$tab.navigateTo('/pages/common/messagePage')
  100. },
  101. changeStation() {
  102. this.$tab.navigateTo('/pages/common/stationListPage')
  103. },
  104. changeYearTab(item) {
  105. this.tableData = []
  106. this.yearData.forEach(it => {
  107. it.showColor = false
  108. if (it.nameEN === item.nameEN) {
  109. item.showColor = true
  110. this.yearTab = it.nameEN
  111. }
  112. })
  113. for (let i in this.reportDataAll) {
  114. let obj = {}
  115. if (this.yearTab === 'day' && i.indexOf('日') > -1) {
  116. obj = {
  117. name: i,
  118. value: this.reportDataAll[i]
  119. }
  120. this.tableData.push(obj)
  121. }
  122. if (this.yearTab === 'month' && i.indexOf('月') > -1) {
  123. obj = {
  124. name: i,
  125. value: this.reportDataAll[i]
  126. }
  127. this.tableData.push(obj)
  128. }
  129. if (this.yearTab === 'year' && i.indexOf('年') > -1) {
  130. obj = {
  131. name: i,
  132. value: this.reportDataAll[i]
  133. }
  134. this.tableData.push(obj)
  135. }
  136. }
  137. },
  138. getReportData() {
  139. let that = this
  140. that.tableData = []
  141. that.reportDataAll = {}
  142. bulletinappBulletinApi({
  143. wpId: 'KGDL_FGS0'
  144. }).then(res => {
  145. if (res && res.data) {
  146. that.reportDataAll = res.data
  147. let datas = res.data
  148. let nowDay = that.getDayOfYear()
  149. let nowPro = nowDay / 365 * 100
  150. that.reportProgressData = [{
  151. inPower: datas['年发电量'] + '万kWh',
  152. allPower: datas['年计划发电量'] + '万kWh',
  153. progress: datas['年完成率'],
  154. name: '年发电量'
  155. },
  156. {
  157. inPower: nowDay + '天',
  158. allPower: '365天',
  159. progress: nowPro + '%',
  160. name: '日历进度'
  161. },
  162. {
  163. inPower: '日历进程',
  164. allPower: '年发电量',
  165. progress: datas['年完成率'],
  166. name: '完成度'
  167. },
  168. ]
  169. for (let i in datas) {
  170. let obj = {}
  171. if (that.yearTab === 'day' && i.indexOf('日') > -1) {
  172. obj = {
  173. name: i,
  174. value: datas[i]
  175. }
  176. that.tableData.push(obj)
  177. }
  178. }
  179. }
  180. })
  181. },
  182. getDayOfYear() {
  183. var date = new Date();
  184. var start = new Date(date.getFullYear(), 0, 0);
  185. var diff = (date - start) + ((start.getTimezoneOffset() - date.getTimezoneOffset()) * 60 * 1000);
  186. var oneDay = 1000 * 60 * 60 * 24;
  187. var dayOfYear = Math.floor(diff / oneDay);
  188. return dayOfYear;
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss">
  194. page {
  195. background-color: #202246;
  196. }
  197. .stationreport {
  198. width: 100vw;
  199. background: url('../../static/jnImage/loginPage/windBack.png'), url('../../static/jnImage/loginPage/backWav.png');
  200. background-repeat: no-repeat, repeat;
  201. background-size: 100% 260px, 100% 5px;
  202. .box-bg {
  203. width: 100vw;
  204. padding: 0;
  205. .uni-navbar {
  206. .uni-navbar__content {
  207. padding: 5px 0;
  208. height: 50px;
  209. }
  210. }
  211. }
  212. .report_main {
  213. padding: 0 20px;
  214. margin-top: 20px;
  215. .report_DataAll {
  216. margin-top: 10px;
  217. .report_Data {
  218. .report_Data_1 {
  219. image {
  220. width: 18px;
  221. height: 18px;
  222. }
  223. text {
  224. margin-left: 5px;
  225. font-size: 28upx;
  226. color: #A49EAC;
  227. position: relative;
  228. top: 0px;
  229. }
  230. }
  231. .report_Data_2 {
  232. text {
  233. font-size: 32upx;
  234. color: #A49EAC;
  235. }
  236. }
  237. .report_Data_3 {
  238. text {
  239. font-size: 28upx;
  240. color: #A49EAC;
  241. }
  242. }
  243. }
  244. .report_Data_msg {
  245. width: 100%;
  246. height: 20px;
  247. border-radius: 5px;
  248. background: #0B143E;
  249. .show_msg {
  250. height: 20px;
  251. background: #00BC6F;
  252. border-radius: 5px 0 0 5px;
  253. }
  254. }
  255. }
  256. .yearTab {
  257. width: 99%;
  258. height: 30px;
  259. border-radius: 5px;
  260. background: #0B143E;
  261. margin-top: 20px;
  262. text {
  263. display: inline-block;
  264. width: 33%;
  265. height: 30px;
  266. text-align: center;
  267. color: #4287FF;
  268. line-height: 30px;
  269. }
  270. text:nth-of-type(1) {
  271. border-radius: 5px 0 0 5px;
  272. }
  273. text:nth-of-type(3) {
  274. border-radius: 0 5px 5px 0;
  275. }
  276. }
  277. .reportTable {
  278. width: 100%;
  279. margin-top: 10px;
  280. .table--border {
  281. border: 1px solid rgba(255, 255, 255, 0.3);
  282. }
  283. .uni-table {
  284. background-color: rgba(255, 255, 255, 0);
  285. .uni-table-tr {
  286. .table--border {
  287. border: 1px solid rgba(255, 255, 255, 0.3);
  288. }
  289. .uni-table-th {
  290. background-color: #2E336D;
  291. }
  292. .uni-table-th,
  293. .uni-table-td {
  294. color: #fff;
  295. font-size: 26upx;
  296. }
  297. .uni-table-th:nth-of-type(1) {
  298. background-color: #6C4B9E;
  299. }
  300. }
  301. .uni-table-tr:hover {
  302. background-color: rgba(255, 255, 255, 0);
  303. }
  304. }
  305. }
  306. }
  307. }
  308. </style>