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