data.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. // 引入Day.js库
  2. const dayjs = require('dayjs');
  3. import { saleOrderProgressStatusEnum,purchaseOrderProgressStatusEnum } from '@/enum/dict';
  4. // 获取本月日期列表的函数
  5. function getDatesInMonth() {
  6. let year = dayjs().year();
  7. let month = dayjs().month();
  8. const dates = [];
  9. const startDate = dayjs(new Date(year, month, 1));
  10. const endDate = dayjs(new Date(year, month + 1, 1)).subtract(1, 'day');
  11. let currentDate = startDate;
  12. while (currentDate.isBefore(endDate) || currentDate.isSame(endDate, 'day')) {
  13. dates.push(currentDate.format('YYYY-MM-DD'));
  14. currentDate = currentDate.add(1, 'day');
  15. }
  16. return dates;
  17. }
  18. export const columns = [
  19. {
  20. columnKey: 'index',
  21. label: '序号',
  22. type: 'index',
  23. width: 55,
  24. align: 'center',
  25. showOverflowTooltip: true,
  26. fixed: 'left'
  27. },
  28. {
  29. prop: 'orderNo',
  30. label: '订单编码',
  31. align: 'center',
  32. showOverflowTooltip: true
  33. },
  34. {
  35. prop: 'needProduce',
  36. label: '类型',
  37. align: 'center',
  38. showOverflowTooltip: true,
  39. formatter: (_row, _column, cellValue) => {
  40. return cellValue==1?'有客户生产性订单':cellValue==2?'无客户生产性订单':cellValue==4?'不定向订单':'库存式订单'
  41. }
  42. },
  43. {
  44. prop: 'productCodes',
  45. label: '产品编码',
  46. align: 'center',
  47. showOverflowTooltip: true
  48. },
  49. {
  50. prop: 'productNames',
  51. label: '产品名称',
  52. align: 'center',
  53. showOverflowTooltip: true
  54. },
  55. {
  56. prop: 'productCount',
  57. label: '总数',
  58. align: 'center',
  59. width: 70,
  60. showOverflowTooltip: true
  61. },
  62. {
  63. prop: 'progress',
  64. label: '进度',
  65. align: 'center',
  66. showOverflowTooltip: true,
  67. formatter: (_row, _column, cellValue) => {
  68. return saleOrderProgressStatusEnum.find(
  69. (val) => val.value == _row.progress
  70. )?.label;
  71. }
  72. }
  73. ];
  74. export const columns1 = [
  75. {
  76. columnKey: 'index',
  77. label: '序号',
  78. type: 'index',
  79. width: 55,
  80. align: 'center',
  81. showOverflowTooltip: true,
  82. fixed: 'left'
  83. },
  84. {
  85. prop: 'orderNo',
  86. label: '订单编码',
  87. align: 'center',
  88. showOverflowTooltip: true
  89. },
  90. {
  91. prop: 'sourceTypeName',
  92. label: '类型',
  93. align: 'center',
  94. showOverflowTooltip: true
  95. },
  96. {
  97. prop: 'productCodes',
  98. label: '产品编码',
  99. align: 'center',
  100. showOverflowTooltip: true
  101. },
  102. {
  103. prop: 'productNames',
  104. label: '产品名称',
  105. align: 'center',
  106. showOverflowTooltip: true
  107. },
  108. {
  109. prop: 'productCount',
  110. label: '总数',
  111. align: 'center',
  112. showOverflowTooltip: true
  113. },
  114. {
  115. prop: 'progress',
  116. label: '进度',
  117. align: 'center',
  118. showOverflowTooltip: true,
  119. formatter: (_row, _column, cellValue) => {
  120. return purchaseOrderProgressStatusEnum.find(
  121. (val) => val.value == _row.progress
  122. )?.label;
  123. },
  124. }
  125. ];
  126. export const barOption = (xData, series,name) => {
  127. return {
  128. tooltip: {
  129. formatter: (item) => {
  130. return item.name + ':' + item.seriesName + ' ' + item.value;
  131. },
  132. trigger: 'item'
  133. },
  134. legend: {
  135. // bottom: '2%',
  136. itemGap: window.innerHeight * 0.014,
  137. textStyle: {
  138. fontSize: window.innerHeight * 0.013
  139. }
  140. },
  141. grid: {
  142. left: 40,
  143. right: 55,
  144. bottom: '13%' //也可设置left和right设置距离来控制图表的大小
  145. },
  146. color: ['#1890ff'],
  147. xAxis: {
  148. type: 'category',
  149. data: xData,
  150. axisLabel: {
  151. fontSize: window.innerHeight * 0.012
  152. }
  153. },
  154. yAxis: [
  155. {
  156. type: 'value',
  157. name,
  158. nameTextStyle: {
  159. align: 'center',
  160. color: '#333',
  161. fontSize: window.innerHeight * 0.012,
  162. padding: [0, 20, -3, 0]
  163. }
  164. }
  165. ],
  166. series
  167. };
  168. };