Commit 199d3ebb69a3e51466101aee30ac6ac2afa8d414

Authored by xingyu4j
1 parent 16b3e910

perf: vxe

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