😎调整打印模板页面

This commit is contained in:
zuohuaijun 2024-07-01 14:17:26 +08:00
parent 267b62ed64
commit 2ce10418e1
3 changed files with 132 additions and 89 deletions

View File

@ -1,14 +1,14 @@
<template>
<div class="sys-print-container">
<div class="printDialog">
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" fullscreen>
<el-dialog v-model="state.isShowDialog" draggable overflow destroy-on-close fullscreen>
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
<span> {{ props.title }} </span>
</div>
</template>
<div style="margin: -16px 0px 0px 0px">
<div style="margin: 0px 0px 0px 0px">
<HiprintDesign ref="hiprintDesignRef" />
</div>
<template #footer>
@ -20,7 +20,7 @@
</el-dialog>
</div>
<el-dialog v-model="state.showDialog2" draggable :close-on-click-modal="false" width="600px">
<el-dialog v-model="state.showDialog2" draggable overflow destroy-on-close width="600px">
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
@ -28,7 +28,7 @@
</div>
</template>
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto">
<el-row :gutter="35">
<el-row :gutter="10">
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-form-item label="模板名称" prop="name" :rules="[{ required: true, message: '模板名称不能为空', trigger: 'blur' }]">
<el-input v-model="state.ruleForm.name" placeholder="模板名称" clearable />
@ -104,6 +104,7 @@ const state = reactive({
showDialog2: false,
});
//
onMounted(async () => {});
//
@ -168,6 +169,7 @@ defineExpose({ openDialog });
}
.el-dialog__body {
max-height: calc(100vh - 80px) !important;
height: calc(100vh - 80px) !important;
}
}
}

View File

