优化检测脚本页面
录入检测脚本
This commit is contained in:
@@ -139,7 +139,7 @@ const save = () => {
|
||||
if (res.code === 'A0000') {
|
||||
ElMessage.success({ message: res.message })
|
||||
formContent.value.id = res.data
|
||||
titleType.value == '编辑检测脚本'
|
||||
titleType.value = '编辑检测脚本'
|
||||
show.value = true
|
||||
}
|
||||
})
|
||||
@@ -179,8 +179,11 @@ const treeInfo = async (currentMode: string) => {
|
||||
sort: 0
|
||||
}
|
||||
const result = await getDictTreeByCode(data)
|
||||
const allOptions = convertToOptions(result.data as Dict.ResDictTree[])
|
||||
secondLevelOptions.push(...(allOptions[0]?.children || []))
|
||||
const result1 = (await getDictTreeByCode({ ...data, code: 'Script_Error' })).data[0].children
|
||||
const allOptions = await convertToOptions(result.data as Dict.ResDictTree[])
|
||||
console.log('🚀 ~ treeInfo ~ result1:', allOptions[0]?.children)
|
||||
const setallTree = await setTree(allOptions[0]?.children, result1)
|
||||
secondLevelOptions.push(...(setallTree || []))
|
||||
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id
|
||||
}
|
||||
|
||||
@@ -193,7 +196,16 @@ onMounted(() => {
|
||||
await open(data.title, data.row)
|
||||
})
|
||||
})
|
||||
|
||||
const setTree = async (data, data1) => {
|
||||
data.forEach(item => {
|
||||
data1.forEach(item1 => {
|
||||
if (item.label.replace(/准确度|检测/g, '') == item1.name) {
|
||||
item.value = item1.id
|
||||
}
|
||||
})
|
||||
})
|
||||
return data
|
||||
}
|
||||
// 转换函数
|
||||
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
||||
return dictTree.map(item => ({
|
||||
|
||||
Reference in New Issue
Block a user