Commit efb4cf0c66798fcd774266655f109538dbc163fb
1 parent
4bc76458
fix: print Params
Showing
4 changed files
with
27 additions
and
12 deletions
yudao-ui-admin-vue3/src/hooks/web/useMessage.ts
| @@ -52,13 +52,25 @@ export const useMessage = () => { | @@ -52,13 +52,25 @@ export const useMessage = () => { | ||
| 52 | ElNotification.warning(content) | 52 | ElNotification.warning(content) |
| 53 | }, | 53 | }, |
| 54 | // 确认窗体 | 54 | // 确认窗体 |
| 55 | - confirm(content: string, tip: string) { | ||
| 56 | - return ElMessageBox.confirm(content, tip, { | 55 | + confirm(content: string, tip?: string) { |
| 56 | + return ElMessageBox.confirm(content, tip ? tip : t('common.confirmTitle'), { | ||
| 57 | confirmButtonText: t('common.ok'), | 57 | confirmButtonText: t('common.ok'), |
| 58 | cancelButtonText: t('common.cancel'), | 58 | cancelButtonText: t('common.cancel'), |
| 59 | type: 'warning' | 59 | type: 'warning' |
| 60 | }) | 60 | }) |
| 61 | }, | 61 | }, |
| 62 | + // 删除窗体 | ||
| 63 | + delConfirm(content?: string, tip?: string) { | ||
| 64 | + return ElMessageBox.confirm( | ||
| 65 | + content ? content : t('common.delMessage'), | ||
| 66 | + tip ? tip : t('common.confirmTitle'), | ||
| 67 | + { | ||
| 68 | + confirmButtonText: t('common.ok'), | ||
| 69 | + cancelButtonText: t('common.cancel'), | ||
| 70 | + type: 'warning' | ||
| 71 | + } | ||
| 72 | + ) | ||
| 73 | + }, | ||
| 62 | // 提交内容 | 74 | // 提交内容 |
| 63 | prompt(content: string, tip: string) { | 75 | prompt(content: string, tip: string) { |
| 64 | return ElMessageBox.prompt(content, tip, { | 76 | return ElMessageBox.prompt(content, tip, { |
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
| @@ -18,7 +18,7 @@ export type VxeCrudSchema = Omit<VxeTableColumn, 'children'> & { | @@ -18,7 +18,7 @@ export type VxeCrudSchema = Omit<VxeTableColumn, 'children'> & { | ||
| 18 | table?: CrudTableParams | 18 | table?: CrudTableParams |
| 19 | form?: CrudFormParams | 19 | form?: CrudFormParams |
| 20 | detail?: CrudDescriptionsParams | 20 | detail?: CrudDescriptionsParams |
| 21 | - print?: boolean | 21 | + print?: CrudPrintParams |
| 22 | children?: VxeCrudSchema[] | 22 | children?: VxeCrudSchema[] |
| 23 | dictType?: string | 23 | dictType?: string |
| 24 | } | 24 | } |
| @@ -42,6 +42,11 @@ type CrudDescriptionsParams = { | @@ -42,6 +42,11 @@ type CrudDescriptionsParams = { | ||
| 42 | show?: boolean | 42 | show?: boolean |
| 43 | } & Omit<DescriptionsSchema, 'field'> | 43 | } & Omit<DescriptionsSchema, 'field'> |
| 44 | 44 | ||
| 45 | +type CrudPrintParams = { | ||
| 46 | + // 是否显示表单项 | ||
| 47 | + show?: boolean | ||
| 48 | +} & Omit<VxeTableDefines.ColumnInfo[], 'field'> | ||
| 49 | + | ||
| 45 | interface VxeAllSchemas { | 50 | interface VxeAllSchemas { |
| 46 | searchSchema: VxeFormItemProps[] | 51 | searchSchema: VxeFormItemProps[] |
| 47 | tableSchema: VxeGridPropTypes.Columns | 52 | tableSchema: VxeGridPropTypes.Columns |
| @@ -233,7 +238,7 @@ const filterPrintSchema = (crudSchema: VxeCrudSchema[]): any[] => { | @@ -233,7 +238,7 @@ const filterPrintSchema = (crudSchema: VxeCrudSchema[]): any[] => { | ||
| 233 | 238 | ||
| 234 | eachTree(crudSchema, (schemaItem: VxeCrudSchema) => { | 239 | eachTree(crudSchema, (schemaItem: VxeCrudSchema) => { |
| 235 | // 判断是否显示 | 240 | // 判断是否显示 |
| 236 | - if (schemaItem?.detail?.show !== false) { | 241 | + if (schemaItem?.print?.show !== false) { |
| 237 | const printSchemaItem = { | 242 | const printSchemaItem = { |
| 238 | field: schemaItem.field | 243 | field: schemaItem.field |
| 239 | } | 244 | } |
yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts
yudao-ui-admin-vue3/src/views/system/post/index.vue
| @@ -79,24 +79,23 @@ | @@ -79,24 +79,23 @@ | ||
| 79 | <script setup lang="ts"> | 79 | <script setup lang="ts"> |
| 80 | import { ref } from 'vue' | 80 | import { ref } from 'vue' |
| 81 | import dayjs from 'dayjs' | 81 | import dayjs from 'dayjs' |
| 82 | -import { useI18n } from '@/hooks/web/useI18n' | ||
| 83 | -import { VxeFormEvents, VxeFormInstance, VxeFormItemProps, VxeGridInstance } from 'vxe-table' | ||
| 84 | -import * as PostApi from '@/api/system/post' | ||
| 85 | import { DICT_TYPE } from '@/utils/dict' | 82 | import { DICT_TYPE } from '@/utils/dict' |
| 86 | -import { ContentWrap } from '@/components/ContentWrap' | 83 | +import * as PostApi from '@/api/system/post' |
| 87 | import { PostVO } from '@/api/system/post/types' | 84 | import { PostVO } from '@/api/system/post/types' |
| 88 | import { rules, allSchemas } from './post.data' | 85 | import { rules, allSchemas } from './post.data' |
| 86 | +import { useI18n } from '@/hooks/web/useI18n' | ||
| 89 | import { useMessage } from '@/hooks/web/useMessage' | 87 | import { useMessage } from '@/hooks/web/useMessage' |
| 90 | import { useVxeGrid } from '@/hooks/web/useVxeGrid' | 88 | import { useVxeGrid } from '@/hooks/web/useVxeGrid' |
| 89 | +import { VxeFormEvents, VxeFormInstance, VxeFormItemProps, VxeGridInstance } from 'vxe-table' | ||
| 91 | 90 | ||
| 92 | const { t } = useI18n() // 国际化 | 91 | const { t } = useI18n() // 国际化 |
| 93 | -const message = useMessage() | 92 | +const message = useMessage() // 消息弹窗 |
| 94 | const xGrid = ref<VxeGridInstance>() | 93 | const xGrid = ref<VxeGridInstance>() |
| 95 | const xForm = ref<VxeFormInstance>() | 94 | const xForm = ref<VxeFormInstance>() |
| 96 | const dialogVisible = ref(false) // 是否显示弹出层 | 95 | const dialogVisible = ref(false) // 是否显示弹出层 |
| 97 | const dialogTitle = ref('edit') // 弹出层标题 | 96 | const dialogTitle = ref('edit') // 弹出层标题 |
| 98 | const actionType = ref('') // 操作按钮的类型 | 97 | const actionType = ref('') // 操作按钮的类型 |
| 99 | -const actionLoading = ref(false) // 遮罩层 | 98 | +const actionLoading = ref(false) // 按钮Loading |
| 100 | 99 | ||
| 101 | const gridOptions = useVxeGrid(allSchemas, PostApi.getPostPageApi) | 100 | const gridOptions = useVxeGrid(allSchemas, PostApi.getPostPageApi) |
| 102 | const formData = ref<PostVO>() | 101 | const formData = ref<PostVO>() |
| @@ -130,7 +129,7 @@ const handleUpdate = async (rowId: number) => { | @@ -130,7 +129,7 @@ const handleUpdate = async (rowId: number) => { | ||
| 130 | // 删除操作 | 129 | // 删除操作 |
| 131 | const handleDelete = (rowId: number) => { | 130 | const handleDelete = (rowId: number) => { |
| 132 | message | 131 | message |
| 133 | - .confirm(t('common.delMessage'), t('common.confirmTitle')) | 132 | + .delConfirm() |
| 134 | .then(async () => { | 133 | .then(async () => { |
| 135 | await PostApi.deletePostApi(rowId) | 134 | await PostApi.deletePostApi(rowId) |
| 136 | message.success(t('common.delSuccess')) | 135 | message.success(t('common.delSuccess')) |