| <script setup>  | 
| import { ref } from 'vue';  | 
| import { formatMessage } from '@/utils/localeUtils';  | 
| import Template1 from './template/template1.vue';  | 
| import Template2 from './template/template2.vue';  | 
| import Template3 from './template/template3.vue';  | 
|   | 
| const template = {  | 
|     Template1,  | 
|     Template2,  | 
|     Template3,  | 
| }  | 
| const selectTemplate = ref('Template1');  | 
| const printChild = ref(null);  | 
|   | 
| let open = ref(false);  | 
| let printData = ref([]);  | 
| let repeatNum = ref(1);  | 
|   | 
| const handleOk = () => {  | 
|   | 
| }  | 
|   | 
| const printObj = ref({  | 
|     id: "printMe",  | 
|     beforeOpenCallback(vue) {  | 
|         console.log('打开之前')  | 
|     },  | 
|     openCallback(vue) {  | 
|         console.log('执行了打印')  | 
|     },  | 
|     closeCallback(vue) {  | 
|         console.log('关闭了打印工具')  | 
|     }  | 
| });  | 
|   | 
| defineExpose({  | 
|     open,  | 
|     printData,  | 
| })  | 
| </script>  | 
|   | 
| <template>  | 
|     <a-modal v-model:open="open" :title="formatMessage('db.man_zpallet_barcode.batchPrint', '批量打印')" @ok="handleOk">  | 
|         <div style="height: 500px;overflow-x: hidden;overflow-y: scroll;">  | 
|             <div style="display: flex;justify-content: center;">  | 
|                 <a-radio-group v-model:value="selectTemplate" button-style="solid">  | 
|                     <a-radio-button value="Template1">  | 
|                         {{ formatMessage('common.template', '模板') }} 1  | 
|                     </a-radio-button>  | 
|                     <a-radio-button value="Template2">  | 
|                         {{ formatMessage('common.template', '模板') }} 2  | 
|                     </a-radio-button>  | 
|                     <a-radio-button value="Template3">  | 
|                         {{ formatMessage('common.template', '模板') }} 3  | 
|                     </a-radio-button>  | 
|                 </a-radio-group>  | 
|             </div>  | 
|             <div style="display: flex;justify-content: center;margin-top: 20px;">  | 
|                 <div style="width: 140px;text-align: center;">  | 
|                     {{ formatMessage('common.repeatNum', '重复数量') }}<a-input-number :min="1" v-model:value="repeatNum" :placeholder="formatMessage('common.repeatNum', '重复数量')" />  | 
|                 </div>  | 
|             </div>  | 
|             <div style="margin-top: 20px;">  | 
|                 <component :is="template[selectTemplate]" ref="printChild" :list="printData" :repeatNum="repeatNum" />  | 
|             </div>  | 
|         </div>  | 
|         <template #footer>  | 
|             <a-button key="submit" type="primary" v-print="printObj" @click="handleOk">  | 
|                 {{ formatMessage('common.print', '打印') }}  | 
|             </a-button>  | 
|         </template>  | 
|     </a-modal>  | 
| </template>  | 
|   | 
| <style></style> |