gdbh.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <!-- 总体指标 -->
  2. <!-- 区划面积、常驻人口、海岸线长、海岛数量 -->
  3. <template>
  4. <div class="gdbh">
  5. <div class="shang"></div>
  6. <div class="xia center" >
  7. <div style=" background-size: 100% 100% ; width: 310px; height: 50px;">
  8. <div style="float: left; width: 45%; height: 48px;margin-left: 10px;
  9. background-image: url('/static/images/homepage/05-1 耕地保护指标.png'); background-size: 100% 100%; ">
  10. <div style="margin-top:0px;margin-left:5px;">耕地保有量</div>
  11. <div style="padding-top:0px; font-size: 16px;">309.8km2</div>
  12. </div>
  13. <div style="float: left; width: 45%; height: 48px;margin-left: 10px;
  14. background-image: url('/static/images/homepage/05-1 耕地保护指标.png'); background-size: 100% 100%; ">
  15. <div style="margin-top:0px;margin-left:5px;">高标准农田</div>
  16. <div style="padding-top:0px; font-size: 16px;">309.8km2</div>
  17. </div>
  18. </div>
  19. <div style="width: 160px; height: 18px; margin-left:75px ;margin-top:3px; background-image: url('/static/images/homepage/05-2 耕地保护二级小标题.png'); background-size: 100% 100%;">耕地质量</div>
  20. <div id="gdbh_xia" style="width: 310px; height: 130px; "></div>
  21. <div id="gdbh_xia2" style="width: 310px; height: 130px;"></div>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import Day from '../../components/Crontab/day.vue';
  27. export default {
  28. name: "overallIndicator",
  29. components: {
  30. Day
  31. },
  32. data() {
  33. return {
  34. mianji:"",
  35. renkou:"",
  36. haianxian:"",
  37. haidao:103,
  38. };
  39. },
  40. created() {
  41. },
  42. mounted() {
  43. this.getRenKou();
  44. this.getRenKou2();
  45. },
  46. methods: {
  47. getRenKou(){
  48. var dom = document.getElementById('gdbh_xia');
  49. var myChart = window.echarts.init(dom);
  50. let option = {
  51. color:['#fe792e','#fedb4b', '#00edfe','#2a71ff'],
  52. tooltip: {
  53. trigger: 'item'
  54. },
  55. legend: {
  56. left: '70%',
  57. top: '15%',
  58. textStyle: {
  59. color: '#ffffff' // 设置图例字体颜色为红色
  60. }
  61. },
  62. series: [
  63. {
  64. name: 'Access From',
  65. type: 'pie',
  66. radius: '80%',
  67. center: ["30%", "50%"],
  68. data: [
  69. { value: 484, name: '优等地' },
  70. { value: 1048, name: '上等地' },
  71. { value: 735, name: '中等地' },
  72. { value: 180, name: '下等地' }
  73. ],
  74. emphasis: {
  75. // itemStyle: {
  76. // shadowBlur: 10,
  77. // shadowOffsetX: 0,
  78. // shadowColor: 'rgb(254, 222, 82, 0)'
  79. // }
  80. },
  81. label: {
  82. show: false
  83. },
  84. labelLine: {
  85. show: false
  86. },
  87. }
  88. ]
  89. };
  90. myChart.setOption(option);
  91. },
  92. getRenKou2(){
  93. var chartDom = document.getElementById('gdbh_xia2');
  94. var myChart = window.echarts.init(chartDom);
  95. var option;
  96. option = {
  97. tooltip: {
  98. trigger: 'axis',
  99. axisPointer: {
  100. type: 'shadow'
  101. }
  102. },
  103. xAxis: {
  104. type: 'category',
  105. data: ['2017', '2018', '2019', '2020', '2021', '2022', '2023'],
  106. axisLabel: {
  107. textStyle: {
  108. color: 'aliceblue' // 设置字体颜色为红色
  109. }
  110. },
  111. axisTick: {
  112. alignWithLabel: true
  113. }
  114. },
  115. yAxis: {
  116. type: 'value',
  117. axisLabel: {
  118. textStyle: {
  119. color: 'aliceblue' // 设置字体颜色为红色
  120. }
  121. }
  122. },
  123. series: [
  124. {
  125. name: "耕地保有量",
  126. data: [120, 200, 150, 80, 70, 110, 130],
  127. type: 'bar',
  128. barWidth: '30%' ,
  129. itemStyle: {
  130. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  131. { offset: 0, color: '#83bff6' },
  132. { offset: 0.5, color: '#188df0' },
  133. { offset: 1, color: '#188df0' }
  134. ])
  135. },
  136. },
  137. ],
  138. grid:{ // 让图表占满容器
  139. top:"8px",
  140. left:"30px",
  141. right:"5px",
  142. bottom:"20px"
  143. }
  144. };
  145. option && myChart.setOption(option);
  146. }
  147. },
  148. }
  149. </script>
  150. <style lang="scss" scoped>
  151. .gdbh {
  152. width: 300px;
  153. height:396PX;
  154. min-height: 100px;
  155. font-size: 12px;
  156. // background: red;
  157. margin-top: 10px;
  158. margin-left: 10px;
  159. display: block;
  160. }
  161. .shang {
  162. width: 300px;
  163. height:50PX;
  164. min-height: 50px;
  165. background-image: url("/static/images/homepage/01-5 标题 耕地保护.png");
  166. background-size: 100% 100%;
  167. }
  168. .xia {
  169. color:aliceblue;
  170. }
  171. .center{
  172. margin-left: 3%;
  173. }
  174. </style>