vxe-formatter.ts 682 B

12345678910111213141516171819202122232425
  1. import {VxeColumnPropTypes} from "vxe-table";
  2. import {VXETable} from 'vxe-table'
  3. import XEUtils from "xe-utils";
  4. VXETable.formats.mixin({
  5. formatDate({cellValue}, format: string = 'yy-MM-dd HH:mm') {
  6. return XEUtils.toDateString(cellValue, format)
  7. },
  8. formatSex({cellValue}) {
  9. if (cellValue) {
  10. if (cellValue == 1) {
  11. return '男'
  12. }
  13. if (cellValue == 2) {
  14. return '女'
  15. }
  16. return '其他'
  17. }
  18. return ''
  19. },
  20. })
  21. export const vxeFormatTime: VxeColumnPropTypes.Formatter = ({cellValue}) => {
  22. return XEUtils.toDateString(cellValue, 'yy-MM-dd HH:mm')
  23. }