@ -70,19 +70,19 @@
<el-row :gutter="8">
<el-col :span="4">
<el-card style="height: 100%" shadow="never">
<el-card style="height: 100%" shadow="never" :body-style="{ padding: '0px 0 5px 7px' }">
<el-row>
<el-col :span="24" id="hiprintEpContainer" class="rect-printElement-types hiprintEpContainer"> </el-col>
</el-row>
</el-card>
</el-col>
<el-col :span="14">
<el-card shadow="never" class="card-design">
<el-card shadow="never" class="card-design" :body-style="{ padding: '18px' }">
<div id="hiprint-printTemplate" class="hiprint-printTemplate"></div>
</el-card>
</el-col>
<el-col :span="6" class="params_setting_container">
<el-card shadow="never">
<el-card shadow="never" :body-style="{ padding: '0px' }">
<el-row class="hinnn-layout-sider">
<div id="PrintElementOptionSetting"></div>
</el-row>
@ -181,7 +181,6 @@ const changeMode = () => {
hiprint.init({
providers: [provider.f],
});
//
const hiprintEpContainerEl = document.getElementById('hiprintEpContainer');
if (hiprintEpContainerEl) {
@ -212,7 +211,7 @@ const changeMode = () => {
});
hiprintTemplate.value.design('#hiprint-printTemplate');
// , zoomtrue
state.scaleValue = hiprintTemplate.value.editingPanel.scale || 1;
state.scaleValue = hiprintTemplate.value.editingPanel?.scale ?? 1;
};
/**
@ -239,7 +238,7 @@ const changeScale = (currentValue: number, oldValue: number) => {
let big = false;
currentValue <= oldValue ? (big = false) : (big = true);
let scaleVal = state.scaleValue;
let scaleVal = currentValue;
if (big) {
if (scaleVal > state.scaleMax) scaleVal = 5;
} else {

View File

@ -1,66 +1,75 @@
<template>
<div class="sys-print-container">
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-form :model="state.queryParams" ref="queryForm" :inline="true">
<el-form-item label="模板名称">
<el-input v-model="state.queryParams.name" placeholder="模板名称" clearable />
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'sysPrint:page'"> 查询 </el-button>
<el-button icon="ele-Refresh" @click="resetQuery"> 重置 </el-button>
</el-button-group>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="ele-Plus" @click="openAddPrint" v-auth="'sysPrint:add'"> 新增 </el-button>
</el-form-item>
<div class="sys-print-container" v-loading="options.loading">
<el-card shadow="hover" :body-style="{ padding: '5px 5px 0 5px', display: 'flex', width: '100%', height: '100%', alignItems: 'start' }">
<el-form :model="state.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true" :label-width="'60px'" style="flex: 1 1 0%">
<el-row :gutter="10">
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<el-form-item label="模板名称" prop="name">
<el-input v-model="state.queryParams.name" placeholder="模板名称" clearable @keyup.enter.native="handleQuery(true)" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-divider style="height: calc(100% - 5px); margin: 0 10px" direction="vertical" />
<el-row>
<el-col>
<el-button-group>
<el-button type="primary" icon="ele-Search" @click="handleQuery(true)" v-auth="'sysPrint:page'" :loading="options.loading"> 查询 </el-button>
<el-button icon="ele-Refresh" @click="resetQuery" :loading="options.loading"> 重置 </el-button>
</el-button-group>
</el-col>
</el-row>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table :data="state.printData" style="width: 100%" v-loading="state.loading" border>
<el-table-column type="index" label="序号" width="55" align="center" fixed />
<el-table-column prop="name" label="名称" header-align="center" show-overflow-tooltip />
<!-- <el-table-column prop="template" label="模板" show-overflow-tooltip /> -->
<el-table-column prop="orderNo" label="排序" align="center" show-overflow-tooltip />
<el-table-column label="状态" align="center" show-overflow-tooltip>
<template #default="scope">
<el-tag type="success" v-if="scope.row.status === 1">启用</el-tag>
<el-tag type="danger" v-else>禁用</el-tag>
</template>
</el-table-column>
<el-table-column label="修改记录" width="100" align="center" show-overflow-tooltip>
<template #default="scope">
<ModifyRecord :data="scope.row" />
</template>
</el-table-column>
<el-table-column label="操作" width="140" fixed="right" align="center" show-overflow-tooltip>
<template #default="scope">
<el-button icon="ele-Edit" size="small" text type="primary" @click="openEditPrint(scope.row)" v-auth="'sysPrint:update'"> 编辑 </el-button>
<el-button icon="ele-Delete" size="small" text type="danger" @click="delPrint(scope.row)" v-auth="'sysPrint:delete'"> 删除 </el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:currentPage="state.tableParams.page"
v-model:page-size="state.tableParams.pageSize"
:total="state.tableParams.total"
:page-sizes="[10, 20, 50, 100]"
small
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
<vxe-grid ref="xGrid" class="xGrid-style" v-bind="options" @sort-change="sortChange">
<template #toolbar_buttons>
<el-button type="primary" icon="ele-Plus" @click="handleAdd" v-auth="'sysPrint:add'"> 新增 </el-button>
</template>
<template #toolbar_tools> </template>
<template #empty>
<el-empty :image-size="200" />
</template>
<template #row_status="{ row }">
<el-tag v-if="row.status === 1" type="success">启用</el-tag>
<el-tag v-else type="danger">禁用</el-tag>
</template>
<template #row_record="{ row }">
<ModifyRecord :data="row" />
</template>
<template #row_buttons="{ row }">
<el-tooltip content="编辑" placement="top">
<el-button icon="ele-Edit" text type="primary" v-auth="'sysPrint:update'" @click="handleEdit(row)"> </el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button icon="ele-Delete" text type="danger" v-auth="'sysPrint:delete'" @click="handleDelete(row)"> </el-button>
</el-tooltip>
</template>
<template #pager>
<vxe-pager
:loading="options.loading"
v-model:current-page="state.tableParams.page"
v-model:page-size="state.tableParams.pageSize"
:total="state.tableParams.total"
@page-change="pageChange"
/>
</template>
</vxe-grid>
</el-card>
<EditPrint ref="editPrintRef" :title="state.editPrintTitle" @handleQuery="handleQuery" />
<EditPrint ref="editPrintRef" :title="state.title" @handleQuery="handleQuery" />
</div>
</template>
<script lang="ts" setup name="sysPrint">
import { onMounted, reactive, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { auth } from '/@/utils/authFunction';
import { VxeGridInstance, VxePagerEvents, VxePagerDefines } from 'vxe-table';
import { useVxeTable } from '/@/hooks/vxeTableOptionsHook';
import EditPrint from '/@/views/system/print/component/editPrint.vue';
import ModifyRecord from '/@/components/table/modifyRecord.vue';
@ -68,55 +77,100 @@ import { getAPI } from '/@/utils/axios-utils';
import { SysPrintApi } from '/@/api-services/api';
import { SysPrint } from '/@/api-services/models';
const xGrid = ref<VxeGridInstance>();
const editPrintRef = ref<InstanceType<typeof EditPrint>>();
const state = reactive({
loading: false,
printData: [] as Array<SysPrint>,
queryParams: {
name: undefined,
},
tableParams: {
page: 1,
pageSize: 10,
pageSize: 50,
field: 'id', //
order: 'aes', //
descStr: 'desc', //
total: 0 as any,
},
editPrintTitle: '',
visible: false,
title: '',
});
//
const options = useVxeTable<SysPrint>({
id: 'sysPrint',
name: '打印信息',
columns: [
// { type: 'checkbox', width: 40, fixed: 'left' },
{ type: 'seq', title: '序号', width: 60, fixed: 'left' },
{ field: 'name', title: '名称', minWidth: 250, showOverflow: 'tooltip' },
// { field: 'template', title: '', minWidth: 200, showOverflow: 'tooltip', sortable: true },
{ field: 'createTime', title: '修改时间', minWidth: 150, showOverflow: 'tooltip' },
{ field: 'remark', title: '备注', minWidth: 250, showOverflow: 'tooltip' },
{ field: 'orderNo', title: '排序', width: 80, showOverflow: 'tooltip' },
{ field: 'status', title: '状态', width: 100, showOverflow: 'tooltip', slots: { default: 'row_status' } },
{ field: '', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
{ title: '操作', fixed: 'right', width: 100, showOverflow: true, slots: { default: 'row_buttons' } },
],
enableExport: auth('sysPrint:export'),
searchCallback: () => handleQuery(),
queryAllCallback: () => fetchData({ pageSize: 99999 }),
});
//
onMounted(async () => {
handleQuery();
await handleQuery();
});
//
const handleQuery = async () => {
state.loading = true;
let params = Object.assign(state.queryParams, state.tableParams);
var res = await getAPI(SysPrintApi).apiSysPrintPagePost(params);
state.printData = res.data.result?.items ?? [];
const handleQuery = async (reset = false) => {
options.loading = true;
if (reset) state.tableParams.page = 1;
var res = await fetchData(null);
xGrid.value?.loadData(res.data.result?.items ?? []);
state.tableParams.total = res.data.result?.total;
state.loading = false;
options.loading = false;
};
//
const fetchData = async (tableParams: any) => {
let params = Object.assign(state.queryParams, state.tableParams, tableParams);
return getAPI(SysPrintApi).apiSysPrintPagePost(params);
};
//
const resetQuery = () => {
state.queryParams.name = undefined;
handleQuery(true);
};
//
const pageChange: VxePagerEvents.PageChange = ({ currentPage, pageSize }: VxePagerDefines.PageChangeEventParams) => {
state.tableParams.page = currentPage;
state.tableParams.pageSize = pageSize;
handleQuery();
};
//
const sortChange = (options: any) => {
state.tableParams.field = options.field;
state.tableParams.order = options.order;
handleQuery();
};
//
const openAddPrint = () => {
state.editPrintTitle = '添加打印模板';
const handleAdd = () => {
state.title = '添加打印模板';
editPrintRef.value?.openDialog({});
};
//
const openEditPrint = (row: any) => {
state.editPrintTitle = '编辑打印模板';
const handleEdit = (row: any) => {
state.title = '编辑打印模板';
editPrintRef.value?.openDialog(row);
};
//
const delPrint = (row: any) => {
//
const handleDelete = (row: any) => {
ElMessageBox.confirm(`确定删除打印模板:【${row.name}】?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -129,16 +183,4 @@ const delPrint = (row: any) => {
})
.catch(() => {});
};
//
const handleSizeChange = (val: number) => {
state.tableParams.pageSize = val;
handleQuery();
};
//
const handleCurrentChange = (val: number) => {
state.tableParams.page = val;
handleQuery();
};
</script>