data.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. // 引入Day.js库
  2. const dayjs = require('dayjs');
  3. // 获取本月日期列表的函数
  4. function getDatesInMonth() {
  5. let year = dayjs().year()
  6. let month = dayjs().month()
  7. const dates = [];
  8. const startDate = dayjs(new Date(year, month, 1));
  9. const endDate = dayjs(new Date(year, month + 1, 1)).subtract(1, 'day');
  10. let currentDate = startDate;
  11. while (currentDate.isBefore(endDate) || currentDate.isSame(endDate, 'day')) {
  12. dates.push(currentDate.format('YYYY-MM-DD'));
  13. currentDate = currentDate.add(1, 'day');
  14. }
  15. return dates;
  16. }
  17. export const columns = [
  18. {
  19. columnKey: 'index',
  20. label: '序号',
  21. type: 'index',
  22. width: 55,
  23. align: 'center',
  24. showOverflowTooltip: true,
  25. fixed: 'left'
  26. },
  27. {
  28. prop: 'name',
  29. label: '生产订单名称',
  30. align: 'center',
  31. showOverflowTooltip: true,
  32. },
  33. {
  34. prop: 'name',
  35. label: '生产订单编号',
  36. align: 'center',
  37. showOverflowTooltip: true,
  38. },
  39. {
  40. prop: 'name1',
  41. label: '订单状态',
  42. align: 'center',
  43. showOverflowTooltip: true,
  44. },
  45. {
  46. prop: 'qualified',
  47. label: '计划开始日期',
  48. minWidth: '120',
  49. align: 'center',
  50. showOverflowTooltip: true,
  51. },
  52. {
  53. prop: 'qualified',
  54. label: '计划完成日期',
  55. minWidth: '120',
  56. align: 'center',
  57. showOverflowTooltip: true,
  58. },
  59. {
  60. prop: 'name12',
  61. label: '产品名称',
  62. align: 'center',
  63. showOverflowTooltip: true,
  64. }, {
  65. prop: 'name12',
  66. label: '产品编码',
  67. align: 'center',
  68. showOverflowTooltip: true,
  69. }, {
  70. prop: 'name12',
  71. label: '规格型号',
  72. align: 'center',
  73. showOverflowTooltip: true,
  74. }, {
  75. prop: 'name12',
  76. label: '数量(个)',
  77. align: 'center',
  78. showOverflowTooltip: true,
  79. }, {
  80. prop: 'name12',
  81. label: '生产单位',
  82. align: 'center',
  83. showOverflowTooltip: true,
  84. }, {
  85. prop: 'name12',
  86. label: '交期状态',
  87. align: 'center',
  88. showOverflowTooltip: true,
  89. },
  90. ];
  91. export const lineOption = (data, itemStyle = {}) => {
  92. return {
  93. tooltip: {
  94. formatter: (item) => {
  95. return item.name + ":" + item.seriesName + " " + item.value
  96. },
  97. trigger: 'item'
  98. },
  99. legend: {
  100. // bottom: '2%',
  101. itemGap: window.innerHeight * 0.014,
  102. textStyle: {
  103. fontSize: window.innerHeight * 0.013,
  104. }
  105. },
  106. grid: {
  107. left: 40,
  108. bottom: "13%"//也可设置left和right设置距离来控制图表的大小
  109. },
  110. color: ['#1890ff'],
  111. xAxis: {
  112. type: 'category',
  113. data: ['10/2', '10/3', '10/4', '10/5', '10/6', '10/7', '10/8'],
  114. axisLabel: {
  115. fontSize: window.innerHeight * 0.012,
  116. }
  117. },
  118. yAxis: [
  119. {
  120. type: 'value',
  121. max: 100,
  122. min: 0,
  123. axisLabel: {
  124. show: true,
  125. formatter: "{value}%", //右侧Y轴文字显示
  126. },
  127. nameTextStyle: {
  128. align: 'center',
  129. color: "#333",
  130. fontSize: window.innerHeight * 0.012,
  131. padding: [0, 20, -3, 0]
  132. },
  133. },
  134. ],
  135. series: [
  136. {
  137. name: '过程控',
  138. symbolSize: 10,
  139. data: data[0],
  140. type: 'line',
  141. itemStyle: {
  142. // color: '#ffab08'
  143. },
  144. }, {
  145. name: '产品控',
  146. symbolSize: 10,
  147. data: data[1],
  148. type: 'line',
  149. itemStyle: {
  150. // color: '#ffab08'
  151. },
  152. }
  153. ]
  154. }
  155. }
  156. export const barOption = ( xData,series) => {
  157. return {
  158. tooltip: {
  159. formatter: (item) => {
  160. return item.name + ":" + item.seriesName + " " + item.value
  161. },
  162. trigger: 'item'
  163. },
  164. legend: {
  165. // bottom: '2%',
  166. itemGap: window.innerHeight * 0.014,
  167. textStyle: {
  168. fontSize: window.innerHeight * 0.013,
  169. }
  170. },
  171. grid: {
  172. left: 40,
  173. right: 55,
  174. bottom: "13%"//也可设置left和right设置距离来控制图表的大小
  175. },
  176. color: ['#1890ff'],
  177. xAxis: {
  178. type: 'category',
  179. data:xData ,
  180. axisLabel: {
  181. fontSize: window.innerHeight * 0.012,
  182. }
  183. },
  184. yAxis: [
  185. {
  186. type: 'value',
  187. // name: '(个)',
  188. nameTextStyle: {
  189. align: 'center',
  190. color: "#333",
  191. fontSize: window.innerHeight * 0.012,
  192. padding: [0, 20, -3, 0]
  193. },
  194. },
  195. {
  196. type: 'value',
  197. max: 100,
  198. min: 0,
  199. axisLabel: {
  200. show: true,
  201. formatter: "{value}%", //右侧Y轴文字显示
  202. }
  203. }
  204. ],
  205. series
  206. }
  207. }
  208. export const pieOption = (data) => {
  209. return {
  210. color: ['#398f4e', '#458ef7', '#fdc537', '#fe6869', '#975fe6'],
  211. tooltip: {
  212. // formatter: '{b}:{c}' + '%',
  213. trigger: 'item'
  214. },
  215. // legend: {
  216. // orient: 'horizontal',
  217. // left: 'right',
  218. // right: '15%',
  219. // bottom: '5%',
  220. // itemGap: window.innerHeight * 0.018,
  221. // textStyle: {
  222. // fontSize: window.innerHeight * 0.014,
  223. // }
  224. // },
  225. series: [
  226. {
  227. center: ['50%', '50%'],
  228. label: {
  229. position: 'outside',
  230. show: true,
  231. formatter: (item) => {
  232. return item.name + ":" + item.value+'/'+item.percent +'%'
  233. },
  234. fontSize: window.innerHeight * 0.014,
  235. // color:"#fff"
  236. },
  237. labelLine: {
  238. show: true,
  239. },
  240. type: 'pie',
  241. radius: '70%',
  242. itemStyle: {
  243. borderWidth: 0,
  244. shadowBlur: 10,
  245. shadowColor: 'rgba(0, 0, 0, 0.5)'
  246. },
  247. data
  248. }
  249. ]
  250. }
  251. }