2025-03-14 17:13:19 +08:00
<!--
* 主应用页面
*
* @ Author : 1024 创新实验室 - 主任 : 卓大
* @ Date : 2022 - 09 - 12 23 : 46 : 47
* @ Wechat : zhuda1024
* @ Email : lab1024 @ 163. com
* @ Copyright 1024 创新实验室 ( https : //1024lab.net ) , Since 2012
-- >
< template >
< a -config -provider
2025-05-10 14:43:49 +08:00
: locale = "antdLocale"
: theme = " {
2025-03-14 17:13:19 +08:00
algorithm : compactFlag ? theme . compactAlgorithm : theme . defaultAlgorithm ,
token : {
2025-05-10 14:43:49 +08:00
fontFamily : '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji' ,
fontsize : '14px' ,
2025-03-14 17:13:19 +08:00
colorPrimary : themeColors [ colorIndex ] . primaryColor ,
colorLink : themeColors [ colorIndex ] . primaryColor ,
colorLinkActive : themeColors [ colorIndex ] . activeColor ,
colorLinkHover : themeColors [ colorIndex ] . hoverColor ,
colorIcon : themeColors [ colorIndex ] . primaryColor ,
borderRadius : borderRadius ,
} ,
components : {
Button : {
colorLink : themeColors [ colorIndex ] . primaryColor ,
colorLinkActive : themeColors [ colorIndex ] . activeColor ,
colorLinkHover : themeColors [ colorIndex ] . hoverColor ,
} ,
Icon : {
colorIcon : themeColors [ colorIndex ] . primaryColor ,
} ,
} ,
} "
2025-05-10 14:43:49 +08:00
: transformCellText = "transformCellText"
2025-03-14 17:13:19 +08:00
>
<!-- - 全局loading -- - >
< a -spin :spinning ="spinning" tip = "稍等片刻,我在拼命加载中..." size = "large" >
<!-- - 路由 -- >
2025-05-10 14:43:49 +08:00
< RouterView / >
2025-03-14 17:13:19 +08:00
< / a - s p i n >
< / a - c o n f i g - p r o v i d e r >
< / template >
< script setup lang = "ts" >
2025-05-10 14:43:49 +08:00
import dayjs from 'dayjs' ;
import { computed , h , useSlots , watch } from 'vue' ;
import { messages } from '/@/i18n' ;
import { useAppConfigStore } from '/@/store/modules/system/app-config' ;
import { useSpinStore } from '/@/store/modules/system/spin' ;
import { theme } from 'ant-design-vue' ;
import { themeColors } from '/@/theme/color.js' ;
import { Popover } from 'ant-design-vue' ;
import SmartCopyIcon from '/@/components/framework/smart-copy-icon/index.vue' ;
import _ from 'lodash' ;
2025-03-14 17:13:19 +08:00
2025-05-10 14:43:49 +08:00
const slots = useSlots ( ) ;
const antdLocale = computed ( ( ) => messages [ useAppConfigStore ( ) . language ] . antdLocale ) ;
const dayjsLocale = computed ( ( ) => messages [ useAppConfigStore ( ) . language ] . dayjsLocale ) ;
dayjs . locale ( dayjsLocale ) ;
2025-03-14 17:13:19 +08:00
2025-05-10 14:43:49 +08:00
// 全局loading
let spinStore = useSpinStore ( ) ;
const spinning = computed ( ( ) => spinStore . loading ) ;
// 是否紧凑
const compactFlag = computed ( ( ) => useAppConfigStore ( ) . compactFlag ) ;
// 主题颜色
const colorIndex = computed ( ( ) => {
return useAppConfigStore ( ) . colorIndex ;
} ) ;
// 圆角
const borderRadius = computed ( ( ) => {
return useAppConfigStore ( ) . borderRadius ;
} ) ;
function transformCellText ( { text , column , record , index } ) {
if ( column && column . textEllipsisFlag === true ) {
return h (
2025-03-14 17:13:19 +08:00
Popover ,
2025-05-10 14:43:49 +08:00
{ placement : 'bottom' } ,
2025-03-14 17:13:19 +08:00
{
default : ( ) =>
2025-05-10 14:43:49 +08:00
h ( 'div' , {
style : { whiteSpace : 'nowrap' , overflow : 'hidden' , textOverflow : 'ellipsis' } ,
id : ` ${ column . dataIndex } ${ index } `
} , text ) ,
2025-03-14 17:13:19 +08:00
content : ( ) =>
2025-05-10 14:43:49 +08:00
h ( 'div' , { style : { display : 'flex' } } , [
h ( 'div' , text ) ,
h ( SmartCopyIcon , { value : document . getElementById ( ` ${ column . dataIndex } ${ index } ` ) . innerText } ) ,
] ) ,
2025-03-14 17:13:19 +08:00
}
2025-05-10 14:43:49 +08:00
) ;
} else {
return text ;
2025-03-14 17:13:19 +08:00
}
2025-05-10 14:43:49 +08:00
}
// 监听主题颜色变化, 更新CSS变量
/ * w a t c h ( ( ) = > c o l o r I n d e x . v a l u e , ( n e w V a l ) = > {
document . documentElement . style . setProperty ( '--primary-color' , themeColors [ newVal ] . primaryColor ) ;
} , { immediate : true } ) ; * /
2025-03-14 17:13:19 +08:00
< / script >
< style scoped lang = "less" >
2025-05-10 14:43:49 +08:00
/ * : d e e p ( . a n t - t a b l e - c o l u m n - s o r t e r s ) {
align - items : flex - start ! important ;
} * /
/ * : d e e p ( . a n t - t a b l e - t h e a d > t r > t h ) {
background - color : var ( -- primary - color ) ! important ;
color : black ! important ;
} * /
: deep ( . ant - table - thead > tr > th ) {
background - color : # FAFAFA ! important ;
}
2025-03-14 17:13:19 +08:00
< / style >