Quellcode durchsuchen

角色管理模糊查询与应用隔离修改

ZL vor 2 Monaten
Ursprung
Commit
64e9a90f32

+ 2 - 2
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysRoleController.java

@@ -124,8 +124,8 @@ public class SysRoleController {
 	 * @param req
 	 * @return
 	 */
-//	@RequiresPermissions("system:role:list")
-	@PermissionData
+	@RequiresPermissions("system:role:list")
+//	@PermissionData
 	@RequestMapping(value = "/listByApp", method = RequestMethod.GET)
 	public Result<IPage<SysRole>> listByApp(SysRole role,
 												@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,

+ 18 - 13
jeecgboot-vue3/src/views/system/role/index.vue

@@ -54,17 +54,15 @@ const [registerDrawer, { openDrawer }] = useDrawer();
 const [registerIndexModal, { openModal: openIndexModal }] = useModal();
 const [rolePermissionDrawer, { openDrawer: openRolePermissionDrawer }] = useDrawer();
 const [registerDesc, { openDrawer: openRoleDesc }] = useDrawer();
-const isFirst = ref(true);
 const apps = ref([]);
 onMounted(async () => {
   apps.value = await appList();
 });
-watch(() => apps.value,(newVal) => {
-    if (newVal.length > 0) {
-      reload();
-    }
-  }
-);
+watch(apps, () => loadData());
+
+function loadData() {
+  reload();
+}
 
 // 列表页面公共参数、方法
 const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
@@ -75,7 +73,6 @@ const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
     columns: columns,
     striped: true,
     immediate: false,
-    
     formConfig: {
       labelWidth: 65,
       rowProps: { gutter: 24 },
@@ -90,13 +87,21 @@ const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
       column: 'createTime',
       order: 'desc',
     },
-    beforeFetch: async (params) => {
-      if (isFirst.value) {
-        params.appId = apps.value[0].id;
-        isFirst.value = false;
+    beforeFetch: (params) => {
+      if (params.appId == null && apps.value.length > 0) {
+        const ids = apps.value.map((item) => item.id);
+        const idsString = ids.join(',');
+        params.appId = idsString;
+      }
+      //模糊查询
+      if(params.roleName){
+        params.roleName ='*'+ params.roleName.trim()+'*';
       }
+      if(params.roleCode){
+        params.roleCode ='*'+ params.roleCode.trim()+'*';
+      } 
     },
-    afterFetch: async (record) => {
+    afterFetch: (record) => {
       const app = apps.value;
       record.forEach((item) => {
         // 获取当前角色的appName