homeMobeilPage.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <div :class="showDatePicker? 'homeMobeilMask': ''">
  3. </div>
  4. <div class="homeMobeilPage">
  5. <van-nav-bar title="年度单位评级" />
  6. <div class="mobeilVant">
  7. <div class="mobeilTop">
  8. <div class="topLeft">
  9. <!-- <van-icon name="star" size="20" /> -->
  10. <img :src="logoImg" alt="">
  11. <span>全业务域考评系统</span>
  12. </div>
  13. <div class="topRight">
  14. <span>系统导航</span>
  15. <img :src="daohangImg" alt="" @click="chooseMenu">
  16. </div>
  17. </div>
  18. <div class="mobeilMain">
  19. <div class="rankingList">
  20. <span>{{showDate}}年度排行榜</span>
  21. <img :src="dateImg" @click="changeDate" alt="">
  22. <van-date-picker
  23. v-model="currentDate"
  24. title="选择年份"
  25. :columns-type="['year']"
  26. @confirm="confirmFn"
  27. @cancel="cancelFn"
  28. v-if="showDatePicker"
  29. />
  30. </div>
  31. <div class="mainModel" v-for="(it, index) in cupDataYearArr" :key="index">
  32. <div class="mainModelTit">
  33. <div class="mainModelTit_left">
  34. <img :src="huodianImg" alt="" v-if="it.nameEn === 'HD'">
  35. <img :src="shuidianImg" alt="" v-else-if="it.nameEn === 'SD'">
  36. <img :src="xinnengyuanImg" alt="" v-else-if="it.nameEn === 'XNYFG'">
  37. <img :src="guojiImg" alt="" v-else-if="it.nameEn === 'GJYW'">
  38. <img :src="meidianImg" alt="" v-else-if="it.nameEn === 'MDYTH'">
  39. <span>{{it.name}}</span>
  40. </div>
  41. <img :src="moreImg" alt="" class="mainModelTit_right" @click="enterDetail(it.nameEn)">
  42. </div>
  43. <div class="mainModelMsg">
  44. <div class="mainTwo">
  45. <!-- <div class="echartsNum" :style="it.echartsData.allNum < 10 ? 'left:56px': 'left: 65px'">{{it.echartsData.allNum}}</div> -->
  46. <div :id="'pieChart'+index" style="height: 100px;width: 100%"></div>
  47. <el-row>
  48. <el-col :span="12">
  49. <span class="mainTwoComColor" style="background: #F65177;"></span>
  50. <span class="mainTwoComTit">A级</span>
  51. </el-col>
  52. <el-col :span="12">
  53. <span class="mainTwoComColor" style="background: #50C14E;"></span>
  54. <span class="mainTwoComTit">B级</span>
  55. </el-col>
  56. <el-col :span="12">
  57. <span class="mainTwoComColor" style="background: #5093E1;"></span>
  58. <span class="mainTwoComTit">C级</span>
  59. </el-col>
  60. <el-col :span="12">
  61. <span class="mainTwoComColor" style="background: #9DA5BE;"></span>
  62. <span class="mainTwoComTit">D级</span>
  63. </el-col>
  64. </el-row>
  65. </div>
  66. <div class="mainThree">
  67. <div class="headerNameTit">
  68. <div class="headerNameTit_left">
  69. <span>单位名称</span>
  70. </div>
  71. <div class="headerNameTit_right">
  72. <span>级别</span>
  73. <span>得分</span>
  74. </div>
  75. </div>
  76. <div style="display: flex" v-for="(item, index) in it.tableDatas" :key="index">
  77. <div class="mainThreeMsg">
  78. <img :src="item.img" alt="">
  79. <div class="msgProgress">
  80. <span>{{item.company}}</span>
  81. <span>{{item.grade}}</span>
  82. <span>{{item.score}}</span>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <script>
  94. import logoImg from '../assets/mobeilImg/logo.png'
  95. import daohangImg from '../assets/mobeilImg/daohang.png'
  96. import dateImg from '../assets/mobeilImg/date.png'
  97. import huodianImg from '../assets/mobeilImg/huodian.png'
  98. import shuidianImg from '../assets/mobeilImg/shuidian.png'
  99. import xinnengyuanImg from '../assets/mobeilImg/xinnengyuan.png'
  100. import meidianImg from '../assets/mobeilImg/meidian.png'
  101. import guojiImg from '../assets/mobeilImg/guoji.png'
  102. import moreImg from '../assets/mobeilImg/more.png'
  103. import cup1 from '../assets/getwayImg/cup1.png'
  104. import cup2 from '../assets/getwayImg/cup2.png'
  105. import cup3 from '../assets/getwayImg/cup3.png'
  106. import {apiGetappAnnualRankingData} from '../api/api'
  107. export default {
  108. data() {
  109. return {
  110. forecastDatas: [],
  111. expendData: ['0'],
  112. openeds: [],
  113. routeTags: [],
  114. userName: '',
  115. logoImg: logoImg,
  116. daohangImg: daohangImg,
  117. dateImg: dateImg,
  118. huodianImg: huodianImg,
  119. shuidianImg: shuidianImg,
  120. xinnengyuanImg: xinnengyuanImg,
  121. meidianImg: meidianImg,
  122. guojiImg: guojiImg,
  123. moreImg: moreImg,
  124. showDatePicker: false,
  125. currentDate: [],
  126. showDate: '',
  127. cupDataYearArr: []
  128. }
  129. },
  130. created() {
  131. this.showDate = new Date().getFullYear()
  132. this.getyearCompanyList()
  133. },
  134. methods: {
  135. //获取年度单位考评数据
  136. getyearCompanyList() {
  137. let that = this
  138. that.cupDataYearArr = []
  139. let params = {
  140. binSection: '',
  141. year: that.showDate
  142. }
  143. apiGetappAnnualRankingData(params).then(datas =>{
  144. if (datas && datas.data) {
  145. let secArr = ['HD', 'SD', 'XNYFG', 'GJYW', 'MDYTH']
  146. secArr.forEach(item =>{
  147. for(let i in datas.data.year) {
  148. let it = datas.data.year[i]
  149. if (item === i) {
  150. let gradeA = 0
  151. let gradeB = 0
  152. let gradeC = 0
  153. let gradeD = 0
  154. let tableData = []
  155. it.forEach((iv, index) =>{
  156. if (index < 3) {
  157. let obj = iv
  158. if (index === 0) {
  159. obj.img = cup1
  160. } else if (index === 1) {
  161. obj.img = cup2
  162. } else if (index === 2) {
  163. obj.img = cup3
  164. }
  165. tableData.push(iv)
  166. }
  167. if (iv.grade === 'A') {
  168. gradeA ++
  169. } else if (iv.grade === 'B') {
  170. gradeB ++
  171. } else if (iv.grade === 'C') {
  172. gradeC ++
  173. } else if (iv.grade === 'D') {
  174. gradeD ++
  175. }
  176. })
  177. let obj = {
  178. name: item === 'HD' ? '火电板块' : item === 'SD' ? '水电板块' :item === 'XNYFG' ? '新能源' : item === 'GJYW' ? '海外业务':'煤电一体化',
  179. nameEn: item,
  180. echartsData: {
  181. allNum: it.length,
  182. echarts: [
  183. { value: gradeA, name: 'A类' },
  184. { value: gradeB, name: 'B类' },
  185. { value: gradeC, name: 'C类' },
  186. { value: gradeD, name: 'D类' }
  187. ]
  188. },
  189. tableDatas: tableData,
  190. allTableData: it,
  191. section: [],
  192. sectionAll: []
  193. }
  194. that.cupDataYearArr.push(obj)
  195. }
  196. }
  197. })
  198. that.cupDataYearArr.forEach(item =>{
  199. for(let i in datas.data.season) {
  200. let it = datas.data.season[i]
  201. if (item.nameEn === i) {
  202. it.forEach((iv, index) =>{
  203. if (index<3) {
  204. item.section.push(iv)
  205. }
  206. })
  207. item.sectionAll = it
  208. }
  209. }
  210. })
  211. this.$nextTick(() =>{
  212. that.getEcharts(that.cupDataYearArr)
  213. })
  214. }
  215. })
  216. },
  217. getEcharts(datas) {
  218. datas.forEach((item, index) =>{
  219. this.getEchartsData(item.echartsData.echarts, 'pieChart'+index)
  220. })
  221. },
  222. chooseMenu() {
  223. this.$router.push({ path: "/menu"})
  224. },
  225. enterDetail(type) {
  226. this.$router.push({ path: "/yearConpanyDetail", query: {binSection: type, year: this.showDate}})
  227. },
  228. getEchartsData(data, name) {
  229. let total = 0
  230. data.forEach(it =>{
  231. total += it.value
  232. })
  233. let option = {
  234. color: ['#F65177', '#50C14E', '#5093E1', '#9DA5BE'],
  235. tooltip: {
  236. trigger: 'item'
  237. },
  238. series: [
  239. {
  240. name: '年度榜',
  241. type: 'pie',
  242. radius: ['50%', '70%'],
  243. avoidLabelOverlap: false,
  244. label: {
  245. show: true,
  246. position: 'center',
  247. formatter: () =>{
  248. return total
  249. },
  250. fontSize: 16,
  251. fontWeight: 600
  252. },
  253. labelLine: {
  254. show: false
  255. },
  256. data: data
  257. }
  258. ]
  259. };
  260. // 基于准备好的dom,初始化echarts实例
  261. let dom = document.getElementById(name);
  262. dom.removeAttribute("_echarts_instance_")
  263. let myChart = this.$echarts.init(dom);
  264. myChart.setOption(option);
  265. window.addEventListener("resize", function () {
  266. myChart.resize()
  267. })
  268. },
  269. changeDate() {
  270. this.showDatePicker = true
  271. },
  272. confirmFn(val) {
  273. this.showDate = val.selectedValues[0]
  274. console.log('riqi', val)
  275. this.getyearCompanyList()
  276. this.cancelFn()
  277. },
  278. cancelFn() {
  279. this.showDatePicker = false
  280. }
  281. }
  282. }
  283. </script>
  284. <style lang="less">
  285. .homeMobeilMask{
  286. position: fixed;
  287. top: 0;
  288. left: 0;
  289. width: 100%;
  290. height: 100%;
  291. background-color: rgba(0,0,0,0.5);
  292. z-index: 111;
  293. }
  294. .homeMobeilPage {
  295. background-color: #184FB4;
  296. .van-nav-bar{
  297. width: 100%;
  298. background-color: #184FB4;
  299. color: #fff;
  300. position: fixed;
  301. top: 0;
  302. }
  303. .mobeilVant{
  304. height: 100%;
  305. margin-top: 45px;
  306. border-radius: 10px 10px 0 0;
  307. background-color: #fff;
  308. .mobeilTop{
  309. height: 60px;
  310. display: flex;
  311. justify-content: space-around;
  312. .topLeft{
  313. display: flex;
  314. img{
  315. width: 24px;
  316. height: 28px;
  317. position: relative;
  318. top: 18px;
  319. left: -10px;
  320. }
  321. span{
  322. font-family: MicrosoftYaHei;
  323. font-weight: 600;
  324. font-size: 16px;
  325. color: #444950;
  326. line-height: 60px;
  327. }
  328. }
  329. .topRight{
  330. display: flex;
  331. img{
  332. width: 22px;
  333. height: 18px;
  334. position: relative;
  335. top: 21px;
  336. left: 5px;
  337. }
  338. span{
  339. font-family: MicrosoftYaHei;
  340. font-weight: 400;
  341. font-size: 14px;
  342. color: #545960;
  343. line-height: 60px;
  344. margin-right: 5px;
  345. }
  346. }
  347. }
  348. .mobeilMain{
  349. // height: 50px;
  350. background-color: #ededf5;
  351. padding: 17px 20px;
  352. .rankingList{
  353. width: 100%;
  354. height: 45px;
  355. background: #184FB4;
  356. border-radius: 5px;
  357. margin-bottom: 15px;
  358. span{
  359. display: inline-block;
  360. width: 85%;
  361. text-align: center;
  362. font-family: MicrosoftYaHei;
  363. font-weight: 400;
  364. font-size: 16px;
  365. color: #fff;
  366. margin-right: 5px;
  367. position: relative;
  368. top: 12px;
  369. left: 8vw;
  370. }
  371. img{
  372. width: 22px;
  373. height: 18px;
  374. position: relative;
  375. top: 15px;
  376. right: 5px;
  377. }
  378. .van-picker{
  379. z-index: 222;
  380. }
  381. }
  382. .mainModel{
  383. background: #fff;
  384. border-radius: 5px;
  385. .mainModelTit{
  386. height: 40px;
  387. padding: 0 15px;
  388. display: flex;
  389. justify-content: space-between;
  390. border-bottom: 1px solid #96A1B4;
  391. .mainModelTit_left{
  392. img{
  393. width: 20px;
  394. height: 20px;
  395. position: relative;
  396. top: 10px;
  397. right: 5px;
  398. }
  399. span{
  400. display: inline-block;
  401. font-family: MicrosoftYaHei;
  402. font-weight: 500;
  403. font-size: 16px;
  404. color: #545960;
  405. margin-right: 5px;
  406. position: relative;
  407. top: 7px;
  408. }
  409. }
  410. .mainModelTit_right{
  411. width: 14px;
  412. height: 14px;
  413. position: relative;
  414. top: 14px;
  415. right: 5px;
  416. }
  417. }
  418. .mainModelMsg{
  419. width: 100%;
  420. display: flex;
  421. margin-bottom: 10px;
  422. .mainTwo{
  423. width: 35%;
  424. border-right: 1px solid #E1E3EA;
  425. position: relative;
  426. .echartsNum{
  427. font-size: 16px;
  428. font-weight: 600;
  429. position: absolute;
  430. top: 40px;
  431. left: 60px;
  432. }
  433. .mainTwoComColor{
  434. display: inline-block;
  435. width: 6px;
  436. height: 6px;
  437. border-radius: 20px;
  438. margin-left: 15px;
  439. position: relative;
  440. top: -1px;
  441. }
  442. .mainTwoComTit{
  443. font-size: 14px;
  444. display: inline-block;
  445. margin-left: 5px;
  446. }
  447. }
  448. .mainThree{
  449. width: 65%;
  450. padding-top: 5px;
  451. border-right: 1px solid #E1E3EA;
  452. position: relative;
  453. .headerNameTit{
  454. display: flex;
  455. // justify-content: space-between;
  456. padding: 0px 15px;
  457. margin-bottom: 5px;
  458. font-size: 14px;
  459. color: #414141;
  460. .headerNameTit_left{
  461. width: 65%;
  462. }
  463. .headerNameTit_right{
  464. width: 40%;
  465. span:nth-child(1){
  466. display: inline-block;
  467. width: 60%;
  468. }
  469. span:nth-child(2){
  470. display: inline-block;
  471. width: 40%;
  472. }
  473. }
  474. }
  475. .mainThreeMsg{
  476. display: flex;
  477. margin: 0 10px;
  478. width: calc(100% - 36px);
  479. height: 33px;
  480. background: #F6F7FA;
  481. margin-bottom: 8px;
  482. padding-left: 8px;
  483. padding-right: 8px;
  484. padding-top: 2px;
  485. border-radius: 5px;
  486. img{
  487. width: 20px;
  488. height: 20px;
  489. position: relative;
  490. top: 5px;
  491. margin-right: 10px;
  492. }
  493. .msgProgress{
  494. margin-top: 5px;
  495. display: flex;
  496. width: 100%;
  497. span{
  498. font-size: 14px;
  499. font-family: Microsoft YaHei;
  500. }
  501. span:nth-child(1){
  502. display: inline-block;
  503. width: 60%;
  504. font-weight: 400;
  505. color: #666;
  506. // margin-right: 10px;
  507. overflow: hidden;
  508. text-overflow: ellipsis;
  509. white-space: nowrap;
  510. }
  511. span:nth-child(2){
  512. display: inline-block;
  513. width: 17%;
  514. font-weight: 600;
  515. color: #F65177;
  516. }
  517. span:nth-child(3){
  518. display: inline-block;
  519. width: 20%;
  520. font-weight: 600;
  521. color: #666;
  522. }
  523. }
  524. }
  525. }
  526. }
  527. }
  528. }
  529. }
  530. }
  531. </style>