index.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. const herfurl = window.location.href.split('index')[0] //跳转地址
  2. let app = new Vue({
  3. el: '#app',
  4. data() {
  5. return {
  6. time: '',
  7. timeout: 15000, // 一分钟发一次心跳
  8. pageindex: 0,
  9. comprehensive: [{
  10. title: '年度累计额销售额',
  11. number: 0,
  12. image: './image/index/01.png',
  13. unit: '万'
  14. }, {
  15. title: '季度累计销售',
  16. number: 0,
  17. image: './image/index/01.png',
  18. unit: '万'
  19. }, {
  20. title: '本月累计销售额',
  21. number: 0,
  22. image: './image/index/01.png',
  23. unit: '万'
  24. }, {
  25. title: '累计销售回款率',
  26. number: 0,
  27. image: './image/index/01.png',
  28. unit: '%'
  29. }, {
  30. title: '年度累计采购支出',
  31. number: 0,
  32. image: './image/index/01.png',
  33. unit: '万'
  34. }, {
  35. title: '季度累计采购支出',
  36. number: 0,
  37. image: './image/index/01.png',
  38. unit: '万'
  39. }, {
  40. title: '本月累计采购支出',
  41. number: 0,
  42. image: './image/index/01.png',
  43. unit: '万'
  44. }, {
  45. title: '累计采购挂帐率',
  46. number: 0,
  47. image: './image/index/01.png',
  48. unit: '%'
  49. }],
  50. dataList: [],
  51. totalCount:0,
  52. incomeOrExpenditure:'',
  53. expenditureData:{
  54. xData:[],
  55. yData:[[],[]]
  56. }
  57. }
  58. },
  59. mounted() {
  60. setTimeout(() => {
  61. //从链接地址中获取token参数
  62. let token = getQueryVariable('token')
  63. //综合概况
  64. get('/mbwb/api/v1/erpscs/ppwStatisticalScreen/getPpwGeneralOverview',{},{
  65. Authorization:token +'='
  66. }).then(res => {
  67. this.comprehensive[0].number = res.info.annualCumulativeSales
  68. this.comprehensive[1].number = res.info.quarterlyCumulativeSales
  69. this.comprehensive[2].number = res.info.monthCumulativeSales
  70. this.comprehensive[3].number = res.info.cumulativeSalesReturnRate
  71. this.comprehensive[4].number = res.info.annualCumulativePurchasingExpenditure
  72. this.comprehensive[5].number = res.info.quarterlyCumulativePurchasingExpenditure
  73. this.comprehensive[6].number = res.info.monthCumulativePurchasingExpenditure
  74. this.comprehensive[7].number = res.info.cumulativePurchaseUnpaidRate
  75. })
  76. //收支情况
  77. get('/mbwb/api/v1/erpscs/ppwStatisticalScreen/getPpwIncomeAndExpenditure',{},{
  78. Authorization:token+'='
  79. }).then(res => {
  80. this.expenditureData = res.info
  81. this.handleQuantity()
  82. })
  83. //累计实际收支
  84. get('/mbwb/api/v1/erpscs/ppwStatisticalScreen/getPpwRealIncomeAndExpenditure',{},{
  85. Authorization:token+'='
  86. }).then(res => {
  87. this.incomeOrExpenditure = res.info
  88. })
  89. //以单定产
  90. get('/mbwb/api/v1/erpscs/ppwStatisticalScreen/queryPpwSalesOrderProgress',{},{
  91. Authorization:token+'='
  92. }).then(res => {
  93. this.dataList = res.infos
  94. this.totalCount = res.totalCount
  95. })
  96. this.handleTime()
  97. }, 0)
  98. },
  99. methods: {
  100. handleTime() {
  101. setInterval(() => {
  102. this.time = dayjs().format('YYYY-MM-DD HH:mm:ss')
  103. }, 1000)
  104. },
  105. handleQuantity() {
  106. let chart = echarts.init(document.getElementById('statistics'))
  107. let option = {
  108. tooltip: {
  109. trigger: 'axis',
  110. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  111. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  112. }
  113. },
  114. grid: {
  115. left: '2%',
  116. right: '4%',
  117. bottom: '14%',
  118. top: '16%',
  119. containLabel: true
  120. },
  121. xAxis: {
  122. type: 'category',
  123. data: this.expenditureData.xData,
  124. axisLine: {
  125. lineStyle: {
  126. color: 'white'
  127. }
  128. },
  129. },
  130. //调整两个柱状图的间距
  131. yAxis: {
  132. type: 'value',
  133. axisLine: {
  134. show: false,
  135. lineStyle: {
  136. color: 'white'
  137. }
  138. },
  139. splitLine: {
  140. show: true,
  141. lineStyle: {
  142. color: 'rgba(255,255,255,0.3)'
  143. }
  144. },
  145. axisLabel: {}
  146. },
  147. series: [{
  148. name: '收入',
  149. type: 'bar',
  150. barWidth: '10%',
  151. itemStyle: {
  152. normal: {
  153. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  154. offset: 0,
  155. color: '#165ACC'
  156. }, {
  157. offset: 1,
  158. color: '#051024'
  159. }]),
  160. barBorderRadius: 10,
  161. },
  162. },
  163. data: this.expenditureData.yData[0]
  164. },
  165. {
  166. name: '支出',
  167. type: 'bar',
  168. barWidth: '10%',
  169. itemStyle: {
  170. normal: {
  171. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  172. offset: 0,
  173. color: '#FFA900'
  174. }, {
  175. offset: 1,
  176. color: '#051024'
  177. }]),
  178. barBorderRadius: 10,
  179. },
  180. },
  181. data: this.expenditureData.yData[1]
  182. }]
  183. };
  184. chart.setOption(option, true);
  185. tools.loopShowTooltip(chart, option, {
  186. nterval: 1000,
  187. loopSeries: true
  188. });
  189. },
  190. },
  191. })