statistics.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="statics_main">
  3. <view class="card_banner">
  4. <u-tabs class="tab_title" lineColor="#36a7f3" :inactiveStyle="{color:'#fff'}"
  5. :activeStyle="{color:'#e6d623'}" :itemStyle="{width:'30%',height:'40px'}" :current="current" scrollable
  6. :list="list" @click="selectTab"></u-tabs>
  7. </view>
  8. <view class="card_one">
  9. <view class="card_title">
  10. 文件传阅卡统计分析
  11. </view>
  12. <view class="charts-box">
  13. <qiun-data-charts type="column" :opts="opts"
  14. :chartData="current==0?chartData:current==1?chartData1:chartData2" />
  15. </view>
  16. <view class="grid">
  17. <view class="grid_item">
  18. <view class="text_font_size">496</view>
  19. <text style="color: #b8b8b8;font-size: 14px;">本年度新增</text>
  20. </view>
  21. <view class="grid_item item_mouth">
  22. <view class="text_font_size">496</view>
  23. <text style="color: #b8b8b8;font-size: 14px;">本月新增</text>
  24. <!-- <view class="charts-box_1">
  25. <qiun-data-charts type="arcbar" :chartData="chartDataOne" />
  26. </view> -->
  27. </view>
  28. </view>
  29. </view>
  30. <u-row>
  31. <u-col span="6" class="card_two">
  32. <view class="">
  33. 本年度传阅卡来文部门top5
  34. </view>
  35. <view class="card_list">
  36. <u-row class="cell_item" justify="space-between" gutter="10" v-for="(item,index) in dataList">
  37. <u-col span="2">
  38. <view class="text-grey text-center">
  39. {{index+1}}
  40. </view>
  41. </u-col>
  42. <u-col span="4">
  43. <view class="text-center text-bold text-black ellipsis-description">
  44. {{item.name}}
  45. </view>
  46. </u-col>
  47. <u-col span="6">
  48. <view class="text-center text-grey text-sm ">
  49. {{item.num}}
  50. </view>
  51. </u-col>
  52. </u-row>
  53. </view>
  54. </u-col>
  55. <u-col span="6" class="card_two">
  56. <view class="">
  57. 本月新增文件传阅卡分析
  58. </view>
  59. <view class="card_chart">
  60. <view class="charts-box_1">
  61. <qiun-data-charts type="ring" :opts="opts1" :chartData="chartDataOne" />
  62. </view>
  63. </view>
  64. </u-col>
  65. </u-row>
  66. </view>
  67. </template>
  68. <script>
  69. export default {
  70. data() {
  71. return {
  72. current: 0,
  73. chartData: {},
  74. chartData1: {},
  75. chartData2: {},
  76. chartDataOne: {},
  77. list: [{
  78. name: '年度'
  79. }, {
  80. name: '月份'
  81. }, {
  82. name: '来文部门'
  83. }],
  84. dataList: [{
  85. name: '政府办',
  86. num: 156
  87. }, {
  88. name: "法规办",
  89. num: 85
  90. }, {
  91. name: "工业强市办",
  92. num: 79
  93. }, {
  94. name: "环保办",
  95. num: 71
  96. }, {
  97. name: "教育办",
  98. num: 68
  99. }],
  100. opts: {
  101. height: '240px',
  102. color: ["#0ec89a"],
  103. enableScroll: false,
  104. legend: {
  105. show: false
  106. },
  107. extra: {
  108. column: {
  109. type: "group",
  110. width: 30,
  111. activeBgColor: "#000000",
  112. activeBgOpacity: 0.08
  113. }
  114. }
  115. },
  116. opts1: {
  117. rotate: false,
  118. rotateLock: false,
  119. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  120. "#ea7ccc"
  121. ],
  122. padding: [5, 5, 5, 5],
  123. dataLabel: true,
  124. enableScroll: false,
  125. legend: {
  126. show: true,
  127. position: "right",
  128. lineHeight: 25
  129. },
  130. title: {
  131. name: "收益率",
  132. fontSize: 15,
  133. color: "#666666"
  134. },
  135. subtitle: {
  136. name: "70%",
  137. fontSize: 25,
  138. color: "#7cb5ec"
  139. },
  140. extra: {
  141. ring: {
  142. ringWidth: 60,
  143. activeOpacity: 0.5,
  144. activeRadius: 10,
  145. offsetAngle: 0,
  146. labelWidth: 15,
  147. border: true,
  148. borderWidth: 3,
  149. borderColor: "#FFFFFF"
  150. }
  151. }
  152. },
  153. };
  154. },
  155. onReady() {
  156. this.getServerData();
  157. },
  158. methods: {
  159. selectTab(item) {
  160. this.current = item.index
  161. },
  162. getServerData() {
  163. //模拟从服务器获取数据时的延时
  164. setTimeout(() => {
  165. let res = {
  166. categories: ["2016", "2017", "2018", "2019", "2020", "2021"],
  167. legend: {
  168. show: false
  169. },
  170. series: [{
  171. data: [35, 36, 31, 33, 13, 34]
  172. }]
  173. };
  174. this.chartData = JSON.parse(JSON.stringify(res));
  175. }, 500);
  176. setTimeout(() => {
  177. let res1 = {
  178. categories: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
  179. legend: {
  180. show: false
  181. },
  182. series: [{
  183. data: [35, 40, 2, 0, 36, 31, 10, 33, 20, 13, 50, 34]
  184. }]
  185. }
  186. this.chartData1 = JSON.parse(JSON.stringify(res1));
  187. }, 500);
  188. setTimeout(() => {
  189. let res2 = {
  190. categories: ["政府办", "去去去", "11111"],
  191. legend: {
  192. show: false
  193. },
  194. series: [{
  195. data: [35, 40, 2]
  196. }]
  197. }
  198. this.chartData2 = JSON.parse(JSON.stringify(res2));
  199. }, 500);
  200. setTimeout(() => {
  201. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  202. let res = {
  203. series: [{
  204. data: [{
  205. "value": 50,
  206. "labelShow": false
  207. }, {
  208. "value": 30,
  209. "labelShow": false
  210. }]
  211. }]
  212. };
  213. this.chartDataOne = JSON.parse(JSON.stringify(res));
  214. }, 500);
  215. },
  216. }
  217. };
  218. </script>
  219. <style>
  220. .card_banner {
  221. width: 100%;
  222. height: 100px;
  223. background-color: #36a7f3;
  224. padding: 10px 20px 0;
  225. }
  226. .charts-box {
  227. width: 100%;
  228. height: 250px;
  229. }
  230. .charts-box_1 {
  231. width: 100%;
  232. height: 80px;
  233. }
  234. .card_one {
  235. width: 96%;
  236. margin: 0 2%;
  237. position: relative;
  238. border-radius: 20px;
  239. background-color: #f5f5f5;
  240. box-shadow: 0 0 0 1px #ccc;
  241. top: -40px;
  242. z-index: 4;
  243. }
  244. .card_title {
  245. height: 40px;
  246. line-height: 40px;
  247. font-size: 16px;
  248. font-weight: 700;
  249. text-align: center;
  250. border-bottom: 1px solid #ccc;
  251. background-color: eee;
  252. margin-bottom: 20px;
  253. }
  254. .grid_item {
  255. width: 50%;
  256. /* height: 20vh; */
  257. border-top: 1px solid #ccc;
  258. margin-top: 20px;
  259. text-align: center;
  260. padding: 10px 0;
  261. }
  262. .grid_item .text_font_size {
  263. font-size: 26px !important;
  264. margin-bottom: 10px;
  265. font-weight: 700;
  266. }
  267. .item_mouth {
  268. border-left: 1px solid #ccc;
  269. }
  270. .card_two {
  271. width: 100%;
  272. margin: 10px;
  273. position: relative;
  274. border-radius: 20px;
  275. background-color: #f5f5f5;
  276. box-shadow: 0 0 0 1px #ccc;
  277. }
  278. .cell_item {
  279. height: 30px;
  280. line-height: 30px;
  281. text-align: center;
  282. }
  283. </style>