budgetDataIndex.vue
2.42 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<route lang="yaml">
# 组件名称
name: ""
</route>
<template>
<iframe :style="tableStyle" :src="link" frameborder="0"></iframe>
</template>
<script lang="ts" setup name="budgetDataIndex">
import { ref, reactive, computed } from "vue";
import { JSEncrypt } from 'jsencrypt';
import { useElementSize } from "@vueuse/core";
import useUserStore from '@/store/modules/user'
const route = useRoute()
const encryptor = new JSEncrypt()
const publicKey = '-----BEGIN PUBLIC KEY-----MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgFiv3Ko6rOBvWDK96tIExpdyuuQAGgZo0YmQxpT10hD3qu/MnNKlIJgo4+NwUHcwpleKE2DBOxgvCeMtUoP4FDWt8q18X+4+7t8p0D/57NhA0liNKQ/Ise6b5i293ht1XPen3XhR5xIcDNxauQ5vKqdwwzhoonsbJDtbowoinLQbAgMBAAE=-----END PUBLIC KEY-----';
function encrypt(txt) {
encryptor.setPublicKey(publicKey) // 设置公钥
return encryptor.encrypt(txt); // 对数据进行加密
}
const { proxy } = getCurrentInstance() as any;
const searchContainer = ref(null)
const { height: contentHeight } = useElementSize(searchContainer)
const tableStyle = computed(() => {
return `height:100%;width:100%;`
})
const userStore = useUserStore()
const userInfoData = JSON.parse(userStore.userData)
const url: any = ref(route.query.url);
const isFormIndex = ref(route.query.isFormIndex);
const link = ref('')
// const router = useRouter()
// // 监听当前路由
// watch(
// () => router.currentRoute.value,
// (newValue: any) => {
// newValue.meta.title = title.value
// },
// { immediate: true }
// )
// 搜索区域的schema
onBeforeMount(() => {
let loginInfo = JSON.stringify({
username: '18600000001',
pwd: 'e3916047c3f96efa4642db7bde06d327',
timestamp: new Date().getTime()
})
console.log(route);
if (isFormIndex.value) {
let linkValue = decodeURIComponent(url.value) + '&loginInfo=' + encodeURI(encrypt(loginInfo));
link.value = linkValue;
} else {
let staffGuid = userInfoData.staffGuid;
let tenantGuid = userInfoData.tenantGuid;
let linkValue = decodeURIComponent(url.value) + '&staffGuid=' + staffGuid + '&tenantGuid=' + tenantGuid + '&organisationGuidList=' + userInfoData.organisationGuidList?.join('|') + '&loginInfo=' + encodeURI(encrypt(loginInfo))
link.value = linkValue;
}
});
onActivated(() => {
let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === route.fullPath);
if (tab) {
tab.meta.title = route.query.title;
}
})
</script>
<style lang="scss" scoped>
</style>