Skip to content

Commit

Permalink
Merge pull request #461 from nanasikeai/fix_bkvision
Browse files Browse the repository at this point in the history
fix: 【审计报表】审计风险报表异常 --bug=133310627
  • Loading branch information
0RAJA authored Nov 4, 2024
2 parents b1a4ba5 + edd4cc1 commit 4ca2c61
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions src/frontend/src/views/statement-manage/detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<script setup lang="ts">
import {
onMounted,
onUnmounted,
watch,
} from 'vue';
import {
Expand All @@ -43,6 +44,7 @@
const route = useRoute();
const { messageError } = useMessage();
const { emit } = useEventBus();
let app: any;

const loadScript = (src: string) => new Promise((resolve, reject) => {
const script = document.createElement('script');
Expand All @@ -62,41 +64,34 @@
}
};

const render = () => {
window.BkVisionSDK.init(
'#panel',
route.params.id,
{
apiPrefix: `${window.PROJECT_CONFIG.AJAX_URL_PREFIX}/bkvision/`,
chartToolMenu: [
{ type: 'tool', id: 'fullscreen', build_in: true },
{ type: 'tool', id: 'refresh', build_in: true },
{ type: 'menu', id: 'excel', build_in: true },
],
handleError,
},
);
const change = (uid: string) => {
app.update(uid);
};

const init = async () => {
try {
// 样式文件
const link = document.createElement('link');
link.href = 'https://staticfile.qq.com/bkvision/p7e76e4518060411cb65c6bc2eaea9c03/latest/main.css?v=1704275097';
link.rel = 'stylesheet';
document.body.append(link);
await loadScript('https://staticfile.qq.com/bkvision/p7e76e4518060411cb65c6bc2eaea9c03/latest/chunk-vendors.js?v=1704275097');
await loadScript('https://staticfile.qq.com/bkvision/p7e76e4518060411cb65c6bc2eaea9c03/latest/chunk-bk-magic-vue.js?v=1704275097');
await loadScript('https://staticfile.qq.com/bkvision/p7e76e4518060411cb65c6bc2eaea9c03/latest/main.js?v=1704275097');
render();
await loadScript('https://staticfile.qq.com/bkvision/pbb9b207ba200407982a9bd3d3f2895d4/latest/main.js');
app = await window.BkVisionSDK.init(
'#panel',
route.params.id,
{
apiPrefix: `${window.PROJECT_CONFIG.AJAX_URL_PREFIX}/bkvision/`,
chartToolMenu: [
{ type: 'tool', id: 'fullscreen', build_in: true },
{ type: 'tool', id: 'refresh', build_in: true },
{ type: 'menu', id: 'excel', build_in: true },
],
handleError,
},
);
} catch (error) {
console.error(error);
}
};

watch(() => route, () => {
if (route.params.id !== '' && route.name === 'statementManageDetail') {
render();
change(route.params.id as string);
}
}, {
deep: true,
Expand All @@ -105,4 +100,10 @@
onMounted(() => {
init();
});

onUnmounted(() => {
if (app) {
app.unmount();
}
});
</script>

0 comments on commit 4ca2c61

Please sign in to comment.