statistics.vue 6.3 KB

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