|
@@ -287,6 +287,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ targetLayerPage: {},
|
|
|
+ targetLayerTotal: {},
|
|
|
currentTotal: 0,
|
|
|
layerLoading: false,
|
|
|
expandedKeys: [],
|
|
@@ -630,6 +632,11 @@ export default {
|
|
|
// 清除页面所有数据
|
|
|
clearAllData() {
|
|
|
this.currentTotal = 0;
|
|
|
+ this.paginationData.total = 0;
|
|
|
+ this.targetLayerTotal = {};
|
|
|
+ this.targetLayerPage = {};
|
|
|
+ this.originalDataMap.clear();
|
|
|
+ this.originalData = {};
|
|
|
map2DViewer.map.off("move");
|
|
|
// 所有图层或预设模型全部删除
|
|
|
if (Object.getOwnPropertyNames(map2DViewer.analysisGroups).length > 0) {
|
|
@@ -682,132 +689,119 @@ export default {
|
|
|
);
|
|
|
}
|
|
|
},
|
|
|
- /**
|
|
|
- * 获取图层信息 -- 所有模型和预设模型
|
|
|
- * @columnId
|
|
|
- * @id label_columnId
|
|
|
- * @mainType 所有图层/预设模型
|
|
|
- * @sourceType 土地资源/林地资源/生态资源/水资源/全部
|
|
|
- */
|
|
|
- displaySingleLayer(columnId, id, mainType, sourceType) {
|
|
|
- debugger;
|
|
|
- let uniqueId = id;
|
|
|
- this.layerIdMap.set(uniqueId, uniqueId);
|
|
|
- // 图例
|
|
|
- this.legendTitle.push({
|
|
|
- name: uniqueId,
|
|
|
- info: uniqueId,
|
|
|
- });
|
|
|
- this.legendIcon.push({
|
|
|
- name: uniqueId,
|
|
|
- background: "transparent",
|
|
|
- border: `1px solid ${this.randomColor.get(uniqueId)}`,
|
|
|
- });
|
|
|
- // 图层未初始化
|
|
|
- if (!map2DViewer.analysisGroups[uniqueId]) {
|
|
|
- map2DViewer.analysisGroups[uniqueId] = L.featureGroup();
|
|
|
- map2DViewer.analysisGroups[uniqueId].addTo(map2DViewer.map);
|
|
|
- if (!this.layerLoading) {
|
|
|
- this.layerLoading = true;
|
|
|
- }
|
|
|
- // console.log(columnId, "columnId");
|
|
|
- let layerParams = new FormData();
|
|
|
- layerParams = {
|
|
|
- columnId: columnId,
|
|
|
- states: "0,1,2,3",
|
|
|
- pageSize: 500,
|
|
|
- page: 0,
|
|
|
- };
|
|
|
-
|
|
|
- this.$Post(this.urlsCollection.selectContentList, layerParams).then(
|
|
|
- (res) => {
|
|
|
- if (res.code === 202 && res.content === "数据不存在") {
|
|
|
- this.layerLoading = false;
|
|
|
+ getMapData(uniqueId, columnId, mainType, sourceType) {
|
|
|
+ let layerParams = new FormData();
|
|
|
+ layerParams = {
|
|
|
+ columnId: columnId,
|
|
|
+ states: "0,1,2,3",
|
|
|
+ pageSize: 500,
|
|
|
+ page: this.targetLayerPage[uniqueId],
|
|
|
+ };
|
|
|
+ this.$Post(this.urlsCollection.selectContentList, layerParams).then(
|
|
|
+ (res) => {
|
|
|
+ if (res.code === 202 && res.content === "数据不存在") {
|
|
|
+ this.layerLoading = false;
|
|
|
+ // 初始化请求 page为0时,提示无数据
|
|
|
+ if (this.targetLayerPage[uniqueId] === 0) {
|
|
|
this.$message.info("暂无数据!");
|
|
|
}
|
|
|
- if (res.code === 200) {
|
|
|
- this.layerLoading = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.layerLoading = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code === 200 && res.content.data.length > 0) {
|
|
|
+ if (!this.$store.state.selectSelectDataMap["singlePolygon"]) {
|
|
|
+ this.$store.state.selectSelectDataMap["singlePolygon"] = [];
|
|
|
}
|
|
|
- if (res.code === 200 && res.content.data.length > 0) {
|
|
|
- console.log(res.content.count, "count");
|
|
|
- // this.paginationData.currentPage = 1;
|
|
|
- this.paginationData.total = res.content.data.length;
|
|
|
|
|
|
- if (!this.$store.state.selectSelectDataMap["singlePolygon"]) {
|
|
|
- this.$store.state.selectSelectDataMap["singlePolygon"] = [];
|
|
|
- }
|
|
|
- // 存储请求到的疑点数据
|
|
|
+ // 存储请求到的疑点数据
|
|
|
+ if (!this.originalDataMap.has(uniqueId)) {
|
|
|
this.originalDataMap.set(uniqueId, res.content.data);
|
|
|
+ } else {
|
|
|
+ let arr = this.originalDataMap
|
|
|
+ .get(uniqueId)
|
|
|
+ .concat(res.content.data);
|
|
|
+ this.originalDataMap.set(uniqueId, arr);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 该图层疑点总数
|
|
|
+ this.targetLayerTotal[uniqueId] = res.content.count;
|
|
|
+
|
|
|
+ // 分页组件total
|
|
|
+ this.paginationData.total =
|
|
|
+ this.originalDataMap.get(uniqueId).length;
|
|
|
+
|
|
|
+ // 当前图层id存在
|
|
|
+ if (
|
|
|
+ map2DViewer.analysisGroups[uniqueId] &&
|
|
|
+ this.originalDataMap.get(uniqueId).length > 0 &&
|
|
|
+ res.content.data.length > 0
|
|
|
+ ) {
|
|
|
+ // 统计所有图斑数
|
|
|
+ this.currentTotal += res.content.data.length;
|
|
|
+ // 请求到数据后直接渲染点
|
|
|
+ res.content.data.forEach((ele) => {
|
|
|
+ let cid = ele.id;
|
|
|
+ let geometry = ele.c_content;
|
|
|
+
|
|
|
+ this.$store.state.mapMethodsCollection
|
|
|
+ .get("RENDER")
|
|
|
+ .addSinglePolygon(
|
|
|
+ geometry,
|
|
|
+ cid,
|
|
|
+ this.randomColor.get(uniqueId),
|
|
|
+ uniqueId,
|
|
|
+ mainType,
|
|
|
+ sourceType
|
|
|
+ );
|
|
|
+ });
|
|
|
|
|
|
+ // 所有图层可视化数据 -- 需要分页展示
|
|
|
if (mainType === "所有图层") {
|
|
|
// 激活当前展开面板
|
|
|
this.activeNames = ["myLabel", uniqueId];
|
|
|
- this.originalData[uniqueId] = res.content.data.map((ele) => {
|
|
|
- let cid = ele.id;
|
|
|
- let geometry = ele.c_content;
|
|
|
-
|
|
|
- this.$store.state.mapMethodsCollection
|
|
|
- .get("RENDER")
|
|
|
- .addSinglePolygon(
|
|
|
- geometry,
|
|
|
- cid,
|
|
|
- this.randomColor.get(uniqueId),
|
|
|
- uniqueId,
|
|
|
- mainType,
|
|
|
- sourceType
|
|
|
- );
|
|
|
+ // 用于分页数据
|
|
|
+ this.originalData[uniqueId] = this.originalDataMap
|
|
|
+ .get(uniqueId)
|
|
|
+ .map((ele) => {
|
|
|
+ return {
|
|
|
+ id: ele.id,
|
|
|
+ // "垃圾堆放点"
|
|
|
+ column_name: ele.column_name,
|
|
|
+ // 是否疑点
|
|
|
+ c_boolean: ele.c_boolean ? "是" : "否",
|
|
|
+ // 行政区划
|
|
|
+ c_xzqh: ele.c_xzqh,
|
|
|
+ // 空间信息
|
|
|
+ c_content: ele.c_content,
|
|
|
+ // 疑点修改时间
|
|
|
+ c_date_time: ele.c_date_time,
|
|
|
+ // 修改人员名称
|
|
|
+ // c_editor_name: ele.c_editor_name,
|
|
|
+ // 标题
|
|
|
+ title: ele.title,
|
|
|
+ column_id: ele.column_id,
|
|
|
+ content: ele.content,
|
|
|
+ secret_level: ele.secret_level,
|
|
|
+ };
|
|
|
+ });
|
|
|
|
|
|
- return {
|
|
|
- id: ele.id,
|
|
|
- // "垃圾堆放点"
|
|
|
- column_name: ele.column_name,
|
|
|
- // 是否疑点
|
|
|
- c_boolean: ele.c_boolean ? "是" : "否",
|
|
|
- // 行政区划
|
|
|
- c_xzqh: ele.c_xzqh,
|
|
|
- // 空间信息
|
|
|
- c_content: ele.c_content,
|
|
|
- // 疑点修改时间
|
|
|
- c_date_time: ele.c_date_time,
|
|
|
- // 修改人员名称
|
|
|
- // c_editor_name: ele.c_editor_name,
|
|
|
- // 标题
|
|
|
- title: ele.title,
|
|
|
- column_id: ele.column_id,
|
|
|
- content: ele.content,
|
|
|
- secret_level: ele.secret_level,
|
|
|
- };
|
|
|
- });
|
|
|
// 进行分页列表展示
|
|
|
this.changeSingleLayer(
|
|
|
1,
|
|
|
this.currentPageSize,
|
|
|
columnId,
|
|
|
- id,
|
|
|
+ uniqueId,
|
|
|
mainType,
|
|
|
sourceType
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- if (
|
|
|
- mainType === "预设模型" &&
|
|
|
- this.originalDataMap.get(uniqueId).length > 0
|
|
|
- ) {
|
|
|
+ // 预设模型可视化数据 -- 不需要分页展示
|
|
|
+ if (mainType === "预设模型") {
|
|
|
this.originalDataMap.get(uniqueId).map((ele) => {
|
|
|
- let cid = ele.id;
|
|
|
- let geometry = ele.c_content;
|
|
|
-
|
|
|
- this.$store.state.mapMethodsCollection
|
|
|
- .get("RENDER")
|
|
|
- .addSinglePolygon(
|
|
|
- geometry,
|
|
|
- cid,
|
|
|
- this.randomColor.get(uniqueId),
|
|
|
- uniqueId,
|
|
|
- mainType,
|
|
|
- sourceType
|
|
|
- );
|
|
|
-
|
|
|
return {
|
|
|
id: ele.id,
|
|
|
// "垃圾堆放点"
|
|
@@ -831,67 +825,56 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- this.currentTotal += this.originalDataMap.get(uniqueId).length;
|
|
|
- // console.log(
|
|
|
- // "target",
|
|
|
- // this.currentPageSize,
|
|
|
- // columnId,
|
|
|
- // id,
|
|
|
- // mainType,
|
|
|
- // sourceType
|
|
|
- // );
|
|
|
+ // 当前图斑数小于数据库中的图斑总数时,递归请求图斑
|
|
|
+ if (
|
|
|
+ this.originalDataMap.get(uniqueId).length <=
|
|
|
+ this.targetLayerTotal[uniqueId]
|
|
|
+ ) {
|
|
|
+ this.targetLayerPage[uniqueId]++;
|
|
|
+ this.getMapData(uniqueId, columnId, mainType, sourceType);
|
|
|
+ }
|
|
|
}
|
|
|
- },
|
|
|
- (error) => {
|
|
|
- this.layerLoading = false;
|
|
|
- this.$message.error("请求错误");
|
|
|
}
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- // 图层已初始化
|
|
|
- // if (
|
|
|
- // map2DViewer.analysisGroups[uniqueId] &&
|
|
|
- // !map2DViewer.map.hasLayer(map2DViewer.analysisGroups[uniqueId])
|
|
|
- // ) {
|
|
|
- // map2DViewer.map.addLayer(map2DViewer.analysisGroups[uniqueId]);
|
|
|
-
|
|
|
- // if (mainType === "所有图层") {
|
|
|
- // this.originalData[uniqueId] = [];
|
|
|
- // // 激活当前展开面板
|
|
|
- // this.activeNames = ["myLabel", uniqueId];
|
|
|
- // // 已经请求过接口无需二次请求
|
|
|
- // if (this.originalDataMap.get(uniqueId).length > 0) {
|
|
|
- // this.originalData[uniqueId] = this.originalDataMap
|
|
|
- // .get(uniqueId)
|
|
|
- // .map((ele) => {
|
|
|
- // return {
|
|
|
- // id: ele.id,
|
|
|
- // column_name: ele.column_name,
|
|
|
- // // 是否疑点
|
|
|
- // c_boolean: ele.c_boolean ? "是" : "否",
|
|
|
- // // 行政区划
|
|
|
- // c_xzqh: ele.c_xzqh,
|
|
|
- // // 空间信息
|
|
|
- // c_content: ele.c_content,
|
|
|
- // // 疑点修改时间
|
|
|
- // c_date_time: ele.c_date_time,
|
|
|
- // // 修改人员名称
|
|
|
- // // c_editor_name: ele.c_editor_name,
|
|
|
- // // 标题
|
|
|
- // title: ele.title,
|
|
|
- // column_id: ele.column_id,
|
|
|
- // content: ele.content,
|
|
|
- // secret_level: ele.secret_level,
|
|
|
- // };
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
+ this.layerLoading = false;
|
|
|
+ if (this.targetLayerPage[uniqueId]) {
|
|
|
+ this.$message.error("请求错误!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取图层信息 -- 所有模型和预设模型
|
|
|
+ * @columnId
|
|
|
+ * @id label_columnId
|
|
|
+ * @mainType 所有图层/预设模型
|
|
|
+ * @sourceType 土地资源/林地资源/生态资源/水资源/全部
|
|
|
+ */
|
|
|
+ displaySingleLayer(columnId, id, mainType, sourceType) {
|
|
|
+ let uniqueId = id;
|
|
|
+ this.layerIdMap.set(uniqueId, uniqueId);
|
|
|
|
|
|
- // if (this.originalDataMap.get(uniqueId).length > 0) {
|
|
|
- // this.currentTotal += this.originalDataMap.get(uniqueId).length;
|
|
|
- // }
|
|
|
- // }
|
|
|
+ // 图层未初始化
|
|
|
+ if (!map2DViewer.analysisGroups[uniqueId]) {
|
|
|
+ // 图例
|
|
|
+ this.legendTitle.push({
|
|
|
+ name: uniqueId,
|
|
|
+ info: uniqueId,
|
|
|
+ });
|
|
|
+ this.legendIcon.push({
|
|
|
+ name: uniqueId,
|
|
|
+ background: "transparent",
|
|
|
+ border: `1px solid ${this.randomColor.get(uniqueId)}`,
|
|
|
+ });
|
|
|
+ map2DViewer.analysisGroups[uniqueId] = L.featureGroup();
|
|
|
+ map2DViewer.analysisGroups[uniqueId].addTo(map2DViewer.map);
|
|
|
+ this.targetLayerPage[uniqueId] = 0;
|
|
|
+ if (!this.layerLoading && this.targetLayerPage[uniqueId] === 0) {
|
|
|
+ this.layerLoading = true;
|
|
|
+ }
|
|
|
+ this.getMapData(uniqueId, columnId, mainType, sourceType);
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* 切换页时改变图层数据
|
|
@@ -1264,7 +1247,6 @@ export default {
|
|
|
|
|
|
// 节点change事件
|
|
|
handleCheckChange(data, checked) {
|
|
|
- debugger;
|
|
|
if (data.mainType && data.mainType !== "我的模型") {
|
|
|
if (checked) {
|
|
|
this.showRightBox = true;
|
|
@@ -1363,14 +1345,15 @@ export default {
|
|
|
data.id
|
|
|
];
|
|
|
}
|
|
|
- // if (this.originalData && this.originalData[data.id]) {
|
|
|
- // this.currentTotal -= this.originalDataMap[data.id].length;
|
|
|
- // delete this.originalData[data.id];
|
|
|
- // }
|
|
|
|
|
|
// 取消勾选当前图层勾选,图斑数改变, 如果是所有图层数据移除折叠面板
|
|
|
- if (this.originalDataMap && this.originalDataMap.has(data.id)) {
|
|
|
+ if (
|
|
|
+ this.originalDataMap &&
|
|
|
+ this.originalDataMap.has(data.id) &&
|
|
|
+ this.currentTotal > 0
|
|
|
+ ) {
|
|
|
this.currentTotal -= this.originalDataMap.get(data.id).length;
|
|
|
+ this.originalDataMap.delete(data.id);
|
|
|
|
|
|
if (
|
|
|
data.mainType === "所有图层" &&
|
|
@@ -1381,6 +1364,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 统计后小于0改为0
|
|
|
+ if (this.currentTotal < 0) {
|
|
|
+ this.currentTotal = 0;
|
|
|
+ }
|
|
|
+
|
|
|
map2DViewer.map.closePopup();
|
|
|
|
|
|
// 移除图例
|
|
@@ -1408,6 +1396,7 @@ export default {
|
|
|
|
|
|
// 移除图层id
|
|
|
if (map2DViewer.analysisGroups[data.id]) {
|
|
|
+ delete this.targetLayerTotal[data.id];
|
|
|
delete map2DViewer.analysisGroups[data.id];
|
|
|
}
|
|
|
}
|
|
@@ -1435,7 +1424,6 @@ export default {
|
|
|
if (!this.$store.state.selectSelectDataMap["singlePolygon"]) {
|
|
|
this.$store.state.selectSelectDataMap["singlePolygon"] = [];
|
|
|
}
|
|
|
- debugger;
|
|
|
|
|
|
// 如果有叠置分析文件 -- 呈现叠置分析内容
|
|
|
if (data.c_dzfx_file) {
|
|
@@ -1514,7 +1502,7 @@ export default {
|
|
|
// }
|
|
|
},
|
|
|
readGeojson(geojson, uniqueId) {
|
|
|
- debugger;
|
|
|
+ // debugger;
|
|
|
// 尽量与所有图层,预设模型读取几何数据的方式一样,
|
|
|
// let states = [];
|
|
|
// states.push(geojson);
|