Browse Source

fix: print Params

xingyu4j 2 years ago
parent
commit
efb4cf0c66

+ 14 - 2
yudao-ui-admin-vue3/src/hooks/web/useMessage.ts

@@ -52,13 +52,25 @@ export const useMessage = () => {
       ElNotification.warning(content)
     },
     // 确认窗体
-    confirm(content: string, tip: string) {
-      return ElMessageBox.confirm(content, tip, {
+    confirm(content: string, tip?: string) {
+      return ElMessageBox.confirm(content, tip ? tip : t('common.confirmTitle'), {
         confirmButtonText: t('common.ok'),
         cancelButtonText: t('common.cancel'),
         type: 'warning'
       })
     },
+    // 删除窗体
+    delConfirm(content?: string, tip?: string) {
+      return ElMessageBox.confirm(
+        content ? content : t('common.delMessage'),
+        tip ? tip : t('common.confirmTitle'),
+        {
+          confirmButtonText: t('common.ok'),
+          cancelButtonText: t('common.cancel'),
+          type: 'warning'
+        }
+      )
+    },
     // 提交内容
     prompt(content: string, tip: string) {
       return ElMessageBox.prompt(content, tip, {

+ 7 - 2
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts

@@ -18,7 +18,7 @@ export type VxeCrudSchema = Omit<VxeTableColumn, 'children'> & {
   table?: CrudTableParams
   form?: CrudFormParams
   detail?: CrudDescriptionsParams
-  print?: boolean
+  print?: CrudPrintParams
   children?: VxeCrudSchema[]
   dictType?: string
 }
@@ -42,6 +42,11 @@ type CrudDescriptionsParams = {
   show?: boolean
 } & Omit<DescriptionsSchema, 'field'>
 
+type CrudPrintParams = {
+  // 是否显示表单项
+  show?: boolean
+} & Omit<VxeTableDefines.ColumnInfo[], 'field'>
+
 interface VxeAllSchemas {
   searchSchema: VxeFormItemProps[]
   tableSchema: VxeGridPropTypes.Columns
@@ -233,7 +238,7 @@ const filterPrintSchema = (crudSchema: VxeCrudSchema[]): any[] => {
 
   eachTree(crudSchema, (schemaItem: VxeCrudSchema) => {
     // 判断是否显示
-    if (schemaItem?.detail?.show !== false) {
+    if (schemaItem?.print?.show !== false) {
       const printSchemaItem = {
         field: schemaItem.field
       }

+ 0 - 1
yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts

@@ -72,7 +72,6 @@ VXETable.setup({
   grid: {
     toolbarConfig: {
       refresh: true,
-      import: true,
       export: true,
       print: true,
       zoom: true,

+ 6 - 7
yudao-ui-admin-vue3/src/views/system/post/index.vue

@@ -79,24 +79,23 @@
 <script setup lang="ts">
 import { ref } from 'vue'
 import dayjs from 'dayjs'
-import { useI18n } from '@/hooks/web/useI18n'
-import { VxeFormEvents, VxeFormInstance, VxeFormItemProps, VxeGridInstance } from 'vxe-table'
-import * as PostApi from '@/api/system/post'
 import { DICT_TYPE } from '@/utils/dict'
-import { ContentWrap } from '@/components/ContentWrap'
+import * as PostApi from '@/api/system/post'
 import { PostVO } from '@/api/system/post/types'
 import { rules, allSchemas } from './post.data'
+import { useI18n } from '@/hooks/web/useI18n'
 import { useMessage } from '@/hooks/web/useMessage'
 import { useVxeGrid } from '@/hooks/web/useVxeGrid'
+import { VxeFormEvents, VxeFormInstance, VxeFormItemProps, VxeGridInstance } from 'vxe-table'
 
 const { t } = useI18n() // 国际化
-const message = useMessage()
+const message = useMessage() // 消息弹窗
 const xGrid = ref<VxeGridInstance>()
 const xForm = ref<VxeFormInstance>()
 const dialogVisible = ref(false) // 是否显示弹出层
 const dialogTitle = ref('edit') // 弹出层标题
 const actionType = ref('') // 操作按钮的类型
-const actionLoading = ref(false) // 遮罩层
+const actionLoading = ref(false) // 按钮Loading
 
 const gridOptions = useVxeGrid(allSchemas, PostApi.getPostPageApi)
 const formData = ref<PostVO>()
@@ -130,7 +129,7 @@ const handleUpdate = async (rowId: number) => {
 // 删除操作
 const handleDelete = (rowId: number) => {
   message
-    .confirm(t('common.delMessage'), t('common.confirmTitle'))
+    .delConfirm()
     .then(async () => {
       await PostApi.deletePostApi(rowId)
       message.success(t('common.delSuccess'))