Skip to content

Commit

Permalink
Merge branch 'mineadmin:main' into feat(select)
Browse files Browse the repository at this point in the history
  • Loading branch information
People-Sea authored Jul 15, 2024
2 parents 0989a51 + 6a7c0ac commit c55ceb4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/components/ma-crud/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -859,12 +859,12 @@ const initSearchColumns = () => crudSearchRef.value.initSearchColumns()
const getColumnService = (strictMode = true) => {
return new ColumnService({ columns: columns.value, cascaders: cascaders.value, dicts: dicts.value }, strictMode )
}

const setTableData = (data=[])=> tableData.value = data
defineExpose({
refresh, requestData, addAction, editAction, getTableData, setSelecteds,
getCurrentAction, getFormData, getFormColumns, getColumnService, getCurrentPage, getPageSize, getTotal,
requestParams, isRecovery, tableRef, initSearchColumns,
crudFormRef, crudSearchRef, crudImportRef, crudSettingRef
crudFormRef, crudSearchRef, crudImportRef, crudSettingRef, setTableData
})

</script>
Expand Down
7 changes: 5 additions & 2 deletions src/components/ma-crud/types/columns.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VNodeChild } from "vue";
import { VNodeChild,Ref } from "vue";

/**
* 表单组件类型
Expand Down Expand Up @@ -30,7 +30,9 @@ export type FormDataType =
| "user-info"
| "city-linkage"
| "form-group"
| "select-resource";
| "select-resource"
| 'component';

/**
* 列字典
*/
Expand Down Expand Up @@ -120,6 +122,7 @@ export interface BasicColumn {
searchPlaceholder?: string;
// 表格是否快捷编辑,只支持 input date select
quickEdit?: boolean;
component?:Ref;
//编辑|创建 通用规则
commonRules?: FieldRule | FieldRule[];
// 创建时规则
Expand Down
13 changes: 10 additions & 3 deletions src/layout/components/columns/ma-columns-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
>
<li
:class="`${classStyle}`"
@click="loadMenu(bigMenu, index)"
@click="() => {
keepAliveStore.menuLoader = false
loadMenu(bigMenu, index)
}"
>
<component v-if="bigMenu.meta.icon" :is="bigMenu.meta.icon" class="text-xl mt-1" />
<span
Expand Down Expand Up @@ -46,24 +49,27 @@
import { useRoute, useRouter } from 'vue-router'
import MaMenu from '../ma-menu.vue'

import { useAppStore, useUserStore } from '@/store'
import { useAppStore, useUserStore, useKeepAliveStore } from '@/store'

const route = useRoute()
const router = useRouter()

const MaMenuRef = ref(null)
const appStore = useAppStore()
const userStore = useUserStore()
const keepAliveStore = useKeepAliveStore()
const showMenu = ref(false)

const title = ref('')
const classStyle = ref('flex flex-col parent-menu items-center rounded mt-1 text-gray-200 hover:bg-gray-700 dark:hover:text-gray-50 dark:hover:bg-blackgray-1')

onMounted(() => {
keepAliveStore.menuLoader = true
initMenu(true)
})

watch(() => route, v => {
keepAliveStore.menuLoader = false
initMenu(false)
}, { deep: true })

Expand All @@ -74,6 +80,7 @@
} else {
current = 'home'
}
console.log(current)
if (userStore.routers && userStore.routers.length > 0) {
userStore.routers.map((item, index) => {
if (item.name == current) loadMenu(item, index, init)
Expand All @@ -87,7 +94,7 @@
return
}
if (bigMenu.children.length > 0) {
if (bigMenu.redirect && isInit) {
if (bigMenu.redirect && isInit && !keepAliveStore.menuLoader) {
router.push(bigMenu.redirect)
}
MaMenuRef.value.loadChildMenu(bigMenu)
Expand Down
12 changes: 9 additions & 3 deletions src/layout/components/mixed/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
<span class="ml-2 text-xl mt-2.5 hidden md:block">{{ $title }}</span>
</div>
<div class="flex justify-between w-full layout-banner">
<top-menu v-model="userStore.routers" :active="active" @go="loadMenu" ref="topMenuRef" />
<top-menu v-model="userStore.routers" :active="active" @go="(bigMenu, index) => {
keepAliveStore.menuLoader = false
loadMenu(bigMenu, index)
}" ref="topMenuRef" />
<ma-operation />
</div>
</a-layout-header>
Expand All @@ -42,7 +45,7 @@

<script setup>
import { ref, watch, onMounted } from 'vue'
import { useAppStore, useUserStore } from '@/store'
import { useAppStore, useUserStore, useKeepAliveStore } from '@/store'
import { useRoute, useRouter } from 'vue-router'
import ResizeObserver from 'resize-observer-polyfill'
import MaOperation from '../ma-operation.vue'
Expand All @@ -58,14 +61,17 @@
const MaMenuRef = ref(null)
const userStore = useUserStore()
const appStore = useAppStore()
const keepAliveStore = useKeepAliveStore()
const showMenu = ref(false)
const active = ref()

onMounted(() => {
keepAliveStore.menuLoader = true
initMenu(true)
})

watch(() => route, v => {
keepAliveStore.menuLoader = false
initMenu(false)
}, { deep: true })

Expand All @@ -88,7 +94,7 @@
return
}
if (bigMenu.children.length > 0) {
if (bigMenu.redirect && isInit) {
if (bigMenu.redirect && isInit && !keepAliveStore.menuLoader) {
router.push(bigMenu.redirect)
}
MaMenuRef.value.loadChildMenu(bigMenu)
Expand Down
3 changes: 2 additions & 1 deletion src/store/modules/keepAlive.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { defineStore } from 'pinia'
const useKeepAliveStore = defineStore('keepAlive', {
state: () => ({
keepAlives: [],
show: true
show: true,
menuLoader: false,
}),

getters: {
Expand Down

0 comments on commit c55ceb4

Please sign in to comment.