Browse Source

fix: 修复大屏bug

feature-v1.0.0
hejunjie 1 month ago
parent
commit
b93176e8b0
  1. 8
      .idea/.gitignore
  2. 12
      .idea/data-board-2025.iml
  3. 6
      .idea/inspectionProfiles/Project_Default.xml
  4. 8
      .idea/modules.xml
  5. 6
      .idea/vcs.xml
  6. 6482
      pnpm-lock.yaml
  7. 5
      src/views/Main/DailyPatrolCard/index.vue
  8. 334
      src/views/Main/InspectionCard/index.vue
  9. 313
      src/views/Main/MonitoringCard/index.vue
  10. 1
      src/views/Main/index.vue
  11. 3
      vite.config.ts

8
.idea/.gitignore

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

12
.idea/data-board-2025.iml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/inspectionProfiles/Project_Default.xml

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

8
.idea/modules.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/data-board-2025.iml" filepath="$PROJECT_DIR$/.idea/data-board-2025.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

6482
pnpm-lock.yaml

File diff suppressed because it is too large

5
src/views/Main/DailyPatrolCard/index.vue

@ -55,6 +55,11 @@ const getChartData = async (time: any) => {
const data: any = await chartStore.initStatisticChart(pramas); const data: any = await chartStore.initStatisticChart(pramas);
if (data?.yaxis?.length) { if (data?.yaxis?.length) {
let newArr = data.yaxis.flatMap((v: any) => v.series); let newArr = data.yaxis.flatMap((v: any) => v.series);
newArr.sort(function(a, b) {
if(a.sort < b.sort) return -1;
if(a.sort > b.sort) return 1;
return 0; //
});
newArr?.forEach((item: any) => { newArr?.forEach((item: any) => {
dailyData.value.push({ dailyData.value.push({
name: item.name || "", name: item.name || "",

334
src/views/Main/InspectionCard/index.vue

@ -1,53 +1,25 @@
<template> <template>
<div class="inspection-card"> <div class="inspection-card">
<div class="sy-water-cart-title">监管检查总览</div> <div class="sy-water-cart-title">堤防分类统计</div>
<div class="card-item"> <div class="echart-wrapper" ref="chartRef"></div>
<div class="left">
<div class="name">今日告警</div>
<div class="count">{{ chartData.JRGJ_YCL + chartData.JRGJ_DCL }}</div>
</div>
<div class="right">
<div class="ok">
<span class="name">已处理</span>
<span class="count">{{ chartData.JRGJ_YCL }}</span>
</div>
<div class="wait">
<span class="name">待处理</span>
<span class="count">{{ chartData.JRGJ_DCL }}</span>
</div>
</div>
</div>
<div class="card-item">
<div class="left">
<div class="name">本月告警</div>
<div class="count">{{ chartData.BYGJ_YCL + chartData.BYGJ_DCL }}</div>
</div>
<div class="right">
<div class="ok">
<span class="name">已处理</span>
<span class="count">{{ chartData.BYGJ_YCL }}</span>
</div>
<div class="wait">
<span class="name">待处理</span>
<span class="count">{{ chartData.BYGJ_DCL }}</span>
</div>
</div>
</div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, onMounted, onBeforeUnmount } from "vue"; import {reactive, onMounted, onBeforeUnmount, ref} from "vue";
import { getlStatisticChart } from "@/api/safety/index"; import { getlStatisticChart } from "@/api/safety/index";
import * as echarts from "echarts";
defineOptions({ defineOptions({
name: "InspectionCard", name: "InspectionCard",
}); });
const chartData = reactive<any>({ const dailyData: any = ref([]);
JRGJ_YCL: 0, const dailyCount = ref(0);
JRGJ_DCL: 0, const chartRef = ref();
BYGJ_YCL: 0,
BYGJ_DCL: 0, let chart: echarts.ECharts | undefined;
}); const handleResize = () => {
chart?.resize();
};
const queryData = (adcd: string = "") => { const queryData = (adcd: string = "") => {
getlStatisticChart({ getlStatisticChart({
endTime: "", endTime: "",
@ -55,31 +27,194 @@ const queryData = (adcd: string = "") => {
adcd: adcd, adcd: adcd,
group: "K3", group: "K3",
}).then((res: any) => { }).then((res: any) => {
const series = res?.data?.data?.yaxis?.[0]?.series; dailyCount.value = 0;
if (!series) return; dailyData.value = [];
series.forEach((item: any) => { if (res?.data?.data?.yaxis?.length) {
if (item.code === "YZT_SUPERVISE_JRGJ_YCL_SUM") { let newArr = res.data.data.yaxis.flatMap((v: any) => v.series);
chartData.JRGJ_YCL = +(+item.sum).toFixed(0); newArr.sort(function(a, b) {
} if(a.sort < b.sort) return -1;
if (item.code === "YZT_SUPERVISE_JRGJ_DCL_SUM") { if(a.sort > b.sort) return 1;
chartData.JRGJ_DCL = +(+item.sum).toFixed(0); return 0; //
} });
if (item.code === "YZT_SUPERVISE_BYGJ_YCL_SUM") { newArr?.forEach((item: any) => {
chartData.BYGJ_YCL = +(+item.sum).toFixed(0); dailyData.value.push({
} name: item.name || "",
if (item.code === "YZT_SUPERVISE_BYGJ_DCL_SUM") { value: Number(item.sum)?.toFixed(0) || 0,
chartData.BYGJ_DCL = +(+item.sum).toFixed(0); unit: item.unit || "",
} });
}); dailyCount.value += Number(item.sum) || 0;
});
// dailyCount.value = newArr
// .map((v: any) => Number(v.sum ?? null))
// .reduce((acc: any, cur: any) => {
// return acc + cur;
// }, 0);
} else {
//
dailyData.value = [
{
name: "一般",
value: 0,
unit: "",
},
{
name: "较大",
value: 0,
unit: "",
},
{
name: "重大",
value: 0,
unit: "",
},
{
name: "紧急",
value: 0,
unit: "",
},
];
}
initChart()
}); });
}; };
const initChart = () => {
chart?.clear();
chart = echarts.init(chartRef.value);
// ['', '', '', '']
const pieName = dailyData.value.map((item: any) => item.name);
const legendStyle = {
type: "scroll",
// orient: 'vertical',
// height: '95%',
width: "50%",
left: "50%",
textAlign: "left",
align: "left",
icon: "circle", //
itemWidth: 10,
itemHeight: 10,
itemGap: 44, // 44
formatter: function (name: any) {
for (var i = 0; i < pieName.length; i++) {
if (name == dailyData.value[i].name) {
return "{name|" + name + "}{rate|" + dailyData.value[i].value + "}";
}
}
},
textStyle: {
rich: {
name: {
fontSize: 16,
fontWeight: 400,
width: 60,
height: 24,
padding: [0, 0, 0, 5],
color: "rgba(0, 0, 0, 0.55)",
},
rate: {
fontSize: 18,
fontWeight: "bold",
fontFamily: "Microsoft YaHei",
height: 24,
width: 30,
padding: [60, 0, 0, -60],
color: "rgba(0, 0, 0, 0.9)",
},
},
},
};
// Chart options
const option = {
tooltip: {
trigger: "item",
// formatter: '{a} <br/>{b}: {c} ({d}%)'
},
color: ["#28CE8E", "#FFDD77", "#FF9A23", "#F26161"],
legend: [
{
top: "15%",
//
data: pieName.slice(0, 2),
...legendStyle,
},
{
top: "55%",
//
data: pieName.slice(2, 4),
...legendStyle,
},
],
series: [
{
// name: '',
type: "pie",
radius: ["52%", "70%"],
center: ["20%", "50%"],
avoidLabelOverlap: false,
label: {
show: false,
},
emphasis: {
label: {
show: false,
},
},
labelLine: {
show: false,
},
data: dailyData.value,
},
{
type: "pie",
radius: ["52%", "70%"],
center: ["20%", "50%"],
z: 0,
itemStyle: {
color: "transparent",
borderWidth: 0,
borderColor: "#eee",
},
label: {
position: "center",
formatter: function () {
return ["{total|" + dailyCount.value + "}", "{label|堤防总数}"].join("\n");
},
rich: {
total: {
color: "#000",
fontSize: 28,
fontWeight: "bold",
fontFamily: "DIN",
lineHeight: 34,
},
label: {
color: "rgba(0, 0, 0, 0.6)",
fontSize: 14,
lineHeight: 18,
fontFamily: "Source Han Sans",
},
},
},
data: [{ value: 1, name: "", tooltip: { show: false } }],
},
],
};
// Set options and render chart
chart.setOption(option);
};
onMounted(() => { onMounted(() => {
queryData(); queryData()
window.$bus.$on("inspection-card-query-data", queryData); // getChartData(props.timeRange);
// getProgressData(props.timeRange);
window.addEventListener("resize", handleResize);
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
// window.$bus.$off("inspection-card-query-data"); chart?.dispose();
window.removeEventListener("resize", handleResize);
}); });
</script> </script>
@ -89,85 +224,10 @@ onBeforeUnmount(() => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 16px; gap: 16px;
.card-item { .echart-wrapper {
margin-top: 30px;
width: 100%; width: 100%;
display: flex; height: 164px + 16px + 32px;
flex-direction: row;
gap: 12px;
.left {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba(54, 178, 158, 0.1);
border: 2px solid rgba(54, 178, 158, 0.6);
width: 160px;
.name {
font-family: 思源黑体;
font-size: 14px;
font-weight: normal;
line-height: normal;
letter-spacing: 0em;
color: rgba(0, 0, 0, 0.9);
}
.count {
font-family: DIN;
font-size: 32px;
font-weight: bold;
line-height: 40px;
letter-spacing: 0em;
font-variation-settings: "opsz" auto;
color: #36b29e;
}
}
.right {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
.ok,
.wait {
display: flex;
flex-direction: row;
width: 238px;
padding: 8px 16px;
height: 52px;
justify-content: space-between;
align-items: center;
.name {
font-family: 思源黑体;
font-size: 14px;
font-weight: normal;
line-height: normal;
letter-spacing: 0em;
color: rgba(0, 0, 0, 0.9);
}
.count {
font-family: 思源黑体;
font-size: 24px;
font-weight: 500;
line-height: normal;
letter-spacing: 0em;
}
}
.ok {
background: rgba(40, 206, 142, 0.15);
border: 1px solid #28ce8e;
.count {
color: #28ce8e;
}
}
.wait {
background: rgba(250, 173, 16, 0.1);
border: 1px solid #faad10;
.count {
color: #ff9a23;
}
}
}
} }
} }
</style> </style>

313
src/views/Main/MonitoringCard/index.vue

@ -1,46 +1,26 @@
<template> <template>
<div class="monitoring-card"> <div class="monitoring-card">
<div class="sy-water-cart-title">测报设施建设</div> <div class="sy-water-cart-title">水闸分类统计</div>
<div class="cart-item"> <div class="echart-wrapper" ref="chartRef"></div>
<div class="left">
<img src="@/assets/card/measuring-reporting-facility.png" />
</div>
<div class="right">
<div class="name">测报设施建设</div>
<div class="count">
{{ chartData.cz + chartData.cd + chartData.yx || 0 }}
</div>
</div>
</div>
<div class="cart-item-row">
<div class="left">
<div class="count">{{ chartData.cz || 0 }}</div>
<div class="name">水文工程检测测站数量</div>
<!-- <div class="name">水雨情监测设施</div> -->
</div>
<div class="right">
<div class="count">{{ chartData.cd || 0 }}</div>
<div class="name">水文工程检测测点数量</div>
<!-- <div class="name">水库大坝安全监测设施</div> -->
</div>
<div class="right">
<div class="count">{{ chartData.yx || 0 }}</div>
<div class="name">水事影像监测监视点</div>
</div>
</div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, onMounted } from "vue"; import {reactive, onMounted, ref, onBeforeUnmount} from "vue";
import { getlStatisticChart } from "@/api/safety/index"; import { getlStatisticChart } from "@/api/safety/index";
import * as echarts from "echarts";
defineOptions({ defineOptions({
name: "MonitoringCard", name: "MonitoringCard",
}); });
const chartData = reactive<any>({
syq: 0, const dailyData: any = ref([]);
dbaq: 0, const dailyCount = ref(0);
}); const chartRef = ref();
let chart: echarts.ECharts | undefined;
const handleResize = () => {
chart?.resize();
};
const queryData = (adcd: string = "") => { const queryData = (adcd: string = "") => {
getlStatisticChart({ getlStatisticChart({
endTime: "", endTime: "",
@ -48,30 +28,187 @@ const queryData = (adcd: string = "") => {
adcd: adcd, adcd: adcd,
group: "K2", group: "K2",
}).then((res: any) => { }).then((res: any) => {
const series = res?.data?.data?.yaxis?.[0]?.series; dailyCount.value = 0;
if (!series) return; dailyData.value = [];
series.forEach((item: any) => { if (res?.data?.data?.yaxis?.length) {
if (item.code === "YZT_CONSTRUCT_SYQ_SUM") { let newArr = res.data.data.yaxis.flatMap((v: any) => v.series);
chartData.syq = +(+item.sum).toFixed(0); newArr.sort(function(a, b) {
} if(a.sort < b.sort) return -1;
if (item.code === "YZT_CONSTRUCT_DBAQ_SUM") { if(a.sort > b.sort) return 1;
chartData.dbaq = +(+item.sum).toFixed(0); return 0; //
} });
if (item.code === "YZT_SWGCJCCZ_SUM") { newArr?.forEach((item: any) => {
chartData.cz = +(+item.sum).toFixed(0); dailyData.value.push({
} name: item.name || "",
if (item.code === "YZT_SWGCJCCD_SUM") { value: Number(item.sum)?.toFixed(0) || 0,
chartData.cd = +(+item.sum).toFixed(0); unit: item.unit || "",
} });
if (item.code === "YZT_SSYX_SUM") { dailyCount.value += Number(item.sum) || 0;
chartData.yx = +(+item.sum).toFixed(0); });
} // dailyCount.value = newArr
}); // .map((v: any) => Number(v.sum ?? null))
// .reduce((acc: any, cur: any) => {
// return acc + cur;
// }, 0);
} else {
//
dailyData.value = [
{
name: "一般",
value: 0,
unit: "",
},
{
name: "较大",
value: 0,
unit: "",
},
{
name: "重大",
value: 0,
unit: "",
},
{
name: "紧急",
value: 0,
unit: "",
},
];
}
initChart()
}); });
}; };
const initChart = () => {
chart?.clear();
chart = echarts.init(chartRef.value);
// ['', '', '', '']
const pieName = dailyData.value.map((item: any) => item.name);
console.log(pieName)
const legendStyle = {
type: "scroll",
// orient: 'vertical',
// height: '95%',
width: "50%",
left: "50%",
textAlign: "left",
align: "left",
icon: "circle", //
itemWidth: 10,
itemHeight: 10,
itemGap: 44, // 44
formatter: function (name: any) {
for (var i = 0; i < pieName.length; i++) {
if (name == dailyData.value[i].name) {
return "{name|" + name + "}{rate|" + dailyData.value[i].value + "}";
}
}
},
textStyle: {
rich: {
name: {
fontSize: 16,
fontWeight: 400,
width: 60,
height: 24,
padding: [0, 0, 0, 5],
color: "rgba(0, 0, 0, 0.55)",
},
rate: {
fontSize: 18,
fontWeight: "bold",
fontFamily: "Microsoft YaHei",
height: 24,
width: 30,
padding: [60, 0, 0, -60],
color: "rgba(0, 0, 0, 0.9)",
},
},
},
};
// Chart options
const option = {
tooltip: {
trigger: "item",
// formatter: '{a} <br/>{b}: {c} ({d}%)'
},
color: ["#28CE8E", "#FFDD77", "#FF9A23", "#F26161"],
legend: {
type: 'scroll',
orient: 'vertical',
right: 10,
top: 20,
bottom: 20,
data: pieName
},
series: [
{
// name: '',
type: "pie",
radius: ["52%", "70%"],
center: ["20%", "50%"],
avoidLabelOverlap: false,
label: {
show: false,
},
emphasis: {
label: {
show: false,
},
},
labelLine: {
show: false,
},
data: dailyData.value,
},
{
type: "pie",
radius: ["52%", "70%"],
center: ["20%", "50%"],
z: 0,
itemStyle: {
color: "transparent",
borderWidth: 0,
borderColor: "#eee",
},
label: {
position: "center",
formatter: function () {
return ["{total|" + dailyCount.value + "}", "{label|水闸总数}"].join("\n");
},
rich: {
total: {
color: "#000",
fontSize: 28,
fontWeight: "bold",
fontFamily: "DIN",
lineHeight: 34,
},
label: {
color: "rgba(0, 0, 0, 0.6)",
fontSize: 14,
lineHeight: 18,
fontFamily: "Source Han Sans",
},
},
},
data: [{ value: 1, name: "", tooltip: { show: false } }],
},
],
};
// Set options and render chart
chart.setOption(option);
};
onMounted(() => { onMounted(() => {
queryData(); queryData()
window.$bus.$on("monitoring-card-query-data", queryData); // getChartData(props.timeRange);
// getProgressData(props.timeRange);
window.addEventListener("resize", handleResize);
});
onBeforeUnmount(() => {
chart?.dispose();
window.removeEventListener("resize", handleResize);
}); });
</script> </script>
@ -81,72 +218,10 @@ onMounted(() => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 16px; gap: 16px;
.cart-item { height: 300px;
// width: calc(100% - 32px); .echart-wrapper {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
padding: 8px 16px;
gap: 16px;
background: rgba(54, 178, 158, 0.1);
border: 2px solid rgba(54, 178, 158, 0.6);
.left {
img {
width: 64px;
height: 64px;
}
}
.right {
height: 80px;
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
}
}
.cart-item-row {
// width: calc(100% - 32px);
width: 100%; width: 100%;
display: flex; height: 164px + 16px + 32px;
flex-direction: row;
align-items: center;
gap: 16px;
.left,
.right {
width: 50%;
height: 156px;
padding: 8px 16px;
background: rgba(54, 178, 158, 0.1);
border: 2px solid rgba(54, 178, 158, 0.6);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
}
.cart-item,
.cart-item-row {
.name {
font-family: 思源黑体;
font-size: 16px;
font-weight: normal;
line-height: normal;
letter-spacing: 0em;
color: #000000;
}
.count {
font-family: DIN;
font-size: 32px;
font-weight: bold;
line-height: 40px;
letter-spacing: 0em;
font-variation-settings: "opsz" auto;
color: #36b29e;
}
} }
} }
</style> </style>

1
src/views/Main/index.vue

@ -132,6 +132,7 @@ onMounted(() => {
showDike.value = false; showDike.value = false;
dikeData.value = {}; dikeData.value = {};
}); });
window.dispatchEvent(new Event("resize"));
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
window.$bus.$all_off(); window.$bus.$all_off();

3
vite.config.ts

@ -13,6 +13,7 @@ const pathSrc = path.resolve(__dirname, "src");
const root = process.cwd(); const root = process.cwd();
// 开发 // 开发
const apiTarget = "http://gateway.product.dev.com:30115/"; const apiTarget = "http://gateway.product.dev.com:30115/";
// const apiTarget = "172.16.34.80:18082";
const apiSluiceTarget = "http://shuili-admin.product.dev.com:30115"; const apiSluiceTarget = "http://shuili-admin.product.dev.com:30115";
// const apiTarget = 'http://sy.datametatech.com:60006/'; // const apiTarget = 'http://sy.datametatech.com:60006/';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
@ -91,7 +92,7 @@ export default defineConfig(({ mode }) => {
rewrite: (path) => path.replace(/^\/api/, "/tianhui-admin-web"), rewrite: (path) => path.replace(/^\/api/, "/tianhui-admin-web"),
}, },
"/api": { "/api": {
target: "http://shuili.product.dev.com:30115", // 'http://172.16.34.59:18083' target: "http://shuili.product.dev.com:30115/", // 'http://172.16.34.59:18083'
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, "/tianhui-admin-web"), rewrite: (path) => path.replace(/^\/api/, "/tianhui-admin-web"),
}, },

Loading…
Cancel
Save