bill 2 rokov pred
rodič
commit
db2796dc14

+ 14 - 15
src/components/main-panel/index.vue

@@ -3,14 +3,14 @@
     <UiEditorHead class="header">
       <slot name="header" />
     </UiEditorHead>
-    <slot/>
+    <slot />
 
     <Menu
       v-if="menus"
       :menu="menus"
-      :class="{fill: isFull}"
+      :class="{ fill: isFull }"
       :active-key="activeMenuKey"
-      @update:active-key="val => emit('update:activeMenuKey', val)"
+      @update:active-key="(val) => emit('update:activeMenuKey', val)"
     />
   </UiEditorLayout>
 </template>
@@ -18,24 +18,23 @@
 <script setup lang="ts">
 import UiEditorLayout from "@/components/base/editor/layout/index.vue";
 import UiEditorHead from "@/components/base/editor/layout/Head.vue";
-import Menu from '@/views/sys/menu'
-import {MenuAtom, MenuRaw} from "@/views/sys/menu/menu.js";
+import Menu from "@/views/sys/menu/index.vue";
+import { MenuAtom, MenuRaw } from "@/views/sys/menu/menu.js";
 import { customMap } from "@/hook/custom";
 import { computed } from "vue";
 
 const props = defineProps<{
-  menus?: MenuRaw,
-  activeMenuKey?: string,
+  menus?: MenuRaw;
+  activeMenuKey?: string;
 }>();
 const emit = defineEmits<{
-  (e: 'update:activeMenuKey', t: MenuAtom['name']): void
-}>()
+  (e: "update:activeMenuKey", t: MenuAtom["name"]): void;
+}>();
 
-const isFull = computed(() => customMap.sysView === 'full' )
+const isFull = computed(() => customMap.sysView === "full");
 const layoutClass = computed(() => ({
-  ["sys-view-full"]: isFull.value
-}))
-
+  ["sys-view-full"]: isFull.value,
+}));
 </script>
 
 <style scoped lang="scss">
@@ -62,7 +61,7 @@ const layoutClass = computed(() => ({
   left: 0;
   top: 0;
   margin: calc((var(--editor-head-height) - 42px) / 2)
-  calc((var(--editor-menu-width) - 42px) / 2);
+    calc((var(--editor-menu-width) - 42px) / 2);
   width: 42px;
   height: 42px;
   display: flex;
@@ -105,6 +104,6 @@ const layoutClass = computed(() => ({
 }
 
 .fill {
-  left: calc(-1 * var(--editor-menu-width))
+  left: calc(-1 * var(--editor-menu-width));
 }
 </style>

+ 5 - 1
src/views/graphic/menus.ts

@@ -262,7 +262,11 @@ export const generateMixMenus = <T extends {}, K extends keyof MenuRaw>(
       if (menu.onClick) {
         menu.onClick(menu);
       } else {
-        uiType.change(menu.key as any);
+        if (menu.key === uiType.current) {
+          uiType.change(null);
+        } else {
+          uiType.change(menu.key as any);
+        }
       }
     },
     () => uiType.current

+ 4 - 2
src/views/roads/tabulation.vue

@@ -138,6 +138,7 @@ import { downloadImage, uploadImage } from "@/store/sync";
 import { Mode } from "@/views/graphic/menus";
 import Message from "@/components/base/components/message/message.vue";
 import matruces from "@/utils/matruces";
+import { genUseLoading } from "@/hook";
 
 const roadPhoto = computed<RoadPhoto>(() => {
   let route, params, data;
@@ -225,7 +226,8 @@ const getLayoutImage = async () => {
   await downloadImage(blob, roadPhoto.value.id + ".jpg");
   return await uploadImage(blob);
 };
-const saveHandler = async () => {
+
+const saveHandler = genUseLoading(async () => {
   let index = 1;
   let prex = "未命名";
   while (true) {
@@ -252,7 +254,7 @@ const saveHandler = async () => {
     url: await getLayoutImage(),
   };
   router.replace({ name: writeRouteName.roads });
-};
+});
 </script>
 
 <style lang="scss" scoped>

+ 13 - 14
src/views/sys/menu/index.vue

@@ -4,11 +4,11 @@
     class="menu global-menu"
     :class="{ show: !isEdit, disabled: showToolbar, readonly: disabledGoto }"
   >
-<!--    <template #first v-if="!os.isPc">-->
-<!--      <div class="menu-close" @click="customMap.sysView = 'full'">-->
-<!--        <ui-icon type="close"></ui-icon>-->
-<!--      </div>-->
-<!--    </template>-->
+    <!--    <template #first v-if="!os.isPc">-->
+    <!--      <div class="menu-close" @click="customMap.sysView = 'full'">-->
+    <!--        <ui-icon type="close"></ui-icon>-->
+    <!--      </div>-->
+    <!--    </template>-->
 
     <template v-slot="{ raw }">
       <Item :menu="raw" :active="active" @select="gotoMenuItem">
@@ -32,12 +32,12 @@ import { currentApp } from "@/store/app";
 
 const props = defineProps<{
   disabledGoto?: boolean;
-  menu: MenuRaw
-  activeKey?: string
+  menu: MenuRaw;
+  activeKey?: string;
 }>();
 const emit = defineEmits<{
-  (e: "update:activeKey", v: MenuAtom['name']): void;
-}>()
+  (e: "update:activeKey", v: MenuAtom["name"]): void;
+}>();
 
 const gotoMenuItem = (item: MenuAtom) => {
   if (!props.disabledGoto) {
@@ -46,13 +46,13 @@ const gotoMenuItem = (item: MenuAtom) => {
     } else if (item.isRoute) {
       router.push({ name: item.name as string });
     }
-    emit('update:activeKey', item.name);
+    emit("update:activeKey", item.name);
   }
 };
 
 const active = computed(() =>
   findMenuLocals(
-    props.activeKey || router.currentRoute.value.name as string,
+    props.activeKey || (router.currentRoute.value.name as string),
     currentApp.menu.value.relation as any
   )
 );
@@ -67,7 +67,6 @@ const active = computed(() =>
   display: flex;
   flex-direction: column;
 
-
   .ui-editor-menu-item {
     position: relative;
   }
@@ -87,8 +86,8 @@ const active = computed(() =>
     }
   }
 }
-.global-menu ,.menu-children {
-
+.global-menu,
+.menu-children {
   .ui-menu-item span {
     font-size: 14px;
   }

+ 1 - 2
src/views/sys/menu/item/item.vue

@@ -6,8 +6,8 @@
       :refer="refer"
       dire="right-top"
       class="menu-children strengthen"
-      :class="{ show }"
       @enter="emit('enter')"
+      :class="{ show: show && active.includes(menuItem.name) }"
       @leave="emit('leave')"
     >
       <menu-child
@@ -60,7 +60,6 @@ const emit = defineEmits<{
   height: calc(100% - var(--editor-head-height));
   top: var(--editor-head-height) !important;
   z-index: -3 !important;
-
 }
 
 .menu-children.show {