新增数据,开始安全巡检模块

This commit is contained in:
Zy
2026-04-17 19:39:21 +08:00
parent 4184f1c55d
commit 9a95e2b7e3
74 changed files with 1942 additions and 403 deletions

View File

@@ -7,9 +7,6 @@ import { ref, onMounted, onBeforeUnmount, watch, nextTick } from 'vue';
import * as echarts from 'echarts';
import type { EChartsOption, ECharts } from 'echarts';
// ==============================================
// ✅ 【核心修复】正确的 Vue3 + TS Props 写法
// ==============================================
interface Props {
width?: string;
height?: string;
@@ -36,6 +33,7 @@ const emit = defineEmits<{
const chartRef = ref<HTMLDivElement>();
let chartInstance: ECharts | null = null;
let resizeObserver: ResizeObserver | null = null;
const initChart = () => {
if (!chartRef.value) return;
@@ -66,8 +64,10 @@ const updateChart = () => {
}
};
// ✅ 核心修复:支持 scale 缩放后重绘
const resizeChart = () => {
chartInstance?.resize();
if (!chartInstance) return;
chartInstance.resize();
};
const getInstance = () => chartInstance;
@@ -88,17 +88,19 @@ onMounted(() => {
nextTick(() => initChart());
if (props.autoResize && chartRef.value) {
const resizeObserver = new ResizeObserver(resizeChart);
resizeObserver = new ResizeObserver(resizeChart);
resizeObserver.observe(chartRef.value);
onBeforeUnmount(() => {
resizeObserver.disconnect();
});
}
});
// ✅ 关键:监听 window.resizescale 缩放会触发 window.resize
onMounted(() => {
window.addEventListener('resize', resizeChart);
});
onBeforeUnmount(() => {
window.removeEventListener('resize', resizeChart);
resizeObserver?.disconnect();
chartInstance?.dispose();
chartInstance = null;
});
@@ -114,5 +116,7 @@ defineExpose({
<style lang="scss" scoped>
.echarts-container {
display: block;
width: 100%;
height: 100%;
}
</style>

View File

@@ -78,10 +78,17 @@ import { ResidentVO } from '@/api/system/resident/type';
import { getHousePathById } from '@/utils/house';
import { ref, watch, nextTick, getCurrentInstance, ComponentInternalInstance, toRefs } from 'vue';
import { useHouseStore } from '@/store/modules/house';
import { storeToRefs } from 'pinia';
const houseStore = useHouseStore();
const { treedata } = storeToRefs(houseStore);
const treedata = ref([]);
function init() {
houseStore.getCurrentVilageTreeHouse().then((res) => {
console.log(res);
treedata.value = res;
});
}
init();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_resident_type } = toRefs<any>(proxy?.useDict('com_resident_type'));