xingyu4j 2 年 前
コミット
199d3ebb69

+ 8 - 1
yudao-ui-admin-vue3/src/components/Descriptions/src/Descriptions.vue

@@ -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>

+ 10 - 0
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts

@@ -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)
     }

+ 0 - 4
yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts

@@ -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' }

+ 2 - 0
yudao-ui-admin-vue3/src/types/descriptions.d.ts

@@ -8,4 +8,6 @@ export interface DescriptionsSchema {
   labelAlign?: 'left' | 'center' | 'right'
   className?: string
   labelClassName?: string
+  dateFormat?: string
+  dictType?: string
 }

+ 1 - 10
yudao-ui-admin-vue3/src/views/system/errorCode/index.vue

@@ -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'

+ 1 - 10
yudao-ui-admin-vue3/src/views/system/post/index.vue

@@ -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'