|
|
@@ -0,0 +1,92 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <a-button type="primary" @click="showDrawer">打印</a-button>
|
|
|
+ <a-drawer
|
|
|
+ v-model:visible="visible"
|
|
|
+ class="custom-class"
|
|
|
+ title="报表打印"
|
|
|
+ placement="right"
|
|
|
+ width="600"
|
|
|
+ :closable="false"
|
|
|
+ @close="onClose">
|
|
|
+ <a-table :dataSource="dataSource" :columns="columns" size="small">
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
+ <template v-if="column.key === 'operation'">
|
|
|
+ <a @click="printData(record)">
|
|
|
+ 打印
|
|
|
+ </a>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ <template #extra>
|
|
|
+ <a-space>
|
|
|
+ <a-button @click="onClose">关闭</a-button>
|
|
|
+ </a-space>
|
|
|
+ </template>
|
|
|
+ </a-drawer>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import {ref,defineProps} from 'vue'
|
|
|
+import Api from '@/api/api'
|
|
|
+const props = defineProps(['keyname','data'])
|
|
|
+const visible = ref(false)
|
|
|
+const form = ref({
|
|
|
+ type:'标准订单',
|
|
|
+ enterprisename:''
|
|
|
+})
|
|
|
+const columns = [{
|
|
|
+ title: '报表名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ key: 'name',
|
|
|
+},
|
|
|
+{
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'operation',
|
|
|
+ key: 'operation',
|
|
|
+},]
|
|
|
+const showDrawer = ()=>{
|
|
|
+ console.log(props.data,props.keyname)
|
|
|
+ visible.value = true
|
|
|
+ getData()
|
|
|
+}
|
|
|
+const onClose = () => {
|
|
|
+ visible.value = false;
|
|
|
+};
|
|
|
+const dataSource = ref([])
|
|
|
+const getData = async ()=>{
|
|
|
+ let appid = sessionStorage.getItem('app')?JSON.parse(sessionStorage.getItem('app')).systemappid:''
|
|
|
+ const res = await Api.requested({
|
|
|
+ id:20221213094401,
|
|
|
+ content:{
|
|
|
+ systemappid:appid
|
|
|
+ }
|
|
|
+ })
|
|
|
+ dataSource.value = res.data
|
|
|
+}
|
|
|
+const DynamicAcquisitionURL = ()=> {
|
|
|
+ var str = window.location.href;
|
|
|
+ var index = str.indexOf('/');
|
|
|
+ var num = 0;
|
|
|
+ while(index !== -1) {
|
|
|
+ num++;
|
|
|
+ index = str.indexOf('/',index + 1);
|
|
|
+ if (num++ === 3) {
|
|
|
+ return str.slice(0, index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+const printData = async (record)=>{
|
|
|
+ let res = await Api.requested({
|
|
|
+ "id":20221213094501,
|
|
|
+ "content": {
|
|
|
+ sys_reportid:record.sys_reportid,
|
|
|
+ dataid:props.data[props.keyname]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ window.open(DynamicAcquisitionURL() + res.data + `&${props.keyname}=${props.data[props.keyname]}`)
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+</style>
|