data.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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. prop: 'name',
  20. minWidth: '120',
  21. label: '里程碑名称',
  22. align: 'center',
  23. showOverflowTooltip: true,
  24. },
  25. {
  26. prop: 'name',
  27. minWidth: '120',
  28. label: '计划进度',
  29. align: 'center',
  30. showOverflowTooltip: true,
  31. },
  32. {
  33. prop: 'name1',
  34. minWidth: '120',
  35. label: '实际进度',
  36. align: 'center',
  37. showOverflowTooltip: true,
  38. },
  39. {
  40. prop: 'qualified',
  41. label: '状态',
  42. minWidth: '120',
  43. align: 'center',
  44. showOverflowTooltip: true,
  45. },
  46. {
  47. prop: 'qualified',
  48. label: '执行者',
  49. minWidth: '120',
  50. align: 'center',
  51. showOverflowTooltip: true,
  52. },
  53. {
  54. prop: 'name12',
  55. minWidth: '120',
  56. label: '延期天数',
  57. align: 'center',
  58. showOverflowTooltip: true,
  59. }
  60. ];
  61. export const columns1 = [
  62. {
  63. prop: 'name',
  64. minWidth: '120',
  65. label: '任务名称',
  66. align: 'center',
  67. showOverflowTooltip: true,
  68. },
  69. {
  70. prop: 'name',
  71. minWidth: '150',
  72. label: '计划开始时间',
  73. align: 'center',
  74. showOverflowTooltip: true,
  75. },
  76. {
  77. prop: 'name1',
  78. minWidth: '150',
  79. label: '计划结束时间',
  80. align: 'center',
  81. showOverflowTooltip: true,
  82. },
  83. {
  84. prop: 'qualified',
  85. label: '计划进度',
  86. minWidth: '120',
  87. align: 'center',
  88. showOverflowTooltip: true,
  89. },
  90. {
  91. prop: 'qualified',
  92. label: '实际进度',
  93. minWidth: '120',
  94. align: 'center',
  95. showOverflowTooltip: true,
  96. },
  97. {
  98. prop: 'name12',
  99. minWidth: '120',
  100. label: '状态',
  101. align: 'center',
  102. showOverflowTooltip: true,
  103. },
  104. {
  105. prop: 'name12',
  106. minWidth: '120',
  107. label: '执行者',
  108. align: 'center',
  109. showOverflowTooltip: true,
  110. },
  111. {
  112. prop: 'name12',
  113. minWidth: '120',
  114. label: '延期天数',
  115. align: 'center',
  116. showOverflowTooltip: true,
  117. }
  118. ];
  119. export const columns2 = [
  120. {
  121. prop: 'name',
  122. minWidth: '120',
  123. label: '任务名称',
  124. align: 'center',
  125. showOverflowTooltip: true,
  126. },
  127. {
  128. prop: 'name',
  129. minWidth: '150',
  130. label: '计划开始时间',
  131. align: 'center',
  132. showOverflowTooltip: true,
  133. },
  134. {
  135. prop: 'name1',
  136. minWidth: '150',
  137. label: '计划结束时间',
  138. align: 'center',
  139. showOverflowTooltip: true,
  140. },
  141. {
  142. prop: 'qualified',
  143. label: '计划进度',
  144. minWidth: '120',
  145. align: 'center',
  146. showOverflowTooltip: true,
  147. },
  148. {
  149. prop: 'qualified',
  150. label: '实际进度',
  151. minWidth: '120',
  152. align: 'center',
  153. showOverflowTooltip: true,
  154. },
  155. {
  156. prop: 'name12',
  157. minWidth: '120',
  158. label: '状态',
  159. align: 'center',
  160. showOverflowTooltip: true,
  161. },
  162. {
  163. prop: 'name12',
  164. minWidth: '120',
  165. label: '执行者',
  166. align: 'center',
  167. showOverflowTooltip: true,
  168. }
  169. ];
  170. export const columns3 = [
  171. {
  172. prop: 'name',
  173. minWidth: '120',
  174. label: '名称',
  175. align: 'center',
  176. showOverflowTooltip: true,
  177. },
  178. {
  179. prop: 'name',
  180. minWidth: '150',
  181. label: '任务数量',
  182. align: 'center',
  183. showOverflowTooltip: true,
  184. },
  185. {
  186. prop: 'name1',
  187. minWidth: '150',
  188. label: '未完成任务数量',
  189. align: 'center',
  190. showOverflowTooltip: true,
  191. },
  192. {
  193. prop: 'qualified',
  194. label: '延期任务数量',
  195. minWidth: '120',
  196. align: 'center',
  197. showOverflowTooltip: true,
  198. },
  199. ];
  200. export const lineOption = (data, itemStyle = {}) => {
  201. return {
  202. tooltip: {
  203. formatter: (item) => {
  204. return item.name + ":" + item.seriesName + " " + item.value
  205. },
  206. trigger: 'item'
  207. },
  208. legend: {
  209. // bottom: '2%',
  210. itemGap: window.innerHeight * 0.014,
  211. textStyle: {
  212. fontSize: window.innerHeight * 0.013,
  213. }
  214. },
  215. grid: {
  216. left: 40,
  217. bottom: "13%"//也可设置left和right设置距离来控制图表的大小
  218. },
  219. color: ['#1890ff'],
  220. xAxis: {
  221. type: 'category',
  222. data: ['10/2', '10/3', '10/4', '10/5', '10/6', '10/7', '10/8'],
  223. axisLabel: {
  224. fontSize: window.innerHeight * 0.012,
  225. }
  226. },
  227. yAxis: [
  228. {
  229. type: 'value',
  230. max: 100,
  231. min: 0,
  232. axisLabel: {
  233. show: true,
  234. formatter: "{value}%", //右侧Y轴文字显示
  235. },
  236. nameTextStyle: {
  237. align: 'center',
  238. color: "#333",
  239. fontSize: window.innerHeight * 0.012,
  240. padding: [0, 20, -3, 0]
  241. },
  242. },
  243. ],
  244. series: [
  245. {
  246. name: '过程控',
  247. symbolSize: 10,
  248. data: data[0],
  249. type: 'line',
  250. itemStyle: {
  251. // color: '#ffab08'
  252. },
  253. }, {
  254. name: '产品控',
  255. symbolSize: 10,
  256. data: data[1],
  257. type: 'line',
  258. itemStyle: {
  259. // color: '#ffab08'
  260. },
  261. }
  262. ]
  263. }
  264. }
  265. export const barOption = ( xData,series) => {
  266. return {
  267. tooltip: {
  268. formatter: (item) => {
  269. return item.name + ":" + item.seriesName + " " + item.value
  270. },
  271. trigger: 'item'
  272. },
  273. legend: {
  274. // bottom: '2%',
  275. itemGap: window.innerHeight * 0.014,
  276. textStyle: {
  277. fontSize: window.innerHeight * 0.013,
  278. }
  279. },
  280. grid: {
  281. left: 40,
  282. right: 55,
  283. bottom: "13%"//也可设置left和right设置距离来控制图表的大小
  284. },
  285. color: ['#1890ff'],
  286. xAxis: {
  287. type: 'category',
  288. data:xData ,
  289. axisLabel: {
  290. fontSize: window.innerHeight * 0.012,
  291. }
  292. },
  293. yAxis: [
  294. {
  295. type: 'value',
  296. // name: '(个)',
  297. nameTextStyle: {
  298. align: 'center',
  299. color: "#333",
  300. fontSize: window.innerHeight * 0.012,
  301. padding: [0, 20, -3, 0]
  302. },
  303. },
  304. {
  305. type: 'value',
  306. max: 100,
  307. min: 0,
  308. axisLabel: {
  309. show: true,
  310. formatter: "{value}%", //右侧Y轴文字显示
  311. }
  312. }
  313. ],
  314. series
  315. }
  316. }
  317. export const pieOption = (data) => {
  318. return {
  319. color: ['#fd625e','#458ef7'],
  320. tooltip: {
  321. // formatter: '{b}:{c}' + '%',
  322. trigger: 'item'
  323. },
  324. // legend: {
  325. // orient: 'horizontal',
  326. // left: 'right',
  327. // right: '15%',
  328. // bottom: '5%',
  329. // itemGap: window.innerHeight * 0.018,
  330. // textStyle: {
  331. // fontSize: window.innerHeight * 0.014,
  332. // }
  333. // },
  334. series: [
  335. {
  336. center: ['50%', '50%'],
  337. label: {
  338. position: 'outside',
  339. show: true,
  340. formatter: (item) => {
  341. return item.name + ":" + item.value+'/'+item.percent +'%'
  342. },
  343. fontSize: window.innerHeight * 0.014,
  344. // color:"#fff"
  345. },
  346. labelLine: {
  347. show: true,
  348. },
  349. type: 'pie',
  350. radius: '70%',
  351. itemStyle: {
  352. borderWidth: 0,
  353. shadowBlur: 10,
  354. shadowColor: 'rgba(0, 0, 0, 0.5)'
  355. },
  356. data
  357. }
  358. ]
  359. }
  360. }