修改测试bug
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog v-model="dialogVisible" title="自定义功能管理" width="650">
|
||||
<el-dialog v-model="dialogVisible" title="驾驶舱管理" width="750">
|
||||
<div style="display: flex; justify-content: end" class="mb10">
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>
|
||||
</div>
|
||||
@@ -13,6 +13,7 @@
|
||||
height="auto"
|
||||
v-bind="defaultAttribute"
|
||||
>
|
||||
<vxe-column type="seq" title="序号" width="80"></vxe-column>
|
||||
<vxe-column field="pageName" title="菜单名称"></vxe-column>
|
||||
|
||||
<vxe-column field="icon" title="图标" width="80">
|
||||
@@ -47,6 +48,9 @@
|
||||
:before-change="() => beforeChange1(row)"
|
||||
/>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="sort" title="排序">
|
||||
|
||||
</vxe-column>
|
||||
<vxe-column field="startTime" title="操作">
|
||||
<template #default="{ row }">
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
@click="settings"
|
||||
v-if="router.currentRoute.value.name == 'dashboard/index'"
|
||||
>
|
||||
自定义功能管理
|
||||
驾驶舱管理
|
||||
</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
@@ -32,7 +32,6 @@
|
||||
:is-draggable="false"
|
||||
:responsive="false"
|
||||
:vertical-compact="false"
|
||||
prevent-collision
|
||||
:col-num="12"
|
||||
:style="{
|
||||
transform: `scale(${zoom})`,
|
||||
@@ -50,9 +49,9 @@
|
||||
<!-- <FullScreen class="HelpFilled" style="cursor: pointer" @click="setZoom(item)" /> -->
|
||||
<span style="display: flex; align-items: center">
|
||||
<img
|
||||
:src="flag ? img : img1"
|
||||
:src="!flag && (item as LayoutItem).i === zoomedId ? img1 : img"
|
||||
style="cursor: pointer; height: 16px"
|
||||
@click="setZoom(item)"
|
||||
@click="setZoom(item as LayoutItem)"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
@@ -60,8 +59,8 @@
|
||||
<component
|
||||
:is="(item as LayoutItem).component"
|
||||
v-if="(item as LayoutItem).component"
|
||||
:key="(item as LayoutItem).i"
|
||||
class="pd10"
|
||||
:key="key"
|
||||
:timeValue="datePickerRef?.timeValue || 3"
|
||||
:height="rowHeight * item.h - seRowHeight(item.h) + 'px'"
|
||||
:width="rowWidth * item.w - 30 + 'px'"
|
||||
@@ -81,7 +80,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, markRaw, onUnmounted, computed, defineAsyncComponent, type Component } from 'vue'
|
||||
import { ref, reactive, onMounted, markRaw, onUnmounted, defineAsyncComponent, nextTick, type Component } from 'vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { GridLayout } from 'grid-layout-plus'
|
||||
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||
@@ -122,7 +121,7 @@ interface LayoutItem {
|
||||
const zoom = ref(1)
|
||||
const RoutingConfigRef = ref()
|
||||
const userId = ref('')
|
||||
const key = ref(0)
|
||||
const zoomedId = ref<string | number | null>(null)
|
||||
const img = new URL(`@/assets/img/amplify.png`, import.meta.url).href
|
||||
const img1 = new URL(`@/assets/img/reduce.png`, import.meta.url).href
|
||||
// 响应式数据
|
||||
@@ -148,7 +147,11 @@ const dataList: any = ref({})
|
||||
const getMainHeight = () => {
|
||||
const elMain = document.querySelector('.el-main') as HTMLElement | null
|
||||
zoom.value =
|
||||
layout.value.length == 1 ? 1 : (elMain?.offsetHeight ?? 0) > 1080 ? 1 : (elMain?.offsetHeight ?? 0) / 1080
|
||||
layoutCopy.value.length <= 1 || !flag.value
|
||||
? 1
|
||||
: (elMain?.offsetHeight ?? 0) > 1080
|
||||
? 1
|
||||
: (elMain?.offsetHeight ?? 0) / 1080
|
||||
// console.log('🚀 ~ getMainHeight ~ elMain:', elMain?.offsetHeight)
|
||||
return ((elMain?.offsetHeight || 0) - 70) / zoom.value
|
||||
}
|
||||
@@ -200,22 +203,36 @@ const registerComponent = (path: string): Component | string | null => {
|
||||
}
|
||||
}
|
||||
|
||||
// 缩放
|
||||
const setZoom = (value: any) => {
|
||||
if (flag.value) {
|
||||
layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }]
|
||||
} else {
|
||||
layout.value = layoutCopy.value.map((item: any, index: number) => ({
|
||||
// 根据 layoutCopy 构建布局,放大时保留全部组件实例仅调整坐标
|
||||
const buildLayoutFromCopy = (zoomItem?: LayoutItem | null) => {
|
||||
return layoutCopy.value.map((item: LayoutItem) => {
|
||||
const entry: LayoutItem = {
|
||||
...item,
|
||||
i: item.i || index, // 确保有唯一标识
|
||||
component: registerComponent(item.path)
|
||||
}))
|
||||
component: registerComponent(item.path) || undefined
|
||||
}
|
||||
if (zoomItem != null && String(item.i) === String(zoomItem.i)) {
|
||||
return { ...entry, x: 0, y: 0, w: 12, h: 6 }
|
||||
}
|
||||
if (zoomItem != null) {
|
||||
return { ...entry, x: -100, y: -100, w: 1, h: 1 }
|
||||
}
|
||||
return entry
|
||||
})
|
||||
}
|
||||
|
||||
// 缩放
|
||||
const setZoom = async (value: LayoutItem) => {
|
||||
if (flag.value) {
|
||||
zoomedId.value = value.i
|
||||
layout.value = buildLayoutFromCopy(value)
|
||||
} else {
|
||||
zoomedId.value = null
|
||||
layout.value = buildLayoutFromCopy()
|
||||
}
|
||||
|
||||
flag.value = !flag.value
|
||||
|
||||
await nextTick()
|
||||
initRowHeight()
|
||||
key.value += 1
|
||||
}
|
||||
// 计算组件高度
|
||||
const seRowHeight = (value: any) => {
|
||||
@@ -236,12 +253,11 @@ const fetchLayoutData = async () => {
|
||||
dataList.value = data
|
||||
const parsedLayout = JSON.parse(data.containerConfig || '[]') as LayoutItem[]
|
||||
// 处理布局数据
|
||||
layout.value = parsedLayout.map((item, index) => ({
|
||||
layoutCopy.value = parsedLayout.map((item, index) => ({
|
||||
...item,
|
||||
i: item.i || index, // 确保有唯一标识
|
||||
component: registerComponent(item.path)
|
||||
i: item.i ?? index
|
||||
}))
|
||||
layoutCopy.value = JSON.parse(JSON.stringify(layout.value))
|
||||
layout.value = buildLayoutFromCopy()
|
||||
if (layout.value.length == 1) {
|
||||
setZoom(layout.value[0])
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
>
|
||||
<el-form ref="formRef" label-width="80px" class="form">
|
||||
<el-form-item label="项目名称">
|
||||
<el-input
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
<el-input maxlength="32" show-word-limit
|
||||
|
||||
|
||||
clearable
|
||||
style="width: 240px"
|
||||
v-model.trim="searchValue"
|
||||
|
||||
@@ -4,38 +4,24 @@
|
||||
<!-- 实时数据 走驾驶舱-->
|
||||
<!-- 添加加载事件监听 -->
|
||||
<div class="dataBox" :style="{ height: prop.height ? prop.height : pageHeight.height }">
|
||||
<div
|
||||
class="iframe-container"
|
||||
:style="{
|
||||
boxShadow: `var(--el-box-shadow-light)`
|
||||
}"
|
||||
style="position: relative"
|
||||
>
|
||||
<iframe
|
||||
v-if="bindId"
|
||||
:key="bindId"
|
||||
:src="iframeSrc"
|
||||
width="100%"
|
||||
height="100%"
|
||||
frameborder="0"
|
||||
scrolling="no"
|
||||
id="iframeLeft"
|
||||
@load="onIframeLoad"
|
||||
></iframe>
|
||||
<div class="iframe-container" :style="{
|
||||
boxShadow: `var(--el-box-shadow-light)`
|
||||
}" style="position: relative">
|
||||
<iframe v-if="bindId" :key="bindId" :src="iframeSrc" width="100%" height="100%" frameborder="0"
|
||||
scrolling="no" id="iframeLeft" @load="onIframeLoad"></iframe>
|
||||
<el-empty v-else description="暂无绑定页面" style="height: 100%" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-container">
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="show ? 'el-icon-ArrowDownBold' : 'el-icon-ArrowUpBold'"
|
||||
@click="show = !show"
|
||||
style="width: 100%"
|
||||
v-if="bindId"
|
||||
>
|
||||
<el-button type="primary" :icon="show ? 'el-icon-ArrowDownBold' : 'el-icon-ArrowUpBold'"
|
||||
@click="show = !show" style="width: 100%" v-if="bindId">
|
||||
事件列表
|
||||
</el-button>
|
||||
<el-button class="bindBut" type="primary" icon="el-icon-Sort" @click="bindClick">绑定</el-button>
|
||||
<!-- <el-button class="bindBut" type="primary" icon="el-icon-Sort" @click="bindClick">绑定</el-button> -->
|
||||
|
||||
<el-icon class="bindBut">
|
||||
<Sort style="width: 30px;height: 30px;" color="#fff" @click="bindClick" />
|
||||
</el-icon>
|
||||
<!-- <div class="buttonBox">
|
||||
<el-button type="primary" icon="el-icon-Aim" @click="reset">复位</el-button>
|
||||
</div> -->
|
||||
@@ -60,7 +46,7 @@ import { ref, watch, onMounted, onUnmounted, provide } from 'vue'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
|
||||
import { Sort } from '@element-plus/icons-vue'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import { audit, add, coFqueryPage, getByUserId } from '@/api/cs-harmonic-boot/mxgraph'
|
||||
import Bind from './bind.vue'
|
||||
@@ -173,7 +159,7 @@ const info = async () => {
|
||||
pageSize: 1000
|
||||
}).then(res => {
|
||||
bindId.value = res.data.records.filter(item => item.scope == 1)[0]?.id || null
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
await setTimeout(() => {
|
||||
@@ -256,6 +242,7 @@ const sendKeysToIframe = (keyList: string[]) => {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.tableBox {
|
||||
/* 必须:初始高度/overflow 配合动画 */
|
||||
overflow: hidden;
|
||||
@@ -291,9 +278,12 @@ const sendKeysToIframe = (keyList: string[]) => {
|
||||
.table-fade-enter-active {
|
||||
transition-delay: 0.05s;
|
||||
}
|
||||
|
||||
.bindBut {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: -35px;
|
||||
right: 10px;
|
||||
top: 7px;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
<el-tab-pane label="基础信息">
|
||||
<el-form ref="formRef" inline :rules="rules" :model="form" label-width="auto" class="form-four">
|
||||
<el-form-item label="页面名称" prop="pageName">
|
||||
<el-input
|
||||
<el-input maxlength="32" show-word-limit
|
||||
style="width: 100%"
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
|
||||
|
||||
v-model.trim="form.pageName"
|
||||
placeholder="请输入页面名称"
|
||||
></el-input>
|
||||
@@ -84,9 +84,9 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" class="top">
|
||||
<el-input
|
||||
<el-input show-word-limit
|
||||
maxlength="300"
|
||||
show-word-limit
|
||||
|
||||
style="width: 100%"
|
||||
type="textarea"
|
||||
:rows="1"
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<TableHeader>
|
||||
<template v-slot:select>
|
||||
<el-form-item label="页面名称">
|
||||
<el-input
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
<el-input maxlength="32" show-word-limit
|
||||
|
||||
|
||||
v-model.trim="tableStore.table.params.searchValue"
|
||||
placeholder="请输入页面名称"
|
||||
></el-input>
|
||||
|
||||
Reference in New Issue
Block a user