You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.9 KiB
Vue

<template>
<ConfigProvider :locale="getAntdLocale">
<AppProvider>
<RouterView />
</AppProvider>
</ConfigProvider>
</template>
<script lang="ts" setup>
import { ConfigProvider } from 'ant-design-vue'
import { AppProvider } from '/@/components/Application'
import { useTitle } from '/@/hooks/web/useTitle'
import { useLocale } from '/@/locales/useLocale'
import VXETable from 'vxe-table'
import XEUtils from 'xe-utils'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')
// 自定义全局的格式化处理函数
VXETable.formats.mixin({
// 格式化性别
formatSex({ cellValue }) {
return cellValue ? (cellValue === '1' ? '男' : '女') : ''
},
// 格式化下拉选项
formatSelect({ cellValue }, list) {
const item = list.find((item) => item.value === cellValue)
return item ? item.label : ''
},
// 格式化日期,默认 yyyy-MM-dd HH:mm:ss
formatDate({ cellValue }, format) {
return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd HH:mm:ss')
},
// 四舍五入金额每隔3位逗号分隔默认2位数
formatAmount({ cellValue }, digits = 2) {
return XEUtils.commafy(Number(cellValue), { digits })
},
// 格式化银行卡默认每4位空格隔开
formatBankcard({ cellValue }) {
return XEUtils.commafy(XEUtils.toValueString(cellValue), { spaceNumber: 4, separator: ' ' })
},
// 四舍五入,默认两位数
formatFixedNumber({ cellValue }, digits = 2) {
return XEUtils.toFixed(XEUtils.round(cellValue, digits), digits)
},
// 向下舍入,默认两位数
formatCutNumber({ cellValue }, digits = 2) {
return XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits)
},
})
// support Multi-language
const { getAntdLocale } = useLocale()
// Listening to page changes and dynamically changing site titles
useTitle()
</script>