Compare commits

..

2 Commits

Author SHA1 Message Date
guanj
5687367602 Merge branch 'main' of http://192.168.1.22:3000/Web/admin-govern 2025-12-04 09:37:58 +08:00
guanj
b8ee530557 修改驾驶舱zoom缩放问题 2025-12-04 09:37:38 +08:00
2 changed files with 16 additions and 12 deletions

View File

@@ -21,7 +21,7 @@
:options="echartList" :options="echartList"
:style="{ :style="{
width: prop.width, width: prop.width,
height: `calc(${prop.height} / 2 - ${headerHeight / 2}px + ${fullscreen ? 0 : 28}px )` height: `calc(${prop.height} / 2 - ${headerHeight / 2}px + ${fullscreen ? 0 : 28}px )`,
}" }"
/> />
<my-echart <my-echart
@@ -187,7 +187,7 @@ const initProbabilityData = () => {
type: 'category', type: 'category',
name: '越限程度', name: '越限程度',
nameLocation: 'middle', nameLocation: 'middle',
nameGap: 30, nameGap: 50,
data: ['0-20%', '20-40%', '40-60%', '60-80%', '80-100%'], data: ['0-20%', '20-40%', '40-60%', '60-80%', '80-100%'],
axisLine: { axisLine: {
lineStyle: { lineStyle: {
@@ -206,7 +206,7 @@ const initProbabilityData = () => {
type: 'category', type: 'category',
name: '指标类型', name: '指标类型',
nameLocation: 'middle', nameLocation: 'middle',
nameGap: 30, nameGap: 50,
data: yAxisData, data: yAxisData,
nameTextStyle: { nameTextStyle: {
color: '#111' color: '#111'

View File

@@ -16,7 +16,6 @@
<el-button type="primary" icon="el-icon-Tools" @click="settings">设置</el-button> <el-button type="primary" icon="el-icon-Tools" @click="settings">设置</el-button>
</template> </template>
</TableHeader> </TableHeader>
<GridLayout <GridLayout
v-model:layout="layout" v-model:layout="layout"
:row-height="rowHeight" :row-height="rowHeight"
@@ -26,6 +25,7 @@
:vertical-compact="false" :vertical-compact="false"
prevent-collision prevent-collision
:col-num="12" :col-num="12"
:style="{ zoom: zoom }"
> >
<template #item="{ item }"> <template #item="{ item }">
<div class="box"> <div class="box">
@@ -34,8 +34,8 @@
<Icon class="HelpFilled" :name="(item as LayoutItem).icon" /> <Icon class="HelpFilled" :name="(item as LayoutItem).icon" />
{{ (item as LayoutItem).name }} {{ (item as LayoutItem).name }}
</div> </div>
<!-- <FullScreen class="HelpFilled" style="cursor: pointer" @click="zoom(item)" /> --> <!-- <FullScreen class="HelpFilled" style="cursor: pointer" @click="setZoom(item)" /> -->
<img :src="flag ? img : img1" style="cursor: pointer; height: 16px" @click="zoom(item)" /> <img :src="flag ? img : img1" style="cursor: pointer; height: 16px" @click="setZoom(item)" />
</div> </div>
<div> <div>
<component <component
@@ -80,6 +80,7 @@ const timeCacheStore = useTimeCacheStore()
defineOptions({ defineOptions({
// name: 'dashboard/index' // name: 'dashboard/index'
}) })
// 定义类型 // 定义类型
interface LayoutItem { interface LayoutItem {
x: number x: number
@@ -95,6 +96,7 @@ interface LayoutItem {
loading?: boolean loading?: boolean
error?: any error?: any
} }
const zoom = ref(1)
const RoutingConfigRef = ref() const RoutingConfigRef = ref()
const key = ref(0) const key = ref(0)
const img = new URL(`@/assets/img/amplify.png`, import.meta.url).href const img = new URL(`@/assets/img/amplify.png`, import.meta.url).href
@@ -120,13 +122,15 @@ const componentMap = reactive(new Map<string, Component | string>())
const dataList: any = ref({}) const dataList: any = ref({})
// 获取主内容区域高度 // 获取主内容区域高度
const getMainHeight = () => { const getMainHeight = () => {
const elMain = document.querySelector('.el-main') const elMain = document.querySelector('.el-main') as HTMLElement | null
return (elMain?.offsetHeight || 0) - 70 zoom.value = layout.value.length==1?1: (elMain?.offsetHeight ?? 0) / 1080
// console.log('🚀 ~ getMainHeight ~ elMain:', elMain?.offsetHeight)
return ((elMain?.offsetHeight || 0) - 70) / zoom.value
} }
// 获取主内容区域高度 // 获取主内容区域高度
const getMainWidth = () => { const getMainWidth = () => {
const elMain = document.querySelector('.el-main') const elMain = document.querySelector('.el-main') as HTMLElement | null
return (elMain?.offsetWidth || 0) - 20 return ((elMain?.offsetWidth || 0) - 20) / zoom.value
} }
// 初始化行高 // 初始化行高
@@ -170,8 +174,9 @@ const registerComponent = (path: string): Component | string | null => {
return null return null
} }
} }
// 缩放 // 缩放
const zoom = (value: any) => { const setZoom = (value: any) => {
if (flag.value) { if (flag.value) {
layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }] layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }]
} else { } else {
@@ -181,7 +186,6 @@ const zoom = (value: any) => {
component: registerComponent(item.path) component: registerComponent(item.path)
})) }))
} }
console.log("🚀 ~ zoom ~ layout.value:", layout.value)
flag.value = !flag.value flag.value = !flag.value