common.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="ele-body">
  3. <el-row :gutter="5">
  4. <el-col :span="13" style="height: 50%">
  5. <el-card class="box-card">
  6. <div slot="header" class="clearfix">
  7. <span>采销统计</span>
  8. </div>
  9. <v-chart ref="barRef" style="height: 100%" :option="barOption" />
  10. </el-card>
  11. </el-col>
  12. <el-col :span="11" style="height: 50%">
  13. <el-card class="box-card">
  14. <div slot="header" class="clearfix">
  15. <span style="cursor: pointer;" @click="handelRouterTo('/page-eos/saleManage/saleOrder')">销售订单进度情况</span>
  16. </div>
  17. <ele-pro-table
  18. ref="table"
  19. :pageSize="20"
  20. :columns="columns"
  21. :datasource="datasource"
  22. :toolbar="false"
  23. height="calc(100% - 45px)"
  24. >
  25. </ele-pro-table>
  26. </el-card>
  27. </el-col>
  28. <el-col :span="11" style="height: 50%; margin-top: 5px">
  29. <el-card class="box-card">
  30. <div slot="header" class="clearfix">
  31. <span style="cursor: pointer;" @click="handelRouterTo('/page-eos/purchaseOrder')">采购订单进度情况</span>
  32. </div>
  33. <ele-pro-table
  34. ref="table"
  35. :columns="columns1"
  36. :pageSize="20"
  37. :datasource="datasource1"
  38. :toolbar="false"
  39. height="calc(100% - 45px)"
  40. >
  41. </ele-pro-table>
  42. </el-card>
  43. </el-col>
  44. <el-col :span="13" style="height: 50%; margin-top: 5px">
  45. <el-card class="box-card">
  46. <div slot="header" class="clearfix">
  47. <span>应收应付统计</span>
  48. </div>
  49. <v-chart ref="barRef1" style="height: 100%" :option="barOption1" />
  50. </el-card>
  51. </el-col>
  52. </el-row>
  53. </div>
  54. </template>
  55. <script>
  56. import { pieOption, barOption, columns, columns1 } from './data';
  57. import { use } from 'echarts/core';
  58. import { CanvasRenderer } from 'echarts/renderers';
  59. import { BarChart } from 'echarts/charts';
  60. import {
  61. GridComponent,
  62. TooltipComponent,
  63. LegendComponent
  64. } from 'echarts/components';
  65. import VChart from 'vue-echarts';
  66. import { echartsMixin } from '@/utils/echarts-mixin';
  67. import { indexGroup } from '@/api/main/index.js';
  68. import { init } from 'echarts';
  69. import { getTableList } from '@/api/purchasingManage/purchaseOrder';
  70. import { getTableListHome } from '@/api/saleManage/saleorder';
  71. // 按需加载 echarts
  72. use([
  73. CanvasRenderer,
  74. BarChart,
  75. GridComponent,
  76. TooltipComponent,
  77. LegendComponent
  78. ]);
  79. export default {
  80. mixins: [echartsMixin(['barRef', 'barRef1'])],
  81. components: { VChart },
  82. data() {
  83. return {
  84. columns,
  85. columns1,
  86. barOption: {},
  87. barOption1: {},
  88. timer: null
  89. };
  90. },
  91. created() {},
  92. mounted() {
  93. this.init();
  94. this.timer = setInterval(() => {
  95. this.init();
  96. }, 3600000);
  97. },
  98. beforeDestroy() {
  99. clearInterval(this.timer);
  100. },
  101. methods: {
  102. handelRouterTo(path) {
  103. window.history.pushState(null, '', path);
  104. },
  105. init() {
  106. indexGroup().then((res) => {
  107. console.log(res, 'res');
  108. this.barOption = barOption(
  109. res.saleAndPurchaseGroup?.monthName,
  110. [
  111. {
  112. name: '采购',
  113. barWidth: '25%',
  114. data: res.saleAndPurchaseGroup.purchaseCounts,
  115. type: 'bar',
  116. yAxisIndex: 0, // 使用第一个Y轴
  117. itemStyle: {
  118. color: '#f9cd5d'
  119. }
  120. },
  121. {
  122. name: '销售',
  123. barWidth: '25%',
  124. data: res.saleAndPurchaseGroup.saleCounts,
  125. type: 'bar',
  126. yAxisIndex: 0, // 使用第一个Y轴
  127. itemStyle: {
  128. color: '#5893eb'
  129. }
  130. }
  131. ],
  132. );
  133. this.barOption1 = barOption(
  134. res.payableAndReceivableGroup?.monthName,
  135. [
  136. {
  137. name: '应收',
  138. barWidth: '25%',
  139. data: res.payableAndReceivableGroup?.receivableCounts,
  140. type: 'bar',
  141. yAxisIndex: 0 // 使用第一个Y轴
  142. },
  143. {
  144. name: '应付',
  145. barWidth: '25%',
  146. data: res.payableAndReceivableGroup?.payableCounts,
  147. type: 'bar',
  148. yAxisIndex: 0 // 使用第一个Y轴
  149. }
  150. ],
  151. '(万元)'
  152. );
  153. setTimeout(() => {
  154. this.$refs.barRef.resize();
  155. this.$refs.barRef1.resize();
  156. }, 300);
  157. });
  158. },
  159. datasource({ page, where, limit }) {
  160. return getTableListHome({
  161. ...where,
  162. pageNum: page,
  163. size: limit,
  164. // progress: 1000
  165. });
  166. },
  167. datasource1({ page, where, limit }) {
  168. return getTableList({
  169. ...where,
  170. pageNum: page,
  171. size: limit,
  172. // progress: 1000
  173. });
  174. }
  175. }
  176. };
  177. </script>
  178. <style lang="scss" scoped>
  179. .clearfix {
  180. font-size: 0.7vw;
  181. > span {
  182. font-weight: bold;
  183. }
  184. :deep(.el-radio-button__inner) {
  185. font-size: 0.7vw;
  186. }
  187. }
  188. .ele-body {
  189. height: calc(100vh - 100px);
  190. > .el-row {
  191. height: 100%;
  192. }
  193. .el-card {
  194. height: 100%;
  195. :deep(.el-card__body) {
  196. padding: 0.3vw;
  197. }
  198. :deep(.el-card__header) {
  199. padding: 0.6vw;
  200. }
  201. :deep(.el-card__body) {
  202. height: calc(100% - 2.3vw);
  203. }
  204. :deep(.ele-pro-table) {
  205. height: 99%;
  206. }
  207. :deep(.el-table) {
  208. font-size: 0.62vw;
  209. }
  210. }
  211. }
  212. </style>