statistics.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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="pie" :opts="opts1" :chartData="chartDataOne" />
  63. <!-- <qiun-data-charts type="arcbar" :opts="opts1" :chartData="chartDataOne" /> -->
  64. </view>
  65. </view>
  66. </u-col>
  67. </u-row>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. current: 0,
  76. chartData: {},
  77. chartData1: {},
  78. chartData2: {},
  79. chartDataOne: {},
  80. list: [{
  81. name: '年度'
  82. }, {
  83. name: '月份'
  84. }, {
  85. name: '来文部门'
  86. }],
  87. dataList: [{
  88. name: '政府办',
  89. num: 156
  90. }, {
  91. name: "法规办",
  92. num: 85
  93. }, {
  94. name: "工业强市办",
  95. num: 79
  96. }, {
  97. name: "环保办",
  98. num: 71
  99. }, {
  100. name: "教育办",
  101. num: 68
  102. }],
  103. opts: {
  104. height: '240px',
  105. color: ["#0ec89a"],
  106. enableScroll: false,
  107. legend: {
  108. show: false,
  109. },
  110. extra: {
  111. column: {
  112. type: "group",
  113. width: 30,
  114. activeBgColor: "#000000",
  115. activeBgOpacity: 0.08
  116. }
  117. }
  118. },
  119. opts1: {
  120. rotate: false,
  121. rotateLock: false,
  122. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  123. "#ea7ccc"
  124. ],
  125. padding: [5, 5, 5, 5],
  126. dataLabel: false,
  127. enableScroll: false,
  128. // legend: {
  129. // show: true,
  130. // position: "right"
  131. // },
  132. subtitle: {
  133. name: "as",
  134. fontSize: 25,
  135. color: "#7cb5ec"
  136. },
  137. extra: {
  138. pie: {
  139. // ringWidth: 100,
  140. activeOpacity: 0.5,
  141. activeRadius: 0,
  142. offsetAngle: 0,
  143. labelWidth: 15,
  144. border: false,
  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. radius: ['40%', '70%'],
  202. data: [{
  203. "name":"已办",
  204. "value": 50,
  205. }, {
  206. "name":"待办",
  207. "value": 50,
  208. }]
  209. }]
  210. };
  211. this.chartDataOne = JSON.parse(JSON.stringify(res));
  212. }, 500);
  213. },
  214. }
  215. };
  216. </script>
  217. <style>
  218. .card_banner {
  219. width: 100%;
  220. height: 100px;
  221. background-color: #36a7f3;
  222. padding: 10px 20px 0;
  223. }
  224. .charts-box {
  225. width: 100%;
  226. height: 250px;
  227. }
  228. .charts-box_1 {
  229. width: 100%;
  230. height: 160px;
  231. }
  232. .card_one {
  233. width: 96%;
  234. margin: 0 2%;
  235. position: relative;
  236. border-radius: 20px;
  237. background-color: #f5f5f5;
  238. box-shadow: 0 0 0 1px #ccc;
  239. top: -40px;
  240. z-index: 4;
  241. }
  242. .card_title {
  243. height: 40px;
  244. line-height: 40px;
  245. font-size: 16px;
  246. font-weight: 700;
  247. text-align: center;
  248. border-bottom: 1px solid #ccc;
  249. background-color: eee;
  250. margin-bottom: 20px;
  251. }
  252. .grid_item {
  253. width: 50%;
  254. /* height: 20vh; */
  255. border-top: 1px solid #ccc;
  256. margin-top: 20px;
  257. text-align: center;
  258. padding: 10px 0;
  259. }
  260. .grid_item .text_font_size {
  261. font-size: 26px !important;
  262. margin-bottom: 10px;
  263. font-weight: 700;
  264. }
  265. .item_mouth {
  266. border-left: 1px solid #ccc;
  267. }
  268. .card_two {
  269. height: 200px;
  270. border-radius: 20px;
  271. background-color: #f5f5f5;
  272. box-shadow: 0 0 0 1px #ccc;
  273. }
  274. .grid_row {
  275. width: 96%;
  276. padding: 0 10px;
  277. position: relative;
  278. top: -20px;
  279. }
  280. .cell_item {
  281. height: 30px;
  282. line-height: 30px;
  283. text-align: center;
  284. border-bottom: 1px solid #eee;
  285. }
  286. .card_two_title {
  287. height: 30px;
  288. /* line-height: 30px; */
  289. margin:10px 0px ;
  290. font-size: 12px;
  291. }
  292. </style>