优化驾驶舱页面
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog v-model="dialogVisible" title="设置" width="600">
|
||||
<el-dialog v-model="dialogVisible" title="自定义功能管理" width="600">
|
||||
<div style="display: flex; justify-content: end" class="mb10">
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>
|
||||
</div>
|
||||
@@ -52,12 +52,13 @@ import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||
import { getDashboardPageByUserId, deleteDashboard, activatePage } from '@/api/system-boot/csstatisticalset'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
import { useNavTabs } from '@/stores/navTabs'
|
||||
import { getMenu } from '@/utils/router'
|
||||
|
||||
const { push } = useRouter()
|
||||
const dialogVisible = ref(false)
|
||||
const route = useRouter()
|
||||
const navTabs = useNavTabs()
|
||||
const adminInfo = useAdminInfo()
|
||||
const pageList: any = ref([])
|
||||
|
||||
@@ -92,7 +93,7 @@ const beforeChange = (row: any): Promise<boolean> => {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
activatePage({ id: row.id, state: row.state == 0 ? 1 : 0 }).then((res: any) => {
|
||||
activatePage({ id: row.id, state: row.state == 0 ? 1 : 0 }).then( async(res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
@@ -101,7 +102,11 @@ const beforeChange = (row: any): Promise<boolean> => {
|
||||
}
|
||||
init()
|
||||
resolve(true)
|
||||
getMenu()
|
||||
await getMenu()
|
||||
await setTimeout(() => {
|
||||
navTabs.refresh()
|
||||
}, 1000)
|
||||
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="default-main">
|
||||
<TableHeader :showSearch="false" v-show="flag">
|
||||
<template v-slot:select>
|
||||
<el-form-item label="日期">
|
||||
<el-form-item label="日期" v-show="layout?.length != 1">
|
||||
<DatePicker
|
||||
ref="datePickerRef"
|
||||
:nextFlag="false"
|
||||
@@ -13,7 +13,14 @@
|
||||
</template>
|
||||
<template v-slot:operation>
|
||||
<el-button type="primary" icon="el-icon-Edit" @click="editd">编辑</el-button>
|
||||
<el-button type="primary" icon="el-icon-Tools" @click="settings">设置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-Tools"
|
||||
@click="settings"
|
||||
v-if="router.currentRoute.value.name == 'dashboard/index'"
|
||||
>
|
||||
自定义功能管理
|
||||
</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<GridLayout
|
||||
@@ -221,6 +228,10 @@ const fetchLayoutData = async () => {
|
||||
component: registerComponent(item.path)
|
||||
}))
|
||||
layoutCopy.value = JSON.parse(JSON.stringify(layout.value))
|
||||
if (layout.value.length == 1) {
|
||||
setZoom(layout.value[0])
|
||||
}
|
||||
|
||||
initRowHeight()
|
||||
} catch (error) {
|
||||
console.error('获取布局数据失败:', error)
|
||||
|
||||
@@ -21,21 +21,30 @@
|
||||
@load="onIframeLoad"
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
<el-card class="bottom-container" style="min-height: 230px">
|
||||
<!-- <div class="buttonBox">
|
||||
</div>
|
||||
<div class="bottom-container">
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="show ? 'el-icon-ArrowDownBold' : 'el-icon-ArrowUpBold'"
|
||||
@click="show = !show"
|
||||
style="width: 100%"
|
||||
>
|
||||
事件列表
|
||||
</el-button>
|
||||
<!-- <div class="buttonBox">
|
||||
<el-button type="primary" icon="el-icon-Aim" @click="reset">复位</el-button>
|
||||
</div> -->
|
||||
<div class="tableBox">
|
||||
<!-- <Table ref="tableRef" height="100%"></Table> -->
|
||||
<vxe-table border auto-resize height="100%" :data="tableData" ref="tableRef">
|
||||
|
||||
<transition name="table-fade">
|
||||
<div class="tableBox" v-if="show">
|
||||
<vxe-table border auto-resize height="230px" :data="tableData" ref="tableRef">
|
||||
<vxe-column type="seq" title="序号" align="center" width="80px"></vxe-column>
|
||||
<vxe-column field="date" align="center" title="时间" width="200px"></vxe-column>
|
||||
<vxe-column field="name" align="center" title="监测点名" width="200px"></vxe-column>
|
||||
<vxe-column field="address" align="center" title="事件描述"></vxe-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
</el-card>
|
||||
</transition>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -49,7 +58,7 @@ import { mainHeight } from '@/utils/layout'
|
||||
// const props = defineProps<{
|
||||
// project: { id: string; name: string } | null
|
||||
// }>()
|
||||
|
||||
const show = ref(false)
|
||||
const prop = defineProps({
|
||||
width: { type: [String, Number] },
|
||||
height: { type: [String, Number] },
|
||||
@@ -57,7 +66,9 @@ const prop = defineProps({
|
||||
timeValue: { type: Object }
|
||||
})
|
||||
|
||||
const tableData = ref()
|
||||
const tableData = ref([
|
||||
|
||||
])
|
||||
|
||||
// 在父页面中添加事件监听器
|
||||
window.addEventListener('message', function (event) {
|
||||
@@ -195,10 +206,10 @@ const sendKeysToIframe = (keyList: string[]) => {
|
||||
flex: 3.5;
|
||||
}
|
||||
|
||||
:deep(.el-card__body) {
|
||||
display: flex;
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
.bottom-container {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 0px;
|
||||
|
||||
.buttonBox {
|
||||
display: flex;
|
||||
@@ -212,4 +223,39 @@ const sendKeysToIframe = (keyList: string[]) => {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.tableBox {
|
||||
/* 必须:初始高度/overflow 配合动画 */
|
||||
overflow: hidden;
|
||||
/* 与表格高度一致,保证展开后高度正确 */
|
||||
height: 230px;
|
||||
// margin-top: 10px;
|
||||
}
|
||||
|
||||
/* 过渡动画核心样式 */
|
||||
.table-fade-enter-from,
|
||||
.table-fade-leave-to {
|
||||
/* 关闭时:高度收为0 + 透明度0 */
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.table-fade-enter-to,
|
||||
.table-fade-leave-from {
|
||||
/* 展开时:高度恢复 + 透明度1 */
|
||||
height: 230px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* 动画过渡时长 + 曲线(可自定义) */
|
||||
.table-fade-enter-active,
|
||||
.table-fade-leave-active {
|
||||
transition: all 0.3s ease;
|
||||
/* 防止动画过程中出现滚动条 */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 解决动画结束后瞬间闪回的问题 */
|
||||
.table-fade-enter-active {
|
||||
transition-delay: 0.05s;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -17,11 +17,20 @@
|
||||
<el-form-item label="页面排序" prop="sort">
|
||||
<el-input-number style="width: 100%" v-model.trim="form.sort" :min="0" :max="10000" :step="1" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="绑定页面">
|
||||
<el-select v-model="form.pagePath" filterable placeholder="请选择绑定页面" style="width: 100%" clearable>
|
||||
<el-option v-for="item in pageList" :key="item.path" :label="item.name" :value="item.path" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item label="是否激活">
|
||||
|
||||
<el-switch
|
||||
v-model="form.state"
|
||||
inline-prompt
|
||||
:disabled="form.pagePath == 'dashboard/index'"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" class="top">
|
||||
<el-input
|
||||
@@ -33,6 +42,7 @@
|
||||
v-model.trim="form.remark"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<div style="width: 100%; display: flex; justify-content: end">
|
||||
<el-button type="primary" icon="el-icon-Check" @click="onSubmit">保存</el-button>
|
||||
@@ -135,14 +145,17 @@ import { addDashboard, updateDashboard, queryById } from '@/api/system-boot/csst
|
||||
import html2canvas from 'html2canvas'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { getMenu } from '@/utils/router'
|
||||
|
||||
import { useNavTabs } from '@/stores/navTabs'
|
||||
// defineOptions({
|
||||
// name: 'cockpit/popup'
|
||||
// })
|
||||
const { go } = useRouter()
|
||||
const navTabs = useNavTabs()
|
||||
const { query } = useRoute()
|
||||
const router = useRouter()
|
||||
const height = mainHeight(108)
|
||||
const indicatorHeight = mainHeight(128)
|
||||
const height = mainHeight(148)
|
||||
const indicatorHeight = mainHeight(168)
|
||||
const rowHeight = ref(0)
|
||||
const pageList: any = ref([])
|
||||
const GridHeight = ref(0)
|
||||
@@ -153,7 +166,7 @@ const form: any = reactive({
|
||||
containerConfig: [],
|
||||
sort: '100',
|
||||
id: '',
|
||||
|
||||
state: 1,
|
||||
icon: '',
|
||||
pagePath: '',
|
||||
remark: '',
|
||||
@@ -209,6 +222,7 @@ const info = () => {
|
||||
form.sort = res.data.sort
|
||||
form.remark = res.data.remark
|
||||
form.id = res.data.id
|
||||
form.state = res.data.state
|
||||
form.icon = res.data.icon
|
||||
})
|
||||
} else {
|
||||
@@ -367,22 +381,28 @@ const onSubmit = () => {
|
||||
|
||||
if (valid) {
|
||||
if (form.id == '') {
|
||||
addDashboard({ ...form, containerConfig: JSON.stringify(layout.value), thumbnail: url }).then(
|
||||
(res: any) => {
|
||||
await addDashboard({ ...form, containerConfig: JSON.stringify(layout.value), thumbnail: url }).then(
|
||||
async (res: any) => {
|
||||
ElMessage.success('新增页面成功!')
|
||||
go(-1)
|
||||
getMenu()
|
||||
// go(-1)
|
||||
await getMenu()
|
||||
}
|
||||
)
|
||||
} else {
|
||||
updateDashboard({ ...form, containerConfig: JSON.stringify(layout.value), thumbnail: url }).then(
|
||||
(res: any) => {
|
||||
await updateDashboard({ ...form, containerConfig: JSON.stringify(layout.value), thumbnail: url }).then(
|
||||
async (res: any) => {
|
||||
ElMessage.success('修改页面成功!')
|
||||
go(-1)
|
||||
getMenu()
|
||||
// go(-1)
|
||||
await getMenu()
|
||||
}
|
||||
)
|
||||
}
|
||||
await setTimeout(() => {
|
||||
router.push({
|
||||
name: form.state == 1 ? form.pagePath : 'dashboard/index'
|
||||
})
|
||||
navTabs.refresh()
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -414,8 +434,9 @@ onBeforeUnmount(() => {
|
||||
justify-content: space-between;
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
// flex: 1;
|
||||
// align-items: center;
|
||||
width: 24%;
|
||||
.el-form-item__content {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
|
||||
Reference in New Issue
Block a user