条件设置添加删除方法

This commit is contained in:
limengnan 2026-06-02 15:07:05 +08:00
parent c0cbdc831c
commit 36713c0edc
2 changed files with 30 additions and 7 deletions

View File

@ -391,7 +391,6 @@ function changeShowResult(isShow:boolean){ // 切换显示结果模型
<img :src="apiUrl +'/models/'+ info.metricsImagePath" alt="" style="width: 100%; height: 100%;object-fit:contain;"> <img :src="apiUrl +'/models/'+ info.metricsImagePath" alt="" style="width: 100%; height: 100%;object-fit:contain;">
</div> </div>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>

View File

@ -11,7 +11,7 @@ import Page from '@/components/Pagination/page.vue'
import { getDictItemById } from '@/api/dict'; import { getDictItemById } from '@/api/dict';
import { topologyDevicesLsit } from '@/api/business/project'; import { topologyDevicesLsit } from '@/api/business/project';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { searchEventsByScenarioId } from '@/api/business/event'; import { searchEventsByScenarioId, deleteEvents } from '@/api/business/event';
import { sizeSchemaAll } from "@/api/business/database/device"; import { sizeSchemaAll } from "@/api/business/database/device";
const url = import.meta.env.VITE_APP_BASE_API; const url = import.meta.env.VITE_APP_BASE_API;
const conditionData:any = ref([{ // const conditionData:any = ref([{ //
@ -146,9 +146,9 @@ function menuClick(index:any){ // 点击菜单切换
getTimelineList() getTimelineList()
} }
function addMenu(){ // function addMenu(){ //
let tempLabel = menuList.value[menuList.value.length - 1].label.split('条件')[1]
menuList.value.push({ menuList.value.push({
label: '条件' + (menuList.value.length + 1), label: '条件' + (Number(tempLabel) + 1),
deviceType: '', deviceType: '',
target:{ target:{
entityType: '', entityType: '',
@ -166,9 +166,33 @@ function addMenu(){ //添加导菜单
menuClick(menuList.value.length - 1) menuClick(menuList.value.length - 1)
} }
function delMenu(){ // function delMenu(){ //
ElMessageBox.confirm('确定删除当前条件吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if(menuList.value[menuIndex.value].eventId != null){
deleteEvents(menuList.value[menuIndex.value].eventId).then((res:any) => {
if(res.code == 0){
menuList.value.splice(menuIndex.value, 1); menuList.value.splice(menuIndex.value, 1);
menuIndex.value = 0 menuIndex.value = 0
menuClick(menuList.value.length - 1) menuClick(menuList.value.length - 1)
ElMessage({
message: '删除成功',
type: 'success'
});
}
})
}else{
menuList.value.splice(menuIndex.value, 1);
menuIndex.value = 0
menuClick(menuList.value.length - 1)
}
});
} }
// //