| | |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="pagination-container"> |
| | | <el-pagination |
| | | :current-page="params.page" |
| | | :page-size="params.pageSize" |
| | | background |
| | | layout="prev, pager, next, ..." |
| | | :pager-count="3" |
| | | prev-text="上一页" |
| | | next-text="下一页" |
| | | :total="total" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <!--绘制按钮--> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { flyVisual } from '@/utils/cesium/mapUtil' |
| | | import { pxToRem, pxToRemNum } from '@/utils/rem' |
| | | import DrawPolygon from '@/views/resource/components/DrawPolygon.vue'; |
| | | import { ElMessage, ElMessageBox } from 'element-plus'; |
| | |
| | | const getTableList = () => { |
| | | const requestParams = { |
| | | patchesInfoId: props.detailid, |
| | | page: params.value.page, |
| | | pageSize: params.value.pageSize, |
| | | |
| | | }; |
| | | tableMapListApi(requestParams).then(res => { |
| | | tableData.value = res.data.data.records?.map(item => ({ |
| | | AlltableMapListApi(requestParams).then(res => { |
| | | tableData.value = res.data.data?.map(item => ({ |
| | | ...item, |
| | | dkfw: item.sdfw && item.is_exception == 1 ? item.sdfw : item.dkfw, |
| | | })); |
| | | total.value = res.data.data.total || res.data.data.length; |
| | | tbJwdList = []; |
| | | viewer?.entities.removeAll(); |
| | | if (!AlltableData.value) { |
| | | if (!tableData.value) { |
| | | viewInstance.value?.flyToContour(); |
| | | } else { |
| | | entitiesAddSpot(); |
| | | } |
| | | }); |
| | | }; |
| | | // 所有图斑数据 |
| | | const getAlltableMapListApi = () => { |
| | | loading.value = true; |
| | | const requestParams = { |
| | | patchesInfoId: props.detailid, |
| | | }; |
| | | AlltableMapListApi(requestParams).then(res => { |
| | | AlltableData.value = res.data.data?.map(item => ({ |
| | | ...item, |
| | | dkfw: item.sdfw && item.is_exception == 1 ? item.sdfw : item.dkfw, |
| | | })); |
| | | |
| | | tbJwdList = []; |
| | | viewer?.entities.removeAll(); |
| | | if (AlltableData.value.length < 1) { |
| | | viewInstance.value?.flyToContour(); |
| | | } else { |
| | | entitiesAddSpot(); |
| | | } |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | const handleSizeChange = val => { |
| | | params.value.pageSize = val; |
| | | params.value.page = 1; |
| | | getTableList(); |
| | | }; |
| | | const handleCurrentChange = val => { |
| | | params.value.page = val; |
| | | getTableList(); |
| | | }; |
| | | |
| | | // 地图 |
| | | const initMap = () => { |
| | |
| | | // 初始化所有图斑 |
| | | const entitiesAddSpot = () => { |
| | | viewer?.entities.removeAll(); |
| | | AlltableData.value.forEach(item => { |
| | | tableData.value.forEach(item => { |
| | | // 取出当中经纬度 |
| | | const numbersWithCommas = item.dkfw.match(/\d+(\.\d+)?/g); |
| | | if (!numbersWithCommas) return; |
| | |
| | | Number(polygonCenter.lat), |
| | | 1500 |
| | | ), |
| | | zIndex: 100, |
| | | |
| | | }); |
| | | } |
| | | // flyMapSpot(nowEntity?.customInfo) |
| | | |
| | | } |
| | | // 清空选中的数据 |
| | | const clearSelect = () => { |
| | |
| | | } |
| | | }; |
| | | // 删除 |
| | | const handleDelete = row => { |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm('确认删除当前行图斑?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | |
| | | deletePatches({ ids: row.id }).then(res => { |
| | | if (res.data.code !== 0) return ElMessage.warning('删除失败'); |
| | | ElMessage.success('删除成功'); |
| | | getTableList(); |
| | | getspotManagementTableApi(); |
| | | getAlltableMapListApi(); |
| | | tableData.value = tableData.value.filter(item => item.id !== row.id); |
| | | //从地图上移除对应的图斑实体 |
| | | const entityId = `polygon_dk${row.id}`; |
| | | viewer?.entities.removeById(entityId); |
| | | const exceptionCountItem = infoList.value.find(item => item.name === '异常图斑数量'); |
| | | if (exceptionCountItem && row.is_exception === 2) { |
| | | exceptionCountItem.value = Math.max(0, parseInt(exceptionCountItem.value) - 1); |
| | | } |
| | | const totalCountItem = infoList.value.find(item => item.name === '图斑数量'); |
| | | if (totalCountItem) { |
| | | totalCountItem.value = Math.max(0, parseInt(totalCountItem.value) - 1); |
| | | } |
| | | |
| | | // 清除选中状态 |
| | | if (selectionIds.value === row.id) { |
| | | selectionIds.value = null; |
| | | selectionList.value = []; |
| | | isEditing.value = false; |
| | | handleUpDateDrawState(false); |
| | | } |
| | | |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | // 保存 |
| | | const handleSave = () => { |
| | | const fileNameItem = infoList.value.find(item => item.name === '文件名称'); |
| | |
| | | setTimeout(() => { |
| | | initMap(); |
| | | getTableList(); |
| | | getAlltableMapListApi(); |
| | | |
| | | getspotManagementTableApi(); |
| | | }, 0); |
| | | } else { |
| | |
| | | // 表格主体 |
| | | .el-table__body { |
| | | tr:hover > td { |
| | | background-color: rgba(0, 0, 0, 0.6) !important; |
| | | background-color: rgba(64, 158, 255,0.3) !important; |
| | | } |
| | | |
| | | td { |
| | |
| | | |
| | | // 选中行 |
| | | .current-row td { |
| | | background-color: rgba(0, 0, 0, 0.6) !important; |
| | | |
| | | background-color: rgba(64, 158, 255,0.3) !important; |
| | | } |
| | | } |
| | | :deep(.el-table__body) { |