Compare commits

..

No commits in common. '86c68adf727f198d81539b68689211e45721acc0' and '06e27720c8a7697265ac96fc387c82e32f97dcee' have entirely different histories.

@ -5,7 +5,6 @@ export interface PrintTemplateVO {
templateCode: string templateCode: string
templateName: string templateName: string
templateType: number templateType: number
templateBizType: string
templateJson: string templateJson: string
remark: string remark: string
isEnable: boolean isEnable: boolean

@ -2806,9 +2806,6 @@ export default {
templateCode: 'Template Code', templateCode: 'Template Code',
templateName: 'Template Name', templateName: 'Template Name',
templateType: 'Template Type', templateType: 'Template Type',
templateBizType: 'Template Category',
bizTypePrint: 'Print',
bizTypeReport: 'Report',
templateJson: 'Template JSON', templateJson: 'Template JSON',
isConfigured: 'Configured', isConfigured: 'Configured',
configured: 'Configured', configured: 'Configured',

@ -2308,9 +2308,6 @@ export default {
templateCode: '模板编码', templateCode: '模板编码',
templateName: '模板名称', templateName: '模板名称',
templateType: '模板类型', templateType: '模板类型',
templateBizType: '模板分类',
bizTypePrint: '打印',
bizTypeReport: '报表',
templateJson: '模板JSON', templateJson: '模板JSON',
isConfigured: '是否已配置', isConfigured: '是否已配置',
configured: '已配置', configured: '已配置',

@ -36,22 +36,6 @@
<Icon icon="ep:zoom-in" /> <Icon icon="ep:zoom-in" />
</el-button> </el-button>
</div> </div>
<el-button size="small" @click="rotatePaper">
<Icon icon="ep:refresh-right" class="mr-4px" />
旋转
</el-button>
<el-button size="small" type="warning" @click="handlePreview">
<Icon icon="ep:view" class="mr-4px" />
预览
</el-button>
<el-popconfirm title="是否确认清空?" @confirm="clearPaper">
<template #reference>
<el-button size="small" type="danger">
<Icon icon="ep:delete" class="mr-4px" />
清空
</el-button>
</template>
</el-popconfirm>
<el-button type="primary" size="small" :loading="saveLoading" @click="handleSave"> <el-button type="primary" size="small" :loading="saveLoading" @click="handleSave">
<Icon icon="ep:check" class="mr-4px" /> <Icon icon="ep:check" class="mr-4px" />
{{ t('common.save') }} {{ t('common.save') }}
@ -81,10 +65,6 @@
</div> </div>
</div> </div>
</div> </div>
<el-dialog v-model="previewVisible" title="打印预览" width="70%" top="2vh" append-to-body>
<div v-html="previewHtml" style="background: #fff;"></div>
</el-dialog>
</Dialog> </Dialog>
</template> </template>
@ -242,9 +222,6 @@ const scaleValue = ref(1)
const scaleMax = 5 const scaleMax = 5
const scaleMin = 0.5 const scaleMin = 0.5
const previewVisible = ref(false)
const previewHtml = ref('')
let hiprintInited = false let hiprintInited = false
let hiprintTemplate: any let hiprintTemplate: any
@ -318,30 +295,6 @@ const changeScale = (isZoomIn: boolean) => {
hiprintTemplate.zoom(nextScale) hiprintTemplate.zoom(nextScale)
} }
const rotatePaper = () => {
if (!hiprintTemplate) return
hiprintTemplate.rotatePaper()
}
const handlePreview = () => {
if (!hiprintTemplate) return
const jquery = (window as any).$
const htmlResult = hiprintTemplate.getHtml({})
if (htmlResult && jquery) {
previewHtml.value = jquery('<div>').append(htmlResult).html() || ''
}
previewVisible.value = true
}
const clearPaper = () => {
if (!hiprintTemplate) return
try {
hiprintTemplate.clear()
} catch (error) {
message.error('清空失败')
}
}
const handleSave = async () => { const handleSave = async () => {
if (!hiprintTemplate) { if (!hiprintTemplate) {
return return

@ -22,15 +22,9 @@
<el-form-item :label="t('TemplateManagement.PrintTemplate.templateName')" prop="templateName"> <el-form-item :label="t('TemplateManagement.PrintTemplate.templateName')" prop="templateName">
<el-input v-model="formData.templateName" :placeholder="t('TemplateManagement.PrintTemplate.placeholderTemplateName')" /> <el-input v-model="formData.templateName" :placeholder="t('TemplateManagement.PrintTemplate.placeholderTemplateName')" />
</el-form-item> </el-form-item>
<el-form-item :label="t('TemplateManagement.PrintTemplate.templateBizType')" prop="templateBizType">
<el-radio-group v-model="formData.templateBizType">
<el-radio value="1">{{ t('TemplateManagement.PrintTemplate.bizTypePrint') }}</el-radio>
<el-radio value="2">{{ t('TemplateManagement.PrintTemplate.bizTypeReport') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="t('TemplateManagement.PrintTemplate.templateType')" prop="templateType"> <el-form-item :label="t('TemplateManagement.PrintTemplate.templateType')" prop="templateType">
<el-select v-model="formData.templateType" :placeholder="t('TemplateManagement.PrintTemplate.placeholderTemplateType')" class="!w-full"> <el-select v-model="formData.templateType" :placeholder="t('TemplateManagement.PrintTemplate.placeholderTemplateType')" class="!w-full">
<el-option v-for="dict in templateTypeDictOptions" :key="dict.value" :label="dict.label" :value="dict.value" /> <el-option v-for="dict in getIntDictOptions('print_template_type')" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="t('TemplateManagement.PrintTemplate.isEnable')" prop="isEnable"> <el-form-item :label="t('TemplateManagement.PrintTemplate.isEnable')" prop="isEnable">
@ -66,7 +60,6 @@ const formData = ref({
isAutoCode: true, isAutoCode: true,
templateName: undefined, templateName: undefined,
templateType: undefined, templateType: undefined,
templateBizType: '1',
remark: undefined, remark: undefined,
isEnable: true, isEnable: true,
}) })
@ -74,27 +67,14 @@ const formRules = computed(() => ({
templateCode: formData.value.isAutoCode ? [] : [{ required: true, message: t('TemplateManagement.PrintTemplate.validatorCodeRequired'), trigger: 'blur' }], templateCode: formData.value.isAutoCode ? [] : [{ required: true, message: t('TemplateManagement.PrintTemplate.validatorCodeRequired'), trigger: 'blur' }],
templateName: [{ required: true, message: t('TemplateManagement.PrintTemplate.validatorNameRequired'), trigger: 'blur' }], templateName: [{ required: true, message: t('TemplateManagement.PrintTemplate.validatorNameRequired'), trigger: 'blur' }],
templateType: [{ required: true, message: t('TemplateManagement.PrintTemplate.validatorTypeRequired'), trigger: 'change' }], templateType: [{ required: true, message: t('TemplateManagement.PrintTemplate.validatorTypeRequired'), trigger: 'change' }],
templateBizType: [{ required: true, message: '请选择模板分类', trigger: 'change' }],
})) }))
const formRef = ref() const formRef = ref()
const templateTypeDictOptions = computed(() => { const open = async (type: string, id?: number) => {
const dictType = formData.value.templateBizType === '2' ? 'report_template_type' : 'print_template_type'
return getIntDictOptions(dictType)
})
watch(() => formData.value.templateBizType, () => {
formData.value.templateType = undefined
})
const open = async (type: string, id?: number, bizType?: string) => {
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
resetForm() resetForm()
if (bizType) {
formData.value.templateBizType = bizType
}
if (id) { if (id) {
formLoading.value = true formLoading.value = true
try { try {
@ -137,7 +117,6 @@ const resetForm = () => {
isAutoCode: true, isAutoCode: true,
templateName: undefined, templateName: undefined,
templateType: undefined, templateType: undefined,
templateBizType: '1',
remark: undefined, remark: undefined,
isEnable: true, isEnable: true,
} }

@ -1,532 +0,0 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" width="92%" :fullscreen="false" top="4vh">
<div class="hiprint-preview">
<div class="hiprint-body">
<div class="hiprint-left">
<div class="hiprint-title">基础元素</div>
<div :id="dragContainerId" class="hiprint-drag-wrap">
<div v-for="item in baseElements" :key="item.tid" class="ep-draggable-item hiprint-item" :tid="item.tid">
<span>{{ item.label }}</span>
</div>
</div>
</div>
<div class="hiprint-right-area">
<div class="hiprint-toolbar">
<div class="hiprint-paper">
<el-button v-for="(value, type) in paperTypes" :key="type" size="small"
:type="curPaperType === type ? 'primary' : 'default'" @click="setPaper(type, value)">
{{ type }}
</el-button>
<el-popover placement="bottom-start" :width="260" trigger="click" v-model:visible="paperPopVisible">
<template #reference>
<el-button size="small" :type="curPaperType === 'other' ? 'primary' : 'default'">自定义纸张</el-button>
</template>
<div class="paper-pop">
<div class="paper-pop-title">设置纸张宽高(mm)</div>
<div class="paper-pop-form">
<el-input-number v-model="paperWidth" :precision="1" :min="1" controls-position="right" />
<span>x</span>
<el-input-number v-model="paperHeight" :precision="1" :min="1" controls-position="right" />
</div>
<el-button class="mt-8px" size="small" type="primary" @click="setPaperOther"></el-button>
</div>
</el-popover>
</div>
<div class="hiprint-zoom">
<el-button size="small" @click="changeScale(false)">
<Icon icon="ep:zoom-out" />
</el-button>
<div class="zoom-value">{{ (scaleValue * 100).toFixed(0) }}%</div>
<el-button size="small" @click="changeScale(true)">
<Icon icon="ep:zoom-in" />
</el-button>
<el-button size="small" @click="rotatePaper">
<Icon icon="ep:refresh-right" class="mr-4px" />
旋转
</el-button>
</div>
<div style="margin-left: 40px;">
<el-button size="small" type="warning" @click="handlePreview">
<Icon icon="ep:view" class="mr-4px" />
预览
</el-button>
<el-popconfirm title="是否确认清空?" @confirm="clearPaper">
<template #reference>
<el-button size="small" type="danger">
<Icon icon="ep:delete" class="mr-4px" />
清空
</el-button>
</template>
</el-popconfirm>
<el-button type="primary" size="small" :loading="saveLoading" @click="handleSave">
<Icon icon="ep:check" class="mr-4px" />
{{ t('common.save') }}
</el-button>
</div>
</div>
<div class="hiprint-toolbar">
<div class="hiprint-align">
<el-button-group>
<el-tooltip content="左对齐" placement="bottom">
<el-button size="small" @click="setElsAlign('left')">
<Icon icon="ep:arrow-left-bold" />
</el-button>
</el-tooltip>
<el-tooltip content="水平居中" placement="bottom">
<el-button size="small" @click="setElsAlign('vertical')">
<Icon icon="ep:minus" />
</el-button>
</el-tooltip>
<el-tooltip content="右对齐" placement="bottom">
<el-button size="small" @click="setElsAlign('right')">
<Icon icon="ep:arrow-right-bold" />
</el-button>
</el-tooltip>
</el-button-group>
<el-button-group style="margin-left: 6px;">
<el-tooltip content="顶部对齐" placement="bottom">
<el-button size="small" @click="setElsAlign('top')">
<Icon icon="ep:arrow-up-bold" />
</el-button>
</el-tooltip>
<el-tooltip content="垂直居中" placement="bottom">
<el-button size="small" @click="setElsAlign('horizontal')">
<Icon icon="ep:minus" style="transform: rotate(90deg);" />
</el-button>
</el-tooltip>
<el-tooltip content="底部对齐" placement="bottom">
<el-button size="small" @click="setElsAlign('bottom')">
<Icon icon="ep:arrow-down-bold" />
</el-button>
</el-tooltip>
</el-button-group>
<el-divider direction="vertical" />
<el-tooltip content="水平间距 10px" placement="bottom">
<el-button size="small" @click="setElsSpace(true)">
<Icon icon="ep:rank" class="mr-4px" />水平间距
</el-button>
</el-tooltip>
<el-tooltip content="垂直间距 10px" placement="bottom">
<el-button size="small" @click="setElsSpace(false)">
<Icon icon="ep:rank" style="transform: rotate(90deg);" class="mr-4px" />垂直间距
</el-button>
</el-tooltip>
<el-divider direction="vertical" />
<el-tooltip content="横向分散" placement="bottom">
<el-button size="small" @click="setElsAlign('distributeHor')">
<Icon icon="ep:sort" /> 横向分散
</el-button>
</el-tooltip>
<el-tooltip content="纵向分散" placement="bottom">
<el-button size="small" @click="setElsAlign('distributeVer')">
<Icon icon="ep:sort" style="transform: rotate(90deg);" /> 纵向分散
</el-button>
</el-tooltip>
</div>
</div>
<div class="hiprint-printPagination"></div>
<div class="hiprint-design-row">
<div class="hiprint-center">
<div :id="designerContainerId"></div>
</div>
<div class="hiprint-right">
<div :id="settingContainerId"></div>
</div>
</div>
</div>
</div>
</div>
<el-dialog v-model="previewVisible" title="打印预览" width="70%" top="2vh" append-to-body>
<div v-html="previewHtml" style="background: #fff;"></div>
</el-dialog>
</Dialog>
</template>
<script setup lang="ts">
import { defaultElementTypeProvider, hiprint } from 'vue-plugin-hiprint'
import { PrintTemplateApi } from '@/api/mes/printtemplate'
import qrCodeImg from '@/assets/imgs/qrCode.png'
const { t } = useI18n()
const message = useMessage()
const baseElements = [
{ tid: 'defaultModule.text', label: '文本' },
{ tid: 'defaultModule.image', label: '图片' },
{ tid: 'qrcodeModule.qrcode', label: '二维码' },
{ tid: 'defaultModule.longText', label: '长文' },
{ tid: 'defaultModule.table', label: '表格' },
{ tid: 'defaultModule.hline', label: '横线' },
{ tid: 'defaultModule.vline', label: '竖线' },
{ tid: 'defaultModule.rect', label: '矩形' },
{ tid: 'defaultModule.oval', label: '圆形' }
]
const qrcodeProvider = function () {
const addElementTypes = function (context: any) {
context.removePrintElementTypes('qrcodeModule')
context.addPrintElementTypes('qrcodeModule', [
new hiprint.PrintElementTypeGroup('二维码', [
{
tid: 'qrcodeModule.qrcode',
title: '二维码',
type: 'image',
options: {
field: '',
src: qrCodeImg,
testData: qrCodeImg,
width: 80,
height: 80,
title: '二维码'
}
}
])
])
}
return { addElementTypes }
}
const dialogVisible = ref(false)
const dialogTitle = ref('模板配置')
const saveLoading = ref(false)
const currentRow = ref<any>(null)
const currentTemplateJson = ref<Record<string, any> | undefined>(undefined)
const instanceId = `hiprint-designer-${Math.random().toString(36).slice(2)}`
const dragContainerId = `${instanceId}-drag`
const designerContainerId = `${instanceId}-designer`
const settingContainerId = `${instanceId}-setting`
const paperTypes = {
A3: { width: 420, height: 296.6 },
A4: { width: 210, height: 296.6 },
A5: { width: 210, height: 147.6 },
B3: { width: 500, height: 352.6 },
B4: { width: 250, height: 352.6 },
B5: { width: 250, height: 175.6 }
}
const curPaper = ref({
type: 'A4',
width: 210,
height: 296.6
})
const paperPopVisible = ref(false)
const paperWidth = ref(220)
const paperHeight = ref(80)
const curPaperType = computed(() => {
let type = 'other'
for (const [key, value] of Object.entries(paperTypes)) {
if (value.width === curPaper.value.width && value.height === curPaper.value.height) {
type = key
break
}
}
return type
})
const scaleValue = ref(1)
const scaleMax = 5
const scaleMin = 0.5
const previewVisible = ref(false)
const previewHtml = ref('')
let hiprintInited = false
let hiprintTemplate: any
const ensureInit = () => {
if (hiprintInited) {
return
}
hiprint.init({
providers: [new defaultElementTypeProvider(), qrcodeProvider()]
})
hiprintInited = true
}
const buildLeftElement = () => {
const jquery = (window as any).$
if (!jquery) {
message.warning('未检测到 jQuery无法加载拖拽元素')
return
}
hiprint.PrintElementTypeManager.buildByHtml(jquery(`#${dragContainerId} .ep-draggable-item`))
}
const buildDesigner = () => {
const jquery = (window as any).$
if (!jquery) {
message.warning('未检测到 jQuery无法初始化打印设计器')
return
}
jquery(`#${designerContainerId}`).empty()
const template = currentTemplateJson.value || undefined
hiprintTemplate = new hiprint.PrintTemplate({
template,
settingContainer: `#${settingContainerId}`,
paginationContainer: '.hiprint-printPagination',
})
hiprintTemplate.design(`#${designerContainerId}`)
setPaper(curPaperType.value, { width: curPaper.value.width, height: curPaper.value.height })
hiprintTemplate.zoom(scaleValue.value)
}
const setPaper = (type: string, value: { width: number; height: number }) => {
if (!hiprintTemplate) {
return
}
const width = Number(value.width)
const height = Number(value.height)
curPaper.value = { type, width, height }
hiprintTemplate.setPaper(width, height)
}
const setPaperOther = () => {
paperPopVisible.value = false
setPaper('other', { width: Number(paperWidth.value), height: Number(paperHeight.value) })
}
const changeScale = (isZoomIn: boolean) => {
if (!hiprintTemplate) {
return
}
let nextScale = scaleValue.value
if (isZoomIn) {
nextScale += 0.1
if (nextScale > scaleMax) nextScale = scaleMax
} else {
nextScale -= 0.1
if (nextScale < scaleMin) nextScale = scaleMin
}
scaleValue.value = nextScale
hiprintTemplate.zoom(nextScale)
}
const rotatePaper = () => {
if (!hiprintTemplate) return
hiprintTemplate.rotatePaper()
}
const handlePreview = () => {
if (!hiprintTemplate) return
const jquery = (window as any).$
const htmlResult = hiprintTemplate.getHtml({})
if (htmlResult && jquery) {
previewHtml.value = jquery('<div>').append(htmlResult).html() || ''
}
previewVisible.value = true
}
const clearPaper = () => {
if (!hiprintTemplate) return
try {
hiprintTemplate.clear()
} catch (error) {
message.error('清空失败')
}
}
const setElsAlign = (e: string) => {
if (!hiprintTemplate) return
try {
hiprintTemplate.setElsAlign(e)
} catch (error) {
message.error('对齐操作失败')
}
}
const setElsSpace = (isHorizontal: boolean) => {
if (!hiprintTemplate) return
try {
hiprintTemplate.setElsSpace(10, isHorizontal)
} catch (error) {
message.error('间距调整失败')
}
}
const handleSave = async () => {
if (!hiprintTemplate) {
return
}
const templateJson = hiprintTemplate.getJson()
saveLoading.value = true
try {
await PrintTemplateApi.updatePrintTemplate({
id: currentRow.value.id,
templateCode: currentRow.value.templateCode,
templateName: currentRow.value.templateName,
templateType: currentRow.value.templateType,
templateJson: JSON.stringify(templateJson),
} as any)
message.success(t('common.updateSuccess'))
dialogVisible.value = false
emit('success')
} finally {
saveLoading.value = false
}
}
const resetState = () => {
scaleValue.value = 1
curPaper.value = {
type: 'A4',
width: 210,
height: 296.6
}
paperWidth.value = 220
paperHeight.value = 80
paperPopVisible.value = false
}
const open = async (row: any) => {
currentRow.value = row
dialogTitle.value = `${t('TemplateManagement.PrintTemplate.designTitle')}${row.templateName ? ' - ' + row.templateName : ''}`
currentTemplateJson.value = row.templateJson ? (typeof row.templateJson === 'string' ? JSON.parse(row.templateJson) : row.templateJson) : undefined
resetState()
dialogVisible.value = true
await nextTick()
ensureInit()
buildLeftElement()
buildDesigner()
}
const emit = defineEmits(['success'])
defineExpose({ open })
</script>
<style scoped lang="scss">
.hiprint-preview {
width: 100%;
}
.hiprint-toolbar {
display: flex;
align-items: center;
gap: 12px;
}
.hiprint-paper {
display: flex;
align-items: center;
gap: 2px;
flex-wrap: wrap;
}
.hiprint-align {
display: flex;
align-items: center;
gap: 2px;
}
.hiprint-printPagination {
:deep(.hiprint-printPagination-content) {
display: flex;
align-items: center;
gap: 6px;
}
}
.hiprint-zoom {
display: flex;
align-items: center;
gap: 4px;
}
.zoom-value {
width: 56px;
text-align: center;
font-size: 13px;
color: var(--el-text-color-regular);
}
.paper-pop-title {
font-size: 14px;
font-weight: 600;
}
.paper-pop-form {
margin-top: 8px;
display: flex;
align-items: center;
gap: 8px;
}
.hiprint-body {
height: 75vh;
display: flex;
gap: 12px;
}
.hiprint-left {
width: 220px;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-light);
border-radius: 8px;
overflow: auto;
}
.hiprint-right-area {
flex: 1;
display: flex;
flex-direction: column;
gap: 12px;
min-width: 0;
}
.hiprint-design-row {
display: flex;
gap: 12px;
flex: 1;
height: 0;
min-height: 0;
}
.hiprint-center {
flex: 1;
height: 100%;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-light);
border-radius: 8px;
overflow: auto;
padding: 16px;
}
.hiprint-right {
width: 300px;
height: 100%;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-light);
border-radius: 8px;
overflow: auto;
padding: 12px;
}
.hiprint-title {
padding: 10px 10px 0;
font-weight: 600;
}
.hiprint-drag-wrap {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
padding: 10px;
}
.hiprint-item {
min-height: 56px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
border: 1px solid var(--el-border-color);
background: var(--el-fill-color-light);
color: var(--el-text-color-primary);
cursor: grab;
}
</style>

@ -29,10 +29,6 @@
</ContentWrap> </ContentWrap>
<ContentWrap> <ContentWrap>
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="打印" name="1" />
<el-tab-pane label="报表" name="2" />
</el-tabs>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id" <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" fixed="left" reserve-selection /> <el-table-column type="selection" width="55" fixed="left" reserve-selection />
@ -43,13 +39,14 @@
<el-table-column :label="t('TemplateManagement.PrintTemplate.templateType')" align="center" prop="templateType" <el-table-column :label="t('TemplateManagement.PrintTemplate.templateType')" align="center" prop="templateType"
sortable> sortable>
<template #default="scope"> <template #default="scope">
<dict-tag :type="activeName === '2' ? 'report_template_type' : 'print_template_type'" :value="scope.row.templateType" /> <dict-tag type="print_template_type" :value="scope.row.templateType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="t('TemplateManagement.PrintTemplate.isEnable')" align="center" prop="isEnable" sortable> <el-table-column :label="t('TemplateManagement.PrintTemplate.isEnable')" align="center" prop="isEnable" sortable>
<template #default="scope"> <template #default="scope">
<el-tag :type="scope.row.isEnable ? 'success' : 'danger'"> <el-tag :type="scope.row.isEnable ? 'success' : 'danger'">
{{ scope.row.isEnable ? t('TemplateManagement.PrintTemplate.enabled') : t('TemplateManagement.PrintTemplate.disabled') }} {{ scope.row.isEnable ? t('TemplateManagement.PrintTemplate.enabled') :
t('TemplateManagement.PrintTemplate.disabled') }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
@ -83,7 +80,6 @@
<PrintTemplateForm ref="formRef" @success="getList" /> <PrintTemplateForm ref="formRef" @success="getList" />
<PrintTemplateDesigner ref="designerRef" @success="getList" /> <PrintTemplateDesigner ref="designerRef" @success="getList" />
<ReportTemplateDesigner ref="reportDesignerRef" @success="getList" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -93,7 +89,6 @@ import { PrintTemplateApi, PrintTemplateVO } from '@/api/mes/printtemplate'
import { DictTag } from '@/components/DictTag' import { DictTag } from '@/components/DictTag'
import PrintTemplateForm from './PrintTemplateForm.vue' import PrintTemplateForm from './PrintTemplateForm.vue'
import PrintTemplateDesigner from './PrintTemplateDesigner.vue' import PrintTemplateDesigner from './PrintTemplateDesigner.vue'
import ReportTemplateDesigner from './ReportTemplateDesigner.vue'
defineOptions({ name: 'PrintTemplate' }) defineOptions({ name: 'PrintTemplate' })
@ -108,7 +103,6 @@ const queryParams = reactive({
pageSize: 10, pageSize: 10,
templateCode: undefined, templateCode: undefined,
templateName: undefined, templateName: undefined,
templateBizType: '1',
}) })
const queryFormRef = ref() const queryFormRef = ref()
const exportLoading = ref(false) const exportLoading = ref(false)
@ -135,25 +129,14 @@ const resetQuery = () => {
handleQuery() handleQuery()
} }
let activeName = '1'
const handleTabClick = (tab: any) => {
queryParams.templateBizType = tab.paneName
handleQuery()
}
const formRef = ref() const formRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {
formRef.value.open(type, id, queryParams.templateBizType) formRef.value.open(type, id)
} }
const designerRef = ref() const designerRef = ref()
const reportDesignerRef = ref()
const openDesigner = (row: any) => { const openDesigner = (row: any) => {
if (row.templateBizType === 2) { designerRef.value.open(row)
reportDesignerRef.value.open(row)
} else {
designerRef.value.open(row)
}
} }
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {

Loading…
Cancel
Save