// 引入Day.js库 const dayjs = require('dayjs'); import { saleOrderProgressStatusEnum,purchaseOrderProgressStatusEnum } from '@/enum/dict'; // 获取本月日期列表的函数 function getDatesInMonth() { let year = dayjs().year(); let month = dayjs().month(); const dates = []; const startDate = dayjs(new Date(year, month, 1)); const endDate = dayjs(new Date(year, month + 1, 1)).subtract(1, 'day'); let currentDate = startDate; while (currentDate.isBefore(endDate) || currentDate.isSame(endDate, 'day')) { dates.push(currentDate.format('YYYY-MM-DD')); currentDate = currentDate.add(1, 'day'); } return dates; } export const columns = [ { columnKey: 'index', label: '序号', type: 'index', width: 55, align: 'center', showOverflowTooltip: true, fixed: 'left' }, { prop: 'orderNo', label: '订单编码', align: 'center', showOverflowTooltip: true }, { prop: 'needProduce', label: '类型', align: 'center', showOverflowTooltip: true, formatter: (_row, _column, cellValue) => { return cellValue==1?'有客户生产性订单':cellValue==2?'无客户生产性订单':cellValue==4?'不定向订单':'库存式订单' } }, { prop: 'productCodes', label: '产品编码', align: 'center', showOverflowTooltip: true }, { prop: 'productNames', label: '产品名称', align: 'center', showOverflowTooltip: true }, { prop: 'productCount', label: '总数', align: 'center', width: 70, showOverflowTooltip: true }, { prop: 'progress', label: '进度', align: 'center', showOverflowTooltip: true, formatter: (_row, _column, cellValue) => { return saleOrderProgressStatusEnum.find( (val) => val.value == _row.progress )?.label; } } ]; export const columns1 = [ { columnKey: 'index', label: '序号', type: 'index', width: 55, align: 'center', showOverflowTooltip: true, fixed: 'left' }, { prop: 'orderNo', label: '订单编码', align: 'center', showOverflowTooltip: true }, { prop: 'sourceTypeName', label: '类型', align: 'center', showOverflowTooltip: true }, { prop: 'productCodes', label: '产品编码', align: 'center', showOverflowTooltip: true }, { prop: 'productNames', label: '产品名称', align: 'center', showOverflowTooltip: true }, { prop: 'productCount', label: '总数', align: 'center', showOverflowTooltip: true }, { prop: 'progress', label: '进度', align: 'center', showOverflowTooltip: true, formatter: (_row, _column, cellValue) => { return purchaseOrderProgressStatusEnum.find( (val) => val.value == _row.progress )?.label; }, } ]; export const barOption = (xData, series,name) => { return { tooltip: { formatter: (item) => { return item.name + ':' + item.seriesName + ' ' + item.value; }, trigger: 'item' }, legend: { // bottom: '2%', itemGap: window.innerHeight * 0.014, textStyle: { fontSize: window.innerHeight * 0.013 } }, grid: { left: 40, right: 55, bottom: '13%' //也可设置left和right设置距离来控制图表的大小 }, color: ['#1890ff'], xAxis: { type: 'category', data: xData, axisLabel: { fontSize: window.innerHeight * 0.012 } }, yAxis: [ { type: 'value', name, nameTextStyle: { align: 'center', color: '#333', fontSize: window.innerHeight * 0.012, padding: [0, 20, -3, 0] } } ], series }; };