|
|
@@ -9,25 +9,17 @@ export default {
|
|
|
name: 'printContainer',
|
|
|
props: {
|
|
|
id: {type: [String, Number], required: true},
|
|
|
+ loadExpress: {type: Boolean, default: false},
|
|
|
},
|
|
|
components: {Print_express_75, Print_ticket_72, Print_recipe_a5, Print_tag_80_50},
|
|
|
data() {
|
|
|
- return {
|
|
|
- selected: 0,
|
|
|
- };
|
|
|
+ return {};
|
|
|
},
|
|
|
computed: {
|
|
|
height() { return `${window.innerHeight * 0.8}`; },
|
|
|
style() { return {height: `${this.height}px`}; },
|
|
|
},
|
|
|
- watch: {
|
|
|
- selected(index) {
|
|
|
- try {
|
|
|
- const el = this.$refs[`print${index}`];
|
|
|
- el['print'](true);
|
|
|
- } catch (e) {}
|
|
|
- },
|
|
|
- },
|
|
|
+ watch: {},
|
|
|
methods: {
|
|
|
async print() {
|
|
|
const keys = Object.keys(this.$refs).filter(key => key.startsWith('print'));
|
|
|
@@ -49,6 +41,12 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ select(index) {
|
|
|
+ try {
|
|
|
+ const el = this.$refs[`print${index}`];
|
|
|
+ el['print'](true);
|
|
|
+ } catch (e) {}
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -56,17 +54,17 @@ export default {
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-button class="pin" type="primary" @click="print">组合打印</el-button>
|
|
|
- <el-tabs tab-position="left" :style="style" v-model="selected">
|
|
|
- <el-tab-pane label="标签" name="0">
|
|
|
+ <el-tabs tab-position="left" :style="style" @tab-click="select($event.index)">
|
|
|
+ <el-tab-pane label="标签">
|
|
|
<print_tag_80_50 ref="print0" :id="id" @click="$event && update(0)"></print_tag_80_50>
|
|
|
</el-tab-pane>
|
|
|
- <el-tab-pane label="处方笺" name="1">
|
|
|
+ <el-tab-pane label="处方笺">
|
|
|
<print_recipe_a5 ref="print1" :id="id" :style="style" @click="$event && update(1)"></print_recipe_a5>
|
|
|
</el-tab-pane>
|
|
|
- <el-tab-pane label="药品清单" name="2">
|
|
|
+ <el-tab-pane label="药品清单">
|
|
|
<print_ticket_72 ref="print2" :id="id" :style="style" @click="$event && update(2)"></print_ticket_72>
|
|
|
</el-tab-pane>
|
|
|
- <el-tab-pane label="快递单" name="3">
|
|
|
+ <el-tab-pane v-if="loadExpress" label="顺丰面单">
|
|
|
<print_express_75 ref="print3" :id="id" :style="style" @click="$event && update()"></print_express_75>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|