修改页面参数细节

This commit is contained in:
fanjia 2026-04-16 14:03:39 +08:00
parent 09693b4a80
commit d458969592
5 changed files with 169 additions and 102 deletions

View File

@ -22,7 +22,7 @@
<div
v-for="(item, index) in impactData"
:key="index"
@click="handleClick(index)"
@click="handleClick(index, item)"
class="stat-card"
:style="{
backgroundImage: `url(${cardType == index ? selectedIcon : unselectedIcon})`,
@ -350,11 +350,11 @@ const tableColumns = ref(bridgeColumns);
const tableData = ref([]);
//
const impactData = ref([
{ name: "影响桥梁", count: 0, icon: Icon0 },
{ name: "影响边坡", count: 0, icon: Icon1 },
{ name: "影响隧道", count: 0, icon: Icon2 },
{ name: "影响项目", count: 0, icon: Icon3 },
{ name: "影响路段", count: 0, icon: Icon4 },
{ name: "影响路段", count: 0, icon: Icon4, type: "路段" },
{ name: "影响桥梁", count: 0, icon: Icon0, type: "桥梁" },
{ name: "影响隧道", count: 0, icon: Icon2, type: "隧道" },
{ name: "影响边坡", count: 0, icon: Icon1, type: "边坡" },
{ name: "影响项目", count: 0, icon: Icon3, type: "项目" },
]);
//
const loadBarChartData = async () => {
@ -401,6 +401,7 @@ const loadBarChartData = async () => {
};
const cardType = ref("0");
const cardTypeVal = ref("路段");
// cardType
const getColumnsByType = (type) => {
@ -417,11 +418,11 @@ const getColumnsByType = (type) => {
// cardType API
const getApiUrlByType = (type) => {
const urlMap = {
0: "/snow-ops-platform/weather-warning/affected-object/bridge",
1: "/snow-ops-platform/weather-warning/affected-object/slope",
2: "/snow-ops-platform/weather-warning/affected-object/tunnel",
3: "/snow-ops-platform/weather-warning/affected-object/project",
4: "/snow-ops-platform/weather-warning/affected-object/road-section",
桥梁: "/snow-ops-platform/weather-warning/affected-object/bridge",
边坡: "/snow-ops-platform/weather-warning/affected-object/slope",
隧道: "/snow-ops-platform/weather-warning/affected-object/tunnel",
项目: "/snow-ops-platform/weather-warning/affected-object/project",
路段: "/snow-ops-platform/weather-warning/affected-object/road-section",
};
return (
urlMap[type] || "/snow-ops-platform/weather-warning/affected-object/bridge"
@ -429,9 +430,10 @@ const getApiUrlByType = (type) => {
};
//
const handleClick = (type) => {
const handleClick = (index, item) => {
tableData.value = [];
cardType.value = type + "";
cardType.value = index + "";
cardTypeVal.value = item.type;
//
tableColumns.value = getColumnsByType(cardType.value);
//
@ -507,15 +509,6 @@ const getTimeParams = () => {
};
//
const processUnifiedData = (item, type) => {
//
const typeMap = {
0: "桥梁",
1: "边坡",
2: "隧道",
3: "项目",
4: "路段",
};
//
const getLevelClass = (level) => {
const levelMap = {
@ -551,7 +544,7 @@ const processUnifiedData = (item, type) => {
item.ADMINISTRATIVE_REGION ||
"-",
//
pointType: typeMap[type] || "-",
pointType: impactData.value[type].type || "-",
//
pointLocation:
item.GL1_QLMC ||
@ -604,7 +597,7 @@ const processUnifiedData = (item, type) => {
};
// BASE_GLQL
if (type === "0") {
if (cardTypeVal.value === "桥梁") {
return {
...baseData,
// - 使
@ -645,7 +638,7 @@ const processUnifiedData = (item, type) => {
}
// BASE_GLSD
if (type === "2") {
if (cardTypeVal.value === "隧道") {
return {
...baseData,
// - 使
@ -686,7 +679,7 @@ const processUnifiedData = (item, type) => {
}
// BASE_XJLD线
if (type === "4") {
if (cardTypeVal.value === "路段") {
return {
...baseData,
// - 使
@ -725,7 +718,7 @@ const processUnifiedData = (item, type) => {
}
// SQL
if (type === "3") {
if (cardTypeVal.value === "项目") {
return {
...baseData,
// - 使COUNTY
@ -801,14 +794,23 @@ const fetchData = async () => {
const timeParams = getTimeParams();
// cardType API URL
const apiUrl = getApiUrlByType(cardType.value);
const apiUrl = getApiUrlByType(cardTypeVal.value);
const res = await request({
url: apiUrl,
method: "GET",
params: timeParams,
});
//
if (cardTypeVal.value == "路段") {
if (res.data) {
tableData.value = res.data.map((item, index) => ({
...processDataByType(item, cardType.value),
id: index + 1,
}));
total.value = res.total || 0;
}
} else {
if (res.code === "00000" && res.data) {
//
const allData = res.data;
@ -827,6 +829,7 @@ const fetchData = async () => {
tableData.value = [];
total.value = 0;
}
}
} catch (error) {
console.error("获取影响点数据失败:", error);
tableData.value = [];

View File

@ -123,31 +123,36 @@ const props = defineProps({
type: Boolean,
default: false,
},
warningitem: {
type: Object,
default: () => ({}),
},
});
const emit = defineEmits(["update:visible", "close", "impactClick"]);
//
const getDefaultDateRange = () => {
const now = new Date();
const start = new Date(now.getFullYear(), now.getMonth(), 1);
const end = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59);
return [start, end];
};
//
const dateRange = ref(getDefaultDateRange());
const dateRange = ref([]);
onMounted(() => {
filterForm.value = {
riskLeve: "",
countyName: "",
isEnded: "",
dateRange: dateRange.value,
};
fetchWarningData();
//
if (props.visible) {
initDialogData();
}
});
// warningitem
watch(
() => props.warningitem,
(newVal) => {
console.log("warningitem 变化:", newVal);
if (newVal && Object.keys(newVal).length > 0) {
filterForm.value.riskLeve = newVal.label || "";
currentPage.value = 1;
}
},
{ deep: true },
);
//
watch(
() => getdateRange.value,
@ -156,11 +161,9 @@ watch(
if (newVal && newVal.length === 2) {
dateRange.value = newVal;
filterForm.value.dateRange = newVal;
//
fetchWarningData();
}
},
{ deep: true, immediate: true },
{ deep: true },
);
//
@ -230,7 +233,7 @@ const fetchWarningData = async () => {
loading.value = true;
try {
const params = {
offset: currentPage.value,
offset: (currentPage.value - 1) * pageSize.value,
limit: pageSize.value,
start: "",
end: "",
@ -335,31 +338,88 @@ const handleImpactClick = (item) => {
//
const handleSizeChange = (val) => {
pageSize.value = val;
console.log("分页大小变化:", val);
currentPage.value = 1;
fetchWarningData();
};
const handleCurrentChange = (val) => {
console.log("当前页码变化:", val);
currentPage.value = val;
fetchWarningData();
};
//
const initDialogData = () => {
//
if (getdateRange.value && getdateRange.value.length === 2) {
dateRange.value = getdateRange.value;
}
// warningitem
if (props.warningitem && Object.keys(props.warningitem).length > 0) {
filterForm.value = {
riskLeve: props.warningitem.label || "",
countyName: props.warningitem.countyName || "",
isEnded: "",
dateRange: dateRange.value,
};
} else {
filterForm.value = {
riskLeve: "",
countyName: "",
isEnded: "",
dateRange: dateRange.value,
};
}
//
currentPage.value = 1;
console.log("初始化筛选条件:", filterForm.value);
fetchWarningData();
};
//
const resetData = () => {
//
tableData.value = [];
total.value = 0;
currentPage.value = 1;
//
filterForm.value = {
riskLeve: "",
countyName: "",
isEnded: "",
dateRange: [],
};
//
dateRange.value = [];
};
// visible
watch(
() => props.visible,
(newVal) => {
if (newVal) {
currentPage.value = 1;
fetchWarningData();
//
initDialogData();
} else {
//
resetData();
}
},
);
//
//
watch(
() => filterForm.value,
() => {
(newVal, oldVal) => {
console.log("筛选条件变化:===========", newVal, oldVal);
//
if (oldVal && Object.keys(oldVal).length > 0) {
currentPage.value = 1;
fetchWarningData();
}
},
{ deep: true },
);

View File

@ -230,7 +230,7 @@ const showCountyCardsOnMap = (dataList) => {
//
handleCenterCardItemClick(item);
//
mapInstance.setView(center, 10);
// mapInstance.setView(center, 10);
//
emit("districtClick", {
name: countyName,
@ -248,10 +248,10 @@ const showCountyCardsOnMap = (dataList) => {
});
//
if (countyCardMarkers.length > 0) {
const group = new window.L.featureGroup(countyCardMarkers);
mapInstance.fitBounds(group.getBounds().pad(0.2));
}
// if (countyCardMarkers.length > 0) {
// const group = new window.L.featureGroup(countyCardMarkers);
// mapInstance.fitBounds(group.getBounds().pad(0.2));
// }
};
//
@ -316,9 +316,9 @@ const getTimeParams = (type) => {
end = formatDateTime(props.dateRange[1]) || "";
}
//
if(props.roadItem && type === "road"){
// end = props.roadItem.endTime || "";
}
// if(props.roadItem && type === "road"){
// // end = props.roadItem.endTime || "";
// }
return {
start: start,
end: end,
@ -370,7 +370,7 @@ const getAffectedBridgeData = async () => {
method: "GET",
params: timeParams,
});
if (res.code === "00000" && res.data) {
if (res.data) {
res.data.forEach((item) => {
item.COORDINATE_POINT = [item.GL1_QLJD, item.GL1_QLWD];
if (
@ -382,8 +382,7 @@ const getAffectedBridgeData = async () => {
}
});
}
// affectedBridgeData.value = res.data;
console.log("受影响桥梁数据:", affectedBridgeData.value);
addProjectMarkers(affectedBridgeData.value, bridgeIcon, "bridge");
} catch (error) {
console.error("获取受影响桥梁数据失败:", error);
@ -391,8 +390,6 @@ const getAffectedBridgeData = async () => {
}
};
const affectedTunnelData = ref([]);
const tunnelInfoDialogRef = ref(null);
//
const getAffectedTunnelData = async () => {
@ -403,7 +400,6 @@ const getAffectedTunnelData = async () => {
method: "GET",
params: timeParams,
});
console.log("受影响隧道数据:", res);
if (res.code === "00000" && res.data) {
res.data.forEach((item) => {
item.COORDINATE_POINT = [
@ -414,9 +410,7 @@ const getAffectedTunnelData = async () => {
tunnelInfoDialogRef.value.push(item);
}
});
// tunnelInfoDialogRef.value = res.data;
console.log("受影响隧道数据:", res.data);
console.log("受影响隧道数据:", tunnelInfoDialogRef.value);
addProjectMarkers(tunnelInfoDialogRef.value, tunnelIcon2, "tunnel");
}
return [];
@ -426,9 +420,8 @@ const getAffectedTunnelData = async () => {
}
};
const affectedProjectData = ref([]);
//
const affectedProjectData = ref([]);
const getAffectedProjectData = async () => {
try {
const timeParams = getTimeParams();
@ -469,25 +462,24 @@ const getAffectedProjectData = async () => {
}
};
const affectedRoadSectionData = ref([]);
//
const affectedRoadSectionData = ref([]);
const getAffectedRoadSectionData = async () => {
try {
const timeParams = getTimeParams(road);
const timeParams = getTimeParams();
const res = await request({
url: "/snow-ops-platform/weather-warning/affected-object/road-section",
method: "GET",
params: timeParams,
});
console.log("受影响路段数据:", res);
if (res.code === "00000" && res.data) {
if (res.data) {
res.data.forEach((item) => {
item.COORDINATE_POINT = JSON.parse(item.STARTPOINT);
});
affectedRoadSectionData.value = res.data;
//
console.log("开始添加项目标记...");
console.log("受影响路段数据:", affectedRoadSectionData.value);
addProjectMarkers(affectedRoadSectionData.value, tunnelLineIcon, "road");
}
return [];
@ -568,8 +560,8 @@ const addProjectMarkers = (data, iconUrl, type = "project") => {
return;
}
// //
// clearProjectMarkers();
//
clearProjectMarkers();
//
const projectIconObj = window.L.icon({
@ -1171,7 +1163,7 @@ const locateToDistrict = (countyName) => {
const center = bounds.getCenter();
//
mapInstance.setView(center, 10);
// mapInstance.setView(center, 10);
//
if (selectedLayer) {

View File

@ -35,6 +35,7 @@
<div class="left">
<left
:dateRange="getdateRange"
@warningClick="handleWarningClick"
@openImpactDetail="openDialog('impactPoint')"
@openWarningInfo="openDialog('warningInfo')"
@openImpactPoint="openDialog('impactPoint')"
@ -212,6 +213,7 @@
<!-- 预警情况对话框 -->
<warningSituationDialog
v-model:visible="dialogVisible.warningSituation"
:warningitem="warningitem"
@close="closeDialog('warningSituation')"
@impactClick="openDialog('impactPoint')"
@impactClickItem="handleImpactClickItem"
@ -356,6 +358,12 @@ const closeDialog = (dialogName) => {
console.log("关闭弹窗", dialogName);
dialogVisible.value[dialogName] = false;
};
//
const warningitem = ref({});
const handleWarningClick = (item) => {
console.log("气象预警点击:", item);
warningitem.value = item;
};
//
const confirmConfig = ref({

View File

@ -229,6 +229,7 @@ const emit = defineEmits([
"openDispatchDistrict",
"openImpactDetail",
"showCenterCard",
"warningClick",
]);
//
@ -244,7 +245,10 @@ const handleStatClick = (item) => {
//
const handleWarningCardClick = (item) => {
console.log("item:", item);
emit("openWarningSituation", item);
//
emit("warningClick", item);
};
//