|
|
@@ -0,0 +1,78 @@
|
|
|
+<template>
|
|
|
+
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {formMixin} from '@/mixins/form'
|
|
|
+import {hiprint} from "vue-plugin-hiprint";
|
|
|
+
|
|
|
+export default {
|
|
|
+ mixins: [formMixin],
|
|
|
+ components: {
|
|
|
+ print
|
|
|
+ },
|
|
|
+ name: 'wx-print',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ templateList: [],
|
|
|
+ docs:{
|
|
|
+ 'sa':{'docName':this.$config.docCode.order,'service':this.$service.orderService,}
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ console.log('this.$route.query',this.$route.query)
|
|
|
+ if (!this.$route.query.layout_id) {
|
|
|
+ this.$Message.warning('请先选择一个模板再打印')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.$route.query.data_id) {
|
|
|
+ this.$Message.warning('请先选择一条数据再打印')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.$route.query.doc) {
|
|
|
+ this.$Message.warning('请先选择单据类型再打印')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // let template = this.templateList.find(it => it.layoutId == this.$route.query.layout_id)?.layoutData
|
|
|
+ console.log('templateList',this.templateList)
|
|
|
+
|
|
|
+ let layout = this.excute(this.$service.printLayoutService, this.$service.printLayoutService.selectByCond, { flgValid: true, docName: this.docs[this.$route.query.doc].docName, })
|
|
|
+ let header=this.excuteNoParam(this.docs[this.$route.query.doc].service, this.docs[this.$route.query.doc].service.selectById,[this.$route.query.data_id])
|
|
|
+ let detail=this.excuteNoParam(this.docs[this.$route.query.doc].service, this.docs[this.$route.query.doc].service.selectOrderInfoById, [this.$route.query.data_id])
|
|
|
+ Promise.all([header, detail,layout])
|
|
|
+ .then((results) => {
|
|
|
+ // 在这里执行接下来的操作
|
|
|
+ if(results?.[0]?.code === this.$config.SUCCESS_CODE && results?.[1]?.code === this.$config.SUCCESS_CODE){
|
|
|
+ let header =results?.[0]?.data
|
|
|
+ let detail =results?.[1]?.data
|
|
|
+ let layout =results?.[2]?.data?.list.find(it => it.layoutId == this.$route.query.layout_id)?.layoutData
|
|
|
+ this.$set(header, 'table', detail['orderItem'])
|
|
|
+
|
|
|
+
|
|
|
+ let printData = {...header}
|
|
|
+
|
|
|
+ let hiprintTemplate = new hiprint.PrintTemplate({
|
|
|
+ template: layout,
|
|
|
+ })
|
|
|
+
|
|
|
+ hiprintTemplate.toPdf(printData,'单据打印')
|
|
|
+
|
|
|
+
|
|
|
+ }else {
|
|
|
+ this.$Message.warning(this.$t('W_006'))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|