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