echarts.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <!-- 创业公司登记 -->
  3. <div class="firm" v-loading="loading">
  4. <div class="pAHeader">
  5. <div class="pAHeader1">数据监测</div>
  6. </div>
  7. <hr />
  8. <!-- 顶部展示信息区开始 -->
  9. <topData v-if="!loading" :data="HeaderData"/>
  10. <!-- 顶部展示信息区结束 -->
  11. <!-- 中部大饼区开始 -->
  12. <div class="midBlock">
  13. <!-- 圆形图开始 -->
  14. <CircularChart v-if="!loading" :data="CircularData"/>
  15. <!-- 圆形图结束 -->
  16. <!-- 横向柱状图开始 -->
  17. <HorizontalChart v-if="!loading" :data="HorizontalData"/>
  18. <!-- 横向柱状图结束 -->
  19. </div>
  20. <!-- 中部大饼区结束 -->
  21. <!-- 柱状图区域开始 -->
  22. <ColumnarChart v-if="!loading" :data="ColumnarData"/>
  23. <!-- 柱状图区域结束 -->
  24. <!-- 底部表格区域开始 -->
  25. <RankingTable v-if="!loading" :tableData="tableData"/>
  26. <!-- 通知表格结束-->
  27. <!-- 底部表格区域结束 -->
  28. </div>
  29. </template>
  30. <script>
  31. //顶部数据
  32. import topData from './components/topData.vue'
  33. //圆形图
  34. import CircularChart from './components/CircularChart.vue';
  35. //横向柱状图
  36. import HorizontalChart from './components/HorizontalChart.vue';
  37. //竖向柱状图
  38. import ColumnarChart from './components/ColumnarChart.vue';
  39. //排名表格
  40. import RankingTable from './components/RankingTable.vue';
  41. export default {
  42. components:{topData,CircularChart,HorizontalChart,ColumnarChart,RankingTable},
  43. data() {
  44. return {
  45. loading:false,
  46. //头部区域数据
  47. HeaderData:{
  48. people:0,
  49. project:0,
  50. activity:0,
  51. // budget:0,
  52. isPay:0
  53. },
  54. //圆形
  55. CircularData:[
  56. {value:0,name:"个人创客"},
  57. {value:0,name:"创客活动"}
  58. ],
  59. //横行的柱状
  60. HorizontalData:[
  61. // [ '物联网激光切割器',0],
  62. // [ '人工智能领跑马拉松',1000, ],
  63. // [ '3D演奏智能工具', 2000],
  64. // [ '人工智能分链机器',3000],
  65. ],
  66. // 柱状
  67. ColumnarData:[
  68. // ['3D智能分链机器', 2000],
  69. // ['3D智能分链机器1',3000],
  70. // ['3D智能分链机器2', 2500],
  71. // ['3D智能分链机器3', 1000],
  72. // ['3D智能分链机器4', 2000],
  73. // ['3D智能分链机器5',3000],
  74. // ['3D智能分链机器6', 2500],
  75. // ['3D智能分链机器7', 1000],
  76. // ['3D智能分链机器8', 2000],
  77. // ['3D智能分链机器9',3000],
  78. // ['3D智能分链机器10', 2500],
  79. // ['3D智能分链机器11', 1000],
  80. // ['3D智能分链机器12', 2000],
  81. // ['3D智能分链机器13',3000],
  82. // ['3D智能分链机器14', 2500],
  83. // ['3D智能分链机器15', 1000],
  84. ],
  85. tableData: [
  86. // {title:"人工智能分链机器",pro_leader:"覃罡彤",TypeName:"个人创客",Activity:"286",ClassName:"信息与通讯学院"},
  87. // {title:"3D演奏智能工具",pro_leader:"袁一鸣",TypeName:"个人创客",Activity:"225",ClassName:"信息与通讯学院"},
  88. // {title:"物联网切割机器",pro_leader:"张晓分",TypeName:"个人创客",Activity:"169",ClassName:"中德制造"},
  89. // {title:"人工智能领航AI马拉松",pro_leader:"林子夏",TypeName:"创客活动",Activity:"121",ClassName:"中德制造"},
  90. ]
  91. };
  92. },
  93. methods:{
  94. getData(){
  95. this.loading = true;
  96. this.ajax.get(this.$store.state.api+'/getEchartsData',{
  97. uid:this.$store.state.userInfo.userid
  98. }).then(result=>{
  99. let data = result['data'];
  100. console.log(data)
  101. //创客项目人数
  102. this.HeaderData['people']=data[0][0]['total']
  103. //目前积累项目数量
  104. this.HeaderData['project'] = data[1][0]['student']+data[1][0]['wordspace']
  105. //目前积累活动数量
  106. this.HeaderData['activity'] = data[2][0]['Maker']+data[2][0]['personal']
  107. //已支出预算
  108. let num = 0;
  109. data[3].forEach(item=>{
  110. item['isUse'] = 0;
  111. let isUse =JSON.parse(item['actualuse']);
  112. for(let i in isUse)item['isUse']+=Number(isUse[i]);
  113. num+=item['isUse'];
  114. })
  115. this.HeaderData['isPay'] = num/10000;
  116. //扇形图数据
  117. this.CircularData[0]['value'] = data[2][0]['personal']
  118. this.CircularData[1]['value'] = data[2][0]['Maker']
  119. //创客活动资金
  120. let MakerData = data[3].filter(item=>item.type==0);
  121. let GroupMakerData = [];
  122. MakerData.forEach(item=>{
  123. let addActivity = GroupMakerData.filter(fItem=>fItem['acId']==item['acId']);
  124. if(addActivity.length!=0){
  125. addActivity[0]['isUse']+=item['isUse'];
  126. }else{
  127. GroupMakerData.push(item);
  128. }
  129. })
  130. GroupMakerData.sort((item1,item2)=>item2['isUse']-item1['isUse']).splice(0,4).sort((item1,item2)=>item1['isUse']-item2['isUse']).forEach(item=>this.HorizontalData.push([item['title'],item['isUse']]))
  131. //个人创客资金
  132. let personalData = data[3].filter(item=>item.type==1);
  133. console.log(personalData)
  134. let GroupPersonalData = [];
  135. personalData.forEach(item=>{
  136. let addActivity = GroupPersonalData.filter(fItem=>fItem['acId']==item['acId']);
  137. if(addActivity.length!=0){
  138. addActivity[0]['isUse']+=item['isUse'];
  139. }else{
  140. GroupPersonalData.push(item);
  141. }
  142. })
  143. GroupPersonalData.sort((item1,item2)=>item2['isUse']-item1['isUse']).splice(0,16).sort((item1,item2)=>item1['isUse']-item2['isUse']).forEach(item=>this.ColumnarData.push([item['title'],item['isUse']]))
  144. //项目排名
  145. this.tableData = data[4];
  146. this.loading = false;
  147. }).catch(err=>{
  148. console.log(err)
  149. })
  150. }
  151. },
  152. mounted(){
  153. this.getData();
  154. }
  155. };
  156. </script>
  157. <style lang="less">
  158. .midBlock{ //中部大饼
  159. max-width: 100%;
  160. min-width: 90%;
  161. height: 400px;
  162. margin-top: 20px;
  163. // background: #ce7070;
  164. display: flex;
  165. justify-content: space-between;
  166. align-items: center;
  167. .mid{
  168. height: 95%;
  169. width: 49%;
  170. padding: 20px;
  171. box-sizing: border-box;
  172. background: #f3f6f7;
  173. overflow: hidden;
  174. }
  175. }
  176. .histogram{ //柱状图
  177. margin-top: 20px;
  178. box-sizing: border-box;
  179. padding: 20px;
  180. min-width: 90%;
  181. max-width: 100%;
  182. height: 400px;
  183. background: #f3f6f7;
  184. overflow: hidden;
  185. }
  186. </style>