refactor: Descriptions

This commit is contained in:
xingyu4j 2022-11-15 17:05:05 +08:00
parent cbd2815c8e
commit 70b8dcb174
24 changed files with 26 additions and 184 deletions

View File

@ -183,6 +183,14 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[
field: schemaItem.field, field: schemaItem.field,
label: schemaItem.detail?.label || schemaItem.label label: schemaItem.detail?.label || schemaItem.label
} }
if (schemaItem.dictType) {
descriptionsSchemaItem.dictType = schemaItem.dictType
}
if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') {
descriptionsSchemaItem.dateFormat = schemaItem.dateFormat
? schemaItem?.detail?.dateFormat
: 'YYYY-MM-DD HH:mm:ss'
}
// 删除不必要的字段 // 删除不必要的字段
delete descriptionsSchemaItem.show delete descriptionsSchemaItem.show

View File

@ -149,14 +149,7 @@ getList()
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 #footer> <template #footer>
<el-button <el-button

View File

@ -205,12 +205,6 @@ onMounted(async () => {
{{ getUserNickName(userId) + ' ' }} {{ getUserNickName(userId) + ' ' }}
</span> </span>
</template> </template>
<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> </Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>

View File

@ -199,11 +199,7 @@ getList()
v-if="actionType === 'detail'" v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema" :schema="allSchemas.detailSchema"
:data="detailRef" :data="detailRef"
> />
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
</Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>
<el-button <el-button

View File

@ -105,14 +105,7 @@ getList()
<XModal v-model="dialogVisible" :title="t('action.detail')"> <XModal v-model="dialogVisible" :title="t('action.detail')">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef"> <Descriptions :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 #footer> <template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>

View File

@ -78,12 +78,6 @@ getList()
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef"> <Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #userType="{ row }">
<DictTag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />
</template>
<template #beginTime="{ row }">
<span>{{ dayjs(row.beginTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
<template #duration="{ row }"> <template #duration="{ row }">
<span>{{ row.duration + 'ms' }}</span> <span>{{ row.duration + 'ms' }}</span>
</template> </template>

View File

@ -116,17 +116,7 @@ getList()
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef"> <Descriptions :schema="allSchemas.detailSchema" :data="detailRef" />
<template #userType="{ row }">
<DictTag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />
</template>
<template #processStatus="{ row }">
<DictTag :type="DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS" :value="row.processStatus" />
</template>
<template #exceptionTime="{ row }">
<span>{{ dayjs(row.exceptionTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
</Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>

View File

@ -175,12 +175,6 @@ getList()
<template #visible="{ row }"> <template #visible="{ row }">
<span>{{ row.visible ? '是' : '否' }} </span> <span>{{ row.visible ? '是' : '否' }} </span>
</template> </template>
<template #type="{ row }">
<DictTag :type="DICT_TYPE.INFRA_CONFIG_TYPE" :value="row.type" />
</template>
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
</Descriptions> </Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>

View File

@ -144,11 +144,7 @@ onMounted(async () => {
v-if="actionType === 'detail'" v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema" :schema="allSchemas.detailSchema"
:data="detailRef" :data="detailRef"
> />
<template #createTime="{ row }">
<span>{{ row.createTime ? dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') : '' }}</span>
</template>
</Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>
<el-button <el-button

View File

@ -189,17 +189,7 @@ getList()
v-if="actionType === 'detail'" v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema" :schema="allSchemas.detailSchema"
:data="detailRef" :data="detailRef"
> />
<template #storage="{ row }">
<DictTag :type="DICT_TYPE.INFRA_FILE_STORAGE" :value="row.storage" />
</template>
<template #primary="{ row }">
<DictTag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="row.master" />
</template>
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
</Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>
<el-button <el-button

View File

@ -161,9 +161,6 @@ getList()
/> />
<span>{{ row.url }}</span> <span>{{ row.url }}</span>
</template> </template>
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
</Descriptions> </Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>

View File

@ -98,9 +98,6 @@ onMounted(() => {
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef"> <Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #status="{ row }">
<DictTag :type="DICT_TYPE.INFRA_JOB_LOG_STATUS" :value="row.status" />
</template>
<template #retryInterval="{ row }"> <template #retryInterval="{ row }">
<span>{{ row.retryInterval + '毫秒' }} </span> <span>{{ row.retryInterval + '毫秒' }} </span>
</template> </template>

View File

@ -226,9 +226,6 @@ getList()
:schema="allSchemas.detailSchema" :schema="allSchemas.detailSchema"
:data="detailRef" :data="detailRef"
> >
<template #status="{ row }">
<DictTag :type="DICT_TYPE.INFRA_JOB_STATUS" :value="row.status" />
</template>
<template #retryInterval="{ row }"> <template #retryInterval="{ row }">
<span>{{ row.retryInterval + '毫秒' }} </span> <span>{{ row.retryInterval + '毫秒' }} </span>
</template> </template>

View File

@ -168,14 +168,7 @@ getList()
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 #footer> <template #footer>
<el-button <el-button

View File

@ -168,14 +168,7 @@ getList()
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 #footer> <template #footer>
<el-button <el-button

View File

@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import dayjs from 'dayjs'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
import { useTable } from '@/hooks/web/useTable' import { useTable } from '@/hooks/web/useTable'
@ -153,14 +152,7 @@ getList()
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 #footer> <template #footer>
<el-button <el-button

View File

@ -95,14 +95,7 @@ getList()
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) --> <!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef"> <Descriptions :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 #footer> <template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>

View File

@ -276,17 +276,7 @@ onMounted(() => {
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_ROLE_TYPE" :value="row.type" />
</template>
<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 #footer> <template #footer>
<el-button <el-button
@ -300,7 +290,7 @@ onMounted(() => {
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template> </template>
</XModal> </XModal>
<XModal v-model="dialogScopeVisible" :title="dialogScopeTitle" max-height="600px"> <XModal v-model="dialogScopeVisible" :title="dialogScopeTitle">
<el-form :model="dataScopeForm"> <el-form :model="dataScopeForm">
<el-form-item label="角色名称"> <el-form-item label="角色名称">
<el-input v-model="dataScopeForm.name" :disabled="true" /> <el-input v-model="dataScopeForm.name" :disabled="true" />

View File

@ -193,14 +193,7 @@ onMounted(async () => {
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 #footer> <template #footer>
<el-button <el-button

View File

@ -162,17 +162,7 @@ getList()
v-if="actionType === 'detail'" v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema" :schema="allSchemas.detailSchema"
:data="detailRef" :data="detailRef"
> />
<template #code="{ row }">
<DictTag :type="DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE" :value="row.code" />
</template>
<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 #footer> <template #footer>
<el-button <el-button

View File

@ -80,17 +80,7 @@ getList()
v-if="actionType === 'detail'" v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema" :schema="allSchemas.detailSchema"
:data="detailRef" :data="detailRef"
> />
<template #code="{ row }">
<DictTag :type="DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE" :value="row.code" />
</template>
<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 #footer> <template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>

View File

@ -210,17 +210,7 @@ getList()
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_SMS_TEMPLATE_TYPE" :value="row.code" />
</template>
<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 #footer> <template #footer>
<el-button <el-button

View File

@ -218,19 +218,10 @@ onMounted(async () => {
:schema="allSchemas.detailSchema" :schema="allSchemas.detailSchema"
:data="detailRef" :data="detailRef"
> >
<template #status="{ row }">
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
</template>
<template #packageId="{ row }"> <template #packageId="{ row }">
<el-tag v-if="row.packageId === 0" type="danger">系统租户</el-tag> <el-tag v-if="row.packageId === 0" type="danger">系统租户</el-tag>
<el-tag v-else type="success"> {{ getPackageName(row.packageId) }} </el-tag> <el-tag v-else type="success"> {{ getPackageName(row.packageId) }} </el-tag>
</template> </template>
<template #expireTime="{ row }">
<span>{{ dayjs(row.expireTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
</Descriptions> </Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>

View File

@ -19,7 +19,6 @@ import {
UploadRawFile UploadRawFile
} from 'element-plus' } from 'element-plus'
import { handleTree } from '@/utils/tree' import { handleTree } from '@/utils/tree'
import { DICT_TYPE } from '@/utils/dict'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useTable } from '@/hooks/web/useTable' import { useTable } from '@/hooks/web/useTable'
import { FormExpose } from '@/components/Form' import { FormExpose } from '@/components/Form'
@ -457,12 +456,6 @@ onMounted(async () => {
</template> </template>
</el-tag> </el-tag>
</template> </template>
<template #status="{ row }">
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
</template>
<template #loginDate="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
</Descriptions> </Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>
@ -478,7 +471,7 @@ onMounted(async () => {
</template> </template>
</XModal> </XModal>
<!-- 分配用户角色 --> <!-- 分配用户角色 -->
<XModal v-model="roleDialogVisible" title="分配角色" maxHeight="450px"> <XModal v-model="roleDialogVisible" title="分配角色">
<el-form :model="userRole" label-width="80px"> <el-form :model="userRole" label-width="80px">
<el-form-item label="用户名称"> <el-form-item label="用户名称">
<el-input v-model="userRole.username" :disabled="true" /> <el-input v-model="userRole.username" :disabled="true" />
@ -507,12 +500,7 @@ onMounted(async () => {
</template> </template>
</XModal> </XModal>
<!-- 导入 --> <!-- 导入 -->
<XModal <XModal v-model="importDialogVisible" :title="importDialogTitle">
v-model="importDialogVisible"
:title="importDialogTitle"
:destroy-on-close="true"
maxHeight="350px"
>
<el-form class="drawer-multiColumn-form" label-width="150px"> <el-form class="drawer-multiColumn-form" label-width="150px">
<el-form-item label="模板下载 :"> <el-form-item label="模板下载 :">
<el-button type="primary" @click="handleImportTemp"> <el-button type="primary" @click="handleImportTemp">