fix: 信令分析-html格式
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { reactive, ref, onMounted, toRaw } from 'vue';
|
import { reactive, ref, onMounted, toRaw, nextTick } from 'vue';
|
||||||
import { PageContainer } from '@ant-design-vue/pro-layout';
|
import { PageContainer } from '@ant-design-vue/pro-layout';
|
||||||
import { message, Modal } from 'ant-design-vue/lib';
|
import { message, Modal } from 'ant-design-vue/lib';
|
||||||
import { SizeType } from 'ant-design-vue/lib/config-provider';
|
import { SizeType } from 'ant-design-vue/lib/config-provider';
|
||||||
@@ -198,20 +198,8 @@ function fnModalVisible(row: Record<string, any>) {
|
|||||||
// RAW解析HTML
|
// RAW解析HTML
|
||||||
getTraceRawInfo(row.id).then(res => {
|
getTraceRawInfo(row.id).then(res => {
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
const htmlString = res.msg;
|
const htmlString = rawDataHTMLScript(res.msg);
|
||||||
// 删除所有 <a> 标签
|
modalState.from.rawDataHTML = htmlString;
|
||||||
const withoutATags = htmlString.replace(/<a\b[^>]*>(.*?)<\/a>/gi, '');
|
|
||||||
// 删除所有 <script> 标签
|
|
||||||
const withoutScriptTags = withoutATags.replace(
|
|
||||||
/<script\b[^>]*>([\s\S]*?)<\/script>/gi,
|
|
||||||
''
|
|
||||||
);
|
|
||||||
// 默认全展开
|
|
||||||
const withoutHiddenElements = withoutScriptTags.replace(
|
|
||||||
/style="display:none"/gi,
|
|
||||||
'style="background:#ffffff"'
|
|
||||||
);
|
|
||||||
modalState.from.rawDataHTML = withoutHiddenElements;
|
|
||||||
modalState.from.downBtn = true;
|
modalState.from.downBtn = true;
|
||||||
} else {
|
} else {
|
||||||
modalState.from.rawDataHTML = t('views.traceManage.analysis.noData');
|
modalState.from.rawDataHTML = t('views.traceManage.analysis.noData');
|
||||||
@@ -290,6 +278,48 @@ function convertToReadableFormat(hexString: string) {
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 信息详情HTMl内容处理
|
||||||
|
function rawDataHTMLScript(htmlString: string) {
|
||||||
|
// 删除所有 <a> 标签
|
||||||
|
// const withoutATags = htmlString.replace(/<a\b[^>]*>(.*?)<\/a>/gi, '');
|
||||||
|
// 删除所有 <script> 标签
|
||||||
|
let withoutScriptTags = htmlString.replace(
|
||||||
|
/<script\b[^>]*>([\s\S]*?)<\/script>/gi,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
// 默认全展开
|
||||||
|
// const withoutHiddenElements = withoutScriptTags.replace(
|
||||||
|
// /style="display:none"/gi,
|
||||||
|
// 'style="background:#ffffff"'
|
||||||
|
// );
|
||||||
|
|
||||||
|
function set_node(node: any, str: string) {
|
||||||
|
if (!node) return;
|
||||||
|
node.style.display = str;
|
||||||
|
node.style.background = '#ffffff';
|
||||||
|
}
|
||||||
|
Reflect.set(window, 'set_node', set_node);
|
||||||
|
function toggle_node(node: any) {
|
||||||
|
node = document.getElementById(node);
|
||||||
|
if (!node) return;
|
||||||
|
set_node(node, node.style.display != 'none' ? 'none' : 'block');
|
||||||
|
}
|
||||||
|
Reflect.set(window, 'toggle_node', toggle_node);
|
||||||
|
function hide_node(node: any) {
|
||||||
|
node = document.getElementById(node);
|
||||||
|
if (!node) return;
|
||||||
|
set_node(node, 'none');
|
||||||
|
}
|
||||||
|
Reflect.set(window, 'hide_node', hide_node);
|
||||||
|
|
||||||
|
// 展开第一个
|
||||||
|
withoutScriptTags = withoutScriptTags.replace(
|
||||||
|
'id="f1c" style="display:none"',
|
||||||
|
'id="f1c" style="display:block"'
|
||||||
|
);
|
||||||
|
return withoutScriptTags;
|
||||||
|
}
|
||||||
|
|
||||||
/**信息文件下载 */
|
/**信息文件下载 */
|
||||||
function fnDownloadFile() {
|
function fnDownloadFile() {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
|
|||||||
Reference in New Issue
Block a user