修改地图逻辑,沿程配置修改

This commit is contained in:
扈兆增 2026-07-08 08:33:08 +08:00
parent a83131abb5
commit 18ab994b24
12 changed files with 892 additions and 173 deletions

View File

@ -4,7 +4,7 @@
NODE_ENV='development'
VITE_APP_TITLE = '水电水利建设项目全过程环境管理信息平台'
VITE_APP_PORT = 3000
VITE_APP_PORT = 8000
VITE_APP_BASE_API = '/dev-api'
# 本地环境
VITE_APP_BASE_URL = 'http://10.84.111.235:8093'

View File

@ -12,9 +12,9 @@ VITE_APP_BASE_API = '/dev-api'
# 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://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:
VITE_APP_TEST_ONLINE_URL = 'https://211.99.26.225:12122'

View File

@ -299,7 +299,7 @@
1. 先收集所有带 URL 的图层
2. 把默认勾选图层作为高优先级任务
3. 并发加载,默认并发数为 4
3. 收集完成后全量并发加载,不再按 4 个一组分批发起
4. 每个图层完成后立即写入缓存
5. 每个图层命中缓存或返回成功后,立即增量更新 `pointData`
6. 全部图层结束后,再统一:

View File

@ -46,3 +46,19 @@ export function getKendoList(data: any) {
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',
data
});
}

View File

