Browse Source

K时日志

master
ctw 2 months ago
parent
commit
564db4b65d
  1. 60
      ruoyi-ui/src/views/childRoom/index.vue

60
ruoyi-ui/src/views/childRoom/index.vue

@ -331,6 +331,7 @@ import { listRoutes, getRoutes, addRoutes, updateRoutes, delRoutes } from "@/api
import { updateWaypoints } from "@/api/system/waypoints"; import { updateWaypoints } from "@/api/system/waypoints";
import { listLib,addLib,delLib} from "@/api/system/lib"; import { listLib,addLib,delLib} from "@/api/system/lib";
import { getRooms, updateRooms } from "@/api/system/rooms"; import { getRooms, updateRooms } from "@/api/system/rooms";
import { getMenuConfig, saveMenuConfig } from "@/api/system/userMenuConfig";
import PlatformImportDialog from "@/views/dialogs/PlatformImportDialog.vue"; import PlatformImportDialog from "@/views/dialogs/PlatformImportDialog.vue";
export default { export default {
name: 'MissionPlanningView', name: 'MissionPlanningView',
@ -544,8 +545,9 @@ export default {
this.isMenuHidden = true; this.isMenuHidden = true;
// //
this.isRightPanelHidden = true; this.isRightPanelHidden = true;
// //
this.menuItems = [...this.defaultMenuItems]; this.menuItems = [...this.defaultMenuItems];
this.loadUserMenuConfig();
// //
this.updateTime(); this.updateTime();
@ -1110,6 +1112,9 @@ export default {
return `${y}-${m}-${day} ${h}:${min}:${s}`; return `${y}-${m}-${day} ${h}:${min}:${s}`;
}, },
openKTimeSetDialog() { openKTimeSetDialog() {
console.log("当前登录 ID (myId):", this.$store.getters.id);
console.log("当前房间 ownerId:", this.roomDetail ? this.roomDetail.ownerId : '无房间信息');
console.log("当前角色 roles:", this.$store.getters.roles);
if (!this.canSetKTime) { if (!this.canSetKTime) {
this.$message.info('仅房主或管理员可设定或修改 K 时'); this.$message.info('仅房主或管理员可设定或修改 K 时');
return; return;
@ -1224,8 +1229,14 @@ export default {
this.isIconEditMode = false this.isIconEditMode = false
}, },
handleResetMenuItems() { async handleResetMenuItems() {
this.menuItems = [...this.defaultMenuItems] this.menuItems = [...this.defaultMenuItems]
try {
await saveMenuConfig({
menuItems: JSON.stringify(this.menuItems),
position: this.menuPosition || 'left'
})
} catch (e) { /* 未登录时仅本地恢复默认 */ }
}, },
updateMenuItems(newItems) { updateMenuItems(newItems) {
@ -1303,8 +1314,43 @@ export default {
} }
}, },
handleSaveMenuItems(savedItems) { async handleSaveMenuItems(savedItems) {
this.menuItems = [...savedItems] this.menuItems = [...savedItems]
//
try {
await saveMenuConfig({
menuItems: JSON.stringify(this.menuItems),
position: this.menuPosition || 'left'
})
} catch (e) {
// LeftMenu
if (e && e.response && e.response.status === 401) {
this.$message.info('当前未登录,配置仅在本页有效;登录后保存可同步到账号')
}
}
},
/** 加载当前用户的左侧菜单配置(登录且有过保存时生效) */
async loadUserMenuConfig() {
try {
const res = await getMenuConfig()
const data = res && res.data
if (!data) return
if (data.menuItems) {
let arr = []
try {
arr = typeof data.menuItems === 'string' ? JSON.parse(data.menuItems) : data.menuItems
} catch (e) { /* 解析失败保留默认 */ }
if (Array.isArray(arr) && arr.length > 0) {
this.menuItems = arr
}
}
if (data.position && ['left', 'top', 'bottom'].includes(data.position)) {
this.menuPosition = data.position
}
} catch (e) {
// 使
}
}, },
attributeEdit() { attributeEdit() {
@ -1413,9 +1459,15 @@ export default {
this.$message.success('外部参数保存成功'); this.$message.success('外部参数保存成功');
}, },
savePageLayout(position) { async savePageLayout(position) {
this.menuPosition = position; this.menuPosition = position;
this.$message.success(`菜单位置已设置为:${this.getPositionLabel(position)}`); this.$message.success(`菜单位置已设置为:${this.getPositionLabel(position)}`);
try {
await saveMenuConfig({
menuItems: JSON.stringify(this.menuItems),
position: this.menuPosition || 'left'
})
} catch (e) { /* 未登录时仅本地生效 */ }
}, },
getPositionLabel(position) { getPositionLabel(position) {

Loading…
Cancel
Save