Commit efb4cf0c66798fcd774266655f109538dbc163fb

Authored by xingyu4j
1 parent 4bc76458

fix: print Params

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