修改地图逻辑,沿程配置修改
This commit is contained in:
parent
a83131abb5
commit
18ab994b24
@ -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'
|
||||||
|
|||||||
@ -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: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. 全部图层结束后,再统一:
|
||||||
|
|||||||
@ -46,3 +46,19 @@ export function getKendoList(data: any) {
|
|||||||
data
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@ -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',
|
||||||
|
|||||||
@ -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,6 +168,36 @@ 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,
|
||||||
@ -156,18 +213,310 @@ 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) {
|
console.log('triggerManualValuesChange', val);
|
||||||
await mapOrchestrator.changeTimeRange(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(() => {
|
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 +574,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 +627,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>
|
||||||
|
|
||||||
|
|||||||
@ -115,16 +115,15 @@ export const useMapOrchestrator = () => {
|
|||||||
pageKey,
|
pageKey,
|
||||||
isInitialLoad = false
|
isInitialLoad = false
|
||||||
}: LoadPageOptions) => {
|
}: LoadPageOptions) => {
|
||||||
mapDataStore.setLoading(true);
|
let backgroundLoadStarted = false;
|
||||||
|
|
||||||
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) || '';
|
||||||
@ -184,16 +183,31 @@ 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
|
||||||
|
})
|
||||||
|
: 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) {
|
||||||
|
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;
|
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);
|
||||||
|
console.log('targetPoint', targetPoint);
|
||||||
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);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -17,7 +17,9 @@ import request from '@/utils/request';
|
|||||||
// import { urlList } from '@/utils/GisUrlList';
|
// import { urlList } from '@/utils/GisUrlList';
|
||||||
const mapClass = MapClass.getInstance();
|
const mapClass = MapClass.getInstance();
|
||||||
const DEFAULT_LAYER_REQUEST_CONCURRENCY = 4;
|
const DEFAULT_LAYER_REQUEST_CONCURRENCY = 4;
|
||||||
|
const ACTIVE_PAGE_REQUEST_CONCURRENCY = 2;
|
||||||
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',
|
||||||
@ -176,6 +178,8 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
>();
|
>();
|
||||||
const activeLayerRequestKeyMap = new Map<string, string>();
|
const activeLayerRequestKeyMap = new Map<string, string>();
|
||||||
let loadSessionSeed = 0;
|
let loadSessionSeed = 0;
|
||||||
|
let activePageRenderToken = 0;
|
||||||
|
let activePageLayerKeys = new Set<string>();
|
||||||
|
|
||||||
const normalizeLegendNameEn = mapConfigStore.normalizeLegendNameEn;
|
const normalizeLegendNameEn = mapConfigStore.normalizeLegendNameEn;
|
||||||
|
|
||||||
@ -333,6 +337,31 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
mapDataStore.rebuildPointDataFromCache();
|
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) => {
|
const ensureGISLayerConfig = (layerItem: any) => {
|
||||||
if (!layerItem) return null;
|
if (!layerItem) return null;
|
||||||
|
|
||||||
@ -388,20 +417,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,13 +431,37 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
return loadSessionSeed === sessionId;
|
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 (
|
const runLayerLoadQueue = async (
|
||||||
tasks: Array<() => Promise<any>>,
|
tasks: Array<() => Promise<any>>,
|
||||||
concurrency: number = DEFAULT_LAYER_REQUEST_CONCURRENCY
|
concurrency: number = DEFAULT_LAYER_REQUEST_CONCURRENCY
|
||||||
) => {
|
) => {
|
||||||
|
if (tasks.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const results: PromiseSettledResult<any>[] = [];
|
const results: PromiseSettledResult<any>[] = [];
|
||||||
const safeConcurrency = Math.max(1, concurrency);
|
const safeConcurrency = Math.max(1, concurrency);
|
||||||
|
|
||||||
@ -460,6 +504,43 @@ 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);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图例数据转对象
|
* 图例数据转对象
|
||||||
*/
|
*/
|
||||||
@ -604,9 +685,19 @@ 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 (
|
||||||
|
items: any[],
|
||||||
|
checkedKeys: string[] = [],
|
||||||
|
options: {
|
||||||
|
pageToken?: number;
|
||||||
|
skipSessionCheck?: boolean;
|
||||||
|
concurrency?: number;
|
||||||
|
} = {}
|
||||||
|
) => {
|
||||||
mapDataStore.setLoading(true);
|
mapDataStore.setLoading(true);
|
||||||
const currentSessionId = startLoadSession();
|
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>();
|
||||||
@ -620,7 +711,12 @@ 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
|
||||||
|
});
|
||||||
if (checkedKeys.includes(item.key)) {
|
if (checkedKeys.includes(item.key)) {
|
||||||
checkedTasks.push(task);
|
checkedTasks.push(task);
|
||||||
} else {
|
} else {
|
||||||
@ -637,9 +733,11 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
processItems(items);
|
processItems(items);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const checkedResults = await runLayerLoadQueue(checkedTasks);
|
const loadResults = await runLayerLoadQueue(
|
||||||
const uncheckedResults = await runLayerLoadQueue(uncheckedTasks);
|
[...checkedTasks, ...uncheckedTasks],
|
||||||
const failedResults = [...checkedResults, ...uncheckedResults].filter(
|
options.concurrency ?? DEFAULT_LAYER_REQUEST_CONCURRENCY
|
||||||
|
);
|
||||||
|
const failedResults = loadResults.filter(
|
||||||
result => result.status === 'rejected'
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,7 +803,69 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
// 不能再回放 load 启动瞬间的默认 checked 快照。
|
// 不能再回放 load 启动瞬间的默认 checked 快照。
|
||||||
await updateLayerData(finalCheckedKeys, true);
|
await updateLayerData(finalCheckedKeys, true);
|
||||||
} finally {
|
} 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);
|
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 (
|
const loadLayerData = async (
|
||||||
layer: any,
|
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;
|
const { key, url, params = {}, paramJson, anchorParamJson } = layer;
|
||||||
|
|
||||||
// 没有URL,跳过
|
// 没有URL,跳过
|
||||||
@ -999,7 +1172,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
controller.signal.aborted ||
|
controller.signal.aborted ||
|
||||||
!isCurrentLoadSession(sessionId) ||
|
(!skipSessionCheck && !isCurrentLoadSession(sessionId)) ||
|
||||||
activeLayerRequestKeyMap.get(key) !== requestIdentifier
|
activeLayerRequestKeyMap.get(key) !== requestIdentifier
|
||||||
) {
|
) {
|
||||||
return [];
|
return [];
|
||||||
@ -1022,22 +1195,11 @@ 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'))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const isLayerChecked = layer.checked === 1;
|
const isLayerChecked = layer.checked === 1;
|
||||||
@ -1050,7 +1212,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
|
|
||||||
layer.data = list;
|
layer.data = list;
|
||||||
|
|
||||||
if (list.length > 0) {
|
if (list.length > 0 && shouldApplyToActivePage(key, pageToken)) {
|
||||||
const displayData = filterPointLayerDataForDisplay(key, list);
|
const displayData = filterPointLayerDataForDisplay(key, list);
|
||||||
mapClass.addInitDataLayer(displayData, key);
|
mapClass.addInitDataLayer(displayData, key);
|
||||||
if (isLayerChecked) {
|
if (isLayerChecked) {
|
||||||
@ -1065,7 +1227,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 +1293,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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,6 +1325,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
layerData,
|
layerData,
|
||||||
setLayerData,
|
setLayerData,
|
||||||
loadAllLayerData,
|
loadAllLayerData,
|
||||||
|
loadCurrentPageLayerData,
|
||||||
loadLayerData,
|
loadLayerData,
|
||||||
setSelectedLegendData,
|
setSelectedLegendData,
|
||||||
legendData,
|
legendData,
|
||||||
@ -1174,6 +1337,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
updateLayerData,
|
updateLayerData,
|
||||||
updateLegendChecked,
|
updateLegendChecked,
|
||||||
updateLegendCheckedBatch,
|
updateLegendCheckedBatch,
|
||||||
|
replacePointLayerData,
|
||||||
getCheckedKeys,
|
getCheckedKeys,
|
||||||
legendData2Obj,
|
legendData2Obj,
|
||||||
loading,
|
loading,
|
||||||
@ -1184,6 +1348,7 @@ export const useMapStore = defineStore('map', () => {
|
|||||||
getLayerBranchKeys,
|
getLayerBranchKeys,
|
||||||
normalizeCheckedLayerKeys,
|
normalizeCheckedLayerKeys,
|
||||||
refreshPointLayerDisplayData,
|
refreshPointLayerDisplayData,
|
||||||
|
activatePageContext,
|
||||||
searchTimeRange,
|
searchTimeRange,
|
||||||
reloadBySearchTimeRange,
|
reloadBySearchTimeRange,
|
||||||
updateSearchTimeRange
|
updateSearchTimeRange
|
||||||
|
|||||||
@ -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 863782c5-5e51-49c6-95fd-13e6f25b9bf2';
|
'bearer 223f63a2-0b13-4757-8e15-f342098e63ca';
|
||||||
config.baseURL = '/';
|
config.baseURL = '/';
|
||||||
} else {
|
} else {
|
||||||
const user = useUserStoreHook();
|
const user = useUserStoreHook();
|
||||||
|
|||||||
@ -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
|
||||||
@ -337,7 +337,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 +458,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 +586,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 +737,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