优化驾驶舱页面

This commit is contained in:
guanj
2025-12-20 23:44:46 +08:00
parent 7e4db9d4cd
commit cc0f8bc8b6
10 changed files with 770 additions and 456 deletions

View File

@@ -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;