mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 03:01:53 +08:00
perf: vxe
This commit is contained in:
parent
16b3e910e4
commit
199d3ebb69
@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import dayjs from 'dayjs'
|
||||||
import { ElCollapseTransition, ElDescriptions, ElDescriptionsItem, ElTooltip } from 'element-plus'
|
import { ElCollapseTransition, ElDescriptions, ElDescriptionsItem, ElTooltip } from 'element-plus'
|
||||||
import { useDesign } from '@/hooks/web/useDesign'
|
import { useDesign } from '@/hooks/web/useDesign'
|
||||||
import { propTypes } from '@/utils/propTypes'
|
import { propTypes } from '@/utils/propTypes'
|
||||||
@ -111,7 +112,13 @@ const toggleClick = () => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #default>
|
<template #default>
|
||||||
<slot :name="item.field" :row="data">{{ data[item.field] }}</slot>
|
<slot v-if="item.dateFormat">
|
||||||
|
{{ dayjs(data[item.field]).format(item.dateFormat) }}
|
||||||
|
</slot>
|
||||||
|
<slot v-else-if="item.dictType">
|
||||||
|
<DictTag :type="item.dictType" :value="data[item.field]" />
|
||||||
|
</slot>
|
||||||
|
<slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot>
|
||||||
</template>
|
</template>
|
||||||
</ElDescriptionsItem>
|
</ElDescriptionsItem>
|
||||||
</ElDescriptions>
|
</ElDescriptions>
|
||||||
|
@ -165,6 +165,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
|
|||||||
field: schemaItem.field,
|
field: schemaItem.field,
|
||||||
title: schemaItem.table?.title || schemaItem.title
|
title: schemaItem.table?.title || schemaItem.title
|
||||||
}
|
}
|
||||||
|
tableSchemaItem.showOverflow = 'tooltip'
|
||||||
if (schemaItem?.formatter) {
|
if (schemaItem?.formatter) {
|
||||||
tableSchemaItem.formatter = schemaItem.formatter
|
tableSchemaItem.formatter = schemaItem.formatter
|
||||||
}
|
}
|
||||||
@ -240,6 +241,15 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema
|
|||||||
field: schemaItem.field,
|
field: schemaItem.field,
|
||||||
label: schemaItem.detail?.label || schemaItem.title
|
label: schemaItem.detail?.label || schemaItem.title
|
||||||
}
|
}
|
||||||
|
if (schemaItem.dictType) {
|
||||||
|
descriptionsSchemaItem.dictType = schemaItem.dictType
|
||||||
|
}
|
||||||
|
if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') {
|
||||||
|
// descriptionsSchemaItem.dateFormat = schemaItem.detail.dateFormat
|
||||||
|
// ? schemaItem?.detail?.dateFormat
|
||||||
|
// : 'YYYY-MM-DD HH:mm:ss'
|
||||||
|
descriptionsSchemaItem.dateFormat = 'YYYY-MM-DD HH:mm:ss'
|
||||||
|
}
|
||||||
|
|
||||||
descriptionsSchema.push(descriptionsSchemaItem)
|
descriptionsSchema.push(descriptionsSchemaItem)
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,6 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
|
|||||||
isCurrent: true, // 当鼠标点击行时,是否要高亮当前行
|
isCurrent: true, // 当鼠标点击行时,是否要高亮当前行
|
||||||
isHover: true // 当鼠标移到行时,是否要高亮当前行
|
isHover: true // 当鼠标移到行时,是否要高亮当前行
|
||||||
},
|
},
|
||||||
showOverflow: 'tooltip', // 当内容溢出时显示为省略号
|
|
||||||
tooltipConfig: {
|
|
||||||
showAll: true // 开启全表工具提示
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
custom: true,
|
custom: true,
|
||||||
slots: { buttons: 'toolbar_buttons' }
|
slots: { buttons: 'toolbar_buttons' }
|
||||||
|
@ -8,4 +8,6 @@ export interface DescriptionsSchema {
|
|||||||
labelAlign?: 'left' | 'center' | 'right'
|
labelAlign?: 'left' | 'center' | 'right'
|
||||||
className?: string
|
className?: string
|
||||||
labelClassName?: string
|
labelClassName?: string
|
||||||
|
dateFormat?: string
|
||||||
|
dictType?: string
|
||||||
}
|
}
|
||||||
|
@ -46,14 +46,7 @@
|
|||||||
v-if="actionType === 'detail'"
|
v-if="actionType === 'detail'"
|
||||||
:schema="allSchemas.detailSchema"
|
:schema="allSchemas.detailSchema"
|
||||||
:data="detailRef"
|
:data="detailRef"
|
||||||
>
|
/>
|
||||||
<template #type="{ row }">
|
|
||||||
<DictTag :type="DICT_TYPE.SYSTEM_ERROR_CODE_TYPE" :value="row.type" />
|
|
||||||
</template>
|
|
||||||
<template #createTime="{ row }">
|
|
||||||
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
|
||||||
</template>
|
|
||||||
</Descriptions>
|
|
||||||
</template>
|
</template>
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@ -71,8 +64,6 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, unref } from 'vue'
|
import { ref, unref } from 'vue'
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
|
||||||
import type { ErrorCodeVO } from '@/api/system/errorCode/types'
|
import type { ErrorCodeVO } from '@/api/system/errorCode/types'
|
||||||
import { rules, allSchemas } from './errorCode.data'
|
import { rules, allSchemas } from './errorCode.data'
|
||||||
import * as ErrorCodeApi from '@/api/system/errorCode'
|
import * as ErrorCodeApi from '@/api/system/errorCode'
|
||||||
|
@ -45,14 +45,7 @@
|
|||||||
v-if="actionType === 'detail'"
|
v-if="actionType === 'detail'"
|
||||||
:schema="allSchemas.detailSchema"
|
:schema="allSchemas.detailSchema"
|
||||||
:data="detailRef"
|
:data="detailRef"
|
||||||
>
|
/>
|
||||||
<template #status="{ row }">
|
|
||||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
|
||||||
</template>
|
|
||||||
<template #createTime="{ row }">
|
|
||||||
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
|
||||||
</template>
|
|
||||||
</Descriptions>
|
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<XButton
|
<XButton
|
||||||
@ -68,8 +61,6 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, unref } from 'vue'
|
import { ref, unref } from 'vue'
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
|
||||||
import * as PostApi from '@/api/system/post'
|
import * as PostApi from '@/api/system/post'
|
||||||
import { PostVO } from '@/api/system/post/types'
|
import { PostVO } from '@/api/system/post/types'
|
||||||
import { rules, allSchemas } from './post.data'
|
import { rules, allSchemas } from './post.data'
|
||||||
|
Loading…
Reference in New Issue
Block a user