budgetDataIndex.vue 2.46 KB
<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:calc(100% - ${contentHeight.value + 10}px);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>