refactor(components): 修改 tooltip 展示内容并注释 iframe 相关代码

- 在 Tootips 组件中,将 tooltip 展示内容从 row.logic_text 改为 row.text
- 在 IntelligentGeneration 组件中,注释掉 iframe 相关代码,暂时保留未删除
This commit is contained in:
Huangzhe
2025-05-27 10:48:03 +08:00
parent 1cf2ad8155
commit 2b297d5e80
2 changed files with 39 additions and 39 deletions

View File

@@ -4,7 +4,7 @@ const content = defineModel<{ row: any; column: any; cellValue: any }>('content'
<template> <template>
<div class="tooltip-content"> <div class="tooltip-content">
<span v-html="content?.row?.logic_text"></span> <span v-html="content?.row?.text"></span>
</div> </div>
</template> </template>

View File

@@ -7,47 +7,47 @@ const param = `token=${encodeURIComponent(localStorage.getItem('plantToken') as
// const url = host + path + param; // const url = host + path + param;
const url = host + path + param; const url = host + path + param;
const iframe = ref<HTMLIFrameElement | null>(null); // const iframe = ref<HTMLIFrameElement | null>(null);
onMounted(() => { // onMounted(() => {
// 保存原始的window.open方法 // // 保存原始的window.open方法
const originalOpen = window.open; // const originalOpen = window.open;
// 监听iframe的load事件确保iframe已完全加载 // // 监听iframe的load事件确保iframe已完全加载
iframe.value?.addEventListener('load', () => { // iframe.value?.addEventListener('load', () => {
try { // try {
const iframeWindow = iframe.value?.contentWindow; // const iframeWindow = iframe.value?.contentWindow;
// 尝试覆盖iframe的open方法 // // 尝试覆盖iframe的open方法
if (iframeWindow) { // if (iframeWindow) {
// 方法一:直接覆盖 // // 方法一:直接覆盖
try { // try {
iframeWindow.open = function (...args: any[]) { // iframeWindow.open = function (...args: any[]) {
// console.log('iframe中的open方法被调用参数', args); // // console.log('iframe中的open方法被调用参数', args);
// 使用父窗口的open方法打开 // // 使用父窗口的open方法打开
return originalOpen.apply(window, args as any); // return originalOpen.apply(window, args as any);
}; // };
} catch (e) { // } catch (e) {
// 方法二如果直接覆盖失败尝试使用defineProperty // // 方法二如果直接覆盖失败尝试使用defineProperty
try { // try {
Object.defineProperty(iframeWindow, 'open', { // Object.defineProperty(iframeWindow, 'open', {
value: function (...args: any[]) { // value: function (...args: any[]) {
// console.log('iframe中的open方法被调用参数', args); // // console.log('iframe中的open方法被调用参数', args);
return originalOpen.apply(window, args as any); // return originalOpen.apply(window, args as any);
}, // },
writable: true, // writable: true,
configurable: true // configurable: true
}); // });
} catch (e2) { // } catch (e2) {
// console.error('无法覆盖iframe的open方法(defineProperty)', e2); // // console.error('无法覆盖iframe的open方法(defineProperty)', e2);
} // }
} // }
} // }
} catch (error) { // } catch (error) {
console.error('无法覆盖iframe的open方法', error); // console.error('无法覆盖iframe的open方法', error);
} // }
}); // });
}); // });
</script> </script>
<template> <template>