| | |
| | | import { ref, watch, onBeforeUnmount, onMounted } from 'vue'; |
| | | import FunButton from '@/views/resource/components/FunButton.vue'; |
| | | const uploadPatchDialog = defineModel('show'); |
| | | const props = defineProps(['title']); |
| | | const props = defineProps(['title','detailid']); |
| | | const polygonTableEle = ref(null); |
| | | let publicCesiumInstance = null; |
| | | let viewer = null; |
| | |
| | | size: 20, |
| | | }); |
| | | // 图斑管理表格 |
| | | const getspotManagementTableApi =()=>{ |
| | | spotManagementTableApi(params).then(res => { |
| | | console.log('管理表格数据',res); |
| | | const getTableList =()=>{ |
| | | const params={ |
| | | patchesInfoId:props.detailid |
| | | } |
| | | tableMapListApi(params).then(res => { |
| | | console.log('地图表格数据',res.data.data); |
| | | tableData.value = res.data.data |
| | | // 先清空地图现有图斑 |
| | | tbJwdList = []; |
| | | viewer?.entities.removeAll(); // 清除所有实体 |
| | | // 加载图斑 |
| | | entitiesAddSpot(); |
| | | }) |
| | | } |
| | | |
| | | const handleSizeChange = () => {}; |
| | | const handleCurrentChange = () => {}; |
| | | const tableData = ref([]); |
| | |
| | | device_sn: '', |
| | | }); |
| | | // 获取列表数据 |
| | | const getTableList = async () => { |
| | | tableData.value = []; |
| | | const res = await getPatchesSpotList(polygonSearch.value); |
| | | if (res.data.code !== 0) return; |
| | | tableData.value = res.data.data.list.map(item => ({ |
| | | ...item, |
| | | dkfw: item.sdfw && item.is_exception == 1 ? item.sdfw : item.dkfw, |
| | | })); |
| | | total.value = res.data.data.pagination.total; |
| | | // 先清空地图现有图斑 |
| | | tbJwdList = []; |
| | | viewer.entities.removeAll(); // 清除所有实体 |
| | | // 加载图斑 |
| | | entitiesAddSpot(); |
| | | }; |
| | | // const getTableList = async () => { |
| | | // tableData.value = []; |
| | | // const res = await getPatchesSpotList(polygonSearch.value); |
| | | // if (res.data.code !== 0) return; |
| | | // console.log('rrrrr',res.data.data); |
| | | |
| | | // tableData.value = res.data.data.list.map(item => ({ |
| | | // ...item, |
| | | // dkfw: item.sdfw && item.is_exception == 1 ? item.sdfw : item.dkfw, |
| | | // })); |
| | | // total.value = res.data.data.pagination.total; |
| | | // // 先清空地图现有图斑 |
| | | // tbJwdList = []; |
| | | // viewer.entities.removeAll(); // 清除所有实体 |
| | | // // 加载图斑 |
| | | // entitiesAddSpot(); |
| | | // }; |
| | | |
| | | // 地图 |
| | | const initMap = () => { |
| | |
| | | const color = |
| | | item.is_exception == 2 ? Cesium.Color.RED.withAlpha(0.5) : Cesium.Color.YELLOW.withAlpha(0.5); |
| | | const outlineColor = item.is_exception == 2 ? Cesium.Color.RED : Cesium.Color.YELLOW; |
| | | viewInstance.value.removeById('polygon_dk' + item.id); |
| | | homeViewer.value.entities?.add({ |
| | | viewInstance.value?.removeById('polygon_dk' + item.id); |
| | | homeViewer.value?.entities?.add({ |
| | | id: 'polygon_dk' + item.id, |
| | | customType: 'pattern_spot_polygon', |
| | | customInfo: { |
| | |
| | | |
| | | if (tbJwdList.length > 0) { |
| | | const positions = tbJwdList.flatMap(item => Cesium.Cartesian3.fromDegreesArray(item.grouped)); |
| | | homeViewer.value.camera.flyToBoundingSphere(new Cesium.BoundingSphere.fromPoints(positions)); |
| | | homeViewer.value?.camera.flyToBoundingSphere(new Cesium.BoundingSphere.fromPoints(positions)); |
| | | } |
| | | viewInstance.value.removeLeftClickEvent('spotHighlighting'); |
| | | viewInstance.value.addLeftClickEvent(null, spotHighlighting, 'spotHighlighting'); |
| | | viewInstance.value?.removeLeftClickEvent('spotHighlighting'); |
| | | viewInstance.value?.addLeftClickEvent(null, spotHighlighting, 'spotHighlighting'); |
| | | }); |
| | | }; |
| | | |
| | |
| | | setTimeout(() => { |
| | | initMap(); |
| | | getTableList(); |
| | | |
| | | }, 0); |
| | | } else { |
| | | if (funButtonEle.value) { |
| | |
| | | } |
| | | }); |
| | | onMounted(()=>{ |
| | | getspotManagementTableApi() |
| | | |
| | | }) |
| | | onBeforeUnmount(() => { |
| | | destroyMap(); |