Merge branch 'main' into dev-tw
This commit is contained in:
commit
b3d97c7cda
@ -4,7 +4,7 @@
|
|||||||
NODE_ENV='development'
|
NODE_ENV='development'
|
||||||
|
|
||||||
VITE_APP_TITLE = '水电水利建设项目全过程环境管理信息平台'
|
VITE_APP_TITLE = '水电水利建设项目全过程环境管理信息平台'
|
||||||
VITE_APP_PORT = 3000
|
VITE_APP_PORT = 8000
|
||||||
VITE_APP_BASE_API = '/dev-api'
|
VITE_APP_BASE_API = '/dev-api'
|
||||||
# 本地环境
|
# 本地环境
|
||||||
VITE_APP_BASE_URL = 'http://10.84.111.235:8093'
|
VITE_APP_BASE_URL = 'http://10.84.111.235:8093'
|
||||||
|
|||||||
@ -7,14 +7,14 @@ VITE_APP_TITLE = '水电水利建设项目全过程环境管理信息平台'
|
|||||||
VITE_APP_PORT = 3000
|
VITE_APP_PORT = 3000
|
||||||
VITE_APP_BASE_API = '/dev-api'
|
VITE_APP_BASE_API = '/dev-api'
|
||||||
# 本地环境
|
# 本地环境
|
||||||
# VITE_APP_BASE_URL = 'http://localhost:8093'
|
# VITE_APP_BASE_URL = 'http://10.84.121.127:8093'
|
||||||
# 测试环境
|
# 测试环境
|
||||||
# VITE_APP_BASE_URL = 'http://172.16.21.142:8093'
|
# VITE_APP_BASE_URL = 'http://172.16.21.142:8093'
|
||||||
# VITE_APP_BASE_URL = 'http://172.16.21.142:8096'
|
# VITE_APP_BASE_URL = 'http://172.16.21.142:8096'
|
||||||
# 汤伟
|
# 汤伟
|
||||||
# VITE_APP_BASE_URL = 'http://10.84.111.235:8093'
|
VITE_APP_BASE_URL = 'http://10.84.111.235:8093'
|
||||||
# 李林
|
# 李林
|
||||||
VITE_APP_BASE_URL = 'http://10.84.111.25:8093'
|
# VITE_APP_BASE_URL = 'http://10.84.111.25:8093'
|
||||||
|
|
||||||
# 测试环境线上10.84.121.122:
|
# 测试环境线上10.84.121.122:
|
||||||
VITE_APP_TEST_ONLINE_URL = 'https://211.99.26.225:12122'
|
VITE_APP_TEST_ONLINE_URL = 'https://211.99.26.225:12122'
|
||||||
|
|||||||
@ -299,7 +299,7 @@
|
|||||||
|
|
||||||
1. 先收集所有带 URL 的图层
|
1. 先收集所有带 URL 的图层
|
||||||
2. 把默认勾选图层作为高优先级任务
|
2. 把默认勾选图层作为高优先级任务
|
||||||
3. 并发加载,默认并发数为 4
|
3. 收集完成后全量并发加载,不再按 4 个一组分批发起
|
||||||
4. 每个图层完成后立即写入缓存
|
4. 每个图层完成后立即写入缓存
|
||||||
5. 每个图层命中缓存或返回成功后,立即增量更新 `pointData`
|
5. 每个图层命中缓存或返回成功后,立即增量更新 `pointData`
|
||||||
6. 全部图层结束后,再统一:
|
6. 全部图层结束后,再统一:
|
||||||
|
|||||||
@ -1,22 +1,12 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { EcoFlowStandard, EcoFlowQueryParams } from './types';
|
import type { EcoFlowStandard, EcoFlowQueryParams } from './types';
|
||||||
|
|
||||||
/**
|
export function getQgcStaticData(
|
||||||
* 获取生态流量达标情况数据
|
params?: EcoFlowQueryParams
|
||||||
* @param params 查询参数
|
): Promise<{ data: EcoFlowStandard[] }> {
|
||||||
*/
|
|
||||||
export function getEcoFlowStandardData(params?: EcoFlowQueryParams): Promise<{ data: EcoFlowStandard[] }> {
|
|
||||||
return request({
|
|
||||||
url: '/api/eco-flow/standard',
|
|
||||||
method: 'get',
|
|
||||||
params
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getQgcStaticData(params?: EcoFlowQueryParams): Promise<{ data: EcoFlowStandard[] }> {
|
|
||||||
return request({
|
return request({
|
||||||
url: '/eng/eq/interval/qgc/getQgcStaticData',
|
url: '/eng/eq/interval/qgc/getQgcStaticData',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data:params
|
data: params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,30 +88,3 @@ export function baseMsstbprptGetKendoList(data: any) {
|
|||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 降水量实时数据
|
|
||||||
export function getBaseStbprpDataPPTNR(data: any) {
|
|
||||||
return request({
|
|
||||||
url: '/api/dec-lygk-base-server/base/stbprpData/GetKendoListCust?tbCode=PPTN_R',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 气温气压实时数据
|
|
||||||
export function getBaseStbprpDataTMPR(data: any) {
|
|
||||||
return request({
|
|
||||||
url: '/api/dec-lygk-base-server/base/stbprpData/GetKendoListCust?tbCode=TMP_R',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 风速风向实时数据
|
|
||||||
export function getBaseStbprpDataWNDR(data: any) {
|
|
||||||
return request({
|
|
||||||
url: '/api/dec-lygk-base-server/base/stbprpData/GetKendoListCust?tbCode=WND_R',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -3,9 +3,7 @@ import request from '@/utils/request';
|
|||||||
// 获取图例列表
|
// 获取图例列表
|
||||||
export function getModuleMapLegendList(params?: { moduleId?: string }) {
|
export function getModuleMapLegendList(params?: { moduleId?: string }) {
|
||||||
const url = params?.moduleId
|
const url = params?.moduleId
|
||||||
? // ? `/api/wmp-sys-server/mapLegend/getModuleMapLegendList?moduleId=${params.moduleId}`
|
? `/mapLegend/getModuleMapLegendList?moduleId=${params.moduleId}`
|
||||||
// : '/api/wmp-sys-server/mapLegend/getModuleMapLegendList';
|
|
||||||
`/mapLegend/getModuleMapLegendList?moduleId=${params.moduleId}`
|
|
||||||
: '/mapLegend/getModuleMapLegendList';
|
: '/mapLegend/getModuleMapLegendList';
|
||||||
return request({
|
return request({
|
||||||
url,
|
url,
|
||||||
@ -15,7 +13,6 @@ export function getModuleMapLegendList(params?: { moduleId?: string }) {
|
|||||||
// 获取地图配置列表
|
// 获取地图配置列表
|
||||||
export function getMapList(data: any) {
|
export function getMapList(data: any) {
|
||||||
return request({
|
return request({
|
||||||
// url: '/api/wmp-sys-server/mapmodule/getMapData',
|
|
||||||
url: '/mapmodule/getMapData',
|
url: '/mapmodule/getMapData',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
@ -24,7 +21,7 @@ export function getMapList(data: any) {
|
|||||||
// 获取梯级流域地图
|
// 获取梯级流域地图
|
||||||
export function getQgcRvcd(data: any) {
|
export function getQgcRvcd(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/wmp-eng-server/eng/rsvrcscdb/getQgcRvcd',
|
url: '/eng/base/rsvrcscdb/getQgcRvcd',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
@ -32,7 +29,7 @@ export function getQgcRvcd(data: any) {
|
|||||||
// 获取梯级流域下拉框列表
|
// 获取梯级流域下拉框列表
|
||||||
export function getRvcdList(data: any) {
|
export function getRvcdList(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/wmp-eng-server/eng/rsvrcscdb/rvcd',
|
url: '/eng/base/rsvrcscdb/rvcd',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
@ -41,7 +38,23 @@ export function getRvcdList(data: any) {
|
|||||||
// 获取梯级流域下拉框图表数据
|
// 获取梯级流域下拉框图表数据
|
||||||
export function getKendoList(data: any) {
|
export function getKendoList(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/wmp-eng-server/eng/rsvrcscdb/GetKendoList',
|
url: '/eng/base/rsvrcscdb/GetKendoList',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 鱼类分布查询 - 站点查询
|
||||||
|
export function getFishPointList(data: any) {
|
||||||
|
return request({
|
||||||
|
url: '/wte/we/fishPoint/qgc/GetKendoListCust',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 鱼类分布查询 -鱼查询
|
||||||
|
export function getFishList(data: any) {
|
||||||
|
return request({
|
||||||
|
url: '/wte/we/fishList/GetKendoListCust',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
|
|||||||
@ -32,7 +32,16 @@ export function saveBaseWbsbChild(data: any) {
|
|||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 查询子节点
|
||||||
|
export function getChildConfigTree(data: any) {
|
||||||
|
return request({
|
||||||
|
url: '/base/msalongdetb/GetKendoList',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存子节点
|
||||||
export function saveBaseWbsbChildDetail(data: any) {
|
export function saveBaseWbsbChildDetail(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/base/msalongdetb/save',
|
url: '/base/msalongdetb/save',
|
||||||
|
|||||||
@ -46,7 +46,7 @@ export function sdFprdRGetKendoListCust(data: any) {
|
|||||||
data
|
data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//装置名称 /api/dec-lygk-base-server/base/vmsstbprpt/GetKendoList
|
//装置名称
|
||||||
export function vmsstbprptGetKendoList(data: any) {
|
export function vmsstbprptGetKendoList(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/fpr/vmsstbprpt/GetKendoList',
|
url: '/fpr/vmsstbprpt/GetKendoList',
|
||||||
@ -54,15 +54,18 @@ export function vmsstbprptGetKendoList(data: any) {
|
|||||||
data
|
data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//鱼种类 /api/wmp-env-server/sdFprdR/getFishInfo
|
//鱼种类
|
||||||
export function sdFprdRgetFishInfo() {
|
export function sdFprdRgetFishInfo() {
|
||||||
return request({
|
return request({
|
||||||
url: '/fpr/sdFprdR/getFishInfo',
|
url: '/fpr/sdFprdR/getFishInfo',
|
||||||
method: 'post',
|
method: 'post'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//获取鱼类变化信息
|
//获取鱼类变化信息
|
||||||
export function sdFprdRGetFtpChangeInfo(data: { baseId: string; year: string }) {
|
export function sdFprdRGetFtpChangeInfo(data: {
|
||||||
|
baseId: string;
|
||||||
|
year: string;
|
||||||
|
}) {
|
||||||
return request({
|
return request({
|
||||||
url: '/fpr/sdFprdR/getFtpChangeInfo',
|
url: '/fpr/sdFprdR/getFtpChangeInfo',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|||||||
@ -9,7 +9,7 @@ export function getAisbdbyxList(data: any) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// AI识别大坝环境-获取饼图+表格数据 /api/wmp-env-server/env/ai/com/GetKendoListCust
|
// AI识别大坝环境-获取饼图+表格数据
|
||||||
export function getAiChartTable(data: any) {
|
export function getAiChartTable(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/warn/ai/com/GetKendoListCust',
|
url: '/warn/ai/com/GetKendoListCust',
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
|
||||||
export function vpcGetKendoListCust(data: any) {
|
export function vpcGetKendoListCust(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/vap/vpc/GetKendoListCust',
|
url: '/vap/vpc/GetKendoListCust',
|
||||||
@ -25,11 +24,3 @@ export function wvaGetKendoListCust(data: any) {
|
|||||||
data
|
data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//植物园情况介绍
|
|
||||||
// export function vpcGetKendoListCust(data: any) {
|
|
||||||
// return request({
|
|
||||||
// url: '/api/wmp-env-server/env/vpc/GetKendoListCust',
|
|
||||||
// method: 'post',
|
|
||||||
// data
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
@ -80,7 +80,6 @@ const init = async () => {
|
|||||||
|
|
||||||
// 备注:地图控制器只分发简单视图切换命令,避免在页面入口堆叠复杂业务逻辑。
|
// 备注:地图控制器只分发简单视图切换命令,避免在页面入口堆叠复杂业务逻辑。
|
||||||
const handleMapController = async (e: any, mapType: any) => {
|
const handleMapController = async (e: any, mapType: any) => {
|
||||||
console.log(e, mapType);
|
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case 'dim':
|
case 'dim':
|
||||||
await mapClass.switchView(mapType);
|
await mapClass.switchView(mapType);
|
||||||
@ -106,7 +105,6 @@ const fetchTjData = async () => {
|
|||||||
for (let i = 0; i < res.data.data.length; i++) {
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
datas.push(res.data.data[i].rvcd);
|
datas.push(res.data.data[i].rvcd);
|
||||||
}
|
}
|
||||||
console.log(servers.Tertiarybasin);
|
|
||||||
mapClass.addTertiarybasinLayer(
|
mapClass.addTertiarybasinLayer(
|
||||||
servers.Tertiarybasin,
|
servers.Tertiarybasin,
|
||||||
'#4DFFDD',
|
'#4DFFDD',
|
||||||
@ -119,9 +117,9 @@ const fetchTjData = async () => {
|
|||||||
// 备注:页面切换后仅触发编排器重载页面,不在组件内继续拼装业务联动。
|
// 备注:页面切换后仅触发编排器重载页面,不在组件内继续拼装业务联动。
|
||||||
watch(
|
watch(
|
||||||
() => pageKey.value,
|
() => pageKey.value,
|
||||||
async newVal => {
|
newVal => {
|
||||||
if (newVal && mapIsInited.value) {
|
if (newVal && mapIsInited.value) {
|
||||||
await mapOrchestrator.handlePageChange(newVal, isShuiDianKaiFaMenu.value);
|
void mapOrchestrator.handlePageChange(newVal, isShuiDianKaiFaMenu.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -19,7 +19,6 @@ declare global {
|
|||||||
__mapMode?: string; // 建议同时声明代码中用到的其他全局变量
|
__mapMode?: string; // 建议同时声明代码中用到的其他全局变量
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(import.meta.env.VITE_APP_ATTACHMENT_URL);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据镜头高度获取地图级别
|
* 根据镜头高度获取地图级别
|
||||||
@ -531,9 +530,7 @@ export const mapOutPut = (imageUrl: string) => {
|
|||||||
downloadElement.click();
|
downloadElement.click();
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.catch((e: any) => {
|
.catch(() => {});
|
||||||
console.log('e', e);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
downloadElement.href = canvas.toDataURL('image/png');
|
downloadElement.href = canvas.toDataURL('image/png');
|
||||||
downloadElement.download = 'download';
|
downloadElement.download = 'download';
|
||||||
|
|||||||
@ -196,7 +196,6 @@ export class MapCesium implements MapInterface {
|
|||||||
// 清理临时元素
|
// 清理临时元素
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
|
|
||||||
console.log('Map image exported successfully:', fileName);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to export map image:', error);
|
console.error('Failed to export map image:', error);
|
||||||
if (error instanceof DOMException && error.name === 'SecurityError') {
|
if (error instanceof DOMException && error.name === 'SecurityError') {
|
||||||
|
|||||||
@ -33,7 +33,6 @@ export class MapClass implements MapClassInterface {
|
|||||||
this.service = new MapOl();
|
this.service = new MapOl();
|
||||||
}
|
}
|
||||||
static getInstance(): MapClass {
|
static getInstance(): MapClass {
|
||||||
console.log('getInstance');
|
|
||||||
if (!this.instance) {
|
if (!this.instance) {
|
||||||
this.instance = new MapClass();
|
this.instance = new MapClass();
|
||||||
}
|
}
|
||||||
@ -41,7 +40,6 @@ export class MapClass implements MapClassInterface {
|
|||||||
}
|
}
|
||||||
// 地图初始化
|
// 地图初始化
|
||||||
init(container: HTMLElement, rectangle?: any): Promise<any> {
|
init(container: HTMLElement, rectangle?: any): Promise<any> {
|
||||||
console.log(container, rectangle);
|
|
||||||
return this.service.init(container, rectangle).then(map => {
|
return this.service.init(container, rectangle).then(map => {
|
||||||
this.view = map;
|
this.view = map;
|
||||||
return map;
|
return map;
|
||||||
@ -176,7 +174,6 @@ export class MapClass implements MapClassInterface {
|
|||||||
|
|
||||||
// 2. 根据类型初始化新的地图服务
|
// 2. 根据类型初始化新的地图服务
|
||||||
if (type === '2D') {
|
if (type === '2D') {
|
||||||
console.log('Switching to 2D (OpenLayers)');
|
|
||||||
this.service = new MapOl();
|
this.service = new MapOl();
|
||||||
|
|
||||||
this.service
|
this.service
|
||||||
@ -187,7 +184,6 @@ export class MapClass implements MapClassInterface {
|
|||||||
})
|
})
|
||||||
.catch(err => reject(err));
|
.catch(err => reject(err));
|
||||||
} else if (type === '3D') {
|
} else if (type === '3D') {
|
||||||
console.log('Switching to 3D (Cesium)');
|
|
||||||
this.service = new MapCesium();
|
this.service = new MapCesium();
|
||||||
|
|
||||||
this.service
|
this.service
|
||||||
@ -261,12 +257,7 @@ export class MapClass implements MapClassInterface {
|
|||||||
// }, 5000)
|
// }, 5000)
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
} catch (e) {
|
} catch {
|
||||||
console.log(
|
|
||||||
'%c switchView: ',
|
|
||||||
'color: MidnightBlue; background: Aquamarine; font-size: 20px;',
|
|
||||||
e
|
|
||||||
);
|
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -60,6 +60,7 @@ export class MapOl implements MapInterface {
|
|||||||
view: View | null = null;
|
view: View | null = null;
|
||||||
private layerRegistry: Map<string, any> = new Map();
|
private layerRegistry: Map<string, any> = new Map();
|
||||||
private iconLoadState = new Map<string, 'loading' | 'loaded' | 'error'>();
|
private iconLoadState = new Map<string, 'loading' | 'loaded' | 'error'>();
|
||||||
|
private pointStyleCache = new Map<string, Style[]>();
|
||||||
private baseLayerConfig: any | null = null;
|
private baseLayerConfig: any | null = null;
|
||||||
private hydropBaseConfig: any | null = null;
|
private hydropBaseConfig: any | null = null;
|
||||||
private REGISTRY_KEY = 'customBaseLayer';
|
private REGISTRY_KEY = 'customBaseLayer';
|
||||||
@ -79,7 +80,9 @@ export class MapOl implements MapInterface {
|
|||||||
private regionMaskManager: RegionMaskManager;
|
private regionMaskManager: RegionMaskManager;
|
||||||
private isBatchPopupMode = false;
|
private isBatchPopupMode = false;
|
||||||
private batchPopupRefreshFrameId: number | null = null;
|
private batchPopupRefreshFrameId: number | null = null;
|
||||||
|
private pointLayerStyleRefreshFrameId: number | null = null;
|
||||||
private labelVisibilityRefreshFrameId: number | null = null;
|
private labelVisibilityRefreshFrameId: number | null = null;
|
||||||
|
private labelVisibilityDebounceTimerId: number | null = null;
|
||||||
constructor() {
|
constructor() {
|
||||||
this.pointLayerManager = new PointLayerManager({
|
this.pointLayerManager = new PointLayerManager({
|
||||||
map: null,
|
map: null,
|
||||||
@ -201,9 +204,9 @@ export class MapOl implements MapInterface {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.map.on('moveend', () => {
|
this.map.on('moveend', () => {
|
||||||
this.requestRefreshPointLabelVisibility(true);
|
this.requestRefreshPointLabelVisibility(false, 60);
|
||||||
if (this.isBatchPopupMode) {
|
if (this.isBatchPopupMode) {
|
||||||
this.requestUpdateBatchPopups(true);
|
this.requestUpdateBatchPopups();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -233,7 +236,7 @@ export class MapOl implements MapInterface {
|
|||||||
|
|
||||||
const currentZoom = this.view ? this.view.getZoom() : INITIAL_ZOOM;
|
const currentZoom = this.view ? this.view.getZoom() : INITIAL_ZOOM;
|
||||||
this.pointLayerManager.updateNearbyFeatureLayout(currentZoom);
|
this.pointLayerManager.updateNearbyFeatureLayout(currentZoom);
|
||||||
this.requestRefreshPointLabelVisibility(true);
|
this.requestRefreshPointLabelVisibility(false, 80);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 初始化 Popup Overlay
|
* 初始化 Popup Overlay
|
||||||
@ -334,10 +337,15 @@ export class MapOl implements MapInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const currentZoom: any = this.view ? this.view.getZoom() : 4.5;
|
const currentZoom: any = this.view ? this.view.getZoom() : 4.5;
|
||||||
|
const cachedDensityVisible = feature.get('_densityVisible');
|
||||||
|
const densityVisible =
|
||||||
|
typeof cachedDensityVisible === 'boolean'
|
||||||
|
? cachedDensityVisible
|
||||||
|
: currentZoom >= this.getFeatureDensityMinZoom(feature);
|
||||||
const iconTargetVisible =
|
const iconTargetVisible =
|
||||||
legendVisible !== false &&
|
legendVisible !== false &&
|
||||||
regionVisible !== false &&
|
regionVisible !== false &&
|
||||||
this.shouldRenderFeatureByDensity(feature, currentZoom) &&
|
densityVisible &&
|
||||||
this.shouldRenderNearbyFeature(feature, currentZoom);
|
this.shouldRenderNearbyFeature(feature, currentZoom);
|
||||||
|
|
||||||
const dynamicScale = this.getDynamicPointScale(currentZoom);
|
const dynamicScale = this.getDynamicPointScale(currentZoom);
|
||||||
@ -361,8 +369,20 @@ export class MapOl implements MapInterface {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles: Style[] = [];
|
const styleCacheKey = [
|
||||||
styles.push(
|
iconUrl,
|
||||||
|
dynamicScale.toFixed(2),
|
||||||
|
fontSize,
|
||||||
|
labelOffsetY,
|
||||||
|
labelTargetVisible ? formattedLabelText : '',
|
||||||
|
labelTargetVisible ? 1 : 0
|
||||||
|
].join('|');
|
||||||
|
const cachedStyles = this.pointStyleCache.get(styleCacheKey);
|
||||||
|
if (cachedStyles) {
|
||||||
|
return cachedStyles;
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles: Style[] = [
|
||||||
new Style({
|
new Style({
|
||||||
image: new Icon({
|
image: new Icon({
|
||||||
src: iconUrl,
|
src: iconUrl,
|
||||||
@ -372,7 +392,7 @@ export class MapOl implements MapInterface {
|
|||||||
declutterMode: 'none'
|
declutterMode: 'none'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
);
|
];
|
||||||
|
|
||||||
if (formattedLabelText && labelTargetVisible) {
|
if (formattedLabelText && labelTargetVisible) {
|
||||||
styles.push(
|
styles.push(
|
||||||
@ -394,9 +414,170 @@ export class MapOl implements MapInterface {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.pointStyleCache.set(styleCacheKey, styles);
|
||||||
return styles;
|
return styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private markFeatureVisibilityDirty(
|
||||||
|
feature: Feature,
|
||||||
|
key: '_densityVisible' | '_iconCollisionVisible' | '_labelCollisionVisible',
|
||||||
|
visible: boolean,
|
||||||
|
dirtyLayerKeys?: Set<string>
|
||||||
|
) {
|
||||||
|
if (feature.get(key) === visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
feature.set(key, visible, true);
|
||||||
|
const layerKey = feature.get('_layerKey');
|
||||||
|
if (dirtyLayerKeys && layerKey) {
|
||||||
|
dirtyLayerKeys.add(String(layerKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private flushDirtyPointLayers(dirtyLayerKeys: Set<string>) {
|
||||||
|
dirtyLayerKeys.forEach(layerKey => {
|
||||||
|
const layer = this.pointLayerManager.getLayer(layerKey);
|
||||||
|
layer?.changed();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private syncFeatureDensityVisible(
|
||||||
|
feature: Feature,
|
||||||
|
visible: boolean,
|
||||||
|
dirtyLayerKeys?: Set<string>
|
||||||
|
) {
|
||||||
|
this.markFeatureVisibilityDirty(
|
||||||
|
feature,
|
||||||
|
'_densityVisible',
|
||||||
|
visible,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private getFeaturePixelGridKey(
|
||||||
|
layerKey: string,
|
||||||
|
pixelX: number,
|
||||||
|
pixelY: number,
|
||||||
|
cellSize: number
|
||||||
|
) {
|
||||||
|
return `${layerKey}:${Math.floor(pixelX / cellSize)}:${Math.floor(
|
||||||
|
pixelY / cellSize
|
||||||
|
)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private hasNearbyViewportFeature(
|
||||||
|
target: {
|
||||||
|
feature: Feature;
|
||||||
|
layerKey: string;
|
||||||
|
pixelX: number;
|
||||||
|
pixelY: number;
|
||||||
|
},
|
||||||
|
pixelGrid: Map<
|
||||||
|
string,
|
||||||
|
Array<{
|
||||||
|
feature: Feature;
|
||||||
|
layerKey: string;
|
||||||
|
pixelX: number;
|
||||||
|
pixelY: number;
|
||||||
|
}>
|
||||||
|
>,
|
||||||
|
threshold: number
|
||||||
|
): boolean {
|
||||||
|
const cellX = Math.floor(target.pixelX / threshold);
|
||||||
|
const cellY = Math.floor(target.pixelY / threshold);
|
||||||
|
|
||||||
|
for (let offsetX = -1; offsetX <= 1; offsetX += 1) {
|
||||||
|
for (let offsetY = -1; offsetY <= 1; offsetY += 1) {
|
||||||
|
const bucket = pixelGrid.get(
|
||||||
|
`${target.layerKey}:${cellX + offsetX}:${cellY + offsetY}`
|
||||||
|
);
|
||||||
|
if (!bucket?.length) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const candidate of bucket) {
|
||||||
|
if (candidate.feature === target.feature) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
Math.hypot(
|
||||||
|
candidate.pixelX - target.pixelX,
|
||||||
|
candidate.pixelY - target.pixelY
|
||||||
|
) <= threshold
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getCollisionGridKeys(
|
||||||
|
rect: { left: number; right: number; top: number; bottom: number },
|
||||||
|
cellSize: number
|
||||||
|
): string[] {
|
||||||
|
const startX = Math.floor(rect.left / cellSize);
|
||||||
|
const endX = Math.floor(rect.right / cellSize);
|
||||||
|
const startY = Math.floor(rect.top / cellSize);
|
||||||
|
const endY = Math.floor(rect.bottom / cellSize);
|
||||||
|
const keys: string[] = [];
|
||||||
|
|
||||||
|
for (let x = startX; x <= endX; x += 1) {
|
||||||
|
for (let y = startY; y <= endY; y += 1) {
|
||||||
|
keys.push(`${x}:${y}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
private addRectToCollisionGrid<
|
||||||
|
T extends {
|
||||||
|
left: number;
|
||||||
|
right: number;
|
||||||
|
top: number;
|
||||||
|
bottom: number;
|
||||||
|
}
|
||||||
|
>(rect: T, grid: Map<string, T[]>, cellSize: number) {
|
||||||
|
this.getCollisionGridKeys(rect, cellSize).forEach(key => {
|
||||||
|
const bucket = grid.get(key) || [];
|
||||||
|
bucket.push(rect);
|
||||||
|
grid.set(key, bucket);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private findCollidingRectInGrid<
|
||||||
|
T extends {
|
||||||
|
left: number;
|
||||||
|
right: number;
|
||||||
|
top: number;
|
||||||
|
bottom: number;
|
||||||
|
}
|
||||||
|
>(
|
||||||
|
rect: { left: number; right: number; top: number; bottom: number },
|
||||||
|
grid: Map<string, T[]>,
|
||||||
|
cellSize: number,
|
||||||
|
isCollision: (candidate: T) => boolean
|
||||||
|
): T | undefined {
|
||||||
|
for (const key of this.getCollisionGridKeys(rect, cellSize)) {
|
||||||
|
const bucket = grid.get(key);
|
||||||
|
if (!bucket?.length) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const candidate of bucket) {
|
||||||
|
if (isCollision(candidate)) {
|
||||||
|
return candidate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
private refreshPointLabelVisibility() {
|
private refreshPointLabelVisibility() {
|
||||||
if (!this.map || !this.view) return;
|
if (!this.map || !this.view) return;
|
||||||
|
|
||||||
@ -442,64 +623,185 @@ export class MapOl implements MapInterface {
|
|||||||
}> = [];
|
}> = [];
|
||||||
|
|
||||||
const viewportFeatures = this.pointLayerManager.getFeaturesInViewport();
|
const viewportFeatures = this.pointLayerManager.getFeaturesInViewport();
|
||||||
|
const dirtyLayerKeys = new Set<string>();
|
||||||
|
const densityIsolationThreshold = 56;
|
||||||
|
const densityPixelGrid = new Map<
|
||||||
|
string,
|
||||||
|
Array<{
|
||||||
|
feature: Feature;
|
||||||
|
layerKey: string;
|
||||||
|
pixelX: number;
|
||||||
|
pixelY: number;
|
||||||
|
}>
|
||||||
|
>();
|
||||||
|
const viewportEntries: Array<{
|
||||||
|
feature: Feature;
|
||||||
|
layerKey: string;
|
||||||
|
iconUrl: string;
|
||||||
|
legendVisible: boolean;
|
||||||
|
regionVisible: boolean;
|
||||||
|
densityPriority: number;
|
||||||
|
nearbyVisible: boolean;
|
||||||
|
labelText: string;
|
||||||
|
pixelX?: number;
|
||||||
|
pixelY?: number;
|
||||||
|
}> = [];
|
||||||
|
|
||||||
|
viewportFeatures.forEach(feature => {
|
||||||
|
const geometry = feature.getGeometry();
|
||||||
|
const pixel =
|
||||||
|
geometry && geometry.getType() === 'Point'
|
||||||
|
? this.map?.getPixelFromCoordinate(
|
||||||
|
(geometry as Point).getCoordinates()
|
||||||
|
)
|
||||||
|
: null;
|
||||||
|
const layerKey = String(feature.get('_layerKey') || '');
|
||||||
|
const entry = {
|
||||||
|
feature,
|
||||||
|
layerKey,
|
||||||
|
iconUrl: String(feature.get('_iconUrl') || ''),
|
||||||
|
legendVisible: feature.get('_legendVisible') !== false,
|
||||||
|
regionVisible: feature.get('_regionVisible') !== false,
|
||||||
|
densityPriority: this.getFeatureDensityPriority(feature),
|
||||||
|
nearbyVisible: this.shouldRenderNearbyFeature(feature, currentZoom),
|
||||||
|
labelText: this.formatPointLabelText(
|
||||||
|
feature.get('_labelText') as string
|
||||||
|
),
|
||||||
|
pixelX: pixel?.[0],
|
||||||
|
pixelY: pixel?.[1]
|
||||||
|
};
|
||||||
|
viewportEntries.push(entry);
|
||||||
|
|
||||||
|
if (
|
||||||
|
pixel &&
|
||||||
|
entry.layerKey &&
|
||||||
|
entry.legendVisible &&
|
||||||
|
entry.regionVisible
|
||||||
|
) {
|
||||||
|
const gridKey = this.getFeaturePixelGridKey(
|
||||||
|
entry.layerKey,
|
||||||
|
pixel[0],
|
||||||
|
pixel[1],
|
||||||
|
densityIsolationThreshold
|
||||||
|
);
|
||||||
|
const bucket = densityPixelGrid.get(gridKey) || [];
|
||||||
|
bucket.push({
|
||||||
|
feature,
|
||||||
|
layerKey: entry.layerKey,
|
||||||
|
pixelX: pixel[0],
|
||||||
|
pixelY: pixel[1]
|
||||||
|
});
|
||||||
|
densityPixelGrid.set(gridKey, bucket);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (currentZoom >= FULL_DISPLAY_NO_COLLISION_ZOOM) {
|
if (currentZoom >= FULL_DISPLAY_NO_COLLISION_ZOOM) {
|
||||||
viewportFeatures.forEach(feature => {
|
viewportEntries.forEach(entry => {
|
||||||
const iconUrl = feature.get('_iconUrl') as string;
|
const minZoom = this.getFeatureDensityMinZoom(entry.feature);
|
||||||
const shouldRenderIcon =
|
const densityVisible =
|
||||||
!!iconUrl &&
|
currentZoom >= minZoom ||
|
||||||
this.isIconReady(iconUrl) &&
|
(entry.legendVisible &&
|
||||||
feature.get('_legendVisible') !== false &&
|
entry.regionVisible &&
|
||||||
feature.get('_regionVisible') !== false &&
|
!!entry.layerKey &&
|
||||||
this.shouldRenderFeatureByDensity(feature, currentZoom) &&
|
entry.pixelX !== undefined &&
|
||||||
this.shouldRenderNearbyFeature(feature, currentZoom);
|
entry.pixelY !== undefined &&
|
||||||
const hasLabel = !!this.formatPointLabelText(
|
!this.hasNearbyViewportFeature(
|
||||||
feature.get('_labelText') as string
|
{
|
||||||
|
feature: entry.feature,
|
||||||
|
layerKey: entry.layerKey,
|
||||||
|
pixelX: entry.pixelX,
|
||||||
|
pixelY: entry.pixelY
|
||||||
|
},
|
||||||
|
densityPixelGrid,
|
||||||
|
densityIsolationThreshold
|
||||||
|
));
|
||||||
|
this.syncFeatureDensityVisible(
|
||||||
|
entry.feature,
|
||||||
|
densityVisible,
|
||||||
|
dirtyLayerKeys
|
||||||
);
|
);
|
||||||
|
const shouldRenderIcon =
|
||||||
|
!!entry.iconUrl &&
|
||||||
|
this.isIconReady(entry.iconUrl) &&
|
||||||
|
entry.legendVisible &&
|
||||||
|
entry.regionVisible &&
|
||||||
|
densityVisible &&
|
||||||
|
entry.nearbyVisible;
|
||||||
|
const hasLabel = !!entry.labelText;
|
||||||
|
|
||||||
this.syncFeatureIconCollisionVisible(feature, shouldRenderIcon);
|
this.syncFeatureIconCollisionVisible(
|
||||||
|
entry.feature,
|
||||||
|
shouldRenderIcon,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
this.syncFeatureLabelCollisionVisible(
|
this.syncFeatureLabelCollisionVisible(
|
||||||
feature,
|
entry.feature,
|
||||||
shouldRenderIcon && hasLabel
|
shouldRenderIcon && hasLabel,
|
||||||
|
dirtyLayerKeys
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
this.flushDirtyPointLayers(dirtyLayerKeys);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewportFeatures.forEach(feature => {
|
viewportEntries.forEach(entry => {
|
||||||
const iconUrl = feature.get('_iconUrl') as string;
|
const minZoom = this.getFeatureDensityMinZoom(entry.feature);
|
||||||
|
const densityVisible =
|
||||||
|
currentZoom >= minZoom ||
|
||||||
|
(entry.legendVisible &&
|
||||||
|
entry.regionVisible &&
|
||||||
|
!!entry.layerKey &&
|
||||||
|
entry.pixelX !== undefined &&
|
||||||
|
entry.pixelY !== undefined &&
|
||||||
|
!this.hasNearbyViewportFeature(
|
||||||
|
{
|
||||||
|
feature: entry.feature,
|
||||||
|
layerKey: entry.layerKey,
|
||||||
|
pixelX: entry.pixelX,
|
||||||
|
pixelY: entry.pixelY
|
||||||
|
},
|
||||||
|
densityPixelGrid,
|
||||||
|
densityIsolationThreshold
|
||||||
|
));
|
||||||
|
this.syncFeatureDensityVisible(
|
||||||
|
entry.feature,
|
||||||
|
densityVisible,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
|
|
||||||
const shouldRenderIcon =
|
const shouldRenderIcon =
|
||||||
!!iconUrl &&
|
!!entry.iconUrl &&
|
||||||
this.isIconReady(iconUrl) &&
|
this.isIconReady(entry.iconUrl) &&
|
||||||
feature.get('_legendVisible') !== false &&
|
entry.legendVisible &&
|
||||||
feature.get('_regionVisible') !== false &&
|
entry.regionVisible &&
|
||||||
this.shouldRenderFeatureByDensity(feature, currentZoom) &&
|
densityVisible &&
|
||||||
this.shouldRenderNearbyFeature(feature, currentZoom);
|
entry.nearbyVisible;
|
||||||
|
|
||||||
if (!shouldRenderIcon) {
|
if (!shouldRenderIcon) {
|
||||||
this.syncFeatureIconCollisionVisible(feature, false);
|
this.syncFeatureIconCollisionVisible(
|
||||||
this.syncFeatureLabelCollisionVisible(feature, false);
|
entry.feature,
|
||||||
|
false,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
|
this.syncFeatureLabelCollisionVisible(
|
||||||
|
entry.feature,
|
||||||
|
false,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const geometry = feature.getGeometry();
|
if (entry.pixelX === undefined || entry.pixelY === undefined) {
|
||||||
if (!geometry || geometry.getType() !== 'Point') {
|
this.syncFeatureIconCollisionVisible(
|
||||||
this.syncFeatureIconCollisionVisible(feature, false);
|
entry.feature,
|
||||||
this.syncFeatureLabelCollisionVisible(feature, false);
|
false,
|
||||||
return;
|
dirtyLayerKeys
|
||||||
}
|
);
|
||||||
|
this.syncFeatureLabelCollisionVisible(
|
||||||
const coordinates = (geometry as any).getCoordinates?.();
|
entry.feature,
|
||||||
if (!coordinates) {
|
false,
|
||||||
this.syncFeatureIconCollisionVisible(feature, false);
|
dirtyLayerKeys
|
||||||
this.syncFeatureLabelCollisionVisible(feature, false);
|
);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pixel = this.map?.getPixelFromCoordinate(coordinates);
|
|
||||||
if (!pixel) {
|
|
||||||
this.syncFeatureIconCollisionVisible(feature, false);
|
|
||||||
this.syncFeatureLabelCollisionVisible(feature, false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,13 +810,11 @@ export class MapOl implements MapInterface {
|
|||||||
// 避免像“小浪底/三门峡”这类近点被过早裁掉成只剩一个点。
|
// 避免像“小浪底/三门峡”这类近点被过早裁掉成只剩一个点。
|
||||||
const iconCollisionSize = Math.max(12, 16 * dynamicScale);
|
const iconCollisionSize = Math.max(12, 16 * dynamicScale);
|
||||||
const iconPadding = 0;
|
const iconPadding = 0;
|
||||||
const iconLeft = pixel[0] - iconCollisionSize / 2 - iconPadding;
|
const iconLeft = entry.pixelX - iconCollisionSize / 2 - iconPadding;
|
||||||
const iconRight = pixel[0] + iconCollisionSize / 2 + iconPadding;
|
const iconRight = entry.pixelX + iconCollisionSize / 2 + iconPadding;
|
||||||
const iconTop = pixel[1] - iconCollisionSize / 2 - iconPadding;
|
const iconTop = entry.pixelY - iconCollisionSize / 2 - iconPadding;
|
||||||
const iconBottom = pixel[1] + iconCollisionSize / 2 + iconPadding;
|
const iconBottom = entry.pixelY + iconCollisionSize / 2 + iconPadding;
|
||||||
const labelText = this.formatPointLabelText(
|
const labelText = entry.labelText;
|
||||||
feature.get('_labelText') as string
|
|
||||||
);
|
|
||||||
const fontSize = this.getPointFontSize(dynamicScale);
|
const fontSize = this.getPointFontSize(dynamicScale);
|
||||||
const lines = labelText ? labelText.split('\n') : [''];
|
const lines = labelText ? labelText.split('\n') : [''];
|
||||||
const maxLineLength = Math.max(...lines.map(line => line.length), 1);
|
const maxLineLength = Math.max(...lines.map(line => line.length), 1);
|
||||||
@ -525,22 +825,22 @@ export class MapOl implements MapInterface {
|
|||||||
);
|
);
|
||||||
const estimatedWidth = maxLineLength * fontSize * 0.6 + 16;
|
const estimatedWidth = maxLineLength * fontSize * 0.6 + 16;
|
||||||
const estimatedHeight = labelLineCount * (fontSize + 4) + 8;
|
const estimatedHeight = labelLineCount * (fontSize + 4) + 8;
|
||||||
const centerX = pixel[0];
|
const centerX = entry.pixelX;
|
||||||
const centerY = pixel[1] + labelOffsetY;
|
const centerY = entry.pixelY + labelOffsetY;
|
||||||
const candidateId = String(
|
const candidateId = String(
|
||||||
feature.getId?.() || feature.get('stcd') || ''
|
entry.feature.getId?.() || entry.feature.get('stcd') || ''
|
||||||
);
|
);
|
||||||
const dedupeKey =
|
const dedupeKey =
|
||||||
candidateId ||
|
candidateId ||
|
||||||
[
|
[
|
||||||
feature.get('_layerKey') || '',
|
entry.feature.get('_layerKey') || '',
|
||||||
pixel[0].toFixed(2),
|
entry.pixelX.toFixed(2),
|
||||||
pixel[1].toFixed(2),
|
entry.pixelY.toFixed(2),
|
||||||
labelText
|
labelText
|
||||||
].join('|');
|
].join('|');
|
||||||
|
|
||||||
candidateMap.set(dedupeKey, {
|
candidateMap.set(dedupeKey, {
|
||||||
feature,
|
feature: entry.feature,
|
||||||
iconLeft,
|
iconLeft,
|
||||||
iconRight,
|
iconRight,
|
||||||
iconTop,
|
iconTop,
|
||||||
@ -550,11 +850,11 @@ export class MapOl implements MapInterface {
|
|||||||
right: centerX + estimatedWidth / 2,
|
right: centerX + estimatedWidth / 2,
|
||||||
top: centerY - estimatedHeight / 2,
|
top: centerY - estimatedHeight / 2,
|
||||||
bottom: centerY + estimatedHeight / 2,
|
bottom: centerY + estimatedHeight / 2,
|
||||||
priority: Number(feature.get('_nearbyPriority') || 9999),
|
priority: Number(entry.feature.get('_nearbyPriority') || 9999),
|
||||||
densityPriority: this.getFeatureDensityPriority(feature),
|
densityPriority: entry.densityPriority,
|
||||||
id: candidateId,
|
id: candidateId,
|
||||||
pixelX: pixel[0],
|
pixelX: entry.pixelX,
|
||||||
pixelY: pixel[1]
|
pixelY: entry.pixelY
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -582,6 +882,16 @@ export class MapOl implements MapInterface {
|
|||||||
top: number;
|
top: number;
|
||||||
bottom: number;
|
bottom: number;
|
||||||
}> = [];
|
}> = [];
|
||||||
|
const placedIconGrid = new Map<
|
||||||
|
string,
|
||||||
|
Array<{
|
||||||
|
featureId: string;
|
||||||
|
left: number;
|
||||||
|
right: number;
|
||||||
|
top: number;
|
||||||
|
bottom: number;
|
||||||
|
}>
|
||||||
|
>();
|
||||||
const placedLabelRects: Array<{
|
const placedLabelRects: Array<{
|
||||||
featureId: string;
|
featureId: string;
|
||||||
left: number;
|
left: number;
|
||||||
@ -589,9 +899,17 @@ export class MapOl implements MapInterface {
|
|||||||
top: number;
|
top: number;
|
||||||
bottom: number;
|
bottom: number;
|
||||||
}> = [];
|
}> = [];
|
||||||
let hiddenByIconCollisionCount = 0;
|
const placedLabelGrid = new Map<
|
||||||
let hiddenByLabelCollisionCount = 0;
|
string,
|
||||||
let hiddenByIconHiddenCount = 0;
|
Array<{
|
||||||
|
featureId: string;
|
||||||
|
left: number;
|
||||||
|
right: number;
|
||||||
|
top: number;
|
||||||
|
bottom: number;
|
||||||
|
}>
|
||||||
|
>();
|
||||||
|
const collisionGridCellSize = 96;
|
||||||
|
|
||||||
candidates.forEach(candidate => {
|
candidates.forEach(candidate => {
|
||||||
const featureId = String(
|
const featureId = String(
|
||||||
@ -603,11 +921,18 @@ export class MapOl implements MapInterface {
|
|||||||
top: candidate.iconTop,
|
top: candidate.iconTop,
|
||||||
bottom: candidate.iconBottom
|
bottom: candidate.iconBottom
|
||||||
};
|
};
|
||||||
const iconHasCollision = placedIconRects.some(rect =>
|
const iconHasCollision = !!this.findCollidingRectInGrid(
|
||||||
this.checkLabelCollision(rect, iconRect)
|
iconRect,
|
||||||
|
placedIconGrid,
|
||||||
|
collisionGridCellSize,
|
||||||
|
rect => this.checkLabelCollision(rect, iconRect)
|
||||||
);
|
);
|
||||||
const iconVisible = !iconHasCollision;
|
const iconVisible = !iconHasCollision;
|
||||||
this.syncFeatureIconCollisionVisible(candidate.feature, iconVisible);
|
this.syncFeatureIconCollisionVisible(
|
||||||
|
candidate.feature,
|
||||||
|
iconVisible,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
|
|
||||||
if (iconVisible) {
|
if (iconVisible) {
|
||||||
placedIconRects.push({
|
placedIconRects.push({
|
||||||
@ -617,6 +942,11 @@ export class MapOl implements MapInterface {
|
|||||||
top: iconRect.top,
|
top: iconRect.top,
|
||||||
bottom: iconRect.bottom
|
bottom: iconRect.bottom
|
||||||
});
|
});
|
||||||
|
this.addRectToCollisionGrid(
|
||||||
|
placedIconRects[placedIconRects.length - 1],
|
||||||
|
placedIconGrid,
|
||||||
|
collisionGridCellSize
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -640,37 +970,45 @@ export class MapOl implements MapInterface {
|
|||||||
const iconVisible =
|
const iconVisible =
|
||||||
candidate.feature.get('_iconCollisionVisible') !== false;
|
candidate.feature.get('_iconCollisionVisible') !== false;
|
||||||
if (!candidate.hasLabel) {
|
if (!candidate.hasLabel) {
|
||||||
this.syncFeatureLabelCollisionVisible(candidate.feature, false);
|
this.syncFeatureLabelCollisionVisible(
|
||||||
|
candidate.feature,
|
||||||
|
false,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!iconVisible) {
|
if (!iconVisible) {
|
||||||
hiddenByIconHiddenCount += 1;
|
this.syncFeatureLabelCollisionVisible(
|
||||||
this.syncFeatureLabelCollisionVisible(candidate.feature, false);
|
candidate.feature,
|
||||||
|
false,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const collidingIconRect = placedIconRects.find(rect => {
|
const collidingIconRect = this.findCollidingRectInGrid(
|
||||||
if (rect.featureId === featureId) {
|
candidate,
|
||||||
return false;
|
placedIconGrid,
|
||||||
}
|
collisionGridCellSize,
|
||||||
return this.checkLabelCollisionWithIcon(rect, candidate);
|
rect =>
|
||||||
});
|
rect.featureId !== featureId &&
|
||||||
|
this.checkLabelCollisionWithIcon(rect, candidate)
|
||||||
|
);
|
||||||
const hasCollisionWithIcon = !!collidingIconRect;
|
const hasCollisionWithIcon = !!collidingIconRect;
|
||||||
const collidingLabelRect = placedLabelRects.find(rect =>
|
const collidingLabelRect = this.findCollidingRectInGrid(
|
||||||
this.checkLabelCollision(rect, candidate)
|
candidate,
|
||||||
|
placedLabelGrid,
|
||||||
|
collisionGridCellSize,
|
||||||
|
rect => this.checkLabelCollision(rect, candidate)
|
||||||
);
|
);
|
||||||
const hasCollisionWithLabel = !!collidingLabelRect;
|
const hasCollisionWithLabel = !!collidingLabelRect;
|
||||||
const visible = !hasCollisionWithIcon && !hasCollisionWithLabel;
|
const visible = !hasCollisionWithIcon && !hasCollisionWithLabel;
|
||||||
|
|
||||||
if (!visible) {
|
this.syncFeatureLabelCollisionVisible(
|
||||||
if (hasCollisionWithIcon) {
|
candidate.feature,
|
||||||
hiddenByIconCollisionCount += 1;
|
visible,
|
||||||
} else {
|
dirtyLayerKeys
|
||||||
hiddenByLabelCollisionCount += 1;
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.syncFeatureLabelCollisionVisible(candidate.feature, visible);
|
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
placedLabelRects.push({
|
placedLabelRects.push({
|
||||||
@ -680,11 +1018,25 @@ export class MapOl implements MapInterface {
|
|||||||
top: candidate.top,
|
top: candidate.top,
|
||||||
bottom: candidate.bottom
|
bottom: candidate.bottom
|
||||||
});
|
});
|
||||||
|
this.addRectToCollisionGrid(
|
||||||
|
placedLabelRects[placedLabelRects.length - 1],
|
||||||
|
placedLabelGrid,
|
||||||
|
collisionGridCellSize
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.flushDirtyPointLayers(dirtyLayerKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
private requestRefreshPointLabelVisibility(
|
||||||
|
immediate = false,
|
||||||
|
debounceMs = 0
|
||||||
|
) {
|
||||||
|
if (this.labelVisibilityDebounceTimerId !== null) {
|
||||||
|
window.clearTimeout(this.labelVisibilityDebounceTimerId);
|
||||||
|
this.labelVisibilityDebounceTimerId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private requestRefreshPointLabelVisibility(immediate = false) {
|
|
||||||
if (immediate) {
|
if (immediate) {
|
||||||
if (this.labelVisibilityRefreshFrameId !== null) {
|
if (this.labelVisibilityRefreshFrameId !== null) {
|
||||||
cancelAnimationFrame(this.labelVisibilityRefreshFrameId);
|
cancelAnimationFrame(this.labelVisibilityRefreshFrameId);
|
||||||
@ -694,6 +1046,14 @@ export class MapOl implements MapInterface {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debounceMs > 0) {
|
||||||
|
this.labelVisibilityDebounceTimerId = window.setTimeout(() => {
|
||||||
|
this.labelVisibilityDebounceTimerId = null;
|
||||||
|
this.requestRefreshPointLabelVisibility();
|
||||||
|
}, debounceMs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.labelVisibilityRefreshFrameId !== null) {
|
if (this.labelVisibilityRefreshFrameId !== null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -704,18 +1064,30 @@ export class MapOl implements MapInterface {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private syncFeatureIconCollisionVisible(feature: Feature, visible: boolean) {
|
private syncFeatureIconCollisionVisible(
|
||||||
if (feature.get('_iconCollisionVisible') !== visible) {
|
feature: Feature,
|
||||||
feature.set('_iconCollisionVisible', visible);
|
visible: boolean,
|
||||||
feature.changed();
|
dirtyLayerKeys?: Set<string>
|
||||||
}
|
) {
|
||||||
|
this.markFeatureVisibilityDirty(
|
||||||
|
feature,
|
||||||
|
'_iconCollisionVisible',
|
||||||
|
visible,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private syncFeatureLabelCollisionVisible(feature: Feature, visible: boolean) {
|
private syncFeatureLabelCollisionVisible(
|
||||||
if (feature.get('_labelCollisionVisible') !== visible) {
|
feature: Feature,
|
||||||
feature.set('_labelCollisionVisible', visible);
|
visible: boolean,
|
||||||
feature.changed();
|
dirtyLayerKeys?: Set<string>
|
||||||
}
|
) {
|
||||||
|
this.markFeatureVisibilityDirty(
|
||||||
|
feature,
|
||||||
|
'_labelCollisionVisible',
|
||||||
|
visible,
|
||||||
|
dirtyLayerKeys
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private isIconReady(iconUrl: string): boolean {
|
private isIconReady(iconUrl: string): boolean {
|
||||||
@ -740,11 +1112,11 @@ export class MapOl implements MapInterface {
|
|||||||
image.crossOrigin = 'anonymous';
|
image.crossOrigin = 'anonymous';
|
||||||
image.onload = () => {
|
image.onload = () => {
|
||||||
this.iconLoadState.set(iconUrl, 'loaded');
|
this.iconLoadState.set(iconUrl, 'loaded');
|
||||||
this.refreshPointLayerStyles();
|
this.requestRefreshPointLayerStyles();
|
||||||
};
|
};
|
||||||
image.onerror = () => {
|
image.onerror = () => {
|
||||||
this.iconLoadState.set(iconUrl, 'error');
|
this.iconLoadState.set(iconUrl, 'error');
|
||||||
this.refreshPointLayerStyles();
|
this.requestRefreshPointLayerStyles();
|
||||||
};
|
};
|
||||||
image.src = iconUrl;
|
image.src = iconUrl;
|
||||||
|
|
||||||
@ -756,13 +1128,24 @@ export class MapOl implements MapInterface {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private requestRefreshPointLayerStyles() {
|
||||||
|
if (this.pointLayerStyleRefreshFrameId !== null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.pointLayerStyleRefreshFrameId = window.requestAnimationFrame(() => {
|
||||||
|
this.pointLayerStyleRefreshFrameId = null;
|
||||||
|
this.refreshPointLayerStyles();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private refreshPointLayerStyles() {
|
private refreshPointLayerStyles() {
|
||||||
this.pointLayerManager.forEachLayer(layer => {
|
this.pointLayerManager.forEachLayer(layer => {
|
||||||
layer.changed();
|
layer.changed();
|
||||||
});
|
});
|
||||||
this.requestRefreshPointLabelVisibility(true);
|
this.requestRefreshPointLabelVisibility();
|
||||||
if (this.isBatchPopupMode) {
|
if (this.isBatchPopupMode) {
|
||||||
this.requestUpdateBatchPopups(true);
|
this.requestUpdateBatchPopups();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1063,72 +1446,6 @@ export class MapOl implements MapInterface {
|
|||||||
|
|
||||||
return priority === 1;
|
return priority === 1;
|
||||||
}
|
}
|
||||||
private createPointStyle1(feature: Feature): Style {
|
|
||||||
const color = (feature.get('iconCode') as string) || '#3399CC';
|
|
||||||
const labelText = feature.get('titleName') as string;
|
|
||||||
const buildType = (feature.get('BuildType') as number) ?? 1;
|
|
||||||
|
|
||||||
const currentZoom = this.view ? this.view.getZoom() : 4.5;
|
|
||||||
let dynamicScale = 0.7 + (currentZoom - 4.5) * 0.08;
|
|
||||||
dynamicScale = Math.max(0.5, Math.min(3.0, dynamicScale));
|
|
||||||
const fontSize = Math.max(16, Math.min(24, 12 * dynamicScale));
|
|
||||||
const radius = Math.max(6, Math.min(18, 6 * dynamicScale));
|
|
||||||
|
|
||||||
let imageStyle;
|
|
||||||
if (buildType === 0) {
|
|
||||||
const canvas = this.createSemiCircleCanvas(radius, color);
|
|
||||||
imageStyle = new Icon({
|
|
||||||
img: canvas,
|
|
||||||
imgSize: [canvas.width, canvas.height],
|
|
||||||
anchor: [0.5, 0.5]
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
imageStyle = new Circle({
|
|
||||||
radius: radius,
|
|
||||||
fill: new Fill({ color: color }),
|
|
||||||
stroke: new Stroke({ color: 'rgba(0, 0, 0, 0.5)', width: 1 })
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const styleOptions: any = {
|
|
||||||
image: imageStyle
|
|
||||||
};
|
|
||||||
|
|
||||||
if (labelText) {
|
|
||||||
let offsetY = -20 * dynamicScale;
|
|
||||||
const specialLabels = [
|
|
||||||
'枕头坝二级',
|
|
||||||
'老鹰岩二级',
|
|
||||||
'长洲',
|
|
||||||
'丹巴',
|
|
||||||
'玛尔挡',
|
|
||||||
'班多',
|
|
||||||
'彭水',
|
|
||||||
'李家峡',
|
|
||||||
'ML',
|
|
||||||
'BDa',
|
|
||||||
'乌东德',
|
|
||||||
'里底',
|
|
||||||
'大华桥',
|
|
||||||
|
|
||||||
'巴塘'
|
|
||||||
];
|
|
||||||
if (specialLabels.includes(labelText)) {
|
|
||||||
offsetY = 20 * dynamicScale;
|
|
||||||
}
|
|
||||||
styleOptions.text = new Text({
|
|
||||||
text: labelText,
|
|
||||||
offsetY: offsetY,
|
|
||||||
font: `${fontSize}px sans-serif`,
|
|
||||||
fill: new Fill({ color: '#fff' }),
|
|
||||||
stroke: new Stroke({ color: 'rgba(0, 0, 0, .9)', width: 2 }),
|
|
||||||
textAlign: 'center',
|
|
||||||
declutterMode: 'declutter'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Style(styleOptions);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 初始化加载基础图层
|
* 初始化加载基础图层
|
||||||
* @param layer 图层配置对象
|
* @param layer 图层配置对象
|
||||||
@ -2167,10 +2484,18 @@ export class MapOl implements MapInterface {
|
|||||||
* 移除地图对象,释放资源
|
* 移除地图对象,释放资源
|
||||||
*/
|
*/
|
||||||
destroy(): void {
|
destroy(): void {
|
||||||
|
if (this.pointLayerStyleRefreshFrameId !== null) {
|
||||||
|
cancelAnimationFrame(this.pointLayerStyleRefreshFrameId);
|
||||||
|
this.pointLayerStyleRefreshFrameId = null;
|
||||||
|
}
|
||||||
if (this.labelVisibilityRefreshFrameId !== null) {
|
if (this.labelVisibilityRefreshFrameId !== null) {
|
||||||
cancelAnimationFrame(this.labelVisibilityRefreshFrameId);
|
cancelAnimationFrame(this.labelVisibilityRefreshFrameId);
|
||||||
this.labelVisibilityRefreshFrameId = null;
|
this.labelVisibilityRefreshFrameId = null;
|
||||||
}
|
}
|
||||||
|
if (this.labelVisibilityDebounceTimerId !== null) {
|
||||||
|
window.clearTimeout(this.labelVisibilityDebounceTimerId);
|
||||||
|
this.labelVisibilityDebounceTimerId = null;
|
||||||
|
}
|
||||||
this.removeQueryLayer();
|
this.removeQueryLayer();
|
||||||
this.regionMaskManager.destroy();
|
this.regionMaskManager.destroy();
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,11 @@ export class PointLayerManager {
|
|||||||
if (!this.map) return;
|
if (!this.map) return;
|
||||||
|
|
||||||
const resolution = this.map.getView().getResolution();
|
const resolution = this.map.getView().getResolution();
|
||||||
if (currentZoom === undefined || !Number.isFinite(currentZoom) || !resolution) {
|
if (
|
||||||
|
currentZoom === undefined ||
|
||||||
|
!Number.isFinite(currentZoom) ||
|
||||||
|
!resolution
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const nearbyPointConfig = getNearbyPointConfig();
|
const nearbyPointConfig = getNearbyPointConfig();
|
||||||
@ -109,7 +113,10 @@ export class PointLayerManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const sortedFeatures = [...features].sort((left, right) => {
|
const sortedFeatures = [...features].sort((left, right) => {
|
||||||
return Number(left.get('_nearbyPriority') || 0) - Number(right.get('_nearbyPriority') || 0);
|
return (
|
||||||
|
Number(left.get('_nearbyPriority') || 0) -
|
||||||
|
Number(right.get('_nearbyPriority') || 0)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
const secondaryFeatures = sortedFeatures.filter(feature => {
|
const secondaryFeatures = sortedFeatures.filter(feature => {
|
||||||
const priority = Number(feature.get('_nearbyPriority'));
|
const priority = Number(feature.get('_nearbyPriority'));
|
||||||
@ -132,7 +139,8 @@ export class PointLayerManager {
|
|||||||
|
|
||||||
const groupSecondaryCount = secondaryFeatures.length;
|
const groupSecondaryCount = secondaryFeatures.length;
|
||||||
const baseOffsetPx =
|
const baseOffsetPx =
|
||||||
Number(feature.get('_nearbyExpandOffsetPx')) || autoRule.expandOffsetPx;
|
Number(feature.get('_nearbyExpandOffsetPx')) ||
|
||||||
|
autoRule.expandOffsetPx;
|
||||||
const ringSize = Math.max(1, layoutRule.ringSize);
|
const ringSize = Math.max(1, layoutRule.ringSize);
|
||||||
const ringIndex = Math.floor(index / ringSize);
|
const ringIndex = Math.floor(index / ringSize);
|
||||||
const ringOffsetIndex = index % ringSize;
|
const ringOffsetIndex = index % ringSize;
|
||||||
@ -156,7 +164,10 @@ export class PointLayerManager {
|
|||||||
const expandOffsetPx =
|
const expandOffsetPx =
|
||||||
baseOffsetPx +
|
baseOffsetPx +
|
||||||
ringIndex *
|
ringIndex *
|
||||||
Math.max(layoutRule.ringGapPx, baseOffsetPx * layoutRule.ringGapFactor);
|
Math.max(
|
||||||
|
layoutRule.ringGapPx,
|
||||||
|
baseOffsetPx * layoutRule.ringGapFactor
|
||||||
|
);
|
||||||
const offsetX = Math.cos(expandAngleRad) * expandOffsetPx * resolution;
|
const offsetX = Math.cos(expandAngleRad) * expandOffsetPx * resolution;
|
||||||
const offsetY = Math.sin(expandAngleRad) * expandOffsetPx * resolution;
|
const offsetY = Math.sin(expandAngleRad) * expandOffsetPx * resolution;
|
||||||
|
|
||||||
@ -452,7 +463,9 @@ export class PointLayerManager {
|
|||||||
|
|
||||||
// 备注:先恢复要素原始坐标,再按缩放阶段决定是否做展开偏移,避免多次缩放后偏移累计。
|
// 备注:先恢复要素原始坐标,再按缩放阶段决定是否做展开偏移,避免多次缩放后偏移累计。
|
||||||
private resetFeatureToBaseCoordinate(feature: Feature): void {
|
private resetFeatureToBaseCoordinate(feature: Feature): void {
|
||||||
const baseCoordinates = feature.get('_baseCoordinates') as number[] | undefined;
|
const baseCoordinates = feature.get('_baseCoordinates') as
|
||||||
|
| number[]
|
||||||
|
| undefined;
|
||||||
const geometry = feature.getGeometry();
|
const geometry = feature.getGeometry();
|
||||||
if (
|
if (
|
||||||
!baseCoordinates ||
|
!baseCoordinates ||
|
||||||
@ -463,6 +476,9 @@ export class PointLayerManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(geometry as Point).setCoordinates([baseCoordinates[0], baseCoordinates[1]]);
|
(geometry as Point).setCoordinates([
|
||||||
|
baseCoordinates[0],
|
||||||
|
baseCoordinates[1]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col v-if="isMenu('fish-survey/fishSurveyZhuanZhi')">
|
<a-col v-if="isMenu('shengTaiDiaoCha/shuiShengShengTaiDiaoCha')">
|
||||||
<a-form-item label="" name="">
|
<a-form-item label="" name="">
|
||||||
<a-checkbox v-model:checked="formModel.fishSurveyZhuanZhi">
|
<a-checkbox v-model:checked="formModel.fishSurveyZhuanZhi">
|
||||||
鱼类分布
|
鱼类分布
|
||||||
@ -60,21 +60,35 @@
|
|||||||
<a-form-item label="" name="">
|
<a-form-item label="" name="">
|
||||||
<a-select
|
<a-select
|
||||||
v-model:value="fishSurveyZhuanZhiParams.value"
|
v-model:value="fishSurveyZhuanZhiParams.value"
|
||||||
placeholder="请输入"
|
placeholder="请选择"
|
||||||
style="width: 140px"
|
style="width: 200px"
|
||||||
|
mode="multiple"
|
||||||
show-search
|
show-search
|
||||||
allow-clear
|
allow-clear
|
||||||
/>
|
:loading="fishSpeciesLoading"
|
||||||
|
:max-tag-count="1"
|
||||||
|
option-filter-prop="label"
|
||||||
|
>
|
||||||
|
<a-select-option
|
||||||
|
v-for="item in fishSpeciesOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:value="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
>
|
||||||
|
{{ item.label }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col>
|
<a-col>
|
||||||
<a-form-item label="" name="anchorPointSelect">
|
<a-form-item label="" name="anchorPointSelect">
|
||||||
<a-select
|
<a-select
|
||||||
v-model:value="formModel.anchorPointSelect"
|
v-model:value="anchorPointSelectValue"
|
||||||
placeholder="请输入关键字检索"
|
placeholder="请输入关键字检索"
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
show-search
|
show-search
|
||||||
allow-clear
|
allow-clear
|
||||||
|
:loading="anchorPointLoading"
|
||||||
:filter-option="filterAnchorPoint"
|
:filter-option="filterAnchorPoint"
|
||||||
@change="handleAnchorPointChange"
|
@change="handleAnchorPointChange"
|
||||||
>
|
>
|
||||||
@ -99,16 +113,24 @@
|
|||||||
import { ref, computed, watch } from 'vue';
|
import { ref, computed, watch } from 'vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { MapClass } from '@/components/gis/map.class';
|
||||||
import { useMapOrchestrator } from '@/modules/map/application/map-orchestrator';
|
import { useMapOrchestrator } from '@/modules/map/application/map-orchestrator';
|
||||||
import { useMapDataStore } from '@/modules/map/stores/map-data.store';
|
import { useMapDataStore } from '@/modules/map/stores/map-data.store';
|
||||||
import { useMapViewStore } from '@/modules/map/stores/map-view.store';
|
import { useMapViewStore } from '@/modules/map/stores/map-view.store';
|
||||||
|
import { useJidiSelectEventStore } from '@/store/modules/jidiSelectEvent';
|
||||||
|
import { useMapStore } from '@/store/modules/map';
|
||||||
import { DateSetting } from '@/utils/enumeration';
|
import { DateSetting } from '@/utils/enumeration';
|
||||||
|
import { getFishList, getFishPointList } from '@/api/map';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const mapOrchestrator = useMapOrchestrator();
|
const mapOrchestrator = useMapOrchestrator();
|
||||||
const mapDataStore = useMapDataStore();
|
const mapDataStore = useMapDataStore();
|
||||||
const mapViewStore = useMapViewStore();
|
const mapViewStore = useMapViewStore();
|
||||||
|
const jidiSelectEventStore = useJidiSelectEventStore();
|
||||||
|
const mapStore = useMapStore();
|
||||||
|
const mapClass = MapClass.getInstance();
|
||||||
const ENG_POINT_LAYER_KEY = 'eng_point';
|
const ENG_POINT_LAYER_KEY = 'eng_point';
|
||||||
|
const YLFB_POINT_LAYER_KEY = 'ylfb_point';
|
||||||
const siteRangePicker = [
|
const siteRangePicker = [
|
||||||
{ label: '全部', value: 'all' },
|
{ label: '全部', value: 'all' },
|
||||||
{ label: '大型电站', value: 'large_eng_built' },
|
{ label: '大型电站', value: 'large_eng_built' },
|
||||||
@ -127,8 +149,13 @@ const defaultYear =
|
|||||||
|
|
||||||
const fishSurveyZhuanZhiParams = ref({
|
const fishSurveyZhuanZhiParams = ref({
|
||||||
time: defaultYear.toString(),
|
time: defaultYear.toString(),
|
||||||
value: []
|
value: [] as string[],
|
||||||
|
anchorPointSelect: null as string | null
|
||||||
});
|
});
|
||||||
|
const fishPointOptions = ref<any[]>([]);
|
||||||
|
const fishSpeciesOptions = ref<{ label: string; value: string }[]>([]);
|
||||||
|
const fishSpeciesLoading = ref(false);
|
||||||
|
const fishPointLoading = ref(false);
|
||||||
|
|
||||||
const searchTimeRange = ref([
|
const searchTimeRange = ref([
|
||||||
dayjs(mapViewStore.searchTimeRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
dayjs(mapViewStore.searchTimeRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
||||||
@ -141,12 +168,41 @@ const isMenu = (menuPath: string) => {
|
|||||||
return path.includes(menuPath);
|
return path.includes(menuPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isFishSurveyMode = computed(() => {
|
||||||
|
return (
|
||||||
|
isMenu('shengTaiDiaoCha/shuiShengShengTaiDiaoCha') &&
|
||||||
|
formModel.value.fishSurveyZhuanZhi
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const anchorPointLoading = computed(() => {
|
||||||
|
return isFishSurveyMode.value ? fishPointLoading.value : false;
|
||||||
|
});
|
||||||
|
|
||||||
|
const currentFishBaseId = computed(() => {
|
||||||
|
return jidiSelectEventStore.selectedItem?.wbsCode || 'all';
|
||||||
|
});
|
||||||
|
|
||||||
|
const anchorPointSelectValue = computed({
|
||||||
|
get: () => {
|
||||||
|
return isFishSurveyMode.value
|
||||||
|
? fishSurveyZhuanZhiParams.value.anchorPointSelect
|
||||||
|
: formModel.value.anchorPointSelect;
|
||||||
|
},
|
||||||
|
set: (value: string | null) => {
|
||||||
|
if (isFishSurveyMode.value) {
|
||||||
|
fishSurveyZhuanZhiParams.value.anchorPointSelect = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formModel.value.anchorPointSelect = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 备注:切页时只重置本地表单输入,并通过编排器复位时间范围,不再直接改运行态 store。
|
// 备注:切页时只重置本地表单输入,并通过编排器复位时间范围,不再直接改运行态 store。
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => route.path,
|
||||||
() => {
|
() => {
|
||||||
mapOrchestrator.resetFilterState();
|
mapOrchestrator.resetFilterState();
|
||||||
mapOrchestrator.changeEngPointCapacity('all');
|
|
||||||
searchTimeRange.value = [
|
searchTimeRange.value = [
|
||||||
dayjs(mapViewStore.searchTimeRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
dayjs(mapViewStore.searchTimeRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
||||||
dayjs(mapViewStore.searchTimeRange[1]).format('YYYY-MM-DD HH:mm:ss')
|
dayjs(mapViewStore.searchTimeRange[1]).format('YYYY-MM-DD HH:mm:ss')
|
||||||
@ -156,18 +212,309 @@ watch(
|
|||||||
anchorPointSelect: null,
|
anchorPointSelect: null,
|
||||||
fishSurveyZhuanZhi: false
|
fishSurveyZhuanZhi: false
|
||||||
};
|
};
|
||||||
|
resetFishSurveyState();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 备注:时间选择只通过编排器分发,由编排器决定运行态更新和数据重载。
|
// 备注:时间选择只通过编排器分发,由编排器决定运行态更新和数据重载。
|
||||||
const triggerManualValuesChange = async (val: any) => {
|
const triggerManualValuesChange = async (val: any) => {
|
||||||
if (val && val.length === 2) {
|
const [startTime, endTime] = getTimeRangeByValue(val);
|
||||||
await mapOrchestrator.changeTimeRange(val);
|
|
||||||
|
if (!startTime || !endTime) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(val)) {
|
||||||
|
await mapOrchestrator.changeTimeRange([startTime, endTime]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await fetchFishSurveyOptions(val);
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchFishSurveyOptions = async (
|
||||||
|
timeValue = fishSurveyZhuanZhiParams.value.time
|
||||||
|
) => {
|
||||||
|
const [startTime, endTime] = getTimeRangeByValue(timeValue);
|
||||||
|
const currentBaseId = currentFishBaseId.value;
|
||||||
|
|
||||||
|
if (!startTime || !endTime) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pointParams = {
|
||||||
|
filter: {
|
||||||
|
logic: 'and',
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
field: 'startTime',
|
||||||
|
operator: 'eq',
|
||||||
|
dataType: 'date',
|
||||||
|
value: startTime
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'endTime',
|
||||||
|
operator: 'eq',
|
||||||
|
dataType: 'date',
|
||||||
|
value: endTime
|
||||||
|
},
|
||||||
|
{ field: 'lgtd', operator: 'isnotnull', dataType: 'string' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const fishParams = {
|
||||||
|
filter: {
|
||||||
|
logic: 'and',
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
field: 'tm',
|
||||||
|
operator: 'gte',
|
||||||
|
dataType: 'date',
|
||||||
|
value: startTime
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'tm',
|
||||||
|
operator: 'lte',
|
||||||
|
dataType: 'date',
|
||||||
|
value: endTime
|
||||||
|
},
|
||||||
|
...(!currentBaseId || currentBaseId === 'all'
|
||||||
|
? []
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
field: 'baseId',
|
||||||
|
operator: 'eq',
|
||||||
|
dataType: 'string',
|
||||||
|
value: currentBaseId
|
||||||
|
}
|
||||||
|
])
|
||||||
|
]
|
||||||
|
},
|
||||||
|
group: [
|
||||||
|
{ dir: 'des', field: 'code' },
|
||||||
|
{ dir: 'des', field: 'name' }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
fishPointLoading.value = true;
|
||||||
|
fishSpeciesLoading.value = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const [fishList, fishList1] = await Promise.all([
|
||||||
|
getFishPointList(pointParams),
|
||||||
|
getFishList(fishParams)
|
||||||
|
]);
|
||||||
|
const nextFishPointOptions = mapFishPointOptions(fishList);
|
||||||
|
const nextFishSpeciesOptions = mapFishSpeciesOptions(fishList1);
|
||||||
|
|
||||||
|
fishPointOptions.value = nextFishPointOptions;
|
||||||
|
fishSpeciesOptions.value = nextFishSpeciesOptions;
|
||||||
|
fishSurveyZhuanZhiParams.value.value = nextFishSpeciesOptions.map(
|
||||||
|
item => item.value
|
||||||
|
);
|
||||||
|
syncFishAnchorPointSelection(nextFishPointOptions);
|
||||||
|
} finally {
|
||||||
|
fishPointLoading.value = false;
|
||||||
|
fishSpeciesLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTimeRangeByValue = (val: any): [string, string] => {
|
||||||
|
if (Array.isArray(val)) {
|
||||||
|
const [start, end] = val;
|
||||||
|
return [formatDateTimeValue(start), formatDateTimeValue(end)];
|
||||||
|
}
|
||||||
|
|
||||||
|
const year = getYearValue(val);
|
||||||
|
return [`${year}-01-01 00:00:00`, `${year}-12-31 23:59:59`];
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatDateTimeValue = (value: any) => {
|
||||||
|
if (!value) return '';
|
||||||
|
return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
};
|
||||||
|
|
||||||
|
const getYearValue = (value: any) => {
|
||||||
|
if (typeof value === 'string' || typeof value === 'number') {
|
||||||
|
return String(value);
|
||||||
|
}
|
||||||
|
return dayjs(value).format('YYYY');
|
||||||
|
};
|
||||||
|
|
||||||
|
const collectLeafItems = (items: any[] = []): any[] => {
|
||||||
|
return items.flatMap(item => {
|
||||||
|
if (Array.isArray(item?.items) && item.items.length > 0) {
|
||||||
|
return collectLeafItems(item.items);
|
||||||
|
}
|
||||||
|
return [item];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const getResponseData = (response: any) => {
|
||||||
|
return response?.data?.data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapFishPointOptions = (response: any) => {
|
||||||
|
const responseData = getResponseData(response);
|
||||||
|
const sourceItems = Array.isArray(responseData)
|
||||||
|
? responseData
|
||||||
|
: collectLeafItems(responseData?.items || []);
|
||||||
|
|
||||||
|
return sourceItems
|
||||||
|
.map((item: any) => ({
|
||||||
|
...item,
|
||||||
|
stcd: item.stcd || item.STCD || item.code || item.CODE || item._id,
|
||||||
|
stnm: item.stnm || item.STNM || item.name || item.NAME || item.ennm || '',
|
||||||
|
ennm: item.ennm || item.ENNM || '',
|
||||||
|
baseName: item.baseName || item.BASENAME || '',
|
||||||
|
lgtd: item.lgtd || item.LGTD,
|
||||||
|
lttd: item.lttd || item.LTTD
|
||||||
|
}))
|
||||||
|
.filter((item: any) => item.stcd);
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapFishSpeciesOptions = (response: any) => {
|
||||||
|
const responseData = getResponseData(response);
|
||||||
|
const sourceItems = Array.isArray(responseData)
|
||||||
|
? collectLeafItems(responseData)
|
||||||
|
: collectLeafItems(responseData?.items || []);
|
||||||
|
const optionMap = new Map<string, { label: string; value: string }>();
|
||||||
|
|
||||||
|
sourceItems.forEach((item: any) => {
|
||||||
|
const value = String(item.CODE || item.code || item.key || '');
|
||||||
|
const label = item.NAME || item.name || item.key || value;
|
||||||
|
|
||||||
|
if (!value || optionMap.has(value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
optionMap.set(value, {
|
||||||
|
label,
|
||||||
|
value
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return Array.from(optionMap.values());
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectedFishSpeciesLabels = computed(() => {
|
||||||
|
const selectedValues = new Set(fishSurveyZhuanZhiParams.value.value || []);
|
||||||
|
return fishSpeciesOptions.value
|
||||||
|
.filter(item => selectedValues.has(item.value))
|
||||||
|
.map(item => item.label);
|
||||||
|
});
|
||||||
|
|
||||||
|
const fishPointLegendMeta = computed(() => {
|
||||||
|
const legendItem =
|
||||||
|
mapStore.getLegendItemsByLayerCode(YLFB_POINT_LAYER_KEY)?.[0];
|
||||||
|
return {
|
||||||
|
iconCode: legendItem?.icon || 'default',
|
||||||
|
code: legendItem?.code || '',
|
||||||
|
nameEn: legendItem?.nameEn || 'ylfb'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const filteredFishPointOptions = computed(() => {
|
||||||
|
let filteredData = [...fishPointOptions.value];
|
||||||
|
|
||||||
|
if (currentFishBaseId.value && currentFishBaseId.value !== 'all') {
|
||||||
|
filteredData = filteredData.filter(
|
||||||
|
(item: any) => item.baseId === currentFishBaseId.value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedLabels = selectedFishSpeciesLabels.value;
|
||||||
|
if (!selectedLabels.length) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return filteredData.filter((item: any) => {
|
||||||
|
const ftp = String(item.ftp || item.FTP || '');
|
||||||
|
return selectedLabels.some(label => ftp.includes(label));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const syncFishAnchorPointSelection = (
|
||||||
|
options = filteredFishPointOptions.value
|
||||||
|
) => {
|
||||||
|
const currentValue = fishSurveyZhuanZhiParams.value.anchorPointSelect;
|
||||||
|
const matchedOption = options.find((item: any) => item.stcd === currentValue);
|
||||||
|
|
||||||
|
fishSurveyZhuanZhiParams.value.anchorPointSelect = matchedOption
|
||||||
|
? currentValue
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const syncFishPointLayerData = (options = filteredFishPointOptions.value) => {
|
||||||
|
const visible = isFishSurveyMode.value && options.length > 0;
|
||||||
|
const layerItem = mapStore.findLayerByKey(
|
||||||
|
mapStore.layerData,
|
||||||
|
YLFB_POINT_LAYER_KEY
|
||||||
|
);
|
||||||
|
const layerData = options.map((item: any) => {
|
||||||
|
const sttpMap = item.sttpMap || 'ylfb';
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
sttp: item.sttp || 'ylfb',
|
||||||
|
sttpMap,
|
||||||
|
anchoPointState: item.anchoPointState || 'ylfb',
|
||||||
|
titleName: item.titleName || '鱼类分布',
|
||||||
|
iconCode: item.iconCode || fishPointLegendMeta.value.iconCode,
|
||||||
|
code: item.code || fishPointLegendMeta.value.code,
|
||||||
|
_id: item._id || `${sttpMap}_${item.stcd}`,
|
||||||
|
layerKey: YLFB_POINT_LAYER_KEY
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const legendNames = mapStore
|
||||||
|
.getLegendItemsByLayerCode(YLFB_POINT_LAYER_KEY)
|
||||||
|
.map((item: any) => item?.nameEn)
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
|
mapDataStore.setPointLayerCache(YLFB_POINT_LAYER_KEY, {
|
||||||
|
checked: visible,
|
||||||
|
data: layerData,
|
||||||
|
cacheKey: `custom:${YLFB_POINT_LAYER_KEY}:${layerData.length}`
|
||||||
|
});
|
||||||
|
mapDataStore.rebuildPointDataFromCache();
|
||||||
|
|
||||||
|
if (layerItem) {
|
||||||
|
layerItem.data = layerData;
|
||||||
|
layerItem.checked = visible ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (legendNames.length > 0) {
|
||||||
|
mapStore.updateLegendCheckedBatch(legendNames, visible ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!visible || layerData.length === 0) {
|
||||||
|
if (mapClass.hasLayer(YLFB_POINT_LAYER_KEY)) {
|
||||||
|
mapClass.mdLayerTreeShowOrHidden(YLFB_POINT_LAYER_KEY, false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mapStore.refreshPointLayerDisplayData(YLFB_POINT_LAYER_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
const resetFishSurveyState = () => {
|
||||||
|
fishSurveyZhuanZhiParams.value = {
|
||||||
|
time: defaultYear.toString(),
|
||||||
|
value: [],
|
||||||
|
anchorPointSelect: null
|
||||||
|
};
|
||||||
|
fishPointOptions.value = [];
|
||||||
|
fishSpeciesOptions.value = [];
|
||||||
|
fishPointLoading.value = false;
|
||||||
|
fishSpeciesLoading.value = false;
|
||||||
|
syncFishPointLayerData([]);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 备注:搜索下拉只从当前缓存点位和运行态筛选条件派生,不直接驱动地图行为。
|
// 备注:搜索下拉只从当前缓存点位和运行态筛选条件派生,不直接驱动地图行为。
|
||||||
const anchorPointOptions = computed(() => {
|
const anchorPointOptions = computed(() => {
|
||||||
|
if (isFishSurveyMode.value) {
|
||||||
|
return filteredFishPointOptions.value;
|
||||||
|
}
|
||||||
|
|
||||||
const pointData = mapDataStore.pointData || [];
|
const pointData = mapDataStore.pointData || [];
|
||||||
const checkedLayerKeys = new Set<string>(
|
const checkedLayerKeys = new Set<string>(
|
||||||
mapViewStore.getCheckedLayerKeys() || []
|
mapViewStore.getCheckedLayerKeys() || []
|
||||||
@ -225,13 +572,52 @@ const filterAnchorPoint = (input: string, option: any) => {
|
|||||||
|
|
||||||
// 备注:基地切换后仅重置本地选中的搜索项,不在组件中直接控制地图。
|
// 备注:基地切换后仅重置本地选中的搜索项,不在组件中直接控制地图。
|
||||||
watch(
|
watch(
|
||||||
() => mapViewStore.selectedBaseId,
|
() => currentFishBaseId.value,
|
||||||
() => {
|
() => {
|
||||||
|
if (isFishSurveyMode.value) {
|
||||||
|
syncFishAnchorPointSelection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
formModel.value.anchorPointSelect = null;
|
formModel.value.anchorPointSelect = null;
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => formModel.value.fishSurveyZhuanZhi,
|
||||||
|
async checked => {
|
||||||
|
if (!checked) {
|
||||||
|
resetFishSurveyState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await fetchFishSurveyOptions();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => currentFishBaseId.value,
|
||||||
|
async () => {
|
||||||
|
if (!isFishSurveyMode.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await fetchFishSurveyOptions();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
filteredFishPointOptions,
|
||||||
|
options => {
|
||||||
|
if (!isFishSurveyMode.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
syncFishAnchorPointSelection(options);
|
||||||
|
syncFishPointLayerData(options);
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
const handleCapacityChange = (value: string) => {
|
const handleCapacityChange = (value: string) => {
|
||||||
formModel.value.anchorPointSelect = null;
|
formModel.value.anchorPointSelect = null;
|
||||||
mapOrchestrator.changeEngPointCapacity(value);
|
mapOrchestrator.changeEngPointCapacity(value);
|
||||||
@ -239,7 +625,12 @@ const handleCapacityChange = (value: string) => {
|
|||||||
|
|
||||||
// 备注:搜索定位只分发定位命令,不在筛选组件里直接操作地图实例。
|
// 备注:搜索定位只分发定位命令,不在筛选组件里直接操作地图实例。
|
||||||
const handleAnchorPointChange = (value: string) => {
|
const handleAnchorPointChange = (value: string) => {
|
||||||
mapOrchestrator.focusPoint(value, 14);
|
if (!value) return;
|
||||||
|
mapOrchestrator.focusPoint(
|
||||||
|
value,
|
||||||
|
14,
|
||||||
|
isFishSurveyMode.value ? anchorPointOptions.value : undefined
|
||||||
|
);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,6 @@ const hasEnvFac = computed(() =>
|
|||||||
);
|
);
|
||||||
|
|
||||||
const legendItemClick = (item: any) => {
|
const legendItemClick = (item: any) => {
|
||||||
console.log(item);
|
|
||||||
if (item.parentName == '环保设施') return;
|
if (item.parentName == '环保设施') return;
|
||||||
if (item.canBeChecked == 0) {
|
if (item.canBeChecked == 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -8,9 +8,7 @@ import { useModelStore } from '@/store/modules/model';
|
|||||||
import GisView from '@/components/gis/GisView.vue';
|
import GisView from '@/components/gis/GisView.vue';
|
||||||
|
|
||||||
const modelStore = useModelStore();
|
const modelStore = useModelStore();
|
||||||
|
|
||||||
const tagsViewStore = useTagsViewStore();
|
const tagsViewStore = useTagsViewStore();
|
||||||
|
|
||||||
const router = useRoute();
|
const router = useRoute();
|
||||||
const routeKey = computed(() => router.path + Math.random());
|
const routeKey = computed(() => router.path + Math.random());
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,17 +1,28 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onBeforeMount, onMounted } from "vue";
|
import { ref, onBeforeMount, onMounted } from 'vue';
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { usePermissionStore } from "@/store/modules/permission";
|
import { useMapStore } from '@/store/modules/map';
|
||||||
|
import { usePermissionStore } from '@/store/modules/permission';
|
||||||
|
const mapStore = useMapStore();
|
||||||
const permissionStore = usePermissionStore();
|
const permissionStore = usePermissionStore();
|
||||||
const menus: any = ref([]); // 主菜单列表
|
const menus: any = ref([]); // 主菜单列表
|
||||||
const subMenus: any = ref([]); // 子菜单列表
|
const subMenus: any = ref([]); // 子菜单列表
|
||||||
const activeKey = ref(""); // 主菜单选中项
|
const activeKey = ref(''); // 主菜单选中项
|
||||||
const subActiveKey = ref(""); // 子菜单选中项
|
const subActiveKey = ref(''); // 子菜单选中项
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const buildPageKeyFromPath = (path?: string) => {
|
||||||
|
const normalizedPath = path || '';
|
||||||
|
const parts = normalizedPath.split('/').filter(Boolean);
|
||||||
|
if (parts.length >= 2) {
|
||||||
|
return `${parts[0]}_${parts[1]}`;
|
||||||
|
}
|
||||||
|
return normalizedPath || '__route-change__';
|
||||||
|
};
|
||||||
|
|
||||||
// 主菜单切换
|
// 主菜单切换
|
||||||
const handleTabChange = (key: string) => {
|
const handleTabChange = (key: string) => {
|
||||||
let data = menus.value.find((item: any) => item.id === key);
|
let data = menus.value.find((item: any) => item.id === key);
|
||||||
@ -19,23 +30,31 @@ const handleTabChange = (key: string) => {
|
|||||||
activeKey.value = key;
|
activeKey.value = key;
|
||||||
if (data.children.length > 0) {
|
if (data.children.length > 0) {
|
||||||
subActiveKey.value = data.children[0].id;
|
subActiveKey.value = data.children[0].id;
|
||||||
let subData = subMenus.value.find((item: any) => item.id === subActiveKey.value);
|
let subData = subMenus.value.find(
|
||||||
|
(item: any) => item.id === subActiveKey.value
|
||||||
|
);
|
||||||
|
mapStore.markPendingPageNavigation(
|
||||||
|
buildPageKeyFromPath(subData?.path || subData?.opturl)
|
||||||
|
);
|
||||||
router.push(subData.path || subData.opturl);
|
router.push(subData.path || subData.opturl);
|
||||||
} else {
|
} else {
|
||||||
subActiveKey.value = "";
|
subActiveKey.value = '';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// 子菜单切换
|
// 子菜单切换
|
||||||
const handleSubTabChange = (key: string) => {
|
const handleSubTabChange = (key: string) => {
|
||||||
subActiveKey.value = key;
|
subActiveKey.value = key;
|
||||||
let data = subMenus.value.find((item: any) => item.id === key);
|
let data = subMenus.value.find((item: any) => item.id === key);
|
||||||
|
mapStore.markPendingPageNavigation(
|
||||||
|
buildPageKeyFromPath(data?.path || data?.opturl)
|
||||||
|
);
|
||||||
router.push(data.path || data.opturl);
|
router.push(data.path || data.opturl);
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
permissionStore.routes.map((item: any) => {
|
permissionStore.routes.map((item: any) => {
|
||||||
if (item.meta?.hidden) {
|
if (item.meta?.hidden) {
|
||||||
return "";
|
return '';
|
||||||
} else {
|
} else {
|
||||||
if (item?.parentid == null) {
|
if (item?.parentid == null) {
|
||||||
menus.value.push(item?.children?.[0]);
|
menus.value.push(item?.children?.[0]);
|
||||||
@ -71,7 +90,11 @@ onMounted(() => {});
|
|||||||
></a-tab-pane>
|
></a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
<div class="sub-menus">
|
<div class="sub-menus">
|
||||||
<a-tabs v-model:activeKey="subActiveKey" @change="handleSubTabChange" size="small">
|
<a-tabs
|
||||||
|
v-model:activeKey="subActiveKey"
|
||||||
|
@change="handleSubTabChange"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<a-tab-pane
|
<a-tab-pane
|
||||||
v-for="route in subMenus"
|
v-for="route in subMenus"
|
||||||
:key="route.id"
|
:key="route.id"
|
||||||
@ -82,7 +105,7 @@ onMounted(() => {});
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@use "@/styles/variables.module.scss" as *;
|
@use '@/styles/variables.module.scss' as *;
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -130,7 +153,7 @@ onMounted(() => {});
|
|||||||
:deep(.ant-tabs-ink-bar) {
|
:deep(.ant-tabs-ink-bar) {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
border: none;
|
border: none;
|
||||||
background: url("@/assets/icons/menuActiveBg.svg") no-repeat center 30px;
|
background: url('@/assets/icons/menuActiveBg.svg') no-repeat center 30px;
|
||||||
height: 51px;
|
height: 51px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +177,7 @@ onMounted(() => {});
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ant-tabs-ink-bar {
|
.ant-tabs-ink-bar {
|
||||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAFCAYAAACXU8ZrAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAxMS8wMy8yMrqNQAoAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAOklEQVQImWNgQAchkx3QhZhQeEFTExj+MexnCJoyH1mYEUUBwz8kScYFDOtyEhGKMBSgKmTErQChEAA6FRM7O0rIOgAAAABJRU5ErkJggg==")
|
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAFCAYAAACXU8ZrAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAxMS8wMy8yMrqNQAoAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAOklEQVQImWNgQAchkx3QhZhQeEFTExj+MexnCJoyH1mYEUUBwz8kScYFDOtyEhGKMBSgKmTErQChEAA6FRM7O0rIOgAAAABJRU5ErkJggg==')
|
||||||
no-repeat center bottom;
|
no-repeat center bottom;
|
||||||
border-bottom: 2px solid #005293;
|
border-bottom: 2px solid #005293;
|
||||||
height: 7px;
|
height: 7px;
|
||||||
|
|||||||
@ -62,6 +62,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { ref, onMounted, onUnmounted, nextTick,watch } from 'vue';
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { useJidiSelectEventStore } from '@/store/modules/jidiSelectEvent';
|
import { useJidiSelectEventStore } from '@/store/modules/jidiSelectEvent';
|
||||||
import SidePanelItem from '@/components/SidePanelItem/index.vue';
|
import SidePanelItem from '@/components/SidePanelItem/index.vue';
|
||||||
|
|||||||
@ -54,6 +54,7 @@ export const useMapOrchestrator = () => {
|
|||||||
const mapDataStore = useMapDataStore();
|
const mapDataStore = useMapDataStore();
|
||||||
const mapViewStore = useMapViewStore();
|
const mapViewStore = useMapViewStore();
|
||||||
const jidiSelectEventStore = useJidiSelectEventStore();
|
const jidiSelectEventStore = useJidiSelectEventStore();
|
||||||
|
let activePageLoadRequestId = 0;
|
||||||
let zoomListenerKey: any = null;
|
let zoomListenerKey: any = null;
|
||||||
let stopBaseSelectionWatch: WatchStopHandle | null = null;
|
let stopBaseSelectionWatch: WatchStopHandle | null = null;
|
||||||
const initializedBaseLayerKeys = new Set<string>();
|
const initializedBaseLayerKeys = new Set<string>();
|
||||||
@ -115,16 +116,16 @@ export const useMapOrchestrator = () => {
|
|||||||
pageKey,
|
pageKey,
|
||||||
isInitialLoad = false
|
isInitialLoad = false
|
||||||
}: LoadPageOptions) => {
|
}: LoadPageOptions) => {
|
||||||
mapDataStore.setLoading(true);
|
let backgroundLoadStarted = false;
|
||||||
|
const pageLoadRequestId = ++activePageLoadRequestId;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
mapDataStore.setLoading(true);
|
||||||
|
|
||||||
const hasGlobalLegendConfig =
|
const hasGlobalLegendConfig =
|
||||||
Array.isArray(mapConfigStore.legendConfigOriginal) &&
|
Array.isArray(mapConfigStore.legendConfigOriginal) &&
|
||||||
mapConfigStore.legendConfigOriginal.length > 0;
|
mapConfigStore.legendConfigOriginal.length > 0;
|
||||||
const hasPointLayerCache =
|
|
||||||
Object.keys(mapDataStore.pointDataCache || {}).length > 0;
|
|
||||||
const shouldLoadGlobalLegend = isInitialLoad && !hasGlobalLegendConfig;
|
const shouldLoadGlobalLegend = isInitialLoad && !hasGlobalLegendConfig;
|
||||||
const shouldPreloadLayerData = isInitialLoad && !hasPointLayerCache;
|
|
||||||
const previousPageKey = mapConfigStore.lastLoadOptions?.pageKey || '';
|
const previousPageKey = mapConfigStore.lastLoadOptions?.pageKey || '';
|
||||||
const previousCheckedKeys = mapViewStore.getCheckedLayerKeys();
|
const previousCheckedKeys = mapViewStore.getCheckedLayerKeys();
|
||||||
const moduleId = (route.meta?.moduleId as string) || '';
|
const moduleId = (route.meta?.moduleId as string) || '';
|
||||||
@ -147,6 +148,10 @@ export const useMapOrchestrator = () => {
|
|||||||
const [{ layerConfig }, { legendOriginal, pageLegend }] =
|
const [{ layerConfig }, { legendOriginal, pageLegend }] =
|
||||||
await Promise.all([layerConfigPromise, legendConfigPromise]);
|
await Promise.all([layerConfigPromise, legendConfigPromise]);
|
||||||
|
|
||||||
|
if (pageLoadRequestId !== activePageLoadRequestId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 先设置图层数据(更新 checkedLayerKeys),再设置图例数据
|
// 先设置图层数据(更新 checkedLayerKeys),再设置图例数据
|
||||||
if (layerConfig.length > 0) {
|
if (layerConfig.length > 0) {
|
||||||
mapStore.setLayerData(layerConfig);
|
mapStore.setLayerData(layerConfig);
|
||||||
@ -184,16 +189,35 @@ export const useMapOrchestrator = () => {
|
|||||||
mapStore.setLegendData(legendOriginal, pageLegend);
|
mapStore.setLegendData(legendOriginal, pageLegend);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldPreloadLayerData) {
|
const activePageToken = mapStore.activatePageContext(
|
||||||
mapStore.setSelectedLegendData();
|
pageKey,
|
||||||
await mapStore.loadAllLayerData(layerConfig, checkedKeys);
|
layerConfig
|
||||||
} else {
|
);
|
||||||
await mapStore.updateLayerData(checkedKeys, true);
|
await mapStore.updateLayerData(checkedKeys, true);
|
||||||
mapStore.setSelectedLegendData();
|
mapStore.setSelectedLegendData();
|
||||||
}
|
const backgroundLoadPromise = isInitialLoad
|
||||||
|
? mapStore.loadAllLayerData(layerConfig, checkedKeys, {
|
||||||
|
pageToken: activePageToken,
|
||||||
|
skipSessionCheck: true,
|
||||||
|
pageKey
|
||||||
|
})
|
||||||
|
: mapStore.loadCurrentPageLayerData(layerConfig, checkedKeys, {
|
||||||
|
pageToken: activePageToken,
|
||||||
|
skipSessionCheck: true
|
||||||
|
});
|
||||||
|
|
||||||
|
void backgroundLoadPromise.catch(error => {
|
||||||
|
console.error(`页面锚点后台加载失败 [${pageKey}]`, error);
|
||||||
|
});
|
||||||
|
backgroundLoadStarted = true;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// mapDataStore.setLoading(false);
|
if (
|
||||||
|
!backgroundLoadStarted &&
|
||||||
|
pageLoadRequestId === activePageLoadRequestId
|
||||||
|
) {
|
||||||
|
mapDataStore.setLoading(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -296,21 +320,21 @@ export const useMapOrchestrator = () => {
|
|||||||
await loadPage({ pageKey, isInitialLoad: false });
|
await loadPage({ pageKey, isInitialLoad: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 备注:菜单切换前先隐藏旧页面当前可见的点图层,避免旧锚点残留到新页面接口返回之后才消失。
|
// 备注:菜单切换前只隐藏旧页面当前可见点图层,底图保持连续显示,避免切换时闪烁。
|
||||||
const hideCurrentVisiblePointLayers = () => {
|
const hideCurrentVisibleLayers = () => {
|
||||||
const currentCheckedKeys = mapViewStore.getCheckedLayerKeys();
|
const currentCheckedKeys = mapViewStore.getCheckedLayerKeys();
|
||||||
|
|
||||||
currentCheckedKeys.forEach(layerKey => {
|
currentCheckedKeys.forEach(layerKey => {
|
||||||
const layerItem = mapStore.findLayerByKey(mapStore.layerData, layerKey);
|
const layerItem = mapStore.findLayerByKey(mapStore.layerData, layerKey);
|
||||||
if (
|
if (!layerItem?.key) {
|
||||||
!layerItem?.key ||
|
|
||||||
layerItem.type !== 'pointMap' ||
|
|
||||||
!mapClass.hasLayer(layerItem.key)
|
|
||||||
) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layerItem.type === 'pointMap') {
|
||||||
|
if (mapClass.hasLayer(layerItem.key)) {
|
||||||
mapClass.mdLayerTreeShowOrHidden(layerItem.key, false);
|
mapClass.mdLayerTreeShowOrHidden(layerItem.key, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -419,16 +443,17 @@ export const useMapOrchestrator = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 备注:统一处理菜单切换后的页面重载和动态图层收口,减少页面组件里的分支编排。
|
// 备注:统一处理菜单切换后的页面重载和动态图层收口,减少页面组件里的分支编排。
|
||||||
const handlePageChange = async (pageKey: string, isHydroMenu: boolean) => {
|
const handlePageChange = (pageKey: string, isHydroMenu: boolean) => {
|
||||||
if (!pageKey) return;
|
if (!pageKey) return Promise.resolve();
|
||||||
|
|
||||||
const previousPageKey = mapConfigStore.lastLoadOptions?.pageKey || '';
|
const previousPageKey = mapConfigStore.lastLoadOptions?.pageKey || '';
|
||||||
if (previousPageKey && previousPageKey !== pageKey) {
|
if (previousPageKey && previousPageKey !== pageKey) {
|
||||||
hideCurrentVisiblePointLayers();
|
hideCurrentVisibleLayers();
|
||||||
|
mapViewStore.setCheckedLayerKeys([]);
|
||||||
|
mapStore.setSelectedLegendData();
|
||||||
}
|
}
|
||||||
|
|
||||||
await reloadPage(pageKey);
|
return reloadPage(pageKey).then(async () => {
|
||||||
|
|
||||||
const currentZoom = getCurrentZoom();
|
const currentZoom = getCurrentZoom();
|
||||||
if (isHydroMenu && currentZoom !== undefined && currentZoom >= 12) {
|
if (isHydroMenu && currentZoom !== undefined && currentZoom >= 12) {
|
||||||
await syncHydroDynamicLayers(true);
|
await syncHydroDynamicLayers(true);
|
||||||
@ -436,6 +461,7 @@ export const useMapOrchestrator = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await syncHydroDynamicLayers(false);
|
await syncHydroDynamicLayers(false);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 备注:统一处理单个图层切换命令,供后续其他入口复用。
|
// 备注:统一处理单个图层切换命令,供后续其他入口复用。
|
||||||
@ -531,11 +557,18 @@ export const useMapOrchestrator = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 备注:统一处理搜索定位,按点位编码从缓存数据中查找并飞行到目标位置。
|
// 备注:统一处理搜索定位,按点位编码从缓存数据中查找并飞行到目标位置。
|
||||||
const focusPoint = (pointId: string, zoom = 15) => {
|
const focusPoint = (
|
||||||
|
pointId: string,
|
||||||
|
zoom = 15,
|
||||||
|
fallbackPoints: any[] = []
|
||||||
|
) => {
|
||||||
if (!pointId) return;
|
if (!pointId) return;
|
||||||
const targetPoint = mapDataStore.pointData.find((item: any) => {
|
const pointMatcher = (item: any) => {
|
||||||
return item.stcd === pointId || item._id === pointId;
|
return item.stcd === pointId || item._id === pointId;
|
||||||
});
|
};
|
||||||
|
const targetPoint =
|
||||||
|
mapDataStore.pointData.find(pointMatcher) ||
|
||||||
|
fallbackPoints.find(pointMatcher);
|
||||||
if (!targetPoint?.lgtd || !targetPoint?.lttd) return;
|
if (!targetPoint?.lgtd || !targetPoint?.lttd) return;
|
||||||
mapClass.flyTopanto([targetPoint.lgtd, targetPoint.lttd], zoom);
|
mapClass.flyTopanto([targetPoint.lgtd, targetPoint.lttd], zoom);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -161,7 +161,6 @@ export const useMapConfigStore = defineStore('map-config', () => {
|
|||||||
moduleId: options.moduleId,
|
moduleId: options.moduleId,
|
||||||
description: options.description ?? 'true'
|
description: options.description ?? 'true'
|
||||||
});
|
});
|
||||||
console.log(cloneConfigData(layerRes));
|
|
||||||
|
|
||||||
const layerConfig = layerRes?.data?.mapLayerVos || [];
|
const layerConfig = layerRes?.data?.mapLayerVos || [];
|
||||||
setLayerConfigTree(layerConfig);
|
setLayerConfigTree(layerConfig);
|
||||||
|
|||||||
@ -59,10 +59,7 @@ export const useMapDataStore = defineStore('map-data', () => {
|
|||||||
// 备注:写入单个图层的锚点缓存,并保留当前是否勾选的状态。
|
// 备注:写入单个图层的锚点缓存,并保留当前是否勾选的状态。
|
||||||
const setPointLayerCache = (layerKey: string, cache: PointLayerCacheItem) => {
|
const setPointLayerCache = (layerKey: string, cache: PointLayerCacheItem) => {
|
||||||
if (!layerKey) return;
|
if (!layerKey) return;
|
||||||
pointDataCache.value = {
|
pointDataCache.value[layerKey] = cache;
|
||||||
...pointDataCache.value,
|
|
||||||
[layerKey]: cache
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 备注:只更新缓存中的勾选状态,避免重复覆盖整份锚点数据。
|
// 备注:只更新缓存中的勾选状态,避免重复覆盖整份锚点数据。
|
||||||
@ -113,13 +110,10 @@ export const useMapDataStore = defineStore('map-data', () => {
|
|||||||
// 备注:统一初始化单个图层的加载状态,避免外层重复判空。
|
// 备注:统一初始化单个图层的加载状态,避免外层重复判空。
|
||||||
const ensureLayerLoadState = (layerKey: string): LayerLoadStatus => {
|
const ensureLayerLoadState = (layerKey: string): LayerLoadStatus => {
|
||||||
if (!layerLoadState.value[layerKey]) {
|
if (!layerLoadState.value[layerKey]) {
|
||||||
layerLoadState.value = {
|
layerLoadState.value[layerKey] = {
|
||||||
...layerLoadState.value,
|
|
||||||
[layerKey]: {
|
|
||||||
loading: false,
|
loading: false,
|
||||||
loaded: false,
|
loaded: false,
|
||||||
error: null
|
error: null
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return layerLoadState.value[layerKey];
|
return layerLoadState.value[layerKey];
|
||||||
@ -128,50 +122,39 @@ export const useMapDataStore = defineStore('map-data', () => {
|
|||||||
// 备注:标记单个图层进入加载中状态。
|
// 备注:标记单个图层进入加载中状态。
|
||||||
const setLayerLoading = (layerKey: string) => {
|
const setLayerLoading = (layerKey: string) => {
|
||||||
const current = ensureLayerLoadState(layerKey);
|
const current = ensureLayerLoadState(layerKey);
|
||||||
layerLoadState.value = {
|
layerLoadState.value[layerKey] = {
|
||||||
...layerLoadState.value,
|
|
||||||
[layerKey]: {
|
|
||||||
...current,
|
...current,
|
||||||
loading: true,
|
loading: true,
|
||||||
error: null
|
error: null
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 备注:标记单个图层加载成功,供后续判断是否已完成首次加载。
|
// 备注:标记单个图层加载成功,供后续判断是否已完成首次加载。
|
||||||
const setLayerLoaded = (layerKey: string) => {
|
const setLayerLoaded = (layerKey: string) => {
|
||||||
const current = ensureLayerLoadState(layerKey);
|
const current = ensureLayerLoadState(layerKey);
|
||||||
layerLoadState.value = {
|
layerLoadState.value[layerKey] = {
|
||||||
...layerLoadState.value,
|
|
||||||
[layerKey]: {
|
|
||||||
...current,
|
...current,
|
||||||
loading: false,
|
loading: false,
|
||||||
loaded: true,
|
loaded: true,
|
||||||
error: null
|
error: null
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 备注:标记单个图层加载失败,并记录错误信息。
|
// 备注:标记单个图层加载失败,并记录错误信息。
|
||||||
const setLayerLoadError = (layerKey: string, error: unknown) => {
|
const setLayerLoadError = (layerKey: string, error: unknown) => {
|
||||||
const current = ensureLayerLoadState(layerKey);
|
const current = ensureLayerLoadState(layerKey);
|
||||||
layerLoadState.value = {
|
layerLoadState.value[layerKey] = {
|
||||||
...layerLoadState.value,
|
|
||||||
[layerKey]: {
|
|
||||||
...current,
|
...current,
|
||||||
loading: false,
|
loading: false,
|
||||||
loaded: false,
|
loaded: false,
|
||||||
error: error instanceof Error ? error.message : String(error)
|
error: error instanceof Error ? error.message : String(error)
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 备注:清理指定图层的加载状态,供重载场景复用。
|
// 备注:清理指定图层的加载状态,供重载场景复用。
|
||||||
const clearLayerLoadState = (layerKey: string) => {
|
const clearLayerLoadState = (layerKey: string) => {
|
||||||
if (!layerLoadState.value[layerKey]) return;
|
if (!layerLoadState.value[layerKey]) return;
|
||||||
const nextState = { ...layerLoadState.value };
|
delete layerLoadState.value[layerKey];
|
||||||
delete nextState[layerKey];
|
|
||||||
layerLoadState.value = nextState;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 备注:整体重置数据缓存 store,供菜单切换或地图销毁时调用。
|
// 备注:整体重置数据缓存 store,供菜单切换或地图销毁时调用。
|
||||||
|
|||||||
@ -14,10 +14,9 @@ import { useMapConfigStore } from '@/modules/map/stores/map-config.store';
|
|||||||
import { useMapDataStore } from '@/modules/map/stores/map-data.store';
|
import { useMapDataStore } from '@/modules/map/stores/map-data.store';
|
||||||
import { useMapViewStore } from '@/modules/map/stores/map-view.store';
|
import { useMapViewStore } from '@/modules/map/stores/map-view.store';
|
||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
// import { urlList } from '@/utils/GisUrlList';
|
|
||||||
const mapClass = MapClass.getInstance();
|
const mapClass = MapClass.getInstance();
|
||||||
const DEFAULT_LAYER_REQUEST_CONCURRENCY = 4;
|
|
||||||
const ENG_POINT_LAYER_KEY = 'eng_point';
|
const ENG_POINT_LAYER_KEY = 'eng_point';
|
||||||
|
const YLFB_POINT_LAYER_KEY = 'ylfb_point';
|
||||||
const ENG_POINT_MEDIUM_VISIBLE_ZOOM = 7.5;
|
const ENG_POINT_MEDIUM_VISIBLE_ZOOM = 7.5;
|
||||||
const ENG_POINT_LARGE_STATES = [
|
const ENG_POINT_LARGE_STATES = [
|
||||||
'large_eng_built',
|
'large_eng_built',
|
||||||
@ -47,24 +46,6 @@ const normalizeCachePayload = (value: any): any => {
|
|||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const buildUrlListIndex = (items: any[] = []) => {
|
|
||||||
// const index: Record<string, any[]> = {};
|
|
||||||
//
|
|
||||||
// items.forEach(item => {
|
|
||||||
// [item.url, item.title, item.keyType].forEach(key => {
|
|
||||||
// if (!key) return;
|
|
||||||
// if (!index[key]) {
|
|
||||||
// index[key] = [];
|
|
||||||
// }
|
|
||||||
// index[key].push(item);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// return index;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// const urlListIndex = buildUrlListIndex(urlList);
|
|
||||||
|
|
||||||
const isCanceledRequestError = (error: unknown) => {
|
const isCanceledRequestError = (error: unknown) => {
|
||||||
const message = error instanceof Error ? error.message : String(error || '');
|
const message = error instanceof Error ? error.message : String(error || '');
|
||||||
return (
|
return (
|
||||||
@ -149,8 +130,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
getLegendConfigByLayerCode,
|
getLegendConfigByLayerCode,
|
||||||
getLegendConfigByNameEn
|
getLegendConfigByNameEn
|
||||||
} = mapConfigStore;
|
} = mapConfigStore;
|
||||||
const { getPointLayerData, hasPointLayerData, hasValidPointLayerCache } =
|
const { hasPointLayerData, getPointLayerData } = mapDataStore;
|
||||||
mapDataStore;
|
|
||||||
const {
|
const {
|
||||||
layerConfigTree: layerData,
|
layerConfigTree: layerData,
|
||||||
legendConfigOriginal: legendDataOriginal,
|
legendConfigOriginal: legendDataOriginal,
|
||||||
@ -175,7 +155,20 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
}
|
}
|
||||||
>();
|
>();
|
||||||
const activeLayerRequestKeyMap = new Map<string, string>();
|
const activeLayerRequestKeyMap = new Map<string, string>();
|
||||||
|
const backgroundPointLayerCache = new Map<
|
||||||
|
string,
|
||||||
|
{
|
||||||
|
checked: boolean;
|
||||||
|
data: any[];
|
||||||
|
cacheKey?: string;
|
||||||
|
}
|
||||||
|
>();
|
||||||
let loadSessionSeed = 0;
|
let loadSessionSeed = 0;
|
||||||
|
let activePageRenderToken = 0;
|
||||||
|
let activePageKey = '';
|
||||||
|
let activePageLayerKeys = new Set<string>();
|
||||||
|
let activeLoadingPageToken: number | null = null;
|
||||||
|
let pendingPageNavigationKey = '';
|
||||||
|
|
||||||
const normalizeLegendNameEn = mapConfigStore.normalizeLegendNameEn;
|
const normalizeLegendNameEn = mapConfigStore.normalizeLegendNameEn;
|
||||||
|
|
||||||
@ -205,7 +198,11 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
if (!layerKey) return;
|
if (!layerKey) return;
|
||||||
|
|
||||||
const layerItem = findLayerByKey(layerData.value, layerKey);
|
const layerItem = findLayerByKey(layerData.value, layerKey);
|
||||||
const rawData = layerItem?.data || getPointLayerData(layerKey);
|
syncBackgroundCacheToReactiveStore(layerKey);
|
||||||
|
const rawData =
|
||||||
|
Array.isArray(layerItem?.data) && layerItem.data.length > 0
|
||||||
|
? layerItem.data
|
||||||
|
: getEffectivePointLayerData(layerKey);
|
||||||
const displayData = filterPointLayerDataForDisplay(layerKey, rawData);
|
const displayData = filterPointLayerDataForDisplay(layerKey, rawData);
|
||||||
const shouldRestoreVisible =
|
const shouldRestoreVisible =
|
||||||
layerItem?.checked === 1 || checkedLayerKeys.value.includes(layerKey);
|
layerItem?.checked === 1 || checkedLayerKeys.value.includes(layerKey);
|
||||||
@ -329,8 +326,82 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
return mapViewStore.getCheckedLayerKeys();
|
return mapViewStore.getCheckedLayerKeys();
|
||||||
};
|
};
|
||||||
|
|
||||||
const syncPointDataForFilter = () => {
|
const shouldSyncMergedPointData = (layerKey: string, pageToken?: number) => {
|
||||||
mapDataStore.rebuildPointDataFromCache();
|
if (!layerKey) return false;
|
||||||
|
return (
|
||||||
|
shouldApplyToActivePage(layerKey, pageToken) ||
|
||||||
|
getRuntimeCheckedLayerKeys().includes(layerKey)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getEffectivePointLayerCache = (layerKey: string) => {
|
||||||
|
const reactiveCache = mapDataStore.getPointLayerCache(layerKey);
|
||||||
|
if (reactiveCache) {
|
||||||
|
return reactiveCache;
|
||||||
|
}
|
||||||
|
return backgroundPointLayerCache.get(layerKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getEffectivePointLayerData = (layerKey: string): any[] => {
|
||||||
|
const reactiveCache = mapDataStore.getPointLayerCache(layerKey);
|
||||||
|
if (reactiveCache?.data) {
|
||||||
|
return reactiveCache.data;
|
||||||
|
}
|
||||||
|
return getEffectivePointLayerCache(layerKey)?.data || [];
|
||||||
|
};
|
||||||
|
|
||||||
|
const hasEffectivePointLayerCache = (layerKey: string, cacheKey: string) => {
|
||||||
|
const cache = getEffectivePointLayerCache(layerKey);
|
||||||
|
if (!cache || !cacheKey) return false;
|
||||||
|
return cache.cacheKey === cacheKey && Array.isArray(cache.data);
|
||||||
|
};
|
||||||
|
|
||||||
|
const setBackgroundPointLayerCache = (
|
||||||
|
layerKey: string,
|
||||||
|
cache: {
|
||||||
|
checked: boolean;
|
||||||
|
data: any[];
|
||||||
|
cacheKey?: string;
|
||||||
|
}
|
||||||
|
) => {
|
||||||
|
if (!layerKey) return;
|
||||||
|
backgroundPointLayerCache.set(layerKey, cache);
|
||||||
|
};
|
||||||
|
|
||||||
|
const syncBackgroundCacheToReactiveStore = (layerKey: string) => {
|
||||||
|
const cache = backgroundPointLayerCache.get(layerKey);
|
||||||
|
if (!cache) return;
|
||||||
|
mapDataStore.setPointLayerCache(layerKey, cache);
|
||||||
|
backgroundPointLayerCache.delete(layerKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
const syncPointDataForFilter = (layerKeys: string[] = []) => {
|
||||||
|
mapDataStore.rebuildPointDataFromCache(layerKeys);
|
||||||
|
};
|
||||||
|
|
||||||
|
const normalizePointLayerItems = (list: any[] = []) => {
|
||||||
|
return list
|
||||||
|
.map((item: any) => {
|
||||||
|
const iconType = item.anchoPointState;
|
||||||
|
const legendConfig = getLegendConfigByNameEn(iconType);
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
iconCode: item.iconCode || legendConfig?.icon || '',
|
||||||
|
code: item.code || legendConfig?.code || '',
|
||||||
|
tm:
|
||||||
|
item.sttpMap === 'WQ_ALARM'
|
||||||
|
? item?.warnDataList?.[0]?.tm
|
||||||
|
: item?.tm,
|
||||||
|
_id:
|
||||||
|
item._id || `${item.sttpMap || iconType || 'point'}_${item.stcd}`,
|
||||||
|
layerKey: item.layerKey || YLFB_POINT_LAYER_KEY
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter(
|
||||||
|
(item: any) =>
|
||||||
|
(item.iconCode || item.code == 'colorLayer') &&
|
||||||
|
!(item?.baseId == 'all' && item?.anchoPointState?.endsWith('_nbuilt'))
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const ensureGISLayerConfig = (layerItem: any) => {
|
const ensureGISLayerConfig = (layerItem: any) => {
|
||||||
@ -366,7 +437,6 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
mapConfigStore.setLayerConfigTree(data);
|
mapConfigStore.setLayerConfigTree(data);
|
||||||
const nextCheckedLayerKeys = mapConfigStore.extractCheckedLayerKeys(data);
|
const nextCheckedLayerKeys = mapConfigStore.extractCheckedLayerKeys(data);
|
||||||
mapViewStore.setCheckedLayerKeys(nextCheckedLayerKeys);
|
mapViewStore.setCheckedLayerKeys(nextCheckedLayerKeys);
|
||||||
console.log(1);
|
|
||||||
rebuildLegendRuntimeData(nextCheckedLayerKeys);
|
rebuildLegendRuntimeData(nextCheckedLayerKeys);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -388,20 +458,11 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动新的图层加载会话,并取消上一轮仍在进行中的旧请求,避免菜单切换后旧数据回写。
|
* 启动新的图层加载会话,供需要严格按最新查询条件收口的场景复用。
|
||||||
*/
|
*/
|
||||||
const startLoadSession = () => {
|
const startLoadSession = () => {
|
||||||
loadSessionSeed += 1;
|
loadSessionSeed += 1;
|
||||||
const currentSessionId = loadSessionSeed;
|
return loadSessionSeed;
|
||||||
|
|
||||||
inFlightRequestMap.forEach(entry => {
|
|
||||||
if (entry.sessionId !== currentSessionId) {
|
|
||||||
entry.controller.abort();
|
|
||||||
mapDataStore.clearLayerLoadState(entry.layerKey);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return currentSessionId;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -411,23 +472,58 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
return loadSessionSeed === sessionId;
|
return loadSessionSeed === sessionId;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
const activatePageContext = (pageKey: string, items: any[] = []) => {
|
||||||
* 按固定并发数执行图层加载任务,避免瞬时请求过多,同时让单个失败不影响其他任务。
|
activePageKey = pageKey;
|
||||||
*/
|
pendingPageNavigationKey = '';
|
||||||
const runLayerLoadQueue = async (
|
activePageRenderToken += 1;
|
||||||
tasks: Array<() => Promise<any>>,
|
activePageLayerKeys = new Set(getAllLayerKeys(items));
|
||||||
concurrency: number = DEFAULT_LAYER_REQUEST_CONCURRENCY
|
return activePageRenderToken;
|
||||||
) => {
|
};
|
||||||
const results: PromiseSettledResult<any>[] = [];
|
|
||||||
const safeConcurrency = Math.max(1, concurrency);
|
|
||||||
|
|
||||||
for (let i = 0; i < tasks.length; i += safeConcurrency) {
|
const markPendingPageNavigation = (targetPageKey: string) => {
|
||||||
const batch = tasks.slice(i, i + safeConcurrency).map(task => task());
|
pendingPageNavigationKey = targetPageKey || '__route-change__';
|
||||||
const batchResults = await Promise.allSettled(batch);
|
};
|
||||||
results.push(...batchResults);
|
|
||||||
|
const hasPendingPageNavigationAwayFrom = (pageKey: string) => {
|
||||||
|
return !!pendingPageNavigationKey && pendingPageNavigationKey !== pageKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
const shouldApplyToActivePage = (layerKey: string, pageToken?: number) => {
|
||||||
|
if (!layerKey) return false;
|
||||||
|
if (activePageKey && hasPendingPageNavigationAwayFrom(activePageKey)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (pageToken === undefined) return true;
|
||||||
|
return (
|
||||||
|
activePageRenderToken === pageToken && activePageLayerKeys.has(layerKey)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isActivePageToken = (pageToken?: number) => {
|
||||||
|
if (pageToken === undefined) return true;
|
||||||
|
return activePageRenderToken === pageToken;
|
||||||
|
};
|
||||||
|
|
||||||
|
const beginPageLoading = (pageToken?: number) => {
|
||||||
|
if (typeof pageToken === 'number') {
|
||||||
|
activeLoadingPageToken = pageToken;
|
||||||
|
}
|
||||||
|
mapDataStore.setLoading(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const finishPageLoading = (pageToken?: number) => {
|
||||||
|
if (typeof pageToken !== 'number') {
|
||||||
|
mapDataStore.setLoading(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
if (
|
||||||
|
activeLoadingPageToken === pageToken &&
|
||||||
|
activePageRenderToken === pageToken
|
||||||
|
) {
|
||||||
|
activeLoadingPageToken = null;
|
||||||
|
mapDataStore.setLoading(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -441,7 +537,6 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
mapViewStore.setLegendCheckedState(
|
mapViewStore.setLegendCheckedState(
|
||||||
buildLegendCheckedState(legendDataOriginal.value, normalizeLegendNameEn)
|
buildLegendCheckedState(legendDataOriginal.value, normalizeLegendNameEn)
|
||||||
);
|
);
|
||||||
console.log(2);
|
|
||||||
rebuildLegendRuntimeData(checkedLayerKeys.value);
|
rebuildLegendRuntimeData(checkedLayerKeys.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -449,7 +544,6 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
* 设置选中的图例数据(在图层加载完成后调用)
|
* 设置选中的图例数据(在图层加载完成后调用)
|
||||||
*/
|
*/
|
||||||
const setSelectedLegendData = () => {
|
const setSelectedLegendData = () => {
|
||||||
console.log(3);
|
|
||||||
rebuildLegendRuntimeData(checkedLayerKeys.value);
|
rebuildLegendRuntimeData(checkedLayerKeys.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -460,6 +554,68 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
mapDataStore.setPointData(data);
|
mapDataStore.setPointData(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const replacePointLayerData = (
|
||||||
|
layerKey: string,
|
||||||
|
data: any[] = [],
|
||||||
|
visible = true
|
||||||
|
) => {
|
||||||
|
if (!layerKey) return;
|
||||||
|
|
||||||
|
const layerItem = findLayerByKey(layerData.value, layerKey);
|
||||||
|
const normalizedData = normalizePointLayerItems(
|
||||||
|
data.map((item: any) => ({
|
||||||
|
...item,
|
||||||
|
layerKey
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
|
mapDataStore.setPointLayerCache(layerKey, {
|
||||||
|
checked: visible,
|
||||||
|
data: normalizedData,
|
||||||
|
cacheKey: `custom:${layerKey}:${normalizedData.length}`
|
||||||
|
});
|
||||||
|
mapDataStore.rebuildPointDataFromCache();
|
||||||
|
|
||||||
|
if (layerItem) {
|
||||||
|
layerItem.data = normalizedData;
|
||||||
|
layerItem.checked = visible ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!visible || normalizedData.length === 0) {
|
||||||
|
if (mapClass.hasLayer(layerKey)) {
|
||||||
|
mapClass.mdLayerTreeShowOrHidden(layerKey, false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshPointLayerDisplayData(layerKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
const applyLoadedPointLayerToMap = (
|
||||||
|
layer: any,
|
||||||
|
layerKey: string,
|
||||||
|
list: any[] = [],
|
||||||
|
pageToken?: number
|
||||||
|
) => {
|
||||||
|
if (!Array.isArray(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
layer.data = list;
|
||||||
|
const isLayerChecked = layer.checked === 1;
|
||||||
|
|
||||||
|
if (list.length === 0 || !shouldApplyToActivePage(layerKey, pageToken)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const displayData = filterPointLayerDataForDisplay(layerKey, list);
|
||||||
|
mapClass.addInitDataLayer(displayData, layerKey);
|
||||||
|
if (isLayerChecked) {
|
||||||
|
restoreLayerLegendVisibility(layerKey);
|
||||||
|
}
|
||||||
|
mapClass.mdLayerTreeShowOrHidden(layerKey, isLayerChecked);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图例数据转对象
|
* 图例数据转对象
|
||||||
*/
|
*/
|
||||||
@ -503,15 +659,14 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 使用初始化时已加载的数据(存入 layer.data)
|
// 使用初始化时已加载的数据(存入 layer.data)
|
||||||
const cachedData = layer?.data || getPointLayerData(key);
|
const cachedData =
|
||||||
|
Array.isArray(layer?.data) && layer.data.length > 0
|
||||||
|
? layer.data
|
||||||
|
: getPointLayerData(key);
|
||||||
if (cachedData && cachedData.length > 0) {
|
if (cachedData && cachedData.length > 0) {
|
||||||
layer.checked = 1;
|
layer.checked = 1;
|
||||||
const displayData = filterPointLayerDataForDisplay(key, cachedData);
|
const displayData = filterPointLayerDataForDisplay(key, cachedData);
|
||||||
if (!mapClass.hasLayer(key)) {
|
|
||||||
mapClass.addInitDataLayer(displayData, key);
|
mapClass.addInitDataLayer(displayData, key);
|
||||||
} else {
|
|
||||||
mapClass.addInitDataLayer(displayData, key);
|
|
||||||
}
|
|
||||||
restoreLayerLegendVisibility(key);
|
restoreLayerLegendVisibility(key);
|
||||||
if (mapDataStore.getPointLayerCache(key)) {
|
if (mapDataStore.getPointLayerCache(key)) {
|
||||||
mapDataStore.setPointLayerCacheChecked(key, true);
|
mapDataStore.setPointLayerCacheChecked(key, true);
|
||||||
@ -527,7 +682,6 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
* @param isInit - 是否是初始化阶段(初始化时遍历所有图层)
|
* @param isInit - 是否是初始化阶段(初始化时遍历所有图层)
|
||||||
*/
|
*/
|
||||||
const updateLayerData = async (checkKeys: string[], isInit = false) => {
|
const updateLayerData = async (checkKeys: string[], isInit = false) => {
|
||||||
console.log(checkKeys);
|
|
||||||
if (!isInit) {
|
if (!isInit) {
|
||||||
checkKeys = normalizeCheckedLayerKeys(checkKeys);
|
checkKeys = normalizeCheckedLayerKeys(checkKeys);
|
||||||
}
|
}
|
||||||
@ -604,12 +758,23 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
* @param items 图层数据
|
* @param items 图层数据
|
||||||
* @param checkedKeys 选中的图层 keys(用于优先加载)
|
* @param checkedKeys 选中的图层 keys(用于优先加载)
|
||||||
*/
|
*/
|
||||||
const loadAllLayerData = async (items: any[], checkedKeys: string[] = []) => {
|
const loadAllLayerData = async (
|
||||||
mapDataStore.setLoading(true);
|
items: any[],
|
||||||
const currentSessionId = startLoadSession();
|
checkedKeys: string[] = [],
|
||||||
|
options: {
|
||||||
|
pageToken?: number;
|
||||||
|
skipSessionCheck?: boolean;
|
||||||
|
pageKey?: string;
|
||||||
|
} = {}
|
||||||
|
) => {
|
||||||
|
beginPageLoading(options.pageToken);
|
||||||
|
const currentSessionId = options.skipSessionCheck
|
||||||
|
? undefined
|
||||||
|
: startLoadSession();
|
||||||
const checkedTasks: Array<() => Promise<any>> = [];
|
const checkedTasks: Array<() => Promise<any>> = [];
|
||||||
const uncheckedTasks: Array<() => Promise<any>> = [];
|
const uncheckedTasks: Array<() => Promise<any>> = [];
|
||||||
const processedKeys = new Set<string>();
|
const processedKeys = new Set<string>();
|
||||||
|
const debugStart = Date.now();
|
||||||
|
|
||||||
const processItems = (itemList: any[]) => {
|
const processItems = (itemList: any[]) => {
|
||||||
itemList.forEach(item => {
|
itemList.forEach(item => {
|
||||||
@ -620,7 +785,13 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
!processedKeys.has(item.key)
|
!processedKeys.has(item.key)
|
||||||
) {
|
) {
|
||||||
processedKeys.add(item.key);
|
processedKeys.add(item.key);
|
||||||
const task = () => loadLayerData(item, currentSessionId);
|
const task = () =>
|
||||||
|
loadLayerData(item, {
|
||||||
|
sessionId: currentSessionId,
|
||||||
|
pageToken: options.pageToken,
|
||||||
|
skipSessionCheck: options.skipSessionCheck,
|
||||||
|
pageKey: options.pageKey
|
||||||
|
});
|
||||||
if (checkedKeys.includes(item.key)) {
|
if (checkedKeys.includes(item.key)) {
|
||||||
checkedTasks.push(task);
|
checkedTasks.push(task);
|
||||||
} else {
|
} else {
|
||||||
@ -637,9 +808,11 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
processItems(items);
|
processItems(items);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const checkedResults = await runLayerLoadQueue(checkedTasks);
|
// 首页初始化:所有图层接口一次性并发下发,避免分批串行等待。
|
||||||
const uncheckedResults = await runLayerLoadQueue(uncheckedTasks);
|
const loadResults = await Promise.allSettled(
|
||||||
const failedResults = [...checkedResults, ...uncheckedResults].filter(
|
[...checkedTasks, ...uncheckedTasks].map(task => task())
|
||||||
|
);
|
||||||
|
const failedResults = loadResults.filter(
|
||||||
result => result.status === 'rejected'
|
result => result.status === 'rejected'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -650,7 +823,18 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isCurrentLoadSession(currentSessionId)) {
|
if (
|
||||||
|
(typeof currentSessionId === 'number' &&
|
||||||
|
!isCurrentLoadSession(currentSessionId)) ||
|
||||||
|
!isActivePageToken(options.pageToken)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
options.pageKey &&
|
||||||
|
hasPendingPageNavigationAwayFrom(options.pageKey)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,8 +842,9 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
const allLayerKeys = getAllLayerKeys(items);
|
const allLayerKeys = getAllLayerKeys(items);
|
||||||
for (const key of allLayerKeys) {
|
for (const key of allLayerKeys) {
|
||||||
const layer = findLayerByKey(items, key);
|
const layer = findLayerByKey(items, key);
|
||||||
if (layer && hasPointLayerData(key)) {
|
if (layer && getEffectivePointLayerData(key).length > 0) {
|
||||||
layer.data = getPointLayerData(key);
|
syncBackgroundCacheToReactiveStore(key);
|
||||||
|
layer.data = getEffectivePointLayerData(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,7 +886,70 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
// 不能再回放 load 启动瞬间的默认 checked 快照。
|
// 不能再回放 load 启动瞬间的默认 checked 快照。
|
||||||
await updateLayerData(finalCheckedKeys, true);
|
await updateLayerData(finalCheckedKeys, true);
|
||||||
} finally {
|
} finally {
|
||||||
mapDataStore.setLoading(false);
|
const shouldFinishLoading =
|
||||||
|
(typeof currentSessionId !== 'number' ||
|
||||||
|
isCurrentLoadSession(currentSessionId)) &&
|
||||||
|
(options.pageToken === undefined ||
|
||||||
|
activePageRenderToken === options.pageToken);
|
||||||
|
if (shouldFinishLoading) {
|
||||||
|
finishPageLoading(options.pageToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadCurrentPageLayerData = async (
|
||||||
|
items: any[],
|
||||||
|
checkedKeys: string[] = [],
|
||||||
|
options: {
|
||||||
|
pageToken?: number;
|
||||||
|
skipSessionCheck?: boolean;
|
||||||
|
} = {}
|
||||||
|
) => {
|
||||||
|
const checkedLayerSet = new Set(checkedKeys);
|
||||||
|
const tasks: Array<() => Promise<any>> = [];
|
||||||
|
const processedKeys = new Set<string>();
|
||||||
|
|
||||||
|
const processItems = (itemList: any[]) => {
|
||||||
|
itemList.forEach(item => {
|
||||||
|
if (
|
||||||
|
item.type === 'pointMap' &&
|
||||||
|
item.key &&
|
||||||
|
item.url &&
|
||||||
|
checkedLayerSet.has(item.key) &&
|
||||||
|
!processedKeys.has(item.key)
|
||||||
|
) {
|
||||||
|
processedKeys.add(item.key);
|
||||||
|
tasks.push(() =>
|
||||||
|
loadLayerData(item, {
|
||||||
|
sessionId: options.skipSessionCheck ? undefined : loadSessionSeed,
|
||||||
|
pageToken: options.pageToken,
|
||||||
|
skipSessionCheck: options.skipSessionCheck ?? true
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.children && item.children.length > 0) {
|
||||||
|
processItems(item.children);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
processItems(items);
|
||||||
|
|
||||||
|
if (tasks.length === 0) {
|
||||||
|
finishPageLoading(options.pageToken);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
beginPageLoading(options.pageToken);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 菜单切换:仅当前页的勾选图层一次性并发下发,旧请求在后台继续运行。
|
||||||
|
await Promise.allSettled(tasks.map(task => task()));
|
||||||
|
} finally {
|
||||||
|
if (isActivePageToken(options.pageToken)) {
|
||||||
|
finishPageLoading(options.pageToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -813,7 +1061,6 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
normalizedNameEn,
|
normalizedNameEn,
|
||||||
checked
|
checked
|
||||||
);
|
);
|
||||||
console.log(5);
|
|
||||||
rebuildLegendRuntimeData(checkedLayerKeys.value);
|
rebuildLegendRuntimeData(checkedLayerKeys.value);
|
||||||
applyLegendItemVisibility(legendItem, checked);
|
applyLegendItemVisibility(legendItem, checked);
|
||||||
};
|
};
|
||||||
@ -832,7 +1079,6 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
mapViewStore.setLegendCheckedState(nextState);
|
mapViewStore.setLegendCheckedState(nextState);
|
||||||
console.log(6);
|
|
||||||
rebuildLegendRuntimeData(checkedLayerKeys.value);
|
rebuildLegendRuntimeData(checkedLayerKeys.value);
|
||||||
changedLegendItems.forEach(legendItem =>
|
changedLegendItems.forEach(legendItem =>
|
||||||
applyLegendItemVisibility(legendItem, checked)
|
applyLegendItemVisibility(legendItem, checked)
|
||||||
@ -852,8 +1098,19 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
*/
|
*/
|
||||||
const loadLayerData = async (
|
const loadLayerData = async (
|
||||||
layer: any,
|
layer: any,
|
||||||
sessionId: number = loadSessionSeed
|
options: {
|
||||||
|
sessionId?: number;
|
||||||
|
pageToken?: number;
|
||||||
|
skipSessionCheck?: boolean;
|
||||||
|
pageKey?: string;
|
||||||
|
} = {}
|
||||||
) => {
|
) => {
|
||||||
|
const {
|
||||||
|
sessionId = loadSessionSeed,
|
||||||
|
pageToken,
|
||||||
|
skipSessionCheck = false,
|
||||||
|
pageKey
|
||||||
|
} = options;
|
||||||
const { key, url, params = {}, paramJson, anchorParamJson } = layer;
|
const { key, url, params = {}, paramJson, anchorParamJson } = layer;
|
||||||
|
|
||||||
// 没有URL,跳过
|
// 没有URL,跳过
|
||||||
@ -866,10 +1123,8 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
|
|
||||||
const layerKey = layer?.key || '';
|
const layerKey = layer?.key || '';
|
||||||
|
|
||||||
const voidSttp = 'all';
|
|
||||||
const ylfbKeys = ['ylfb_point'];
|
const ylfbKeys = ['ylfb_point'];
|
||||||
const timeRangeLayerKeys = ['ef_point'];
|
const timeRangeLayerKeys = ['ef_point'];
|
||||||
const spjkz = ['stinfo_video_point'];
|
|
||||||
|
|
||||||
const yearTime = dayjs().subtract(1, 'years');
|
const yearTime = dayjs().subtract(1, 'years');
|
||||||
|
|
||||||
@ -894,15 +1149,6 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
value: dayjs(searchTimeRange.value[1]).format('YYYY-MM-DD 23:59:59')
|
value: dayjs(searchTimeRange.value[1]).format('YYYY-MM-DD 23:59:59')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (spjkz.includes(layerKey)) {
|
|
||||||
if (voidSttp !== 'all') {
|
|
||||||
requestParams.filters.push({
|
|
||||||
field: 'sttp',
|
|
||||||
operator: 'in',
|
|
||||||
value: voidSttp == 'VD_EQ,VD_EQS' ? ['VD_EQ', 'VD_EQS'] : [voidSttp]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ylfbKeys.includes(layerKey)) {
|
if (ylfbKeys.includes(layerKey)) {
|
||||||
if (yearTime) {
|
if (yearTime) {
|
||||||
requestParams.filters.push({
|
requestParams.filters.push({
|
||||||
@ -955,42 +1201,40 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
requestData
|
requestData
|
||||||
});
|
});
|
||||||
|
|
||||||
if (hasValidPointLayerCache(key, requestIdentifier)) {
|
if (hasEffectivePointLayerCache(key, requestIdentifier)) {
|
||||||
layer.data = getPointLayerData(key);
|
syncBackgroundCacheToReactiveStore(key);
|
||||||
layer.checked = 0;
|
const cachedList = getEffectivePointLayerData(key);
|
||||||
syncPointDataForFilter();
|
layer.data = cachedList;
|
||||||
if (!mapClass.hasLayer(key)) {
|
if (shouldSyncMergedPointData(key, pageToken)) {
|
||||||
mapClass.addInitDataLayer(
|
syncPointDataForFilter(getRuntimeCheckedLayerKeys());
|
||||||
filterPointLayerDataForDisplay(key, getPointLayerData(key)),
|
|
||||||
key
|
|
||||||
);
|
|
||||||
mapClass.mdLayerTreeShowOrHidden(key, false);
|
|
||||||
}
|
}
|
||||||
return layer.data;
|
applyLoadedPointLayerToMap(layer, key, cachedList, pageToken);
|
||||||
}
|
return cachedList;
|
||||||
|
|
||||||
const previousRequestKey = activeLayerRequestKeyMap.get(key);
|
|
||||||
if (previousRequestKey && previousRequestKey !== requestIdentifier) {
|
|
||||||
const previousRequest = inFlightRequestMap.get(previousRequestKey);
|
|
||||||
previousRequest?.controller.abort();
|
|
||||||
mapDataStore.clearLayerLoadState(key);
|
|
||||||
inFlightRequestMap.delete(previousRequestKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activeLayerRequestKeyMap.set(key, requestIdentifier);
|
||||||
const existingRequest = inFlightRequestMap.get(requestIdentifier);
|
const existingRequest = inFlightRequestMap.get(requestIdentifier);
|
||||||
if (existingRequest) {
|
if (existingRequest) {
|
||||||
return existingRequest.promise;
|
mapDataStore.setLayerLoading(key);
|
||||||
|
return existingRequest.promise.then(list => {
|
||||||
|
if (Array.isArray(list) && list.length > 0) {
|
||||||
|
if (shouldSyncMergedPointData(key, pageToken)) {
|
||||||
|
syncPointDataForFilter(getRuntimeCheckedLayerKeys());
|
||||||
|
}
|
||||||
|
applyLoadedPointLayerToMap(layer, key, list, pageToken);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mapDataStore.setLayerLoading(key);
|
mapDataStore.setLayerLoading(key);
|
||||||
|
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
activeLayerRequestKeyMap.set(key, requestIdentifier);
|
|
||||||
|
|
||||||
const requestPromise = (async () => {
|
const requestPromise = (async () => {
|
||||||
try {
|
try {
|
||||||
const response = await request({
|
const response = await request({
|
||||||
url: '/api' + requestUrl,
|
url: requestUrl,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: requestData,
|
data: requestData,
|
||||||
signal: controller.signal
|
signal: controller.signal
|
||||||
@ -999,8 +1243,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
controller.signal.aborted ||
|
controller.signal.aborted ||
|
||||||
!isCurrentLoadSession(sessionId) ||
|
(!skipSessionCheck && !isCurrentLoadSession(sessionId))
|
||||||
activeLayerRequestKeyMap.get(key) !== requestIdentifier
|
|
||||||
) {
|
) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@ -1022,42 +1265,37 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list.forEach((item: any) => {
|
list = normalizePointLayerItems(
|
||||||
const iconType = item.anchoPointState;
|
list.map((item: any) => ({
|
||||||
const legendConfig = getLegendConfigByNameEn(iconType);
|
...item,
|
||||||
item.iconCode = legendConfig?.icon || '';
|
layerKey: item.layerKey || key
|
||||||
item.code = legendConfig?.code || '';
|
}))
|
||||||
item.tm =
|
|
||||||
item.sttpMap === 'WQ_ALARM'
|
|
||||||
? item?.warnDataList?.[0]?.tm
|
|
||||||
: item?.tm;
|
|
||||||
item._id = item.sttpMap + '_' + item.stcd;
|
|
||||||
});
|
|
||||||
|
|
||||||
list = list.filter(
|
|
||||||
(l: any) =>
|
|
||||||
(l.iconCode || l.code == 'colorLayer') &&
|
|
||||||
!(l?.baseId == 'all' && l?.anchoPointState?.endsWith('_nbuilt'))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (activeLayerRequestKeyMap.get(key) !== requestIdentifier) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const isLayerChecked = layer.checked === 1;
|
const isLayerChecked = layer.checked === 1;
|
||||||
mapDataStore.setPointLayerCache(key, {
|
const cachePayload = {
|
||||||
checked: isLayerChecked,
|
checked: isLayerChecked,
|
||||||
data: list,
|
data: list,
|
||||||
cacheKey: requestIdentifier
|
cacheKey: requestIdentifier
|
||||||
});
|
};
|
||||||
syncPointDataForFilter();
|
const shouldDeferToBackgroundCache =
|
||||||
|
!!pageKey && hasPendingPageNavigationAwayFrom(pageKey);
|
||||||
|
|
||||||
|
if (shouldDeferToBackgroundCache) {
|
||||||
|
setBackgroundPointLayerCache(key, cachePayload);
|
||||||
layer.data = list;
|
layer.data = list;
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
if (list.length > 0) {
|
mapDataStore.setPointLayerCache(key, cachePayload);
|
||||||
const displayData = filterPointLayerDataForDisplay(key, list);
|
if (shouldSyncMergedPointData(key, pageToken)) {
|
||||||
mapClass.addInitDataLayer(displayData, key);
|
syncPointDataForFilter(getRuntimeCheckedLayerKeys());
|
||||||
if (isLayerChecked) {
|
|
||||||
restoreLayerLegendVisibility(key);
|
|
||||||
}
|
|
||||||
mapClass.mdLayerTreeShowOrHidden(key, isLayerChecked);
|
|
||||||
}
|
}
|
||||||
|
applyLoadedPointLayerToMap(layer, key, list, pageToken);
|
||||||
|
|
||||||
mapDataStore.setLayerLoaded(key);
|
mapDataStore.setLayerLoaded(key);
|
||||||
return list;
|
return list;
|
||||||
@ -1065,7 +1303,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
if (
|
if (
|
||||||
controller.signal.aborted ||
|
controller.signal.aborted ||
|
||||||
isCanceledRequestError(error) ||
|
isCanceledRequestError(error) ||
|
||||||
!isCurrentLoadSession(sessionId) ||
|
(!skipSessionCheck && !isCurrentLoadSession(sessionId)) ||
|
||||||
activeLayerRequestKeyMap.get(key) !== requestIdentifier
|
activeLayerRequestKeyMap.get(key) !== requestIdentifier
|
||||||
) {
|
) {
|
||||||
return [];
|
return [];
|
||||||
@ -1131,7 +1369,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
for (const key of timeRangeLayerKeys) {
|
for (const key of timeRangeLayerKeys) {
|
||||||
const layerItem = findLayerByKey(layerData.value, key);
|
const layerItem = findLayerByKey(layerData.value, key);
|
||||||
if (layerItem && currentCheckedKeys.includes(key)) {
|
if (layerItem && currentCheckedKeys.includes(key)) {
|
||||||
await loadLayerData(layerItem, currentSessionId);
|
await loadLayerData(layerItem, { sessionId: currentSessionId });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1140,9 +1378,6 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const allPointData = mapDataStore.rebuildPointDataFromCache();
|
const allPointData = mapDataStore.rebuildPointDataFromCache();
|
||||||
|
|
||||||
console.log(888);
|
|
||||||
console.log(currentCheckedKeys);
|
|
||||||
// 更新地图锚点显示
|
// 更新地图锚点显示
|
||||||
await updateLayerData(currentCheckedKeys, false);
|
await updateLayerData(currentCheckedKeys, false);
|
||||||
}
|
}
|
||||||
@ -1163,6 +1398,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
layerData,
|
layerData,
|
||||||
setLayerData,
|
setLayerData,
|
||||||
loadAllLayerData,
|
loadAllLayerData,
|
||||||
|
loadCurrentPageLayerData,
|
||||||
loadLayerData,
|
loadLayerData,
|
||||||
setSelectedLegendData,
|
setSelectedLegendData,
|
||||||
legendData,
|
legendData,
|
||||||
@ -1174,6 +1410,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
updateLayerData,
|
updateLayerData,
|
||||||
updateLegendChecked,
|
updateLegendChecked,
|
||||||
updateLegendCheckedBatch,
|
updateLegendCheckedBatch,
|
||||||
|
replacePointLayerData,
|
||||||
getCheckedKeys,
|
getCheckedKeys,
|
||||||
legendData2Obj,
|
legendData2Obj,
|
||||||
loading,
|
loading,
|
||||||
@ -1184,6 +1421,8 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
getLayerBranchKeys,
|
getLayerBranchKeys,
|
||||||
normalizeCheckedLayerKeys,
|
normalizeCheckedLayerKeys,
|
||||||
refreshPointLayerDisplayData,
|
refreshPointLayerDisplayData,
|
||||||
|
activatePageContext,
|
||||||
|
markPendingPageNavigation,
|
||||||
searchTimeRange,
|
searchTimeRange,
|
||||||
reloadBySearchTimeRange,
|
reloadBySearchTimeRange,
|
||||||
updateSearchTimeRange
|
updateSearchTimeRange
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import dayjs from 'dayjs';
|
|||||||
export const urlList = [
|
export const urlList = [
|
||||||
{
|
{
|
||||||
url: '/wmp-eng-server/eng/point/GetKendoListCust',
|
url: '/wmp-eng-server/eng/point/GetKendoListCust',
|
||||||
title: '常规水电',
|
title: '常规水电✅️',
|
||||||
params: {
|
params: {
|
||||||
anchoPointState: [{ field: 'anchoPointState', operator: 'isnotnull' }]
|
anchoPointState: [{ field: 'anchoPointState', operator: 'isnotnull' }]
|
||||||
},
|
},
|
||||||
@ -15,12 +15,12 @@ export const urlList = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/sw/getFacilityPointList/GetKendoListCust',
|
url: '/wmp-env-server/sw/getFacilityPointList/GetKendoListCust',
|
||||||
title: '低温水减缓设施',
|
title: '低温水减缓设施✅️',
|
||||||
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-eng-server/eng/eq/interval/GetKendoListCust',
|
url: '/wmp-eng-server/eng/eq/interval/GetKendoListCust',
|
||||||
title: '生态流量达标率',
|
title: '生态流量达标率✅️',
|
||||||
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] },
|
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] },
|
||||||
orders:
|
orders:
|
||||||
'{"baseId":"asc","rvcdStepSort":"asc","siteStepSort":"asc","ennm":"asc"}'
|
'{"baseId":"asc","rvcdStepSort":"asc","siteStepSort":"asc","ennm":"asc"}'
|
||||||
@ -37,7 +37,7 @@ export const urlList = [
|
|||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// url: '/wmp-env-server/env/wq/anchorPoint/GetKendoListCust',
|
// url: '/wmp-env-server/env/wq/anchorPoint/GetKendoListCust',
|
||||||
// title: '自建站',
|
// title: '自建站✅️',
|
||||||
// params: {
|
// params: {
|
||||||
// dtinType: '0',
|
// dtinType: '0',
|
||||||
// ...(window.__lyConfigs?.baseId === "07" ? { sttpCode: "WQ" } : {}),
|
// ...(window.__lyConfigs?.baseId === "07" ? { sttpCode: "WQ" } : {}),
|
||||||
@ -47,17 +47,17 @@ export const urlList = [
|
|||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/wq/anchorPoint/GetKendoListCust',
|
url: '/wmp-env-server/env/wq/anchorPoint/GetKendoListCust',
|
||||||
title: '国家站',
|
title: '国家站✅️',
|
||||||
params: { dtinType: '1', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { dtinType: '1', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/wq/anchorPoint/GetKendoListCust',
|
url: '/wmp-env-server/env/wq/anchorPoint/GetKendoListCust',
|
||||||
title: '人工站',
|
title: '人工站✅️',
|
||||||
params: { dtinType: '2', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { dtinType: '2', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/wq/anchorPoint/GetKendoListCust',
|
url: '/wmp-env-server/env/wq/anchorPoint/GetKendoListCust',
|
||||||
title: '栖息地水质站',
|
title: '栖息地水质站❓不知道',
|
||||||
params: {
|
params: {
|
||||||
fhstcd: [{ field: 'fhstcd', operator: 'isnotnull' }],
|
fhstcd: [{ field: 'fhstcd', operator: 'isnotnull' }],
|
||||||
fhFlag: '1',
|
fhFlag: '1',
|
||||||
@ -67,48 +67,48 @@ export const urlList = [
|
|||||||
// { url: getUrl('/wmp-env-server/env/fp/point/GetKendoListCust'), title: '过鱼设施', params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
// { url: getUrl('/wmp-env-server/env/fp/point/GetKendoListCust'), title: '过鱼设施', params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
||||||
{
|
{
|
||||||
url: '/wmp-eng-server/eng/eq/eqds/GetKendoListCust',
|
url: '/wmp-eng-server/eng/eq/eqds/GetKendoListCust',
|
||||||
title: '生态流量泄放设施',
|
title: '生态流量泄放设施✅️',
|
||||||
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/fb/point/GetKendoListCust',
|
url: '/wmp-env-server/fb/point/GetKendoListCust',
|
||||||
title: '鱼类增殖站',
|
title: '鱼类增殖站✅️',
|
||||||
params: { sttp: 'FB', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { sttp: 'FB', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fhvap/GetKendoListCust',
|
url: '/wmp-env-server/env/fhvap/GetKendoListCust',
|
||||||
title: '珍稀植物园',
|
title: '珍稀植物园✅️',
|
||||||
params: { sttpCode: 'VP', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { sttpCode: 'VP', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fhvap/GetKendoListCust',
|
url: '/wmp-env-server/env/fhvap/GetKendoListCust',
|
||||||
title: '动物救助站',
|
title: '动物救助站✅️',
|
||||||
params: { sttpCode: 'VA', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { sttpCode: 'VA', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/fb/point/GetKendoListCust',
|
url: '/wmp-env-server/fb/point/GetKendoListCust',
|
||||||
title: '人工产卵场',
|
title: '人工产卵场✅️',
|
||||||
params: { sttp: 'SG', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { sttp: 'SG', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/sw/getEngTempPointList/GetKendoListCust',
|
url: '/wmp-env-server/sw/getEngTempPointList/GetKendoListCust',
|
||||||
title: '水温监测断面',
|
title: '水温监测断面✅️',
|
||||||
keyType: 'wt_point',
|
keyType: 'wt_point',
|
||||||
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/sw/getEngTempPointList/GetKendoListCust',
|
url: '/wmp-env-server/sw/getEngTempPointList/GetKendoListCust',
|
||||||
title: '自建水温站',
|
title: '自建水温站❓',
|
||||||
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }], flag: '0' }
|
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }], flag: '0' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/sw/getEngTempPointList/GetKendoListCust',
|
url: '/wmp-env-server/sw/getEngTempPointList/GetKendoListCust',
|
||||||
title: '人工水温站',
|
title: '人工水温站❓',
|
||||||
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }], flag: '2' }
|
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }], flag: '2' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/sw/getEngTempPointList/GetKendoListCust',
|
url: '/wmp-env-server/sw/getEngTempPointList/GetKendoListCust',
|
||||||
title: '栖息地水温站',
|
title: '栖息地水温站❓',
|
||||||
params: {
|
params: {
|
||||||
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
||||||
fhstcd: [{ field: 'fhstcd', operator: 'isnotnull' }],
|
fhstcd: [{ field: 'fhstcd', operator: 'isnotnull' }],
|
||||||
@ -117,18 +117,18 @@ export const urlList = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fhvap/GetKendoListCust',
|
url: '/wmp-env-server/env/fhvap/GetKendoListCust',
|
||||||
title: '栖息地',
|
title: '栖息地✅️',
|
||||||
params: { sttpCode: 'FH', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { sttpCode: 'FH', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fhvap/fhPoint/GetKendoListCust',
|
url: '/wmp-env-server/env/fhvap/fhPoint/GetKendoListCust',
|
||||||
title: '水质监测站',
|
title: '水质监测站✅️',
|
||||||
params: { sttpCode: 'WQ', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { sttpCode: 'WQ', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fhvap/fhPoint/GetKendoListCust',
|
url: '/wmp-env-server/env/fhvap/fhPoint/GetKendoListCust',
|
||||||
title: '水温监测站',
|
title: '水温监测站✅️',
|
||||||
params: {
|
params: {
|
||||||
sttpCode: 'WTRV',
|
sttpCode: 'WTRV',
|
||||||
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }]
|
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }]
|
||||||
@ -136,19 +136,19 @@ export const urlList = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fhvap/fhPoint/GetKendoListCust',
|
url: '/wmp-env-server/env/fhvap/fhPoint/GetKendoListCust',
|
||||||
title: '流量监测站',
|
title: '流量监测站✅️',
|
||||||
params: { sttpCode: 'ZQ', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { sttpCode: 'ZQ', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fhvap/fhPoint/GetKendoListCust',
|
url: '/wmp-env-server/env/fhvap/fhPoint/GetKendoListCust',
|
||||||
title: '视频监控',
|
title: '视频监控✅️',
|
||||||
params: { sttpCode: 'VD', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { sttpCode: 'VD', lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// url: '/wmp-env-server/env/vd/aiPoint/GetKendoListCust',
|
url: '/wmp-env-server/env/vd/aiPoint/GetKendoListCust',
|
||||||
// title: 'AI视频监控站',
|
title: 'AI视频监控站 缺失!',
|
||||||
// params: { sttpCode: 'AIVD' }
|
params: { sttpCode: 'AIVD' }
|
||||||
// },
|
},
|
||||||
// { url: '/wmp-env-server/env/fh/vdpoint/GetKendoListCust', title: '水电站监控视频', keyType: "video_fbfm_point", params: { sttp: 'VD_FBFM', hbrvcd: window.__lyConfigs.wbsCode, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
// { url: '/wmp-env-server/env/fh/vdpoint/GetKendoListCust', title: '水电站监控视频', keyType: "video_fbfm_point", params: { sttp: 'VD_FBFM', hbrvcd: window.__lyConfigs.wbsCode, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
||||||
// { url: '/wmp-env-server/env/fh/vdpoint/GetKendoListCust', title: '生态流量监测断面视频', keyType: "video_eqs_point", params: { sttp: 'VD_EQS', hbrvcd: window.__lyConfigs.wbsCode, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
// { url: '/wmp-env-server/env/fh/vdpoint/GetKendoListCust', title: '生态流量监测断面视频', keyType: "video_eqs_point", params: { sttp: 'VD_EQS', hbrvcd: window.__lyConfigs.wbsCode, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
||||||
// { url: '/wmp-env-server/env/fh/vdpoint/GetKendoListCust', title: '水质站运行视频', keyType: "video_wq_point", params: { sttp: 'VD_WQ', hbrvcd: window.__lyConfigs.wbsCode, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
// { url: '/wmp-env-server/env/fh/vdpoint/GetKendoListCust', title: '水质站运行视频', keyType: "video_wq_point", params: { sttp: 'VD_WQ', hbrvcd: window.__lyConfigs.wbsCode, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
||||||
@ -161,14 +161,18 @@ export const urlList = [
|
|||||||
|
|
||||||
// {
|
// {
|
||||||
// url: getUrl('/wmp-env-server/env/we/point/GetKendoListCust'),
|
// url: getUrl('/wmp-env-server/env/we/point/GetKendoListCust'),
|
||||||
// title: '水生生态调查断面',
|
// title: '水生生态调查断面 ❌️数量不对 真实是338',
|
||||||
// params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] },
|
// params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] },
|
||||||
// orders: '{"siteStepSort":"asc"}'
|
// orders: '{"siteStepSort":"asc"}'
|
||||||
// },
|
// },
|
||||||
// { url: getUrl('/wmp-env-server/env/we/fishPoint/GetKendoListCust'), title: '鱼类分布', params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
// {
|
||||||
|
// url: getUrl('/wmp-env-server/env/we/fishPoint/GetKendoListCust'),
|
||||||
|
// title: '鱼类分布 ✅️',
|
||||||
|
// params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
url: '/wmp-eng-server/eng/alarmPoint/GetKendoListCust',
|
url: '/wmp-eng-server/eng/alarmPoint/GetKendoListCust',
|
||||||
title: '水电站告警情况',
|
title: '水电站告警情况❌️ 数据不对 真实数据是663',
|
||||||
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
@ -178,12 +182,12 @@ export const urlList = [
|
|||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fh/zqpoint/GetKendoListCust',
|
url: '/wmp-env-server/env/fh/zqpoint/GetKendoListCust',
|
||||||
title: '国家水文站',
|
title: '国家水文站✅️',
|
||||||
params: { dtinType: 1, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { dtinType: 1, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fh/zqpoint/GetKendoListCust',
|
url: '/wmp-env-server/env/fh/zqpoint/GetKendoListCust',
|
||||||
title: '自建水文站',
|
title: '自建水文站✅️',
|
||||||
params: { dtinType: 0, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { dtinType: 0, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -197,7 +201,7 @@ export const urlList = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fh/vdpoint/GetKendoListCust',
|
url: '/wmp-env-server/env/fh/vdpoint/GetKendoListCust',
|
||||||
title: '视频监控站',
|
title: '视频监控站✅️',
|
||||||
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
@ -267,33 +271,33 @@ export const urlList = [
|
|||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fp/point/built/GetKendoListCust',
|
url: '/wmp-env-server/env/fp/point/built/GetKendoListCust',
|
||||||
title: '在建过鱼设施-地图锚点',
|
title: '在建过鱼设施-地图锚点 ✅️',
|
||||||
params: {
|
params: {
|
||||||
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
||||||
bldsttCcode: [{ field: 'bldsttCcode', operator: 'eq', value: '1' }]
|
bldsttCcode: [{ field: 'bldsttCcode', operator: 'eq', value: '1' }]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// url: '/wmp-env-server/env/fb/point/built/GetKendoListCust',
|
url: '/wmp-env-server/env/fb/point/built/GetKendoListCust',
|
||||||
// title: '在建鱼类增殖站',
|
title: '在建鱼类增殖站 缺失!',
|
||||||
// params: {
|
params: {
|
||||||
// lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
||||||
// sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'FB' }],
|
sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'FB' }],
|
||||||
// bldsttCcode: [{ field: 'bldsttCcode', operator: 'eq', value: '1' }]
|
bldsttCcode: [{ field: 'bldsttCcode', operator: 'eq', value: '1' }]
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// url: '/wmp-env-server/env/fb/point/built/GetKendoListCust',
|
url: '/wmp-env-server/env/fb/point/built/GetKendoListCust',
|
||||||
// title: '在建人工产卵场',
|
title: '在建人工产卵场 缺失!',
|
||||||
// params: {
|
params: {
|
||||||
// lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
||||||
// sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'SG' }],
|
sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'SG' }],
|
||||||
// bldsttCcode: [{ field: 'bldsttCcode', operator: 'eq', value: '1' }]
|
bldsttCcode: [{ field: 'bldsttCcode', operator: 'eq', value: '1' }]
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fhvap/built/GetKendoListCust',
|
url: '/wmp-env-server/env/fhvap/built/GetKendoListCust',
|
||||||
title: '在建珍稀植物园',
|
title: '在建珍稀植物园✅️',
|
||||||
params: {
|
params: {
|
||||||
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
||||||
sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'VP' }],
|
sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'VP' }],
|
||||||
@ -302,7 +306,7 @@ export const urlList = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/fhvap/built/GetKendoListCust',
|
url: '/wmp-env-server/env/fhvap/built/GetKendoListCust',
|
||||||
title: '在建动物救助站',
|
title: '在建动物救助站✅️',
|
||||||
params: {
|
params: {
|
||||||
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
||||||
sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'VA' }],
|
sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'VA' }],
|
||||||
@ -326,7 +330,7 @@ export const urlList = [
|
|||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/env/wva/point/GetKendoListCust',
|
url: '/wmp-env-server/env/wva/point/GetKendoListCust',
|
||||||
title: '野生动物监测',
|
title: '野生动物监测✅️',
|
||||||
params: {
|
params: {
|
||||||
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
lgtd: [{ field: 'lgtd', operator: 'isnotnull' }],
|
||||||
sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'WVA' }]
|
sttpCode: [{ field: 'sttpCode', operator: 'eq', value: 'WVA' }]
|
||||||
@ -344,7 +348,7 @@ export const urlList = [
|
|||||||
// { url: '/wmp-env-server/te/tet/point/GetTerrestrialAnimal', title: '陆生动物分布', params: { baseId: window?.__lyConfigs?.baseId, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
// { url: '/wmp-env-server/te/tet/point/GetTerrestrialAnimal', title: '陆生动物分布', params: { baseId: window?.__lyConfigs?.baseId, lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] } },
|
||||||
{
|
{
|
||||||
url: '/wmp-env-server/sdFprdR/point/getFprdPointList',
|
url: '/wmp-env-server/sdFprdR/point/getFprdPointList',
|
||||||
title: '鱼类调查装置',
|
title: '鱼类调查装置 对',
|
||||||
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
params: { lgtd: [{ field: 'lgtd', operator: 'isnotnull' }] }
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@ -34,7 +34,7 @@ service.interceptors.request.use(
|
|||||||
config.headers._sysid = '10EC2E0B-AEA9-4757-83A2-201BA1BC54E9';
|
config.headers._sysid = '10EC2E0B-AEA9-4757-83A2-201BA1BC54E9';
|
||||||
|
|
||||||
config.headers.authorization =
|
config.headers.authorization =
|
||||||
'bearer f2438154-ca4c-4acb-8e56-739534932ebb';
|
'bearer 223f63a2-0b13-4757-8e15-f342098e63ca';
|
||||||
config.baseURL = '/';
|
config.baseURL = '/';
|
||||||
} else {
|
} else {
|
||||||
const user = useUserStoreHook();
|
const user = useUserStoreHook();
|
||||||
@ -54,10 +54,13 @@ service.interceptors.response.use(
|
|||||||
(response: any) => {
|
(response: any) => {
|
||||||
const { status, msg } = response;
|
const { status, msg } = response;
|
||||||
if (status === 200) {
|
if (status === 200) {
|
||||||
|
console.log(response.data);
|
||||||
if (response.data.code == 401) {
|
if (response.data.code == 401) {
|
||||||
message.error(response.data.msg || '请求失败');
|
message.error(response.data.msg || '请求失败');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
localStorage.clear();
|
||||||
router.push('/login');
|
router.push('/login');
|
||||||
|
window.location.href = '/';
|
||||||
}, 1000);
|
}, 1000);
|
||||||
return;
|
return;
|
||||||
} else if (response.data.code == 1) {
|
} else if (response.data.code == 1) {
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref } from 'vue';
|
import { onActivated, onMounted, ref } from 'vue';
|
||||||
import JidiSelectorMod from '@/modules/jidiSelectorMod.vue';
|
import JidiSelectorMod from '@/modules/jidiSelectorMod.vue';
|
||||||
import RightDrawer from '@/components/RightDrawer/index.vue';
|
import RightDrawer from '@/components/RightDrawer/index.vue';
|
||||||
import jidiInfoMod from '@/modules/jidiInfoMod/index.vue';
|
import jidiInfoMod from '@/modules/jidiInfoMod/index.vue';
|
||||||
import shuidianhuangjingjieruMod from '@/modules/shuidianhuangjingjieruMod/index.vue';
|
import shuidianhuangjingjieruMod from '@/modules/shuidianhuangjingjieruMod/index.vue';
|
||||||
import { useModelStore } from '@/store/modules/model';
|
import { useModelStore } from '@/store/modules/model';
|
||||||
onMounted(() => {
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch } from 'vue';
|
||||||
import JidiSelectorMod from "@/modules/jidiSelectorMod.vue";
|
import JidiSelectorMod from '@/modules/jidiSelectorMod.vue';
|
||||||
import RightDrawer from "@/components/RightDrawer/index.vue";
|
import RightDrawer from '@/components/RightDrawer/index.vue';
|
||||||
import ShuiZhiJianCeGongZuoQingKuang from "@/modules/shuizhijiancegongzuoQK/index.vue"
|
import ShuiZhiJianCeGongZuoQingKuang from '@/modules/shuizhijiancegongzuoQK/index.vue';
|
||||||
import EnvironmentalQuality from "@/modules/EnvironmentalQuality/index.vue" // 环境质量满足度
|
import EnvironmentalQuality from '@/modules/EnvironmentalQuality/index.vue'; // 环境质量满足度
|
||||||
import { useJidiSelectEventStore } from "@/store/modules/jidiSelectEvent";
|
import { useJidiSelectEventStore } from '@/store/modules/jidiSelectEvent';
|
||||||
import SZYCBH from "@/modules/waterQuality/index.vue"
|
import SZYCBH from '@/modules/waterQuality/index.vue';
|
||||||
const JidiSelectEventStore = useJidiSelectEventStore();
|
const JidiSelectEventStore = useJidiSelectEventStore();
|
||||||
const wbsCode = ref('');
|
const wbsCode = ref('');
|
||||||
watch(
|
watch(
|
||||||
() => JidiSelectEventStore.selectedItem,
|
() => JidiSelectEventStore.selectedItem,
|
||||||
(newVal) => {
|
newVal => {
|
||||||
console.log(newVal);
|
console.log(newVal);
|
||||||
//
|
//
|
||||||
wbsCode.value = newVal.wbsCode;
|
wbsCode.value = newVal.wbsCode;
|
||||||
@ -29,7 +29,6 @@ watch(
|
|||||||
<ShuiZhiJianCeGongZuoQingKuang />
|
<ShuiZhiJianCeGongZuoQingKuang />
|
||||||
<EnvironmentalQuality />
|
<EnvironmentalQuality />
|
||||||
<SZYCBH v-if="wbsCode != 'all'"></SZYCBH>
|
<SZYCBH v-if="wbsCode != 'all'"></SZYCBH>
|
||||||
|
|
||||||
</RightDrawer>
|
</RightDrawer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -78,7 +78,7 @@
|
|||||||
:key="item.stcd"
|
:key="item.stcd"
|
||||||
:value="item.stcd"
|
:value="item.stcd"
|
||||||
>
|
>
|
||||||
{{ item.ennm }}
|
{{ item.stnm }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
<a-button
|
<a-button
|
||||||
@ -103,7 +103,7 @@
|
|||||||
:default-expand-all="false"
|
:default-expand-all="false"
|
||||||
:selectable="false"
|
:selectable="false"
|
||||||
block-node
|
block-node
|
||||||
style="width: 300px"
|
style="width: 400px"
|
||||||
>
|
>
|
||||||
<template #title="{ dataRef }">
|
<template #title="{ dataRef }">
|
||||||
<!-- 编辑状态:只显示编辑区域 -->
|
<!-- 编辑状态:只显示编辑区域 -->
|
||||||
@ -154,7 +154,11 @@
|
|||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
@click.stop="handleAddChild(dataRef)"
|
@click.stop="handleAddChild(dataRef)"
|
||||||
title="添加子节点"
|
:title="
|
||||||
|
dataRef.sttpName
|
||||||
|
? `子级添加-${dataRef.sttpName}`
|
||||||
|
: '子级添加'
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<PlusOutlined />
|
<PlusOutlined />
|
||||||
</a-button>
|
</a-button>
|
||||||
@ -252,7 +256,7 @@
|
|||||||
:key="item.stcd"
|
:key="item.stcd"
|
||||||
:value="item.stcd"
|
:value="item.stcd"
|
||||||
>
|
>
|
||||||
{{ item.stnm }}
|
{{ item.stnm }}-{{ item.sttpName }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
<a-button
|
<a-button
|
||||||
@ -337,7 +341,10 @@ const rules: Record<string, Rule[]> = {
|
|||||||
|
|
||||||
const handleRiverSelect = async (value: string) => {
|
const handleRiverSelect = async (value: string) => {
|
||||||
const res = await getEngInfoDropdown({ rvcd: value });
|
const res = await getEngInfoDropdown({ rvcd: value });
|
||||||
stationList.value = res.data || [];
|
stationList.value = (res.data || []).map((item: any) => ({
|
||||||
|
...item,
|
||||||
|
stnm: item.ennm
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const isEdit = computed(() => !!props.initialValues);
|
const isEdit = computed(() => !!props.initialValues);
|
||||||
@ -455,7 +462,7 @@ const handleAdd = () => {
|
|||||||
const handleNodeSelect = (value: string) => {
|
const handleNodeSelect = (value: string) => {
|
||||||
const station = stationList.value.find(item => item.stcd === value);
|
const station = stationList.value.find(item => item.stcd === value);
|
||||||
if (station) {
|
if (station) {
|
||||||
newNodeData.value.ennm = station.ennm;
|
newNodeData.value.ennm = station.stnm;
|
||||||
newNodeData.value.sttpName = station.sttpName;
|
newNodeData.value.sttpName = station.sttpName;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -583,7 +590,7 @@ const handleEditNodeSelect = (dataRef: any) => {
|
|||||||
const list = dataRef.parentId ? childStationList.value : stationList.value;
|
const list = dataRef.parentId ? childStationList.value : stationList.value;
|
||||||
const station = list.find(item => item.stcd === value);
|
const station = list.find(item => item.stcd === value);
|
||||||
if (station) {
|
if (station) {
|
||||||
editNodeData.value.ennm = dataRef.parentId ? station.stnm : station.ennm;
|
editNodeData.value.ennm = station.stnm;
|
||||||
editNodeData.value.sttpName = station.sttpName;
|
editNodeData.value.sttpName = station.sttpName;
|
||||||
editNodeData.value.stcd = station.stcd;
|
editNodeData.value.stcd = station.stcd;
|
||||||
}
|
}
|
||||||
@ -734,7 +741,10 @@ const initForm = async () => {
|
|||||||
// 编辑时调用接口获取一级站点列表
|
// 编辑时调用接口获取一级站点列表
|
||||||
if (formData.rvcd) {
|
if (formData.rvcd) {
|
||||||
const res = await getEngInfoDropdown({ rvcd: formData.rvcd });
|
const res = await getEngInfoDropdown({ rvcd: formData.rvcd });
|
||||||
stationList.value = res.data || [];
|
stationList.value = (res.data || []).map((item: any) => ({
|
||||||
|
...item,
|
||||||
|
stnm: item.ennm
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resetForm();
|
resetForm();
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
:list-url="getAllConfigTree"
|
:list-url="getAllConfigTree"
|
||||||
:search-params="searchParams"
|
:search-params="searchParams"
|
||||||
>
|
>
|
||||||
<template #action="{ column, record }">
|
<template #action="{ record }">
|
||||||
<div class="flex gap-[6px]">
|
<div class="flex gap-[6px]">
|
||||||
<a-button
|
<a-button
|
||||||
class="!p-0"
|
class="!p-0"
|
||||||
@ -57,9 +57,11 @@ import {
|
|||||||
getAllConfigTree,
|
getAllConfigTree,
|
||||||
deleteBaseWbsb,
|
deleteBaseWbsb,
|
||||||
saveBaseWbsbChild,
|
saveBaseWbsbChild,
|
||||||
saveBaseWbsbChildDetail
|
saveBaseWbsbChildDetail,
|
||||||
|
getChildConfigTree
|
||||||
} from '@/api/system/map/ConfigManagement';
|
} from '@/api/system/map/ConfigManagement';
|
||||||
import { getRvcdDropdown } from '@/api/select';
|
import { getRvcdDropdown } from '@/api/select';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const basicTable = ref<any>(null);
|
const basicTable = ref<any>(null);
|
||||||
@ -71,7 +73,7 @@ const columns = [
|
|||||||
key: 'index',
|
key: 'index',
|
||||||
width: 60,
|
width: 60,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({ text, record, index }) => index + 1
|
customRender: ({ index }) => index + 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '沿程配置名称',
|
title: '沿程配置名称',
|
||||||
@ -89,11 +91,13 @@ const columns = [
|
|||||||
title: '所在河段',
|
title: '所在河段',
|
||||||
dataIndex: 'rvnm',
|
dataIndex: 'rvnm',
|
||||||
key: 'rvnm',
|
key: 'rvnm',
|
||||||
|
width: 300,
|
||||||
ellipsis: true
|
ellipsis: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '创建人',
|
title: '创建人',
|
||||||
key: 'recordUser',
|
key: 'recordUser',
|
||||||
|
width: 120,
|
||||||
dataIndex: 'recordUser'
|
dataIndex: 'recordUser'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -147,8 +151,56 @@ const filterRecord = (record: any) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 编辑处理
|
// 编辑处理
|
||||||
const handleEdit = (record: any) => {
|
const handleEdit = async (record: any) => {
|
||||||
currentRecord.value = filterRecord(record);
|
currentRecord.value = filterRecord(record);
|
||||||
|
const params = {
|
||||||
|
filter: {
|
||||||
|
logic: 'and',
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
field: 'alongId',
|
||||||
|
operator: 'eq',
|
||||||
|
value: record.id
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
sort: [
|
||||||
|
{
|
||||||
|
field: 'sort',
|
||||||
|
dir: 'asc'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
const res = await getChildConfigTree(params);
|
||||||
|
if (res.code == 0) {
|
||||||
|
const data = res.data.data || [];
|
||||||
|
const firstLevelNodes = data.filter((item: any) => !item.rstcd);
|
||||||
|
const secondLevelNodes = data.filter((item: any) => item.rstcd);
|
||||||
|
|
||||||
|
const configNodes = firstLevelNodes.map((node: any, index: number) => {
|
||||||
|
const children = secondLevelNodes.filter(
|
||||||
|
(child: any) => child.rstcd === node.stcd
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
key: `parent-${index}`,
|
||||||
|
stcd: node.stcd,
|
||||||
|
ennm: node.stnm,
|
||||||
|
sttpName: node.sttpName,
|
||||||
|
parentId: null,
|
||||||
|
children: children.map((child: any, childIndex: number) => ({
|
||||||
|
key: `child-${index}-${childIndex}`,
|
||||||
|
stcd: child.stcd,
|
||||||
|
ennm: child.stnm,
|
||||||
|
sttpName: child.sttpName,
|
||||||
|
parentId: `parent-${index}`,
|
||||||
|
children: []
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
currentRecord.value.configNodes = configNodes;
|
||||||
|
}
|
||||||
editModalVisible.value = true;
|
editModalVisible.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -220,7 +272,8 @@ const handleEditSubmit = async (values: any) => {
|
|||||||
try {
|
try {
|
||||||
const formData = {
|
const formData = {
|
||||||
...currentRecord.value,
|
...currentRecord.value,
|
||||||
...values
|
...values,
|
||||||
|
modifyTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||||
};
|
};
|
||||||
delete formData.configNodes;
|
delete formData.configNodes;
|
||||||
|
|
||||||
@ -238,17 +291,19 @@ const handleEditSubmit = async (values: any) => {
|
|||||||
if (treeData.length > 0) {
|
if (treeData.length > 0) {
|
||||||
const formatTreeData = (
|
const formatTreeData = (
|
||||||
nodes: any[],
|
nodes: any[],
|
||||||
parentId: string | null = null
|
parentId: string | null = null,
|
||||||
|
parentStcd: string | null = null
|
||||||
) => {
|
) => {
|
||||||
return nodes.map(node => ({
|
return nodes.map(node => ({
|
||||||
alongId,
|
alongId,
|
||||||
stcd: node.stcd,
|
stcd: node.stcd,
|
||||||
stnm: node.ennm,
|
stnm: node.ennm || node.stnm,
|
||||||
sttpName: node.sttpName,
|
sttpName: node.sttpName,
|
||||||
parentId: parentId ? parentId : null,
|
parentId: parentId ? parentId : null,
|
||||||
|
rstcd: parentStcd || null,
|
||||||
children:
|
children:
|
||||||
node.children && node.children.length > 0
|
node.children && node.children.length > 0
|
||||||
? formatTreeData(node.children, node.key)
|
? formatTreeData(node.children, node.key, node.stcd)
|
||||||
: []
|
: []
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: "role",
|
name: 'role'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref, nextTick } from "vue";
|
import { onMounted, ref, nextTick } from 'vue';
|
||||||
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
|
import { ElForm, ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import {
|
import {
|
||||||
listRolePages,
|
listRolePages,
|
||||||
isvaildTo,
|
isvaildTo,
|
||||||
@ -16,8 +16,8 @@ import {
|
|||||||
assignmentPer,
|
assignmentPer,
|
||||||
setMenuById,
|
setMenuById,
|
||||||
setOrgscope,
|
setOrgscope,
|
||||||
postOrgscope,
|
postOrgscope
|
||||||
} from "@/api/role";
|
} from '@/api/role';
|
||||||
//定义表格数据
|
//定义表格数据
|
||||||
const tableData: any = ref([]);
|
const tableData: any = ref([]);
|
||||||
const multipleSelection = ref([]);
|
const multipleSelection = ref([]);
|
||||||
@ -28,11 +28,11 @@ const tree = ref();
|
|||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
function gettableData() {
|
function gettableData() {
|
||||||
let params = {
|
let params = {
|
||||||
rolename: input.value,
|
rolename: input.value
|
||||||
};
|
};
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listRolePages(params)
|
listRolePages(params)
|
||||||
.then((result) => {
|
.then(result => {
|
||||||
tableData.value = result;
|
tableData.value = result;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
})
|
})
|
||||||
@ -46,26 +46,26 @@ function handleSelectionChange(val: any) {
|
|||||||
}
|
}
|
||||||
function switchChange(row: any) {
|
function switchChange(row: any) {
|
||||||
const elMessage = ref();
|
const elMessage = ref();
|
||||||
if (row.isvaild == "0") {
|
if (row.isvaild == '0') {
|
||||||
elMessage.value = "确定设置该角色为无效吗?";
|
elMessage.value = '确定设置该角色为无效吗?';
|
||||||
} else if (row.isvaild == "1") {
|
} else if (row.isvaild == '1') {
|
||||||
elMessage.value = "确定设置该角色为有效吗?";
|
elMessage.value = '确定设置该角色为有效吗?';
|
||||||
}
|
}
|
||||||
ElMessageBox.confirm(elMessage.value, "提示信息", {
|
ElMessageBox.confirm(elMessage.value, '提示信息', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning",
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
let params = {
|
let params = {
|
||||||
isvaild: row.isvaild,
|
isvaild: row.isvaild,
|
||||||
id: row.id,
|
id: row.id
|
||||||
};
|
};
|
||||||
isvaildTo(params).then(() => {
|
isvaildTo(params).then(() => {
|
||||||
gettableData();
|
gettableData();
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "改变成功",
|
message: '改变成功'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@ -75,35 +75,35 @@ function switchChange(row: any) {
|
|||||||
}
|
}
|
||||||
const infoForm = ref();
|
const infoForm = ref();
|
||||||
//搜索内容及点击搜索按钮
|
//搜索内容及点击搜索按钮
|
||||||
const input = ref("");
|
const input = ref('');
|
||||||
//新建角色
|
//新建角色
|
||||||
const title = ref("");
|
const title = ref('');
|
||||||
const info: any = ref({
|
const info: any = ref({
|
||||||
rolename: "",
|
rolename: '',
|
||||||
level: "2",
|
level: '2',
|
||||||
description: "",
|
description: ''
|
||||||
});
|
});
|
||||||
const faultList: any = [
|
const faultList: any = [
|
||||||
{
|
{
|
||||||
value: "1",
|
value: '1',
|
||||||
label: "超级管理员",
|
label: '超级管理员'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "2",
|
value: '2',
|
||||||
label: "系统管理员",
|
label: '系统管理员'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "3",
|
value: '3',
|
||||||
label: "一般用户",
|
label: '一般用户'
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
function addClick() {
|
function addClick() {
|
||||||
title.value = "新增角色";
|
title.value = '新增角色';
|
||||||
info.value = {
|
info.value = {
|
||||||
rolename: "",
|
rolename: '',
|
||||||
level: "2",
|
level: '2',
|
||||||
description: "",
|
description: ''
|
||||||
};
|
};
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ function confirmClick(formEl: any) {
|
|||||||
const params = {
|
const params = {
|
||||||
rolename: info.value.rolename,
|
rolename: info.value.rolename,
|
||||||
level: info.value.level,
|
level: info.value.level,
|
||||||
description: info.value.description,
|
description: info.value.description
|
||||||
};
|
};
|
||||||
addDept(params).then(() => {
|
addDept(params).then(() => {
|
||||||
gettableData();
|
gettableData();
|
||||||
@ -126,7 +126,7 @@ function confirmClick(formEl: any) {
|
|||||||
rolename: info.value.rolename,
|
rolename: info.value.rolename,
|
||||||
level: info.value.level,
|
level: info.value.level,
|
||||||
description: info.value.description,
|
description: info.value.description,
|
||||||
id: info.value.id,
|
id: info.value.id
|
||||||
};
|
};
|
||||||
renewDept(params).then(() => {
|
renewDept(params).then(() => {
|
||||||
gettableData();
|
gettableData();
|
||||||
@ -150,12 +150,12 @@ function handleClose() {
|
|||||||
}
|
}
|
||||||
//新建角色-rules
|
//新建角色-rules
|
||||||
const rules = ref({
|
const rules = ref({
|
||||||
rolename: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
|
rolename: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
|
||||||
level: [{ required: true, message: "请选择角色级别", trigger: "change" }],
|
level: [{ required: true, message: '请选择角色级别', trigger: 'change' }]
|
||||||
});
|
});
|
||||||
//修改角色
|
//修改角色
|
||||||
function editrole(row: any) {
|
function editrole(row: any) {
|
||||||
title.value = "修改角色";
|
title.value = '修改角色';
|
||||||
info.value = JSON.parse(JSON.stringify(row));
|
info.value = JSON.parse(JSON.stringify(row));
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
}
|
}
|
||||||
@ -163,9 +163,9 @@ function editrole(row: any) {
|
|||||||
const businessVisible = ref(false);
|
const businessVisible = ref(false);
|
||||||
function businessclick() {
|
function businessclick() {
|
||||||
// businessVisible.value = true;
|
// businessVisible.value = true;
|
||||||
ElMessageBox.confirm("此模块允许用户进行定制。", "提示信息", {
|
ElMessageBox.confirm('此模块允许用户进行定制。', '提示信息', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
type: "warning",
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
businessVisible.value = false;
|
businessVisible.value = false;
|
||||||
});
|
});
|
||||||
@ -178,14 +178,14 @@ function businessclick() {
|
|||||||
//组织范围修改
|
//组织范围修改
|
||||||
const organizeVisible = ref(false);
|
const organizeVisible = ref(false);
|
||||||
const deptdata = ref();
|
const deptdata = ref();
|
||||||
const roleIda = ref("");
|
const roleIda = ref('');
|
||||||
function organizeclick(row: any) {
|
function organizeclick(row: any) {
|
||||||
organizeVisible.value = true;
|
organizeVisible.value = true;
|
||||||
roleIda.value = row.id;
|
roleIda.value = row.id;
|
||||||
const params = {
|
const params = {
|
||||||
roleId: row.id,
|
roleId: row.id
|
||||||
};
|
};
|
||||||
setOrgscope(params).then((res) => {
|
setOrgscope(params).then(res => {
|
||||||
deptdata.value = res;
|
deptdata.value = res;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -194,7 +194,9 @@ function accessCheckAllChange(indexone: any) {
|
|||||||
for (var j = 0; j < deptdata.value[indexone].children.length; j++) {
|
for (var j = 0; j < deptdata.value[indexone].children.length; j++) {
|
||||||
Arrayall.value.push(deptdata.value[indexone].children[j].orgname);
|
Arrayall.value.push(deptdata.value[indexone].children[j].orgname);
|
||||||
}
|
}
|
||||||
deptdata.value[indexone].array = deptdata.value[indexone].checkinfo ? Arrayall : [];
|
deptdata.value[indexone].array = deptdata.value[indexone].checkinfo
|
||||||
|
? Arrayall
|
||||||
|
: [];
|
||||||
deptdata.value[indexone].bool = false;
|
deptdata.value[indexone].bool = false;
|
||||||
}
|
}
|
||||||
function accessCheckedCitiesChanges(indexone: any) {
|
function accessCheckedCitiesChanges(indexone: any) {
|
||||||
@ -216,31 +218,31 @@ function organizesubmit() {
|
|||||||
});
|
});
|
||||||
const params = {
|
const params = {
|
||||||
id: roleIda.value,
|
id: roleIda.value,
|
||||||
orgscope: allid.value.toString(),
|
orgscope: allid.value.toString()
|
||||||
};
|
};
|
||||||
postOrgscope(params).then(() => {
|
postOrgscope(params).then(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "组织范围修改成功",
|
message: '组织范围修改成功'
|
||||||
});
|
});
|
||||||
organizeVisible.value = false;
|
organizeVisible.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//删除角色
|
//删除角色
|
||||||
function delrole(row: any) {
|
function delrole(row: any) {
|
||||||
ElMessageBox.confirm("确定删除此角色吗?", "删除提示", {
|
ElMessageBox.confirm('确定删除此角色吗?', '删除提示', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning",
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
let params = {
|
let params = {
|
||||||
id: row.id,
|
id: row.id
|
||||||
};
|
};
|
||||||
deleDept(params).then(() => {
|
deleDept(params).then(() => {
|
||||||
gettableData();
|
gettableData();
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "删除成功",
|
message: '删除成功'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -253,8 +255,8 @@ const DefaultDeployment: any = ref([]);
|
|||||||
//传参id
|
//传参id
|
||||||
const Passparameter: any = ref([]);
|
const Passparameter: any = ref([]);
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: "children",
|
children: 'children',
|
||||||
label: "name",
|
label: 'name'
|
||||||
};
|
};
|
||||||
const rowid = ref();
|
const rowid = ref();
|
||||||
function menuChange(data: any, ids: any) {
|
function menuChange(data: any, ids: any) {
|
||||||
@ -272,7 +274,7 @@ function assignment(row: any) {
|
|||||||
rowid.value = row.id;
|
rowid.value = row.id;
|
||||||
accessVisible.value = true;
|
accessVisible.value = true;
|
||||||
const params = {
|
const params = {
|
||||||
roleId: rowid.value,
|
roleId: rowid.value
|
||||||
};
|
};
|
||||||
assignmentPer(params).then((res: any) => {
|
assignmentPer(params).then((res: any) => {
|
||||||
accessdata.value = res;
|
accessdata.value = res;
|
||||||
@ -286,42 +288,44 @@ function assignment(row: any) {
|
|||||||
|
|
||||||
// 树形选择器
|
// 树形选择器
|
||||||
function currentChecked(_nodeObj: any, SelectedObj: any) {
|
function currentChecked(_nodeObj: any, SelectedObj: any) {
|
||||||
Passparameter.value = SelectedObj.checkedKeys.concat(SelectedObj.halfCheckedKeys);
|
Passparameter.value = SelectedObj.checkedKeys.concat(
|
||||||
|
SelectedObj.halfCheckedKeys
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// 权限范围-权限范围-确定
|
// 权限范围-权限范围-确定
|
||||||
function accesssubmit() {
|
function accesssubmit() {
|
||||||
const parans = {
|
const parans = {
|
||||||
id: rowid.value,
|
id: rowid.value,
|
||||||
menuIds: Passparameter.value.toString(),
|
menuIds: Passparameter.value.toString()
|
||||||
};
|
};
|
||||||
setMenuById(parans).then(() => {
|
setMenuById(parans).then(() => {
|
||||||
accessVisible.value = false;
|
accessVisible.value = false;
|
||||||
gettableData();
|
gettableData();
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "修改成功",
|
message: '修改成功'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 多选删除?
|
// 多选删除?
|
||||||
function delClick() {
|
function delClick() {
|
||||||
ElMessageBox.confirm("确定删除已选择角色吗?", "删除提示", {
|
ElMessageBox.confirm('确定删除已选择角色吗?', '删除提示', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning",
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
let id = [] as any[];
|
let id = [] as any[];
|
||||||
multipleSelection.value.forEach((item: any) => {
|
multipleSelection.value.forEach((item: any) => {
|
||||||
id.push(item.id);
|
id.push(item.id);
|
||||||
});
|
});
|
||||||
let params = {
|
let params = {
|
||||||
id: id.join(","),
|
id: id.join(',')
|
||||||
};
|
};
|
||||||
deleDept(params).then(() => {
|
deleDept(params).then(() => {
|
||||||
gettableData();
|
gettableData();
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: "删除成功",
|
message: '删除成功',
|
||||||
type: "success",
|
type: 'success'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -332,14 +336,32 @@ function dateFormat(row: any) {
|
|||||||
var date = new Date(daterc);
|
var date = new Date(daterc);
|
||||||
var year = date.getFullYear();
|
var year = date.getFullYear();
|
||||||
var month =
|
var month =
|
||||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
date.getMonth() + 1 < 10
|
||||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
? '0' + (date.getMonth() + 1)
|
||||||
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
: date.getMonth() + 1;
|
||||||
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
date.getMonth() + 1 < 10
|
||||||
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
? '0' + (date.getMonth() + 1)
|
||||||
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
: date.getMonth() + 1;
|
||||||
|
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
|
||||||
|
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
||||||
|
var minutes =
|
||||||
|
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
||||||
|
var seconds =
|
||||||
|
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
||||||
// 拼接
|
// 拼接
|
||||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
return (
|
||||||
|
year +
|
||||||
|
'-' +
|
||||||
|
month +
|
||||||
|
'-' +
|
||||||
|
day +
|
||||||
|
' ' +
|
||||||
|
hours +
|
||||||
|
':' +
|
||||||
|
minutes +
|
||||||
|
':' +
|
||||||
|
seconds
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,13 +390,20 @@ onMounted(() => {
|
|||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
<el-button type="primary" style="margin-left: 10px" @click="gettableData"
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
style="margin-left: 10px"
|
||||||
|
@click="gettableData"
|
||||||
>搜索</el-button
|
>搜索</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button v-hasPerm="['add:role']" type="primary" @click="addClick">
|
<el-button v-hasPerm="['add:role']" type="primary" @click="addClick">
|
||||||
<img src="@/assets/MenuIcon/jscz_xz.png" alt="" style="margin-right: 3px" />
|
<img
|
||||||
|
src="@/assets/MenuIcon/jscz_xz.png"
|
||||||
|
alt=""
|
||||||
|
style="margin-right: 3px"
|
||||||
|
/>
|
||||||
新增</el-button
|
新增</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
@ -398,12 +427,24 @@ onMounted(() => {
|
|||||||
:header-cell-style="{
|
:header-cell-style="{
|
||||||
background: 'rgb(250 250 250)',
|
background: 'rgb(250 250 250)',
|
||||||
color: '#383838',
|
color: '#383838',
|
||||||
height: '50px',
|
height: '50px'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="50" align="center"></el-table-column>
|
<el-table-column
|
||||||
<el-table-column prop="rolecode" label="角色编号" width="100"></el-table-column>
|
type="selection"
|
||||||
<el-table-column prop="rolename" label="角色名称" width="180"></el-table-column>
|
width="50"
|
||||||
|
align="center"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="rolecode"
|
||||||
|
label="角色编号"
|
||||||
|
width="100"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="rolename"
|
||||||
|
label="角色名称"
|
||||||
|
width="180"
|
||||||
|
></el-table-column>
|
||||||
<el-table-column prop="level" label="角色级别" width="116">
|
<el-table-column prop="level" label="角色级别" width="116">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-show="scope.row.level == '1'">超级管理员</span>
|
<span v-show="scope.row.level == '1'">超级管理员</span>
|
||||||
@ -416,7 +457,12 @@ onMounted(() => {
|
|||||||
label="角色描述"
|
label="角色描述"
|
||||||
min-width="100"
|
min-width="100"
|
||||||
></el-table-column>
|
></el-table-column>
|
||||||
<el-table-column prop="isvaild" label="是否有效" align="center" width="120">
|
<el-table-column
|
||||||
|
prop="isvaild"
|
||||||
|
label="是否有效"
|
||||||
|
align="center"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="scope.row.isvaild"
|
v-model="scope.row.isvaild"
|
||||||
@ -425,7 +471,9 @@ onMounted(() => {
|
|||||||
active-value="1"
|
active-value="1"
|
||||||
inactive-value="0"
|
inactive-value="0"
|
||||||
></el-switch>
|
></el-switch>
|
||||||
<span v-if="scope.row.isvaild == 1" style="color: #0099ff">有效</span>
|
<span v-if="scope.row.isvaild == 1" style="color: #0099ff"
|
||||||
|
>有效</span
|
||||||
|
>
|
||||||
<span v-else style="color: #d7d7d7">无效</span>
|
<span v-else style="color: #d7d7d7">无效</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -537,7 +585,9 @@ onMounted(() => {
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
<el-button @click="handleClose">取 消</el-button>
|
<el-button @click="handleClose">取 消</el-button>
|
||||||
<el-button type="primary" @click="confirmClick(infoForm)">确 定</el-button>
|
<el-button type="primary" @click="confirmClick(infoForm)"
|
||||||
|
>确 定</el-button
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -585,9 +635,12 @@ onMounted(() => {
|
|||||||
@change="accessCheckedCitiesChanges(indexone)"
|
@change="accessCheckedCitiesChanges(indexone)"
|
||||||
style="margin-left: 20px"
|
style="margin-left: 20px"
|
||||||
>
|
>
|
||||||
<el-checkbox v-for="k in item.children" :key="k.id" :label="k.orgname">{{
|
<el-checkbox
|
||||||
k.orgname
|
v-for="k in item.children"
|
||||||
}}</el-checkbox>
|
:key="k.id"
|
||||||
|
:label="k.orgname"
|
||||||
|
>{{ k.orgname }}</el-checkbox
|
||||||
|
>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -681,7 +734,7 @@ onMounted(() => {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 120px;
|
width: 120px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family: "微软雅黑";
|
font-family: '微软雅黑';
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
color: #787878;
|
color: #787878;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user