PointStructureChart.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <!--suppress ALL -->
  2. <template>
  3. <ve-pie :legend="pieLegend" :series="pieseries" :legend-visible="true" width="300px"
  4. height="150px"
  5. class="card-panel-pichart"/>
  6. </template>
  7. <script>
  8. import Vue from 'vue'
  9. import VCharts from 'v-charts'
  10. Vue.use(VCharts)
  11. export default {
  12. data() {
  13. return {
  14. pieseries:
  15. {
  16. name: '姓名',
  17. type: 'pie',
  18. radius: 55,
  19. center: [100, 80],
  20. label: {show: false},
  21. data: [],
  22. itemStyle: {
  23. emphasis: {
  24. shadowBlur: 10,
  25. shadowOffsetX: 0,
  26. shadowColor: 'rgba(0, 0, 0, 0.5)'
  27. }
  28. }
  29. },
  30. pieLegend: {
  31. type: 'scroll',
  32. orient: 'vertical',
  33. right: 10,
  34. top: 30,
  35. bottom: 20,
  36. data: []
  37. }
  38. }
  39. },
  40. created() {
  41. this.get_chart_data()
  42. this.get_rank_data()
  43. this.get_manager_auth_info()
  44. },
  45. filters: {
  46. dateTimeFormatter: function (cellValue) {
  47. return cellValue ? moment(cellValue * 1000).format('MM-DD HH:mm') : ''
  48. },
  49. },
  50. methods: {
  51. getCurrMonthDays() {
  52. let date = []
  53. let start = moment().add('month', 0).format('YYYY-MM') + '-01'
  54. let end = moment(start).add('month', 1).add('days', -1).format('YYYY-MM-DD')
  55. date.push(start)
  56. date.push(end)
  57. return date
  58. },
  59. get_rank_data() {
  60. const self = this
  61. const time_range = self.getCurrMonthDays()
  62. console.log(moment(self.getCurrMonthDays()[0]).format('x'))
  63. const time_start = moment(time_range[0]).format('x')/1000
  64. const time_end = moment(time_range[1]).format('x')/1000 + (3600*24-1)
  65. const params = {
  66. employee_id: self.profile.id,
  67. time_range: time_start + ',' + time_end
  68. }
  69. this.$http('get','/integral.php/point_data/get_employee_rank',params).then((response) => {
  70. if (response.status == 200) {
  71. var jsonData = response.data
  72. try {
  73. self.rank_info = jsonData.data
  74. console.log(self.rank_info)
  75. } catch (err) {
  76. console.log(err)
  77. }
  78. }
  79. }).catch(function (error) {
  80. console.log(error)
  81. })
  82. },
  83. get_manager_auth_info() {
  84. const self = this
  85. const time_range = self.getCurrMonthDays()
  86. console.log(moment(self.getCurrMonthDays()[0]).format('x'))
  87. const time_start = moment(time_range[0]).format('x')/1000
  88. const time_end = moment(time_range[1]).format('x')/1000 + (3600*24-1)
  89. const params = {
  90. employee_id: self.profile.id,
  91. time_range: time_start + ',' + time_end
  92. }
  93. this.$http('get','/integral.php/point_data/get_manager_auth_info',params).then((response) => {
  94. if (response.status == 200) {
  95. var jsonData = response.data
  96. try {
  97. self.auth_info['addSum'] = 0
  98. self.auth_info['deduct_addCount'] = 0
  99. self.auth_info['deductSum'] = 0
  100. if(jsonData.data.length == 1){
  101. self.auth_info['addSum'] = jsonData.data[0].point*1
  102. self.auth_info['deduct_addCount'] += jsonData.data[0].rec_count*1
  103. }else if(jsonData.data.length == 2){
  104. self.auth_info['addSum'] = jsonData.data[0].point*1
  105. self.auth_info['deduct_addCount'] += jsonData.data[0].rec_count*1
  106. self.auth_info['deductSum'] = jsonData.data[1].point*1
  107. self.auth_info['deduct_addCount'] += jsonData.data[1].rec_count*1
  108. }
  109. console.log(self.auth_info)
  110. } catch (err) {
  111. console.log(err)
  112. }
  113. }
  114. }).catch(function (error) {
  115. console.log(error)
  116. })
  117. },
  118. get_chart_data() {
  119. const self = this
  120. const time_now = moment(Date.now(), 'YYYY-MM-DD HH:mm:ss')._i / 1000
  121. const time_end = time_now - 24 * 3600 * 30
  122. const params = {
  123. employee_id: self.profile.id,
  124. target_id: self.profile.id,
  125. point_type: 0,
  126. time_range: time_end + ',' + time_now
  127. }
  128. this.$http('get','/integral.php/point_data/chart_data_by_employee',params).then((response) => {
  129. if (response.status == 200) {
  130. var jsonData = response.data
  131. try {
  132. // 饼图
  133. const pieseries = []
  134. const pieLegend = []
  135. for (const item in jsonData.structure_positive_chart_data) {
  136. pieseries.push({
  137. value: jsonData.structure_positive_chart_data[item][1],
  138. name: jsonData.structure_positive_chart_data[item][0] + '(' + jsonData.structure_positive_chart_data[item][1] + ')'
  139. })
  140. pieLegend.push(jsonData.structure_positive_chart_data[item][0] + '(' + jsonData.structure_positive_chart_data[item][1] + ')')
  141. }
  142. self.$set(self.pieseries, 'data', pieseries)
  143. self.$set(self.pieLegend, 'data', pieLegend)
  144. // 线图
  145. const lineData = []
  146. for (const item in jsonData.trend_chart_data.labels) {
  147. lineData.push({
  148. '日期': jsonData.trend_chart_data.labels[item],
  149. '奖分': jsonData.trend_chart_data.p_positive[item],
  150. '扣分': jsonData.trend_chart_data.p_negative[item] * -1
  151. })
  152. }
  153. self.$set(self.chartData02, 'rows', lineData)
  154. } catch (err) {
  155. console.log(err)
  156. }
  157. }
  158. }).catch(function (error) {
  159. console.log(error)
  160. })
  161. }
  162. }
  163. }
  164. </script>
  165. <style rel="stylesheet/scss" lang="scss">
  166. .charts-pie-box {
  167. float: left;
  168. }
  169. .charts-tag li {
  170. list-style-type: none;
  171. line-height: 2;
  172. font-size: 14px;
  173. }
  174. .charts-tag li span {
  175. display: inline;
  176. padding: 0px 12px;
  177. margin-right: 12px;
  178. border-radius: 2px;
  179. }
  180. .person-panel {
  181. width: 100%;
  182. height: 330px;
  183. overflow: hidden;
  184. padding: 0 !important;
  185. margin: 0 !important;
  186. margin-bottom: 10px !important;
  187. margin-top: 18px;
  188. .card-panel-left {
  189. padding-right: 0px !important;
  190. padding-left: 0 !important;
  191. }
  192. .card-panel {
  193. font-size: 12px;
  194. overflow: hidden;
  195. color: #666;
  196. background: #fff;
  197. box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
  198. border-color: rgba(0, 0, 0, .05);
  199. .card-panel-icon-wrapper {
  200. color: #fff;
  201. }
  202. .icon-people {
  203. background: rgba(216, 216, 216, 1);
  204. }
  205. .icon-people {
  206. color: #fff;
  207. }
  208. .card-panel-icon-wrapper {
  209. float: left;
  210. margin: 25px 0 0 36px;
  211. transition: all 0.38s ease-out;
  212. border-radius: 100%;
  213. }
  214. .card-panel-icon {
  215. float: left;
  216. font-size: 36px;
  217. }
  218. .card-panel-img_01 {
  219. width: 20px;
  220. margin-left: 15px;
  221. }
  222. .card-panel-description {
  223. float: left;
  224. margin-top: 31px;
  225. margin-left: 15px;
  226. .card-panel-text {
  227. font-weight: bold;
  228. line-height: 18px;
  229. color: #606266;
  230. font-size: 16px;
  231. margin-bottom: 12px;
  232. }
  233. .card-panel-text span{color:#666; font-size: 12px; font-weight: normal;}
  234. }
  235. .card-panel-updatetext {
  236. float: left;
  237. color: #606266;
  238. font-size: 14px;
  239. margin-top: 48px;
  240. margin-left: 60px;
  241. .card-panel-timetext {
  242. white-space: nowrap;
  243. }
  244. }
  245. .card-panel-BP {
  246. float: left;
  247. color: #606266;
  248. width: 100%;
  249. font-size: 14px;
  250. margin-top: 20px;
  251. margin-left: 10px;
  252. margin-right: 944px;
  253. display: flex;
  254. flex-direction: row;
  255. flex-wrap: wrap;
  256. text-align: center;
  257. .card-panel-BP01 {
  258. width: 33.333%;
  259. }
  260. .card-panel-BP02 {
  261. width: 33.333%;
  262. }
  263. .card-panel-BP03 {
  264. width: 33.333%;
  265. }
  266. .x-sidebar {
  267. float: left;
  268. height: 67px;
  269. border-right: 0.09rem solid #DDDDDD;
  270. }
  271. }
  272. .card-panel-BP-text {
  273. font-family: "Microsoft YaHei";
  274. color: rgba(144, 147, 153, 1);
  275. font-size: 14px;
  276. white-space: nowrap;
  277. line-height: 19px;
  278. text-align: center;
  279. .card-panel-img_02 {
  280. max-height: .3rem;
  281. }
  282. }
  283. .card-panel-num {
  284. font-family: "Microsoft YaHei";
  285. font-size: 32px;
  286. color: rgba(245, 108, 108, 1);
  287. }
  288. .card-panel-tasktitle {
  289. font-family: "Microsoft YaHei";
  290. color: rgba(85, 85, 85, 1);
  291. float: left;
  292. width: 120px;
  293. height: 10px;
  294. font-size: 16px;
  295. font-size: 14px;
  296. margin-left: 35px;
  297. margin-right: 906px;
  298. }
  299. .card-panel-Score {
  300. float: left;
  301. color: #606266;
  302. width: 100%;
  303. font-size: 14px;
  304. margin-top: 10px;
  305. margin-left: 10px;
  306. display: flex;
  307. flex-direction: row;
  308. flex-wrap: wrap;
  309. text-align: center;
  310. .card-panel-Score01 {
  311. width: 100%;
  312. }
  313. .card-panel-Score02 {
  314. width: 100%;
  315. }
  316. .card-panel-Score03 {
  317. width: 100%;
  318. }
  319. .x-sidebar {
  320. float: left;
  321. height: 67px;
  322. border-right: 0.09rem solid #DDDDDD;
  323. }
  324. }
  325. .card-panel-Score-text {
  326. font-family: "Microsoft YaHei";
  327. color: rgba(144, 147, 153, 1);
  328. font-size: 14px;
  329. white-space: nowrap;
  330. line-height: 19px;
  331. text-align: center;
  332. }
  333. .card-panel-mark {
  334. font-family: "Microsoft YaHei";
  335. font-size: 32px;
  336. color: rgba(91, 139, 247, 1);
  337. }
  338. }
  339. .card-panel-right {
  340. float: right;
  341. padding: 0px !important;
  342. background: #fff;
  343. }
  344. }
  345. .person-panel .card-panel {
  346. box-shadow: none !important;
  347. border: none;
  348. }
  349. </style>