@ -32,7 +32,16 @@ export function saveBaseWbsbChild(data: any) {
data: data
});
}
// 查询子节点
export function getChildConfigTree(data: any) {
return request({
url: '/base/msalongdetb/GetKendoList',
method: 'post',
data: data
});
}
// 保存子节点
export function saveBaseWbsbChildDetail(data: any) {
return request({
url: '/base/msalongdetb/save',

View File

@ -35,7 +35,7 @@
/>
</a-form-item>
</a-col>
<a-col v-if="isMenu('fish-survey/fishSurveyZhuanZhi')">
<a-col v-if="isMenu('shengTaiDiaoCha/shuiShengShengTaiDiaoCha')">
<a-form-item label="" name="">
<a-checkbox v-model:checked="formModel.fishSurveyZhuanZhi">
鱼类分布
@ -60,21 +60,35 @@
<a-form-item label="" name="">
<a-select
v-model:value="fishSurveyZhuanZhiParams.value"
placeholder="请输入"
style="width: 140px"
placeholder="请选择"
style="width: 200px"
mode="multiple"
show-search
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-col>
<a-col>
<a-form-item label="" name="anchorPointSelect">
<a-select
v-model:value="formModel.anchorPointSelect"
v-model:value="anchorPointSelectValue"
placeholder="请输入关键字检索"
style="width: 200px"
show-search
allow-clear
:loading="anchorPointLoading"
:filter-option="filterAnchorPoint"
@change="handleAnchorPointChange"
>
@ -99,16 +113,24 @@
import { ref, computed, watch } from 'vue';
import dayjs from 'dayjs';
import { useRoute } from 'vue-router';
import { MapClass } from '@/components/gis/map.class';
import { useMapOrchestrator } from '@/modules/map/application/map-orchestrator';
import { useMapDataStore } from '@/modules/map/stores/map-data.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 { getFishList, getFishPointList } from '@/api/map';
const route = useRoute();
const mapOrchestrator = useMapOrchestrator();
const mapDataStore = useMapDataStore();
const mapViewStore = useMapViewStore();
const jidiSelectEventStore = useJidiSelectEventStore();
const mapStore = useMapStore();
const mapClass = MapClass.getInstance();
const ENG_POINT_LAYER_KEY = 'eng_point';
const YLFB_POINT_LAYER_KEY = 'ylfb_point';
const siteRangePicker = [
{ label: '全部', value: 'all' },
{ label: '大型电站', value: 'large_eng_built' },
@ -127,8 +149,13 @@ const defaultYear =
const fishSurveyZhuanZhiParams = ref({
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([
dayjs(mapViewStore.searchTimeRange[0]).format('YYYY-MM-DD HH:mm:ss'),
@ -141,6 +168,36 @@ const isMenu = (menuPath: string) => {
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
watch(
() => route.path,
@ -156,18 +213,310 @@ watch(
anchorPointSelect: null,
fishSurveyZhuanZhi: false
};
resetFishSurveyState();
}
);
//
const triggerManualValuesChange = async (val: any) => {
if (val && val.length === 2) {
await mapOrchestrator.changeTimeRange(val);
console.log('triggerManualValuesChange', val);
const [startTime, endTime] = getTimeRangeByValue(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(() => {
if (isFishSurveyMode.value) {
return filteredFishPointOptions.value;
}
const pointData = mapDataStore.pointData || [];
const checkedLayerKeys = new Set<string>(
mapViewStore.getCheckedLayerKeys() || []
@ -225,13 +574,52 @@ const filterAnchorPoint = (input: string, option: any) => {
//
watch(
() => mapViewStore.selectedBaseId,
() => currentFishBaseId.value,
() => {
if (isFishSurveyMode.value) {
syncFishAnchorPointSelection();
return;
}
formModel.value.anchorPointSelect = null;
},
{ 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) => {
formModel.value.anchorPointSelect = null;
mapOrchestrator.changeEngPointCapacity(value);
@ -239,7 +627,12 @@ const handleCapacityChange = (value: string) => {
//
const handleAnchorPointChange = (value: string) => {
mapOrchestrator.focusPoint(value, 14);
if (!value) return;
mapOrchestrator.focusPoint(
value,
14,
isFishSurveyMode.value ? anchorPointOptions.value : undefined
);
};
</script>

View File

@ -115,16 +115,15 @@ export const useMapOrchestrator = () => {
pageKey,
isInitialLoad = false
}: LoadPageOptions) => {
mapDataStore.setLoading(true);
let backgroundLoadStarted = false;
try {
mapDataStore.setLoading(true);
const hasGlobalLegendConfig =
Array.isArray(mapConfigStore.legendConfigOriginal) &&
mapConfigStore.legendConfigOriginal.length > 0;
const hasPointLayerCache =
Object.keys(mapDataStore.pointDataCache || {}).length > 0;
const shouldLoadGlobalLegend = isInitialLoad && !hasGlobalLegendConfig;
const shouldPreloadLayerData = isInitialLoad && !hasPointLayerCache;
const previousPageKey = mapConfigStore.lastLoadOptions?.pageKey || '';
const previousCheckedKeys = mapViewStore.getCheckedLayerKeys();
const moduleId = (route.meta?.moduleId as string) || '';
@ -184,16 +183,31 @@ export const useMapOrchestrator = () => {
mapStore.setLegendData(legendOriginal, pageLegend);
}
if (shouldPreloadLayerData) {
mapStore.setSelectedLegendData();
await mapStore.loadAllLayerData(layerConfig, checkedKeys);
} else {
const activePageToken = mapStore.activatePageContext(
pageKey,
layerConfig
);
await mapStore.updateLayerData(checkedKeys, true);
mapStore.setSelectedLegendData();
}
const backgroundLoadPromise = isInitialLoad
? mapStore.loadAllLayerData(layerConfig, checkedKeys, {
pageToken: activePageToken,
skipSessionCheck: true
})
: mapStore.loadCurrentPageLayerData(layerConfig, checkedKeys, {
pageToken: activePageToken,
skipSessionCheck: true
});
void backgroundLoadPromise.catch(error => {
console.error(`页面锚点后台加载失败 [${pageKey}]`, error);
});
backgroundLoadStarted = true;
}
} finally {
// mapDataStore.setLoading(false);
if (!backgroundLoadStarted) {
mapDataStore.setLoading(false);
}
}
};
@ -531,11 +545,19 @@ export const useMapOrchestrator = () => {
};
// 备注:统一处理搜索定位,按点位编码从缓存数据中查找并飞行到目标位置。
const focusPoint = (pointId: string, zoom = 15) => {
const focusPoint = (
pointId: string,
zoom = 15,
fallbackPoints: any[] = []
) => {
if (!pointId) return;
const targetPoint = mapDataStore.pointData.find((item: any) => {
const pointMatcher = (item: any) => {
return item.stcd === pointId || item._id === pointId;
});
};
const targetPoint =
mapDataStore.pointData.find(pointMatcher) ||
fallbackPoints.find(pointMatcher);
console.log('targetPoint', targetPoint);
if (!targetPoint?.lgtd || !targetPoint?.lttd) return;
mapClass.flyTopanto([targetPoint.lgtd, targetPoint.lttd], zoom);
};

View File

@ -17,7 +17,9 @@ import request from '@/utils/request';
// import { urlList } from '@/utils/GisUrlList';
const mapClass = MapClass.getInstance();
const DEFAULT_LAYER_REQUEST_CONCURRENCY = 4;
const ACTIVE_PAGE_REQUEST_CONCURRENCY = 2;
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_LARGE_STATES = [
'large_eng_built',
@ -176,6 +178,8 @@ export const useMapStore = defineStore('map', () => {
>();
const activeLayerRequestKeyMap = new Map<string, string>();
let loadSessionSeed = 0;
let activePageRenderToken = 0;
let activePageLayerKeys = new Set<string>();
const normalizeLegendNameEn = mapConfigStore.normalizeLegendNameEn;
@ -333,6 +337,31 @@ export const useMapStore = defineStore('map', () => {
mapDataStore.rebuildPointDataFromCache();
};
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) => {
if (!layerItem) return null;
@ -388,20 +417,11 @@ export const useMapStore = defineStore('map', () => {
};
/**
*
*
*/
const startLoadSession = () => {
loadSessionSeed += 1;
const currentSessionId = loadSessionSeed;
inFlightRequestMap.forEach(entry => {
if (entry.sessionId !== currentSessionId) {
entry.controller.abort();
mapDataStore.clearLayerLoadState(entry.layerKey);
}
});
return currentSessionId;
return loadSessionSeed;
};
/**
@ -411,13 +431,37 @@ export const useMapStore = defineStore('map', () => {
return loadSessionSeed === sessionId;
};
const activatePageContext = (pageKey: string, items: any[] = []) => {
void pageKey;
activePageRenderToken += 1;
activePageLayerKeys = new Set(getAllLayerKeys(items));
return activePageRenderToken;
};
const shouldApplyToActivePage = (layerKey: string, pageToken?: number) => {
if (!layerKey) 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 runLayerLoadQueue = async (
tasks: Array<() => Promise<any>>,
concurrency: number = DEFAULT_LAYER_REQUEST_CONCURRENCY
) => {
if (tasks.length === 0) {
return [];
}
const results: PromiseSettledResult<any>[] = [];
const safeConcurrency = Math.max(1, concurrency);
@ -460,6 +504,43 @@ export const useMapStore = defineStore('map', () => {
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);
};
/**
*
*/
@ -604,9 +685,19 @@ export const useMapStore = defineStore('map', () => {
* @param items
* @param checkedKeys keys
*/
const loadAllLayerData = async (items: any[], checkedKeys: string[] = []) => {
const loadAllLayerData = async (
items: any[],
checkedKeys: string[] = [],
options: {
pageToken?: number;
skipSessionCheck?: boolean;
concurrency?: number;
} = {}
) => {
mapDataStore.setLoading(true);
const currentSessionId = startLoadSession();
const currentSessionId = options.skipSessionCheck
? undefined
: startLoadSession();
const checkedTasks: Array<() => Promise<any>> = [];
const uncheckedTasks: Array<() => Promise<any>> = [];
const processedKeys = new Set<string>();
@ -620,7 +711,12 @@ export const useMapStore = defineStore('map', () => {
!processedKeys.has(item.key)
) {
processedKeys.add(item.key);
const task = () => loadLayerData(item, currentSessionId);
const task = () =>
loadLayerData(item, {
sessionId: currentSessionId,
pageToken: options.pageToken,
skipSessionCheck: options.skipSessionCheck
});
if (checkedKeys.includes(item.key)) {
checkedTasks.push(task);
} else {
@ -637,9 +733,11 @@ export const useMapStore = defineStore('map', () => {
processItems(items);
try {
const checkedResults = await runLayerLoadQueue(checkedTasks);
const uncheckedResults = await runLayerLoadQueue(uncheckedTasks);
const failedResults = [...checkedResults, ...uncheckedResults].filter(
const loadResults = await runLayerLoadQueue(
[...checkedTasks, ...uncheckedTasks],
options.concurrency ?? DEFAULT_LAYER_REQUEST_CONCURRENCY
);
const failedResults = loadResults.filter(
result => result.status === 'rejected'
);
@ -650,7 +748,11 @@ export const useMapStore = defineStore('map', () => {
);
}
if (!isCurrentLoadSession(currentSessionId)) {
if (
(typeof currentSessionId === 'number' &&
!isCurrentLoadSession(currentSessionId)) ||
!isActivePageToken(options.pageToken)
) {
return;
}
@ -701,8 +803,70 @@ export const useMapStore = defineStore('map', () => {
// 不能再回放 load 启动瞬间的默认 checked 快照。
await updateLayerData(finalCheckedKeys, true);
} finally {
const shouldFinishLoading =
(typeof currentSessionId !== 'number' ||
isCurrentLoadSession(currentSessionId)) &&
(options.pageToken === undefined ||
activePageRenderToken === options.pageToken);
if (shouldFinishLoading) {
mapDataStore.setLoading(false);
}
}
};
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) {
mapDataStore.setLoading(false);
return;
}
mapDataStore.setLoading(true);
try {
await runLayerLoadQueue(tasks, ACTIVE_PAGE_REQUEST_CONCURRENCY);
} finally {
if (isActivePageToken(options.pageToken)) {
mapDataStore.setLoading(false);
}
}
};
/**
@ -852,8 +1016,17 @@ export const useMapStore = defineStore('map', () => {
*/
const loadLayerData = async (
layer: any,
sessionId: number = loadSessionSeed
options: {
sessionId?: number;
pageToken?: number;
skipSessionCheck?: boolean;
} = {}
) => {
const {
sessionId = loadSessionSeed,
pageToken,
skipSessionCheck = false
} = options;
const { key, url, params = {}, paramJson, anchorParamJson } = layer;
// 没有URL跳过
@ -999,7 +1172,7 @@ export const useMapStore = defineStore('map', () => {
if (
controller.signal.aborted ||
!isCurrentLoadSession(sessionId) ||
(!skipSessionCheck && !isCurrentLoadSession(sessionId)) ||
activeLayerRequestKeyMap.get(key) !== requestIdentifier
) {
return [];
@ -1022,22 +1195,11 @@ export const useMapStore = defineStore('map', () => {
}
}
list.forEach((item: any) => {
const iconType = item.anchoPointState;
const legendConfig = getLegendConfigByNameEn(iconType);
item.iconCode = legendConfig?.icon || '';
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'))
list = normalizePointLayerItems(
list.map((item: any) => ({
...item,
layerKey: item.layerKey || key
}))
);
const isLayerChecked = layer.checked === 1;
@ -1050,7 +1212,7 @@ export const useMapStore = defineStore('map', () => {
layer.data = list;
if (list.length > 0) {
if (list.length > 0 && shouldApplyToActivePage(key, pageToken)) {
const displayData = filterPointLayerDataForDisplay(key, list);
mapClass.addInitDataLayer(displayData, key);
if (isLayerChecked) {
@ -1065,7 +1227,7 @@ export const useMapStore = defineStore('map', () => {
if (
controller.signal.aborted ||
isCanceledRequestError(error) ||
!isCurrentLoadSession(sessionId) ||
(!skipSessionCheck && !isCurrentLoadSession(sessionId)) ||
activeLayerRequestKeyMap.get(key) !== requestIdentifier
) {
return [];
@ -1131,7 +1293,7 @@ export const useMapStore = defineStore('map', () => {
for (const key of timeRangeLayerKeys) {
const layerItem = findLayerByKey(layerData.value, key);
if (layerItem && currentCheckedKeys.includes(key)) {
await loadLayerData(layerItem, currentSessionId);
await loadLayerData(layerItem, { sessionId: currentSessionId });
}
}
@ -1163,6 +1325,7 @@ export const useMapStore = defineStore('map', () => {
layerData,
setLayerData,
loadAllLayerData,
loadCurrentPageLayerData,
loadLayerData,
setSelectedLegendData,
legendData,
@ -1174,6 +1337,7 @@ export const useMapStore = defineStore('map', () => {
updateLayerData,
updateLegendChecked,
updateLegendCheckedBatch,
replacePointLayerData,
getCheckedKeys,
legendData2Obj,
loading,
@ -1184,6 +1348,7 @@ export const useMapStore = defineStore('map', () => {
getLayerBranchKeys,
normalizeCheckedLayerKeys,
refreshPointLayerDisplayData,
activatePageContext,
searchTimeRange,
reloadBySearchTimeRange,
updateSearchTimeRange

View File

@ -34,7 +34,7 @@ service.interceptors.request.use(
config.headers._sysid = '10EC2E0B-AEA9-4757-83A2-201BA1BC54E9';
config.headers.authorization =
'bearer 863782c5-5e51-49c6-95fd-13e6f25b9bf2';
'bearer 223f63a2-0b13-4757-8e15-f342098e63ca';
config.baseURL = '/';
} else {
const user = useUserStoreHook();

View File

@ -78,7 +78,7 @@
:key="item.stcd"
:value="item.stcd"
>
{{ item.ennm }}
{{ item.stnm }}
</a-select-option>
</a-select>
<a-button
@ -337,7 +337,10 @@ const rules: Record<string, Rule[]> = {
const handleRiverSelect = async (value: string) => {
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);
@ -455,7 +458,7 @@ const handleAdd = () => {
const handleNodeSelect = (value: string) => {
const station = stationList.value.find(item => item.stcd === value);
if (station) {
newNodeData.value.ennm = station.ennm;
newNodeData.value.ennm = station.stnm;
newNodeData.value.sttpName = station.sttpName;
}
};
@ -583,7 +586,7 @@ const handleEditNodeSelect = (dataRef: any) => {
const list = dataRef.parentId ? childStationList.value : stationList.value;
const station = list.find(item => item.stcd === value);
if (station) {
editNodeData.value.ennm = dataRef.parentId ? station.stnm : station.ennm;
editNodeData.value.ennm = station.stnm;
editNodeData.value.sttpName = station.sttpName;
editNodeData.value.stcd = station.stcd;
}
@ -734,7 +737,10 @@ const initForm = async () => {
//
if (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 {
resetForm();

View File

@ -15,7 +15,7 @@
:list-url="getAllConfigTree"
:search-params="searchParams"
>
<template #action="{ column, record }">
<template #action="{ record }">
<div class="flex gap-[6px]">
<a-button
class="!p-0"
@ -57,9 +57,11 @@ import {
getAllConfigTree,
deleteBaseWbsb,
saveBaseWbsbChild,
saveBaseWbsbChildDetail
saveBaseWbsbChildDetail,
getChildConfigTree
} from '@/api/system/map/ConfigManagement';
import { getRvcdDropdown } from '@/api/select';
import dayjs from 'dayjs';
//
const basicTable = ref<any>(null);
@ -71,7 +73,7 @@ const columns = [
key: 'index',
width: 60,
align: 'center',
customRender: ({ text, record, index }) => index + 1
customRender: ({ index }) => index + 1
},
{
title: '沿程配置名称',
@ -89,11 +91,13 @@ const columns = [
title: '所在河段',
dataIndex: 'rvnm',
key: 'rvnm',
width: 300,
ellipsis: true
},
{
title: '创建人',
key: 'recordUser',
width: 120,
dataIndex: 'recordUser'
},
{
@ -147,8 +151,56 @@ const filterRecord = (record: any) => {
};
//
const handleEdit = (record: any) => {
const handleEdit = async (record: any) => {
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;
};
@ -220,7 +272,8 @@ const handleEditSubmit = async (values: any) => {
try {
const formData = {
...currentRecord.value,
...values
...values,
modifyTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
};
delete formData.configNodes;
@ -238,17 +291,19 @@ const handleEditSubmit = async (values: any) => {
if (treeData.length > 0) {
const formatTreeData = (
nodes: any[],
parentId: string | null = null
parentId: string | null = null,
parentStcd: string | null = null
) => {
return nodes.map(node => ({
alongId,
stcd: node.stcd,
stnm: node.ennm,
stnm: node.ennm || node.stnm,
sttpName: node.sttpName,
parentId: parentId ? parentId : null,
rstcd: parentStcd || null,
children:
node.children && node.children.length > 0
? formatTreeData(node.children, node.key)
? formatTreeData(node.children, node.key, node.stcd)
: []
}));
};

View File

@ -1,12 +1,12 @@
<script lang="ts">
export default {
name: "role",
name: 'role'
};
</script>
<script setup lang="ts">
import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { onMounted, ref, nextTick } from 'vue';
import { ElForm, ElMessage, ElMessageBox } from 'element-plus';
import {
listRolePages,
isvaildTo,
@ -16,8 +16,8 @@ import {
assignmentPer,
setMenuById,
setOrgscope,
postOrgscope,
} from "@/api/role";
postOrgscope
} from '@/api/role';
//
const tableData: any = ref([]);
const multipleSelection = ref([]);
@ -28,11 +28,11 @@ const tree = ref();
const loading = ref(false);
function gettableData() {
let params = {
rolename: input.value,
rolename: input.value
};
loading.value = true;
listRolePages(params)
.then((result) => {
.then(result => {
tableData.value = result;
loading.value = false;
})
@ -46,26 +46,26 @@ function handleSelectionChange(val: any) {
}
function switchChange(row: any) {
const elMessage = ref();
if (row.isvaild == "0") {
elMessage.value = "确定设置该角色为无效吗?";
} else if (row.isvaild == "1") {
elMessage.value = "确定设置该角色为有效吗?";
if (row.isvaild == '0') {
elMessage.value = '确定设置该角色为无效吗?';
} else if (row.isvaild == '1') {
elMessage.value = '确定设置该角色为有效吗?';
}
ElMessageBox.confirm(elMessage.value, "提示信息", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
ElMessageBox.confirm(elMessage.value, '提示信息', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
let params = {
isvaild: row.isvaild,
id: row.id,
id: row.id
};
isvaildTo(params).then(() => {
gettableData();
ElMessage({
type: "success",
message: "改变成功",
type: 'success',
message: '改变成功'
});
});
})
@ -75,35 +75,35 @@ function switchChange(row: any) {
}
const infoForm = ref();
//
const input = ref("");
const input = ref('');
//
const title = ref("");
const title = ref('');
const info: any = ref({
rolename: "",
level: "2",
description: "",
rolename: '',
level: '2',
description: ''
});
const faultList: any = [
{
value: "1",
label: "超级管理员",
value: '1',
label: '超级管理员'
},
{
value: "2",
label: "系统管理员",
value: '2',
label: '系统管理员'
},
{
value: "3",
label: "一般用户",
},
value: '3',
label: '一般用户'
}
];
const dialogVisible = ref(false);
function addClick() {
title.value = "新增角色";
title.value = '新增角色';
info.value = {
rolename: "",
level: "2",
description: "",
rolename: '',
level: '2',
description: ''
};
dialogVisible.value = true;
}
@ -115,7 +115,7 @@ function confirmClick(formEl: any) {
const params = {
rolename: info.value.rolename,
level: info.value.level,
description: info.value.description,
description: info.value.description
};
addDept(params).then(() => {
gettableData();
@ -126,7 +126,7 @@ function confirmClick(formEl: any) {
rolename: info.value.rolename,
level: info.value.level,
description: info.value.description,
id: info.value.id,
id: info.value.id
};
renewDept(params).then(() => {
gettableData();
@ -150,12 +150,12 @@ function handleClose() {
}
//-rules
const rules = ref({
rolename: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
level: [{ required: true, message: "请选择角色级别", trigger: "change" }],
rolename: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
level: [{ required: true, message: '请选择角色级别', trigger: 'change' }]
});
//
function editrole(row: any) {
title.value = "修改角色";
title.value = '修改角色';
info.value = JSON.parse(JSON.stringify(row));
dialogVisible.value = true;
}
@ -163,9 +163,9 @@ function editrole(row: any) {
const businessVisible = ref(false);
function businessclick() {
// businessVisible.value = true;
ElMessageBox.confirm("此模块允许用户进行定制。", "提示信息", {
confirmButtonText: "确定",
type: "warning",
ElMessageBox.confirm('此模块允许用户进行定制。', '提示信息', {
confirmButtonText: '确定',
type: 'warning'
}).then(() => {
businessVisible.value = false;
});
@ -178,14 +178,14 @@ function businessclick() {
//
const organizeVisible = ref(false);
const deptdata = ref();
const roleIda = ref("");
const roleIda = ref('');
function organizeclick(row: any) {
organizeVisible.value = true;
roleIda.value = row.id;
const params = {
roleId: row.id,
roleId: row.id
};
setOrgscope(params).then((res) => {
setOrgscope(params).then(res => {
deptdata.value = res;
});
}
@ -194,7 +194,9 @@ function accessCheckAllChange(indexone: any) {
for (var j = 0; j < deptdata.value[indexone].children.length; j++) {
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;
}
function accessCheckedCitiesChanges(indexone: any) {
@ -216,31 +218,31 @@ function organizesubmit() {
});
const params = {
id: roleIda.value,
orgscope: allid.value.toString(),
orgscope: allid.value.toString()
};
postOrgscope(params).then(() => {
ElMessage({
type: "success",
message: "组织范围修改成功",
type: 'success',
message: '组织范围修改成功'
});
organizeVisible.value = false;
});
}
//
function delrole(row: any) {
ElMessageBox.confirm("确定删除此角色吗?", "删除提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
ElMessageBox.confirm('确定删除此角色吗?', '删除提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = {
id: row.id,
id: row.id
};
deleDept(params).then(() => {
gettableData();
ElMessage({
type: "success",
message: "删除成功",
type: 'success',
message: '删除成功'
});
});
});
@ -253,8 +255,8 @@ const DefaultDeployment: any = ref([]);
//id
const Passparameter: any = ref([]);
const defaultProps = {
children: "children",
label: "name",
children: 'children',
label: 'name'
};
const rowid = ref();
function menuChange(data: any, ids: any) {
@ -272,7 +274,7 @@ function assignment(row: any) {
rowid.value = row.id;
accessVisible.value = true;
const params = {
roleId: rowid.value,
roleId: rowid.value
};
assignmentPer(params).then((res: any) => {
accessdata.value = res;
@ -286,42 +288,44 @@ function assignment(row: any) {
//
function currentChecked(_nodeObj: any, SelectedObj: any) {
Passparameter.value = SelectedObj.checkedKeys.concat(SelectedObj.halfCheckedKeys);
Passparameter.value = SelectedObj.checkedKeys.concat(
SelectedObj.halfCheckedKeys
);
}
// --
function accesssubmit() {
const parans = {
id: rowid.value,
menuIds: Passparameter.value.toString(),
menuIds: Passparameter.value.toString()
};
setMenuById(parans).then(() => {
accessVisible.value = false;
gettableData();
ElMessage({
type: "success",
message: "修改成功",
type: 'success',
message: '修改成功'
});
});
}
//
function delClick() {
ElMessageBox.confirm("确定删除已选择角色吗?", "删除提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
ElMessageBox.confirm('确定删除已选择角色吗?', '删除提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let id = [] as any[];
multipleSelection.value.forEach((item: any) => {
id.push(item.id);
});
let params = {
id: id.join(","),
id: id.join(',')
};
deleDept(params).then(() => {
gettableData();
ElMessage({
message: "删除成功",
type: "success",
message: '删除成功',
type: 'success'
});
});
});
@ -332,14 +336,32 @@ function dateFormat(row: any) {
var date = new Date(daterc);
var year = date.getFullYear();
var month =
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : 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();
date.getMonth() + 1 < 10
? '0' + (date.getMonth() + 1)
: date.getMonth() + 1;
date.getMonth() + 1 < 10
? '0' + (date.getMonth() + 1)
: 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"
clearable
/>
<el-button type="primary" style="margin-left: 10px" @click="gettableData"
<el-button
type="primary"
style="margin-left: 10px"
@click="gettableData"
>搜索</el-button
>
</div>
<div>
<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
@ -398,12 +427,24 @@ onMounted(() => {
:header-cell-style="{
background: 'rgb(250 250 250)',
color: '#383838',
height: '50px',
height: '50px'
}"
>
<el-table-column type="selection" 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
type="selection"
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">
<template #default="scope">
<span v-show="scope.row.level == '1'">超级管理员</span>
@ -416,7 +457,12 @@ onMounted(() => {
label="角色描述"
min-width="100"
></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">
<el-switch
v-model="scope.row.isvaild"
@ -425,7 +471,9 @@ onMounted(() => {
active-value="1"
inactive-value="0"
></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>
</template>
</el-table-column>
@ -537,7 +585,9 @@ onMounted(() => {
"
>
<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>
</el-form>
</el-dialog>
@ -585,9 +635,12 @@ onMounted(() => {
@change="accessCheckedCitiesChanges(indexone)"
style="margin-left: 20px"
>
<el-checkbox v-for="k in item.children" :key="k.id" :label="k.orgname">{{
k.orgname
}}</el-checkbox>
<el-checkbox
v-for="k in item.children"
:key="k.id"
:label="k.orgname"
>{{ k.orgname }}</el-checkbox
>
</el-checkbox-group>
</div>
</div>
@ -681,7 +734,7 @@ onMounted(() => {
display: inline-block;
width: 120px;
font-size: 14px;
font-family: "微软雅黑";
font-family: '微软雅黑';
font-weight: 400;
font-style: normal;
color: #787878;