homeMobeilPage.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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, apiGetevaluationportalhomeSeason} 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.getYearSeasonData()
  132. },
  133. methods: {
  134. // 获取首页年份和季度数据
  135. getYearSeasonData() {
  136. let that = this
  137. apiGetevaluationportalhomeSeason().then(datas => {
  138. if (datas.success) {
  139. that.showDate = datas.data.newyear
  140. that.currentDate = [that.showDate]
  141. that.getyearCompanyList()
  142. }
  143. })
  144. },
  145. //获取年度单位考评数据
  146. getyearCompanyList() {
  147. let that = this
  148. that.cupDataYearArr = []
  149. let params = {
  150. binSection: '',
  151. year: that.showDate
  152. }
  153. apiGetappAnnualRankingData(params).then(datas =>{
  154. if (datas && datas.data) {
  155. let secArr = ['HD', 'SD', 'XNYFG', 'GJYW', 'MDYTH']
  156. secArr.forEach(item =>{
  157. for(let i in datas.data.year) {
  158. let it = datas.data.year[i]
  159. if (item === i) {
  160. let gradeA = 0
  161. let gradeB = 0
  162. let gradeC = 0
  163. let gradeD = 0
  164. let tableData = []
  165. it.forEach((iv, index) =>{
  166. if (index < 3) {
  167. let obj = iv
  168. if (index === 0) {
  169. obj.img = cup1
  170. } else if (index === 1) {
  171. obj.img = cup2
  172. } else if (index === 2) {
  173. obj.img = cup3
  174. }
  175. tableData.push(iv)
  176. }
  177. if (iv.grade === 'A') {
  178. gradeA ++
  179. } else if (iv.grade === 'B') {
  180. gradeB ++
  181. } else if (iv.grade === 'C') {
  182. gradeC ++
  183. } else if (iv.grade === 'D') {
  184. gradeD ++
  185. }
  186. })
  187. let obj = {
  188. name: item === 'HD' ? '火电板块' : item === 'SD' ? '水电板块' :item === 'XNYFG' ? '新能源' : item === 'GJYW' ? '海外业务':'煤电一体化',
  189. nameEn: item,
  190. echartsData: {
  191. allNum: it.length,
  192. echarts: [
  193. { value: gradeA, name: 'A类' },
  194. { value: gradeB, name: 'B类' },
  195. { value: gradeC, name: 'C类' },
  196. { value: gradeD, name: 'D类' }
  197. ]
  198. },
  199. tableDatas: tableData,
  200. allTableData: it,
  201. section: [],
  202. sectionAll: []
  203. }
  204. that.cupDataYearArr.push(obj)
  205. }
  206. }
  207. })
  208. that.cupDataYearArr.forEach(item =>{
  209. for(let i in datas.data.season) {
  210. let it = datas.data.season[i]
  211. if (item.nameEn === i) {
  212. it.forEach((iv, index) =>{
  213. if (index<3) {
  214. item.section.push(iv)
  215. }
  216. })
  217. item.sectionAll = it
  218. }
  219. }
  220. })
  221. this.$nextTick(() =>{
  222. that.getEcharts(that.cupDataYearArr)
  223. })
  224. }
  225. })
  226. },
  227. getEcharts(datas) {
  228. datas.forEach((item, index) =>{
  229. this.getEchartsData(item.echartsData.echarts, 'pieChart'+index)
  230. })
  231. },
  232. chooseMenu() {
  233. this.$router.push({ path: "/menu"})
  234. },
  235. enterDetail(type) {
  236. this.$router.push({ path: "/yearConpanyDetail", query: {binSection: type, year: this.showDate}})
  237. },
  238. getEchartsData(data, name) {
  239. let total = 0
  240. data.forEach(it =>{
  241. total += it.value
  242. })
  243. let option = {
  244. color: ['#F65177', '#50C14E', '#5093E1', '#9DA5BE'],
  245. tooltip: {
  246. trigger: 'item'
  247. },
  248. series: [
  249. {
  250. name: '年度榜',
  251. type: 'pie',
  252. radius: ['50%', '70%'],
  253. avoidLabelOverlap: false,
  254. label: {
  255. show: true,
  256. position: 'center',
  257. formatter: () =>{
  258. return total
  259. },
  260. fontSize: 16,
  261. fontWeight: 600
  262. },
  263. labelLine: {
  264. show: false
  265. },
  266. data: data
  267. }
  268. ]
  269. };
  270. // 基于准备好的dom,初始化echarts实例
  271. let dom = document.getElementById(name);
  272. dom.removeAttribute("_echarts_instance_")
  273. let myChart = this.$echarts.init(dom);
  274. myChart.setOption(option);
  275. window.addEventListener("resize", function () {
  276. myChart.resize()
  277. })
  278. },
  279. changeDate() {
  280. this.showDatePicker = true
  281. },
  282. confirmFn(val) {
  283. this.showDate = val.selectedValues[0]
  284. console.log('riqi', val)
  285. this.getyearCompanyList()
  286. this.cancelFn()
  287. },
  288. cancelFn() {
  289. this.showDatePicker = false
  290. }
  291. }
  292. }
  293. </script>
  294. <style lang="less">
  295. .homeMobeilMask{
  296. position: fixed;
  297. top: 0;
  298. left: 0;
  299. width: 100%;
  300. height: 100%;
  301. background-color: rgba(0,0,0,0.5);
  302. z-index: 111;
  303. }
  304. .homeMobeilPage {
  305. background-color: #184FB4;
  306. .van-nav-bar{
  307. width: 100%;
  308. background-color: #184FB4;
  309. color: #fff;
  310. position: fixed;
  311. top: 0;
  312. }
  313. .mobeilVant{
  314. height: 100%;
  315. margin-top: 45px;
  316. border-radius: 10px 10px 0 0;
  317. background-color: #fff;
  318. .mobeilTop{
  319. height: 60px;
  320. display: flex;
  321. justify-content: space-around;
  322. .topLeft{
  323. display: flex;
  324. img{
  325. width: 24px;
  326. height: 28px;
  327. position: relative;
  328. top: 18px;
  329. left: -10px;
  330. }
  331. span{
  332. font-family: MicrosoftYaHei;
  333. font-weight: 600;
  334. font-size: 16px;
  335. color: #444950;
  336. line-height: 60px;
  337. }
  338. }
  339. .topRight{
  340. display: flex;
  341. img{
  342. width: 22px;
  343. height: 18px;
  344. position: relative;
  345. top: 21px;
  346. left: 5px;
  347. }
  348. span{
  349. font-family: MicrosoftYaHei;
  350. font-weight: 400;
  351. font-size: 14px;
  352. color: #545960;
  353. line-height: 60px;
  354. margin-right: 5px;
  355. }
  356. }
  357. }
  358. .mobeilMain{
  359. // height: 50px;
  360. background-color: #ededf5;
  361. padding: 17px 20px;
  362. .rankingList{
  363. width: 100%;
  364. height: 45px;
  365. background: #184FB4;
  366. border-radius: 5px;
  367. margin-bottom: 15px;
  368. span{
  369. display: inline-block;
  370. width: 85%;
  371. text-align: center;
  372. font-family: MicrosoftYaHei;
  373. font-weight: 400;
  374. font-size: 16px;
  375. color: #fff;
  376. margin-right: 5px;
  377. position: relative;
  378. top: 12px;
  379. left: 8vw;
  380. }
  381. img{
  382. width: 22px;
  383. height: 18px;
  384. position: relative;
  385. top: 15px;
  386. right: 5px;
  387. }
  388. .van-picker{
  389. z-index: 222;
  390. }
  391. }
  392. .mainModel{
  393. background: #fff;
  394. border-radius: 5px;
  395. .mainModelTit{
  396. height: 40px;
  397. padding: 0 15px;
  398. display: flex;
  399. justify-content: space-between;
  400. border-bottom: 1px solid #96A1B4;
  401. .mainModelTit_left{
  402. img{
  403. width: 20px;
  404. height: 20px;
  405. position: relative;
  406. top: 10px;
  407. right: 5px;
  408. }
  409. span{
  410. display: inline-block;
  411. font-family: MicrosoftYaHei;
  412. font-weight: 500;
  413. font-size: 16px;
  414. color: #545960;
  415. margin-right: 5px;
  416. position: relative;
  417. top: 7px;
  418. }
  419. }
  420. .mainModelTit_right{
  421. width: 14px;
  422. height: 14px;
  423. position: relative;
  424. top: 14px;
  425. right: 5px;
  426. }
  427. }
  428. .mainModelMsg{
  429. width: 100%;
  430. display: flex;
  431. margin-bottom: 10px;
  432. .mainTwo{
  433. width: 35%;
  434. border-right: 1px solid #E1E3EA;
  435. position: relative;
  436. .echartsNum{
  437. font-size: 16px;
  438. font-weight: 600;
  439. position: absolute;
  440. top: 40px;
  441. left: 60px;
  442. }
  443. .mainTwoComColor{
  444. display: inline-block;
  445. width: 6px;
  446. height: 6px;
  447. border-radius: 20px;
  448. margin-left: 15px;
  449. position: relative;
  450. top: -1px;
  451. }
  452. .mainTwoComTit{
  453. font-size: 14px;
  454. display: inline-block;
  455. margin-left: 5px;
  456. }
  457. }
  458. .mainThree{
  459. width: 65%;
  460. padding-top: 5px;
  461. border-right: 1px solid #E1E3EA;
  462. position: relative;
  463. .headerNameTit{
  464. display: flex;
  465. // justify-content: space-between;
  466. padding: 0px 15px;
  467. margin-bottom: 5px;
  468. font-size: 14px;
  469. color: #414141;
  470. .headerNameTit_left{
  471. width: 65%;
  472. }
  473. .headerNameTit_right{
  474. width: 40%;
  475. span:nth-child(1){
  476. display: inline-block;
  477. width: 60%;
  478. }
  479. span:nth-child(2){
  480. display: inline-block;
  481. width: 40%;
  482. }
  483. }
  484. }
  485. .mainThreeMsg{
  486. display: flex;
  487. margin: 0 10px;
  488. width: calc(100% - 36px);
  489. height: 33px;
  490. background: #F6F7FA;
  491. margin-bottom: 8px;
  492. padding-left: 8px;
  493. padding-right: 8px;
  494. padding-top: 2px;
  495. border-radius: 5px;
  496. img{
  497. width: 20px;
  498. height: 20px;
  499. position: relative;
  500. top: 5px;
  501. margin-right: 10px;
  502. }
  503. .msgProgress{
  504. margin-top: 5px;
  505. display: flex;
  506. width: 100%;
  507. span{
  508. font-size: 14px;
  509. font-family: Microsoft YaHei;
  510. }
  511. span:nth-child(1){
  512. display: inline-block;
  513. width: 60%;
  514. font-weight: 400;
  515. color: #666;
  516. // margin-right: 10px;
  517. overflow: hidden;
  518. text-overflow: ellipsis;
  519. white-space: nowrap;
  520. }
  521. span:nth-child(2){
  522. display: inline-block;
  523. width: 17%;
  524. font-weight: 600;
  525. color: #F65177;
  526. }
  527. span:nth-child(3){
  528. display: inline-block;
  529. width: 20%;
  530. font-weight: 600;
  531. color: #666;
  532. }
  533. }
  534. }
  535. }
  536. }
  537. }
  538. }
  539. }
  540. }
  541. </style>