diff --git a/admin/src/enums/pageEnum.ts b/admin/src/enums/pageEnum.ts
index 89e6525fcb3ea2755b8f7893544aea909c8d62f5..57cee08b703103ada50487b02e62c90d3c34dc10 100644
--- a/admin/src/enums/pageEnum.ts
+++ b/admin/src/enums/pageEnum.ts
@@ -5,5 +5,7 @@ export enum PageEnum {
ERROR_403 = '/403',
// 404
ERROR_404 = '/:pathMatch(.*)*',
- INDEX = '/'
+ INDEX = '/',
+ //重定向
+ REDIRECT = '/redirect'
}
diff --git a/admin/src/layout/default/components/header/multiple-tabs.vue b/admin/src/layout/default/components/header/multiple-tabs.vue
index 16a5d48f7a6aba87ac8403b4c9ae22d5894584b0..7963ef0f316d66b47bb7a0619a1788297ab157ef 100644
--- a/admin/src/layout/default/components/header/multiple-tabs.vue
+++ b/admin/src/layout/default/components/header/multiple-tabs.vue
@@ -12,18 +12,43 @@
-
-
-
-
-
-
- 关闭当前
- 关闭其他
- 关闭全部
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -31,6 +56,15 @@
import useMultipleTabs from '@/hooks/useMultipleTabs'
import { useWatchRoute } from '@/hooks/useWatchRoute'
import useTabsStore, { getRouteParams } from '@/stores/modules/multipleTabs'
+
+const state = reactive({
+ visible: false,
+ top: 0,
+ left: 0
+})
+
+const instance = getCurrentInstance()
+const { proxy } = instance as any
const router = useRouter()
const tabsStore = useTabsStore()
const { removeOtherTab, addTab, removeAllTab, removeTab, tabsLists, currentTab } = useMultipleTabs()
@@ -54,8 +88,43 @@ const handleCommand = (command: any) => {
case 'closeAll':
removeAllTab()
break
+ case 'refresh':
+ tabsStore.reRefreshTab(route.path, router)
+ break
}
}
+watch(() => state.visible, (value) => {
+ if (value) {
+ document.body.addEventListener('click', closeMenu)
+ } else {
+ document.body.removeEventListener('click', closeMenu)
+ }
+})
+const openMenu = (e: MouseEvent) => {
+ e.preventDefault(); //防止默认菜单弹出
+ const menuMinWidth = 73
+ const offsetWidth = proxy.$el.offsetWidth // container width
+ const maxLeft = offsetWidth - menuMinWidth // left boundary
+ const left = e.clientX + 5 // 15: margin right
+ if (left > maxLeft) {
+ state.left = maxLeft
+ } else {
+ state.left = left
+ }
+ state.top = e.clientY
+ state.visible = true
+ console.log(currentTab.value)
+}
+const closeMenu = () => {
+ state.visible = false
+}
+onMounted(() => {
+ closeMenu()
+})
+
+onBeforeUnmount(() => {
+ closeMenu()
+})
diff --git a/admin/src/router/routes.ts b/admin/src/router/routes.ts
index dc91f60bc29ab04b65a1fbf43099a455947e2169..b7ca82aaab955a3e4103a558afc03c9cac7a1510 100644
--- a/admin/src/router/routes.ts
+++ b/admin/src/router/routes.ts
@@ -8,7 +8,7 @@
icon: 'icon-name' // 设置该路由的图标
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
query: '{"id": 1}' // 访问路由的默认传递参数
- hidden: true // 当设置 true 的时候该路由不会在侧边栏出现
+ hidden: true // 当设置 true 的时候该路由不会在侧边栏出现
hideTab: true //当设置 true 的时候该路由不会在多标签tab栏出现
}
*/
@@ -22,6 +22,10 @@ export const LAYOUT = () => Promise.resolve(Layout)
export const INDEX_ROUTE_NAME = Symbol()
export const constantRoutes: Array = [
+ {
+ path: PageEnum.REDIRECT + '/:path(.*)',
+ component: () => import( '@/views/redirect/index.vue')
+ },
{
path: PageEnum.ERROR_404,
component: () => import('@/views/error/404.vue')
diff --git a/admin/src/stores/modules/multipleTabs.ts b/admin/src/stores/modules/multipleTabs.ts
index b14e36649d384d46055a976548a95f1533327b9b..3fc194b08304d1740d676c939ee8e9fb274992fa 100644
--- a/admin/src/stores/modules/multipleTabs.ts
+++ b/admin/src/stores/modules/multipleTabs.ts
@@ -162,7 +162,21 @@ const useTabsStore = defineStore({
this.tabList = []
this.clearCache()
push(PageEnum.INDEX)
- }
+ },
+ reRefreshTab(path: string, router: Router) {
+ const { push } = router
+ const index = findTabsIndex(path, this.tabList)
+ let toTab: TabItem = this.tabList[index]
+
+ const toRoute = getRouteParams(toTab)
+ push(toRoute)
+
+ nextTick(() => {
+ router.replace({ path: '/redirect' + path }).catch(err => {
+ console.warn(err)
+ })
+ })
+ }
}
})
diff --git a/admin/src/views/organization/department/edit.vue b/admin/src/views/organization/department/edit.vue
index 70b5e5841221edf54922faddad35358688e71675..3dec91d10fa8009e8370f6e0759bb40dbf8cd6a9 100644
--- a/admin/src/views/organization/department/edit.vue
+++ b/admin/src/views/organization/department/edit.vue
@@ -125,6 +125,12 @@ const { optionsData } = useDictOptions<{
}
})
+watch(optionsData, (arr) => {
+ if (arr.dept) {
+ formData.pid = arr.dept[0].id
+ }
+})
+
const handleSubmit = async () => {
await formRef.value?.validate()
mode.value == 'edit' ? await deptEdit(formData) : await deptAdd(formData)
diff --git a/admin/src/views/redirect/index.vue b/admin/src/views/redirect/index.vue
new file mode 100644
index 0000000000000000000000000000000000000000..1ffbd165f54f5456a00240fa841285d5b1780567
--- /dev/null
+++ b/admin/src/views/redirect/index.vue
@@ -0,0 +1,29 @@
+
+
+
diff --git a/admin/src/views/setting/search/index.vue b/admin/src/views/setting/search/index.vue
index 691faad53807f5a5977342646b516a05ea454b32..55032b24b832c5b71b077d7d953c1bcbc1401bd5 100644
--- a/admin/src/views/setting/search/index.vue
+++ b/admin/src/views/setting/search/index.vue
@@ -166,6 +166,7 @@ getData()
margin: 0 6px 6px 0;
display: inline-block;
background-color: #f4f4f4;
+ word-break: break-all;
}
}
}
diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/system/impl/SystemAuthDeptServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/system/impl/SystemAuthDeptServiceImpl.java
index b9afdde126c5d8060db449dc1aa6ddf0c68fd8fe..33f9c1dcb5011375c98780792b5d88f217c647bb 100644
--- a/server/like-admin/src/main/java/com/mdd/admin/service/system/impl/SystemAuthDeptServiceImpl.java
+++ b/server/like-admin/src/main/java/com/mdd/admin/service/system/impl/SystemAuthDeptServiceImpl.java
@@ -14,6 +14,7 @@ import com.mdd.common.utils.ArrayUtil;
import com.mdd.common.utils.TimeUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
@@ -159,6 +160,7 @@ class SystemAuthDeptServiceImpl implements ISystemAuthDeptService {
* @author fzr
* @param systemAuthDeptParam 参数
*/
+ @Transactional(rollbackFor = Exception.class)
@Override
public void edit(SystemAuthDeptParam systemAuthDeptParam) {
SystemAuthDept model = systemAuthDeptMapper.selectOne(
@@ -182,6 +184,8 @@ class SystemAuthDeptServiceImpl implements ISystemAuthDeptService {
model.setIsStop(systemAuthDeptParam.getIsStop());
model.setUpdateTime(System.currentTimeMillis() / 1000);
systemAuthDeptMapper.updateById(model);
+ //级联更新自己状态
+ systemAuthDeptMapper.updateChilder(systemAuthDeptParam.getIsStop(),model.getId());
}
/**
diff --git a/server/like-common/src/main/java/com/mdd/common/mapper/system/SystemAuthDeptMapper.java b/server/like-common/src/main/java/com/mdd/common/mapper/system/SystemAuthDeptMapper.java
index 68e8dcc433f2b920052a874d435afd47ec3d6fd6..a975ba704e20bd654ebefd9a87719ac9d9a53dc1 100644
--- a/server/like-common/src/main/java/com/mdd/common/mapper/system/SystemAuthDeptMapper.java
+++ b/server/like-common/src/main/java/com/mdd/common/mapper/system/SystemAuthDeptMapper.java
@@ -3,10 +3,29 @@ package com.mdd.common.mapper.system;
import com.mdd.common.core.basics.IBaseMapper;
import com.mdd.common.entity.system.SystemAuthDept;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Update;
/**
* 系统岗位Mapper
*/
@Mapper
public interface SystemAuthDeptMapper extends IBaseMapper {
+
+ /**
+ * 级联更新部门状态
+ * @param stopStatus
+ * @param id
+ * @return
+ */
+ @Update(value = "WITH recursive temp AS (SELECT id, pid\n"
+ + " FROM la_system_auth_dept\n"
+ + " WHERE id = #{id}\n" + " UNION ALL\n"
+ + " SELECT u.id, u.pid\n"
+ + " FROM la_system_auth_dept u,\n"
+ + " temp t\n"
+ + " WHERE u.pid = t.id and u.is_stop <> #{stopStatus})\n"
+ + "update la_system_auth_dept set is_stop = #{stopStatus}\n"
+ + "where id in (select id from temp)")
+ void updateChilder(@Param("stopStatus") int stopStatus, @Param("id") Integer id);
}