Browse Source

菜单点击打开新窗口

pengjing 9 months ago
parent
commit
f3b0720d4e

+ 5 - 1
doc/待更新脚本

@@ -17,4 +17,8 @@ insert into sys_role_sys_function_code (`RoleID`, `FunctionCode`) values('20afde
 -- 2024-5-29 求职人员数据可视化地图菜单与权限
 INSERT INTO sys_function_code VALUES ('T011003', '求职人员数据可视化地图', 'T0110', 3);
 INSERT INTO `sys_menu` VALUES ('T011003', 3, '求职人员数据可视化地图', NULL, 'views/dataMap/jobUserDataMap', '/jobUserDataMap', 'T0110', NULL, 0, 1, 1, 'T011003', 1, NULL);
-insert into sys_role_sys_function_code (`RoleID`, `FunctionCode`) values('20afde90-a81a-11ed-a6c5-7085c2a9999e','T011003');
+insert into sys_role_sys_function_code (`RoleID`, `FunctionCode`) values('20afde90-a81a-11ed-a6c5-7085c2a9999e','T011003');
+
+-- 2024.5.31
+alter table sys_menu add IsBlank tinyint(1);
+update sys_menu set IsBlank=1 where MenuNo='T011001';

+ 1 - 0
src/main/java/com/hz/employmentsite/controller/AccountController.java

@@ -138,6 +138,7 @@ public class AccountController {
             nm.setIsShow(m.getIsVisible());
             nm.setHideInMenu(!m.getIsVisible());//无效则隐藏当前菜单
             nm.setHideChildrenInMenu(m.getIsLeaf());//叶子节点不显示子菜单
+            nm.isBlank = m.getIsBlank();
 
             if (StringUtils.isNotBlank(nm.getRouter())) {
                 if (nm.getParentId().equals("T01")) {

+ 10 - 0
src/main/java/com/hz/employmentsite/model/SysMenu.java

@@ -29,6 +29,8 @@ public class SysMenu {
 
     private String shortcutIcon;
 
+    private Boolean isBlank;
+
     public String getMenuNo() {
         return menuNo;
     }
@@ -140,4 +142,12 @@ public class SysMenu {
     public void setShortcutIcon(String shortcutIcon) {
         this.shortcutIcon = shortcutIcon == null ? null : shortcutIcon.trim();
     }
+
+    public Boolean getIsBlank() {
+        return isBlank;
+    }
+
+    public void setIsBlank(Boolean isBlank) {
+        this.isBlank = isBlank;
+    }
 }

+ 60 - 0
src/main/java/com/hz/employmentsite/model/SysMenuExample.java

@@ -1033,6 +1033,66 @@ public class SysMenuExample {
             addCriterion("ShortcutIcon not between", value1, value2, "shortcutIcon");
             return (Criteria) this;
         }
+
+        public Criteria andIsBlankIsNull() {
+            addCriterion("IsBlank is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankIsNotNull() {
+            addCriterion("IsBlank is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankEqualTo(Boolean value) {
+            addCriterion("IsBlank =", value, "isBlank");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankNotEqualTo(Boolean value) {
+            addCriterion("IsBlank <>", value, "isBlank");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankGreaterThan(Boolean value) {
+            addCriterion("IsBlank >", value, "isBlank");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankGreaterThanOrEqualTo(Boolean value) {
+            addCriterion("IsBlank >=", value, "isBlank");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankLessThan(Boolean value) {
+            addCriterion("IsBlank <", value, "isBlank");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankLessThanOrEqualTo(Boolean value) {
+            addCriterion("IsBlank <=", value, "isBlank");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankIn(List<Boolean> values) {
+            addCriterion("IsBlank in", values, "isBlank");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankNotIn(List<Boolean> values) {
+            addCriterion("IsBlank not in", values, "isBlank");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankBetween(Boolean value1, Boolean value2) {
+            addCriterion("IsBlank between", value1, value2, "isBlank");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsBlankNotBetween(Boolean value1, Boolean value2) {
+            addCriterion("IsBlank not between", value1, value2, "isBlank");
+            return (Criteria) this;
+        }
     }
 
     public static class Criteria extends GeneratedCriteria {

+ 1 - 0
src/main/java/com/hz/employmentsite/vo/MenuData.java

@@ -18,4 +18,5 @@ public class MenuData {
     private Boolean isShow;
     private Boolean hideInMenu;
     private boolean hideChildrenInMenu;
+    public Boolean isBlank;
 }

+ 2 - 1
src/main/resources/generatorConfig.xml

@@ -25,7 +25,7 @@
         -->
         <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                         connectionURL="jdbc:mysql://192.168.0.68:3306/employmentsitedb?useSSL=false" userId="root"
-                        password="bowin123">
+                        password="bowin@123">
 
         </jdbcConnection>
 
@@ -111,5 +111,6 @@
         <!--<table schema="" tableName="wx_qrcode"><property name="useActualColumnNames" value="true"/></table>
         <table schema="" tableName="wx_qrcode_scan_record"><property name="useActualColumnNames" value="true"/></table>-->
 
+
     </context>
 </generatorConfiguration>

+ 22 - 5
src/main/resources/mapping/SysMenuMapper.xml

@@ -16,6 +16,7 @@
     <result column="FunctionCode" jdbcType="VARCHAR" property="functionCode" />
     <result column="RecordStatus" jdbcType="INTEGER" property="recordStatus" />
     <result column="ShortcutIcon" jdbcType="VARCHAR" property="shortcutIcon" />
+    <result column="IsBlank" jdbcType="BIT" property="isBlank" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <where>
@@ -77,7 +78,7 @@
   </sql>
   <sql id="Base_Column_List">
     MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, 
-    IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon
+    IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon, IsBlank
   </sql>
   <select id="selectByExample" parameterType="com.hz.employmentsite.model.SysMenuExample" resultMap="BaseResultMap">
     select
@@ -114,12 +115,14 @@
       Icon, ViewPath, Url, 
       ParentMenuNo, Description, IsTopMenu, 
       IsVisible, IsLeaf, FunctionCode, 
-      RecordStatus, ShortcutIcon)
+      RecordStatus, ShortcutIcon, IsBlank
+      )
     values (#{menuNo,jdbcType=VARCHAR}, #{orderNo,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, 
       #{icon,jdbcType=VARCHAR}, #{viewPath,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, 
       #{parentMenuNo,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{isTopMenu,jdbcType=BIT}, 
       #{isVisible,jdbcType=BIT}, #{isLeaf,jdbcType=BIT}, #{functionCode,jdbcType=VARCHAR}, 
-      #{recordStatus,jdbcType=INTEGER}, #{shortcutIcon,jdbcType=VARCHAR})
+      #{recordStatus,jdbcType=INTEGER}, #{shortcutIcon,jdbcType=VARCHAR}, #{isBlank,jdbcType=BIT}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.hz.employmentsite.model.SysMenu">
     insert into sys_menu
@@ -166,6 +169,9 @@
       <if test="shortcutIcon != null">
         ShortcutIcon,
       </if>
+      <if test="isBlank != null">
+        IsBlank,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="menuNo != null">
@@ -210,6 +216,9 @@
       <if test="shortcutIcon != null">
         #{shortcutIcon,jdbcType=VARCHAR},
       </if>
+      <if test="isBlank != null">
+        #{isBlank,jdbcType=BIT},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.hz.employmentsite.model.SysMenuExample" resultType="java.lang.Long">
@@ -263,6 +272,9 @@
       <if test="row.shortcutIcon != null">
         ShortcutIcon = #{row.shortcutIcon,jdbcType=VARCHAR},
       </if>
+      <if test="row.isBlank != null">
+        IsBlank = #{row.isBlank,jdbcType=BIT},
+      </if>
     </set>
     <if test="example != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -283,7 +295,8 @@
       IsLeaf = #{row.isLeaf,jdbcType=BIT},
       FunctionCode = #{row.functionCode,jdbcType=VARCHAR},
       RecordStatus = #{row.recordStatus,jdbcType=INTEGER},
-      ShortcutIcon = #{row.shortcutIcon,jdbcType=VARCHAR}
+      ShortcutIcon = #{row.shortcutIcon,jdbcType=VARCHAR},
+      IsBlank = #{row.isBlank,jdbcType=BIT}
     <if test="example != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -330,6 +343,9 @@
       <if test="shortcutIcon != null">
         ShortcutIcon = #{shortcutIcon,jdbcType=VARCHAR},
       </if>
+      <if test="isBlank != null">
+        IsBlank = #{isBlank,jdbcType=BIT},
+      </if>
     </set>
     where MenuNo = #{menuNo,jdbcType=VARCHAR}
   </update>
@@ -347,7 +363,8 @@
       IsLeaf = #{isLeaf,jdbcType=BIT},
       FunctionCode = #{functionCode,jdbcType=VARCHAR},
       RecordStatus = #{recordStatus,jdbcType=INTEGER},
-      ShortcutIcon = #{shortcutIcon,jdbcType=VARCHAR}
+      ShortcutIcon = #{shortcutIcon,jdbcType=VARCHAR},
+      IsBlank = #{isBlank,jdbcType=BIT}
     where MenuNo = #{menuNo,jdbcType=VARCHAR}
   </update>
 </mapper>

+ 1 - 1
src/main/resources/mapping/cquery/SysUserCQuery.xml

@@ -144,7 +144,7 @@
     </select>
 
     <select id="selectUserMenuList" resultType="com.hz.employmentsite.model.SysMenu">
-        select distinct mu.menuNo,mu.orderNo,mu.menuName,mu.icon,mu.viewPath,mu.url,mu.parentMenuNo,mu.isTopMenu,mu.isVisible,mu.isLeaf,mu.functionCode
+        select distinct mu.menuNo,mu.orderNo,mu.menuName,mu.icon,mu.viewPath,mu.url,mu.parentMenuNo,mu.isTopMenu,mu.isVisible,mu.isLeaf,mu.functionCode,mu.isBlank
         from sys_menu mu
                              inner join (
             with recursive type_cte as (

+ 1 - 0
vue/src/api/account/model.d.ts

@@ -17,6 +17,7 @@ declare namespace API {
     isShow: boolean;
     hideInMenu: boolean;
     hideChildrenInMenu: boolean;
+    isBlank: boolean;
   };
 
   type PermMenu = {

+ 1 - 1
vue/src/layout/menu/menu-item.vue

@@ -17,7 +17,7 @@
   </template>
   <!-- 菜单 -->
   <template v-else>
-    <Menu.Item :key="props.menuInfo?.name" :menuname="props.menuInfo?.meta?.title">
+    <Menu.Item :key="props.menuInfo?.name" :menuname="props.menuInfo?.meta?.title" :isBlank="props.menuInfo?.meta?.isBlank">
 <!--      <icon-font :type="props.menuInfo?.meta?.icon" />-->
       <component :is="$antIcons[props.menuInfo.meta?.icon]" />
       <TitleI18n :title="props.menuInfo?.meta?.title" />

+ 17 - 4
vue/src/layout/menu/menu.vue

@@ -102,16 +102,29 @@
   );
 
   // 点击菜单
-  const clickMenuItem = ({ item,key }) => {
+  const clickMenuItem = ({ item, key }) => {
     if (key === currentRoute.name) return;
     if (/http(s)?:/.test(key)) {
       window.open(key);
     } else {
-      router.push({ name: key });
+      if (item.isBlank === true) {
+        const href = location.href;
+        let urls = [];
+        if (href.indexOf('#') != -1) {
+          const index = href.indexOf('#');
+          urls = [href.slice(0, index) as never, href.slice(index + 1) as never];
+        } else {
+          urls = [href as never];
+        }
+
+        window.open(`${urls[0]}#${key}`);
+      } else {
+        router.push({ name: key });
+      }
     }
 
-    if(item.menuname){
-      save(item.menuname,key,"点击菜单");
+    if (item.menuname) {
+      save(item.menuname, key, '点击菜单');
     }
   };
 </script>

+ 3 - 2
vue/src/router/generator-router.tsx

@@ -24,7 +24,7 @@ export function filterAsyncRoute(
   return routes
     .filter((item) => item.type !== 2 && item.parentId == parentRoute?.id)
     .map((item) => {
-      const {id, router, viewPath, name, icon, orderNum, keepalive} = item;
+      const { id, router, viewPath, name, icon, orderNum, keepalive, isBlank } = item;
 
       let fullPath = '';
       const pathPrefix = lastNamePath.at(-1) || '';
@@ -58,7 +58,8 @@ export function filterAsyncRoute(
           namePath: lastNamePath.concat(fullPath),
           keepAlive: keepalive,
           hideInMenu: item.hideInMenu,
-          hideChildrenInMenu: item.hideChildrenInMenu
+          hideChildrenInMenu: item.hideChildrenInMenu,
+          isBlank,
         },
       };
 

+ 10 - 1
vue/src/router/outsideLayout.ts

@@ -13,4 +13,13 @@ export const LoginRoute: RouteRecordRaw = {
   },
 };
 
-export default [LoginRoute];
+export const companyDataMapRoute: RouteRecordRaw = {
+  path: '/dataMap/companyDataMap',
+  name: 'dataMap_companyDataMap',
+  component: () => import('@/views/dataMap/companyDataMap.vue'),
+  meta: {
+    title: '惠州市就业驿站管理系统',
+  },
+};
+
+export default [LoginRoute, companyDataMapRoute];