ny
22 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
57
58
59
60
<script lang="ts" setup>
import { onMounted, reactive } from 'vue';
 
import { useGlobSetting } from '@jnpf/hooks';
import { BasicModal, useModalInner } from '@jnpf/ui/modal';
 
import { useAccessStore } from '@vben/stores';
 
import { getRealJnpfAppEnCode } from '#/utils/jnpf';
 
interface State {
  url: string;
}
 
const emit = defineEmits(['register', 'reload']);
const { dataReportPre } = useGlobSetting();
const accessStore = useAccessStore();
const [registerModal, { closeModal }] = useModalInner(init);
const state = reactive<State>({
  url: '',
});
 
function init(data) {
  state.url = `${dataReportPre}/index.html?token=${accessStore.accessToken}&appCode=${getRealJnpfAppEnCode()}${data.id ? `&id=${data.id}` : ''}`;
}
function handleMessage(e) {
  const data = e.data;
  if (data !== 'closeDialog') return;
  state.url = '';
  closeModal();
  emit('reload');
}
 
onMounted(() => {
  window.addEventListener('message', handleMessage);
});
</script>
<template>
  <BasicModal
    v-bind="$attrs"
    @register="registerModal"
    default-fullscreen
    :footer="null"
    :closable="false"
    :keyboard="false"
    class="jnpf-full-modal full-modal report-modal designer-modal">
    <iframe :src="state.url" width="100%" height="100%" frameborder="0" class="frame"></iframe>
  </BasicModal>
</template>
<style lang="scss">
.report-modal {
  .ant-modal-header {
    display: none !important;
  }
 
  .scrollbar {
    padding: 0 !important;
  }
}
</style>