import dayjs from 'dayjs' function columns(vm) { const cols = [ { title: '序号', key: 'rowIndex', width: 60, align: 'center', customRender: function(t, r, index) { return parseInt(index) + 1 } }, { title: '线别', align: 'center', dataIndex: 'lineName', key: 'lineName' }, { title: '所亭名称', align: 'center', dataIndex: 'substationName', key: 'substationName' }, { title: '设备名称', align: 'center', dataIndex: 'sbmc', key: 'sbmc' }, { title: '运行编号', align: 'center', dataIndex: 'yxbh', key: 'yxbh' }, { title: '试验周期', align: 'center', dataIndex: 'testCycle', key: 'testCycle' }, { title: '计划试验日期', align: 'center', dataIndex: 'testPlanDate', key: 'testPlanDate', customRender: function(data, r, index) { return dayjs(data).format('YYYY-MM-DD') } }, { title: '完成日期', align: 'center', dataIndex: 'completionDate', key: 'completionDate', customRender: function(data, r, index) { return dayjs(data).format('YYYY-MM-DD') } } ] return cols } export default columns