Commit 199d3ebb69a3e51466101aee30ac6ac2afa8d414

Authored by xingyu4j
1 parent 16b3e910

perf: vxe

yudao-ui-admin-vue3/src/components/Descriptions/src/Descriptions.vue
1 1 <script setup lang="ts">
  2 +import dayjs from 'dayjs'
2 3 import { ElCollapseTransition, ElDescriptions, ElDescriptionsItem, ElTooltip } from 'element-plus'
3 4 import { useDesign } from '@/hooks/web/useDesign'
4 5 import { propTypes } from '@/utils/propTypes'
... ... @@ -111,7 +112,13 @@ const toggleClick = () =&gt; {
111 112 </template>
112 113  
113 114 <template #default>
114   - <slot :name="item.field" :row="data">{{ data[item.field] }}</slot>
  115 + <slot v-if="item.dateFormat">
  116 + {{ dayjs(data[item.field]).format(item.dateFormat) }}
  117 + </slot>
  118 + <slot v-else-if="item.dictType">
  119 + <DictTag :type="item.dictType" :value="data[item.field]" />
  120 + </slot>
  121 + <slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot>
115 122 </template>
116 123 </ElDescriptionsItem>
117 124 </ElDescriptions>
... ...
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
... ... @@ -165,6 +165,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
165 165 field: schemaItem.field,
166 166 title: schemaItem.table?.title || schemaItem.title
167 167 }
  168 + tableSchemaItem.showOverflow = 'tooltip'
168 169 if (schemaItem?.formatter) {
169 170 tableSchemaItem.formatter = schemaItem.formatter
170 171 }
... ... @@ -240,6 +241,15 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema
240 241 field: schemaItem.field,
241 242 label: schemaItem.detail?.label || schemaItem.title
242 243 }
  244 + if (schemaItem.dictType) {
  245 + descriptionsSchemaItem.dictType = schemaItem.dictType
  246 + }
  247 + if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') {
  248 + // descriptionsSchemaItem.dateFormat = schemaItem.detail.dateFormat
  249 + // ? schemaItem?.detail?.dateFormat
  250 + // : 'YYYY-MM-DD HH:mm:ss'
  251 + descriptionsSchemaItem.dateFormat = 'YYYY-MM-DD HH:mm:ss'
  252 + }
243 253  
244 254 descriptionsSchema.push(descriptionsSchemaItem)
245 255 }
... ...
yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts
... ... @@ -43,10 +43,6 @@ export const useVxeGrid = &lt;T = any&gt;(config?: UseVxeGridConfig&lt;T&gt;) =&gt; {
43 43 isCurrent: true, // 当鼠标点击行时,是否要高亮当前行
44 44 isHover: true // 当鼠标移到行时,是否要高亮当前行
45 45 },
46   - showOverflow: 'tooltip', // 当内容溢出时显示为省略号
47   - tooltipConfig: {
48   - showAll: true // 开启全表工具提示
49   - },
50 46 toolbarConfig: {
51 47 custom: true,
52 48 slots: { buttons: 'toolbar_buttons' }
... ...
yudao-ui-admin-vue3/src/types/descriptions.d.ts
... ... @@ -8,4 +8,6 @@ export interface DescriptionsSchema {
8 8 labelAlign?: 'left' | 'center' | 'right'
9 9 className?: string
10 10 labelClassName?: string
  11 + dateFormat?: string
  12 + dictType?: string
11 13 }
... ...
yudao-ui-admin-vue3/src/views/system/errorCode/index.vue
... ... @@ -46,14 +46,7 @@
46 46 v-if="actionType === 'detail'"
47 47 :schema="allSchemas.detailSchema"
48 48 :data="detailRef"
49   - >
50   - <template #type="{ row }">
51   - <DictTag :type="DICT_TYPE.SYSTEM_ERROR_CODE_TYPE" :value="row.type" />
52   - </template>
53   - <template #createTime="{ row }">
54   - <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
55   - </template>
56   - </Descriptions>
  49 + />
57 50 </template>
58 51 <!-- 操作按钮 -->
59 52 <template #footer>
... ... @@ -71,8 +64,6 @@
71 64  
72 65 <script setup lang="ts">
73 66 import { ref, unref } from 'vue'
74   -import dayjs from 'dayjs'
75   -import { DICT_TYPE } from '@/utils/dict'
76 67 import type { ErrorCodeVO } from '@/api/system/errorCode/types'
77 68 import { rules, allSchemas } from './errorCode.data'
78 69 import * as ErrorCodeApi from '@/api/system/errorCode'
... ...
yudao-ui-admin-vue3/src/views/system/post/index.vue
... ... @@ -45,14 +45,7 @@
45 45 v-if="actionType === 'detail'"
46 46 :schema="allSchemas.detailSchema"
47 47 :data="detailRef"
48   - >
49   - <template #status="{ row }">
50   - <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
51   - </template>
52   - <template #createTime="{ row }">
53   - <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
54   - </template>
55   - </Descriptions>
  48 + />
56 49 </template>
57 50 <template #footer>
58 51 <XButton
... ... @@ -68,8 +61,6 @@
68 61 </template>
69 62 <script setup lang="ts">
70 63 import { ref, unref } from 'vue'
71   -import dayjs from 'dayjs'
72   -import { DICT_TYPE } from '@/utils/dict'
73 64 import * as PostApi from '@/api/system/post'
74 65 import { PostVO } from '@/api/system/post/types'
75 66 import { rules, allSchemas } from './post.data'
... ...