SAannulus.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <div class="annulus_box">
  3. <div class="annulus_title"><p>及格率比较</p></div>
  4. <div id="pie_duo" style="width:99%; height:450px;"></div>
  5. </div>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {
  11. }
  12. },
  13. created() {
  14. this.init();
  15. },
  16. computed: {
  17. annulus() {
  18. return this.$store.state.annulus
  19. },
  20. },
  21. methods: {
  22. drawLine(obj) {
  23. let title = '';
  24. let num = '';
  25. console.log(title,456789)
  26. var dataStyle = {
  27. normal: {
  28. label: { show: false },
  29. labelLine: { show: false },
  30. // shadowBlur: 40,
  31. shadowColor: 'rgba(40, 40, 40, 0.5)',
  32. }
  33. };
  34. let myChart_lei = this.$echarts.init(document.getElementById('pie_duo'));
  35. myChart_lei.setOption({
  36. title:{
  37. text:title ,
  38. subtext: this.num,
  39. x:'center',
  40. y:'35%',
  41. itemGap: 0,
  42. textStyle: {
  43. fontSize: 28,
  44. fontWeight: 'bolder',
  45. color: '#000080'
  46. },
  47. //subtextStyle: {
  48. // fontSize: 19,
  49. // fontWeight: 'bolder',
  50. // color: '#333'
  51. //},
  52. },
  53. backgroundColor: '#fff',
  54. color: obj.primarycolor,
  55. tooltip: {
  56. show: true,
  57. position: ['33%', '41%'],
  58. fontSize:'30',
  59. formatter: function (value) {
  60. var res = '<div style="text-align:center;width:120px;"><p style="font-size:16px;">' + value.name + '</p></div>' + '<br/>' +
  61. '<div style="text-align:center;width:120px;"><p style="color:#00FFFF;font-size:20px;">' + value.value + '%' + '</p></div>'
  62. return res;
  63. },
  64. },
  65. legend: {
  66. show: false,
  67. itemGap: 12,
  68. top: '0%',
  69. right: '4%',
  70. data: obj.title
  71. },
  72. toolbox: {
  73. show: false,
  74. feature: {
  75. mark: { show: true },
  76. dataView: { show: true, readOnly: false },
  77. restore: { show: true },
  78. saveAsImage: { show: true }
  79. }
  80. },
  81. series: [
  82. {
  83. name: obj.areadata.dataname,
  84. type: 'pie',
  85. clockWise: true,
  86. radius: ['75%', '90%'],
  87. itemStyle: dataStyle,
  88. hoverAnimation: false,
  89. data: [
  90. {
  91. value: obj.areadata.occupydata,
  92. name: '本区及格率'
  93. },
  94. {
  95. value: obj.areadata.remaindata,
  96. name: '本区未及格率',
  97. itemStyle: {
  98. normal: {
  99. color: '#BFEFFF',
  100. }
  101. }
  102. },
  103. ]
  104. },
  105. {
  106. name: obj.schooldata.dataname,
  107. type: 'pie',
  108. clockWise: true,
  109. hoverAnimation: false,
  110. radius: ['60%', '75%'],
  111. itemStyle: dataStyle,
  112. data: [
  113. {
  114. value: obj.schooldata.occupydata,
  115. name: '本校及格率'
  116. },
  117. {
  118. value: obj.schooldata.remaindata,
  119. name: '本校未及格率',
  120. itemStyle: {
  121. normal: {
  122. color: '#B2DFEE',
  123. }
  124. }
  125. }
  126. ]
  127. },
  128. {
  129. name: obj.teachingdata.dataname,
  130. type: 'pie',
  131. clockWise: true,
  132. hoverAnimation: false,
  133. radius: ['45%', '60%'],
  134. itemStyle: dataStyle,
  135. data: [
  136. {
  137. value: obj.teachingdata.occupydata,
  138. name: '任教班及格率'
  139. },
  140. {
  141. value: obj.teachingdata.remaindata,
  142. name: '任教班未及格率',
  143. itemStyle: {
  144. normal: {
  145. color: '#F2F2F2',
  146. }
  147. }
  148. }
  149. ]
  150. },
  151. ]
  152. })
  153. },
  154. init() {
  155. this.$api.FindTeachAnnulus({})
  156. .then((response) => {
  157. //console.log(response.result.data, 777777)
  158. this.$store.state.annulus = response.result.data
  159. })
  160. },
  161. },
  162. watch: {
  163. // 监听指令
  164. annulus(a) {
  165. this.drawLine(a)
  166. },
  167. }
  168. }
  169. </script>
  170. <style scoped>
  171. .annulus_box {
  172. width:100%;
  173. height:450px;
  174. }
  175. .annulus_title {
  176. width:100%;
  177. font-size:18px;
  178. font-weight:bold;
  179. color:#333;
  180. padding-left:3%;
  181. padding-top:1%;
  182. }
  183. </style>