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