fix: 编译类型缺失

This commit is contained in:
TsMask
2024-09-03 16:57:43 +08:00
parent 66b6b60505
commit 2f1265c47a
2 changed files with 32 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import { PropType } from 'vue';
import DissectionTreeSub from './DissectionTreeSub.vue';
defineProps({
@@ -7,7 +8,7 @@ defineProps({
required: true,
},
tree: {
type: Array,
type: Array as PropType<Record<string, any>[]>,
required: true,
},
sub: {

View File

@@ -1,13 +1,17 @@
<script setup lang="ts">
import { reactive, onMounted, toRaw, ref } from 'vue';
import { reactive, onMounted } from 'vue';
import { message, Upload } from 'ant-design-vue/lib';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { FileType } from 'ant-design-vue/lib/upload/interface';
import { PageContainer } from 'antdv-pro-layout';
import DissectionTree from './components/DissectionTree.vue';
import DissectionDump from './components/DissectionDump.vue';
import PacketTable from './components/PacketTable.vue';
import { scriptUrl } from '@/assets/js/wiregasm_worker';
import { WK, OptionsType } from '@/plugins/wk-worker';
import { parseSizeFromFile } from '@/utils/parse-utils';
import { WK, OptionsType } from '@/plugins/wk-worker';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const wk = new WK();
const NO_SELECTION = { id: '', idx: 0, start: 0, length: 0 };
@@ -28,16 +32,34 @@ type StateType = {
};
/**字段 */
columns: string[];
/**过滤条件 */
filter: string;
/**过滤条件错误信息 */
filterError: string | null;
/**当前过滤条件 */
currentFilter: string;
/**当前选中的帧编号 */
selectedFrame: number;
/**当前选中的帧数据 */
selectedPacket: { tree: any[]; data_sources: any[] };
/**pcap包帧数据 */
packetFrameData: Map<string, any> | null;
/**当前选中的帧数据-空占位 */
selectedTreeEntry: typeof NO_SELECTION;
/**选择帧的Dump数据标签 */
selectedDataSourceIndex: number;
/**处理完成状态 */
finishedProcessing: boolean;
/**pcap包帧数匹配帧数 */
totalFrames: number;
/**pcap包帧数据 */
packetFrames: any[];
/**加载帧数 */
nextPageSize: number;
/**加载页数 */
nextPageNum: number;
/**加载下一页 */
nextPageLoad: boolean;
/**未知属性 */
// [key: string]: any;
};
const state = reactive<StateType>({
@@ -53,22 +75,18 @@ const state = reactive<StateType>({
elapsed_time: 0,
},
columns: [],
/**过滤条件 */
filter: '',
filterError: null,
currentFilter: '',
/**当前选中的帧编号 */
selectedFrame: 1,
/**当前选中的帧数据 */
selectedPacket: { tree: [], data_sources: [] },
packetFrameData: new Map(), // 注意Map 需要额外处理
packetFrameData: null, // 注意Map 需要额外处理
selectedTreeEntry: NO_SELECTION, // NO_SELECTION 需要定义
/**选择帧的Dump数据标签 */
selectedDataSourceIndex: 0,
/**处理完成状态 */
finishedProcessing: false,
totalFrames: 0,
packetFrames: [],
nextPageNum: 1,
@@ -83,7 +101,7 @@ function fnStateReset() {
// 选择帧的数据
state.selectedFrame = 0;
state.selectedPacket = { tree: [], data_sources: [] };
state.packetFrameData = new Map();
state.packetFrameData = null;
state.selectedTreeEntry = NO_SELECTION;
state.selectedDataSourceIndex = 0;
}
@@ -119,9 +137,9 @@ function fnSelectedTreeEntry(e: any) {
/**报文数据点击选中 */
function fnSelectedFindSelection(src_idx: number, pos: number) {
console.log('fnSelectedFindSelection', pos);
if (state.packetFrameData == null) return;
// find the smallest one
let current = null;
for (let [k, pp] of state.packetFrameData) {
if (pp.idx !== src_idx) continue;
@@ -136,7 +154,6 @@ function fnSelectedFindSelection(src_idx: number, pos: number) {
}
}
}
if (current != null) {
state.selectedTreeEntry = state.packetFrameData.get(current);
}