微调
This commit is contained in:
@@ -107,6 +107,7 @@ export namespace CheckData {
|
||||
|
||||
// 用来描述 检测数据-左侧树结构
|
||||
export interface TreeItem {
|
||||
id:string | null,
|
||||
scriptTypeName: string | null,
|
||||
sourceDesc: string | null,
|
||||
harmNum: number | null,
|
||||
|
||||
@@ -286,6 +286,7 @@ const second = ref(0)
|
||||
const emit = defineEmits(['update:activeName','update:activeIndex','update:startDisabeld','update:pauseDisabled'])
|
||||
|
||||
watch(()=>props.formControl.scriptId,()=>{
|
||||
console.log("切换脚本",props.formControl.scriptId);
|
||||
if(props.formControl.scriptId!=''){
|
||||
getTree()
|
||||
}
|
||||
@@ -303,6 +304,19 @@ const getTree = () => {
|
||||
}).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
treeData.value = res.data
|
||||
|
||||
// 为 treeData 及其子节点添加 id
|
||||
let idCounter = 0;
|
||||
const addIdToTree = (nodes: any[]) => {
|
||||
nodes.forEach(node => {
|
||||
node.id = idCounter++; // 为每个节点添加唯一的 id
|
||||
if (node.children && node.children.length > 0) {
|
||||
addIdToTree(node.children); // 递归为子节点添加 id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
addIdToTree(treeData.value);
|
||||
|
||||
// 添加tab子项
|
||||
props.options.forEach((k: any, i: number) => {
|
||||
@@ -312,6 +326,7 @@ const getTree = () => {
|
||||
item.children.forEach((s: any) => {
|
||||
k.children.forEach((P: any) => {
|
||||
if (P.code == s.scriptTypeCode) {
|
||||
|
||||
tabData.value[i].children.push({
|
||||
label: P.label,
|
||||
value: P.code,
|
||||
@@ -336,6 +351,8 @@ const getTree = () => {
|
||||
tabChange()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +393,7 @@ const tabChange = () => {
|
||||
const inquireTable = () => {
|
||||
const sortOrder = ['Ua', 'Ia', 'Ub', 'Ib', 'Uc', 'Ic']
|
||||
dlsDetails({
|
||||
scriptId: '9ff96807cf8c7524587982ed8baa8b57',
|
||||
scriptId: props.formControl.scriptId,
|
||||
scriptType: activeName.value,
|
||||
scriptSubType: childActiveName.value
|
||||
}).then((res: any) => {
|
||||
@@ -393,7 +410,7 @@ const inquireTable = () => {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
console.log('treeData',treeData.value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-tree
|
||||
node-key="scriptName"
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
:data="props.treeData"
|
||||
:props="defaultProps"
|
||||
@@ -44,7 +44,7 @@ const childActiveName = ref('')
|
||||
const activeIndex = ref()
|
||||
const treeRef = ref()
|
||||
const handleNodeClick = (data, node) => {
|
||||
console.log('handleNodeClick', props.treeData)
|
||||
//console.log('handleNodeClick', props.treeData)
|
||||
if(data.index!= null){
|
||||
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
|
||||
const parents = getParentNodes(node, [])
|
||||
@@ -105,8 +105,12 @@ function findTargetCodes(data: any[], targetCodes: string[]) {
|
||||
function handleCheckChange(data,isChecked) {
|
||||
console.log('handleCheckChange', data,isChecked)
|
||||
if(isChecked){
|
||||
const checked = [data.scriptName]; // id为tree的node-key属性
|
||||
const checked = [data.id]; // id为tree的node-key属性
|
||||
treeRef.value?.setCheckedKeys(checked);
|
||||
emit('setTab', {
|
||||
activeIndex:data.index
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
// // 对外映射
|
||||
|
||||
@@ -80,14 +80,24 @@ const pqSourceList=ref<TestSource.ResTestSource[]>([])//获取指定模式下所
|
||||
const modeStore = useModeStore()
|
||||
const pqSourceArray = ref<{ label: string; value: string; }[]>()
|
||||
const scriptArray = reactive<{label: string, value: string}[]>([])
|
||||
// const formContent = ref<TestScript.ResTestScript>({
|
||||
// id : '9ff96807cf8c7524587982ed8baa8b57',
|
||||
// name: '测试',
|
||||
// type: '1',
|
||||
// valueType: '2973cb938b591b93d0df2547599b87d8',
|
||||
// pattern: modeId.value,
|
||||
// standardName: 'GBT 19862',
|
||||
// standardTime: '2025',
|
||||
// state: 1
|
||||
// })
|
||||
const formContent = ref<TestScript.ResTestScript>({
|
||||
id : '9ff96807cf8c7524587982ed8baa8b57',
|
||||
name: '测试',
|
||||
type: '1',
|
||||
valueType: '2973cb938b591b93d0df2547599b87d8',
|
||||
id : '',
|
||||
name: '',
|
||||
type: '',
|
||||
valueType: '',
|
||||
pattern: modeId.value,
|
||||
standardName: 'GBT 19862',
|
||||
standardTime: '2025',
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
state: 1
|
||||
})
|
||||
const connectDisabeld = ref(false)
|
||||
@@ -167,6 +177,7 @@ onMounted(async () => {
|
||||
nextTick(async () => {
|
||||
await treeInfo(modeStore.currentMode)
|
||||
formContent.value.pattern = modeId.value
|
||||
formContent.value.id = controlContent.value.scriptId
|
||||
show.value = true
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user