优化检测脚本页面

This commit is contained in:
GGJ
2025-02-24 16:45:39 +08:00
parent 1a23bcb510
commit bd1eecc106
8 changed files with 544 additions and 411 deletions

View File

@@ -16,7 +16,13 @@
<el-table-column prop="name" label="指标" show-overflow-tooltip width="180px" />
<el-table-column align="center" label="参与误差比较">
<template #default="{ row }">
<el-switch v-model="row.errorFlag" v-if="row.show" :active-value="1" :inactive-value="0">
<el-switch
v-model="row.errorFlag"
v-if="row.show"
:active-value="1"
:inactive-value="0"
:disabled="disabled"
>
<template #active-action>
<span></span>
</template>
@@ -28,7 +34,13 @@
</el-table-column>
<el-table-column align="center" label="是否启用">
<template #default="{ row }">
<el-switch v-model="row.enable" v-if="row.show" :active-value="1" :inactive-value="0">
<el-switch
v-model="row.enable"
v-if="row.show"
:active-value="1"
:inactive-value="0"
:disabled="disabled"
>
<template #active-action>
<span></span>
</template>
@@ -51,10 +63,26 @@ const props = defineProps({
activeName: {
type: String,
required: true
},
formContent: {
type: Object,
required: true
},
disabled: {
type: Boolean,
default: true
}
})
const tableData = ref<any[]>([])
const info = async () => {
let checkData: any = []
await checkDataList({
scriptId: props.formContent.id,
scriptType: props.activeName
}).then((res: any) => {
checkData = res.data
})
let { data } = await getDictTreeByCode({
name: '',
id: '',
@@ -72,22 +100,46 @@ const info = async () => {
children: []
})
item.children.forEach((k: any) => {
tableData.value[i].children.push({
id: k.id,
pid: item.id,
name: k.name,
dataType: 'real',
show: true,
errorFlag: 0,
enable: 0
let childrenList: any = []
checkData.forEach((j: any) => {
if (j.valueType == k.id) {
childrenList.push(j)
}
})
if (childrenList.length > 0) {
tableData.value[i].children.push({
id: k.id,
pid: item.id,
name: k.name,
dataType: item.name == '闪变' ? 'avg' : item.name == '暂态' ? 'avg' : 'real',
show: true,
errorFlag: childrenList[0].errorFlag,
enable: childrenList[0].enable
})
} else {
tableData.value[i].children.push({
id: k.id,
pid: item.id,
name: k.name,
dataType: item.name == '闪变' ? 'avg' : item.name == '暂态' ? 'avg' : 'real',
show: true,
errorFlag: 0,
enable: 0
})
}
})
})
console.log('🚀 ~ item.children.forEach ~ tableData.value:', tableData.value)
}
const getData = () => {
return tableData.value
}
onMounted(() => {
info()
// tableData.value = data.data[0].children || []
})
// 对外映射
defineExpose({ getData })
</script>
<style lang="scss" scoped></style>