skyouc
2025-07-01 0b83887ab167c420499a01738ba9795bb79952c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<script setup>
import {ref, toRaw} from 'vue';
import { formatMessage } from '@/utils/localeUtils';
import locTemplate from './locTemplate.vue';
 
const template = {
    locTemplate
}
 
const printChild = ref(null);
const selectTemplate = ref('locTemplate');
let open = ref(false);
let printData = ref([]);
let repeatNum = ref(1);
let orderNo = ref('');
const handleOk = () => {
 
}
 
const printObj = ref({
    id: "printOrder",
    beforeOpenCallback(vue) {
        // console.log(toRaw(printData.value))
    },
    openCallback(vue) {
        console.log('执行了打印')
    },
    closeCallback(vue) {
        console.log('关闭了打印工具')
    },
 
});
 
defineExpose({
    open,
    orderNo,
    printData
})
</script>
 
<template>
    <a-modal v-model:open="open" :title="formatMessage('', '库位打印')" @ok="handleOk" :width="'60%'" v-if="open">
        <div style="height: 500px;overflow-x: hidden;overflow-y: scroll;">
            <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>