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) ElNotification.warning(content)
}, },
// 确认窗体 // 确认窗体
confirm(content: string, tip: string) { confirm(content: string, tip?: string) {
return ElMessageBox.confirm(content, tip, { return ElMessageBox.confirm(content, tip ? tip : t('common.confirmTitle'), {
confirmButtonText: t('common.ok'), confirmButtonText: t('common.ok'),
cancelButtonText: t('common.cancel'), cancelButtonText: t('common.cancel'),
type: 'warning' 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) { prompt(content: string, tip: string) {
return ElMessageBox.prompt(content, tip, { return ElMessageBox.prompt(content, tip, {

View File

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

View File

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

View File

@ -79,24 +79,23 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import dayjs from 'dayjs' 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 { 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 { PostVO } from '@/api/system/post/types'
import { rules, allSchemas } from './post.data' import { rules, allSchemas } from './post.data'
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid' import { useVxeGrid } from '@/hooks/web/useVxeGrid'
import { VxeFormEvents, VxeFormInstance, VxeFormItemProps, VxeGridInstance } from 'vxe-table'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() const message = useMessage() //
const xGrid = ref<VxeGridInstance>() const xGrid = ref<VxeGridInstance>()
const xForm = ref<VxeFormInstance>() const xForm = ref<VxeFormInstance>()
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('edit') // const dialogTitle = ref('edit') //
const actionType = ref('') // const actionType = ref('') //
const actionLoading = ref(false) // const actionLoading = ref(false) // Loading
const gridOptions = useVxeGrid(allSchemas, PostApi.getPostPageApi) const gridOptions = useVxeGrid(allSchemas, PostApi.getPostPageApi)
const formData = ref<PostVO>() const formData = ref<PostVO>()
@ -130,7 +129,7 @@ const handleUpdate = async (rowId: number) => {
// //
const handleDelete = (rowId: number) => { const handleDelete = (rowId: number) => {
message message
.confirm(t('common.delMessage'), t('common.confirmTitle')) .delConfirm()
.then(async () => { .then(async () => {
await PostApi.deletePostApi(rowId) await PostApi.deletePostApi(rowId)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))