fix: print Params

pull/2/head
xingyu4j 2022-11-07 14:58:53 +08:00
parent 4bc7645850
commit efb4cf0c66
4 changed files with 27 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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