diff --git a/src/views/index.vue b/src/views/index.vue index c1bc95e..7468fda 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -987,7 +987,7 @@ const getShildTableList = () => { } // 障碍物列表 -const tableData1 = ref([{Lon:1},{Lon:2}]) +const tableData1 = ref([{Lon: 1}, {Lon: 2}]) // 上传图片 const uploadRef = ref(null) const uploadFiles = async (e) => { @@ -1032,11 +1032,10 @@ const dialogImageUrl = ref('') const imgDialog = ref(false) // 删除 const delPoint = (e) => { - // tableData1.value.splice((currentPage1.value - 1) * pageSize1.value + e.$index, 1); let arr = JSON.parse(JSON.stringify(tableData1.value)) arr.splice((currentPage1.value - 1) * pageSize1.value + e.$index, 1); - tableData1.value = arr ||[] - if((currentPage1.value - 1) * pageSize1.value + e.$index === dotIndex.value ){ + tableData1.value = arr || [] + if ((currentPage1.value - 1) * pageSize1.value + e.$index === dotIndex.value) { console.log(123) dotIndex.value = -1 } @@ -1051,6 +1050,7 @@ const openHandleObstacleDialog = (e) => { console.log(e.row) dialog1.value = true dialog1Form.value = { + dotIndex : e.index, index: e.$index, time: e.row.time, longitude: e.row.Lon, @@ -1069,6 +1069,7 @@ const handleObstacle = () => { findTime: dialog1Form.value.time, }).then(e => { dialog1.value = false + dotIndexF(dialog1Form.value.dotIndex) tableData1.value.splice((currentPage1.value - 1) * pageSize1.value + dialog1Form.value.index, 1); }) } @@ -1085,6 +1086,7 @@ const batchDisposal = () => { files: [], findTime: '', }) + dotIndexF(row.index) tableData1.value = tableData1.value.filter(item => row.index !== item.index); }) getShildTableList() @@ -1093,6 +1095,7 @@ const batchDisposal = () => { const batchDel = () => { let datas = table1Ref.value.getSelectionRows() datas.forEach((row) => { + dotIndexF(row.index) tableData1.value = tableData1.value.filter(item => row.index !== item.index); }) } @@ -1108,6 +1111,7 @@ const batchShild = () => { deviation: shieldInfoForm.value.deviation, shielding: shieldInfoForm.value.shielding, }) + dotIndexF(row.index) tableData1.value = tableData1.value.filter(item => row.index !== item.index); }) getShildTableList() @@ -1212,6 +1216,18 @@ const setDot = (e, re) => { return {...v, index: tableData1.value.length + k} })] } + +const dotIndexF = (index) => { + if (dotIndex.value === index) { + dotIndex.value = -1 + } else if (dotIndex.value > index) { + dotIndex.value -= 1 + } else if (dotIndex.value > index) { + + } else { + + } +} const table1Current = (e, v) => { if (dotIndex.value === e.index) { dotIndex.value = -1 @@ -1368,7 +1384,7 @@ onMounted(() => { getSocket() getOption() getShildTableList() - testFun() + // testFun()? getDotsData() })