diff --git a/frontend/src/views/lineSetting/index.vue b/frontend/src/views/lineSetting/index.vue index 7593e27..b5a1395 100644 --- a/frontend/src/views/lineSetting/index.vue +++ b/frontend/src/views/lineSetting/index.vue @@ -26,17 +26,17 @@ const lineTabs = ref([ ]) const activeTab = ref('1') const infoList = ref({ - line_no:1, - fault_alarm:[ - {category:'PT断线',delay:0,enabled:false,output_node:'',limit:0}, - {category:'CT断线',delay:0,enabled:false,output_node:'',limit:0}, + line_no: 1, + fault_alarm: [ + { category: 'PT断线', delay: 0, enabled: false, output_node: '', limit: 0 }, + { category: 'CT断线', delay: 0, enabled: false, output_node: '', limit: 0 }, ], - over_limit_alarm:[ - {category:'电压',delay:0,enabled:false,output_node:'',limit:0}, - {category:'电流',delay:0,enabled:false,output_node:'',limit:0}, - {category:'差流',delay:0,enabled:false,output_node:'',limit:0}, - {category:'功率',delay:0,enabled:false,output_node:'',limit:0}, - {category:'频率',delay:0,enabled:false,output_node:'',limit:0}, + over_limit_alarm: [ + { category: '电压', delay: 0, enabled: false, output_node: '', limit: 0 }, + { category: '电流', delay: 0, enabled: false, output_node: '', limit: 0 }, + { category: '差流', delay: 0, enabled: false, output_node: '', limit: 0 }, + { category: '功率', delay: 0, enabled: false, output_node: '', limit: 0 }, + { category: '频率', delay: 0, enabled: false, output_node: '', limit: 0 }, ], }) const options = ref([ @@ -104,7 +104,7 @@ const cleardata = () => { }) } const currentLine = ref(1) -const handleTabClick = (tab:string) => { +const handleTabClick = (tab: string) => { activeTab.value = tab infoList.value.line_no = Number(tab) currentLine.value = Number(tab) @@ -118,26 +118,26 @@ const init = () => { fetchLineAlarmSetting(currentLine.value).then(res => { infoList.value.line_no = res.line_no cleardata() - res.fault_alarm.forEach(item => { - infoList.value.fault_alarm.forEach((faultItem, idx) => { - if (faultItem.category === item.category) { - faultItem.delay = item.delay - faultItem.enabled = item.enabled - faultItem.output_node = item.output_node - faultItem.limit = item.limit || 0 - } + res.fault_alarm.forEach(item => { + infoList.value.fault_alarm.forEach((faultItem, idx) => { + if (faultItem.category === item.category) { + faultItem.delay = item.delay + faultItem.enabled = item.enabled + faultItem.output_node = item.output_node + faultItem.limit = item.limit || 0 + } + }) }) - }) - res.over_limit_alarm.forEach(item => { - infoList.value.over_limit_alarm.forEach((overLimitItem, idx) => { - if (overLimitItem.category === item.category) { - overLimitItem.delay = item.delay - overLimitItem.enabled = item.enabled - overLimitItem.output_node = item.output_node - overLimitItem.limit = item.limit || 0 - } + res.over_limit_alarm.forEach(item => { + infoList.value.over_limit_alarm.forEach((overLimitItem, idx) => { + if (overLimitItem.category === item.category) { + overLimitItem.delay = item.delay + overLimitItem.enabled = item.enabled + overLimitItem.output_node = item.output_node + overLimitItem.limit = item.limit || 0 + } + }) }) - }) }) } const isswitch = ref(false) @@ -165,7 +165,7 @@ const handleSave = () => { ElMessage.error('保存失败') } }) - }else{ + } else { isswitch.value = false dialogVisible.value = true } @@ -201,90 +201,119 @@ const handleSave = () => {