3 Commits cddd3fb34a ... e3bf435e53

Author SHA1 Message Date
  ZL e3bf435e53 Merge branch 'dev' into ZL 1 week ago
  ZL c1418a1570 #13598 修复点击更多时的选中记录数量问题 1 week ago
  ZL 83e3771c8f 代码保存 2 weeks ago

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

@@ -476,10 +476,11 @@ public class SysRoleController {
 		//------------------------------------------------------------------------------------------------
 		
 		// Step.1 组装查询条件
-		QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
+//		QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
+		String ids = request.getParameter("ids");
 		//Step.2 AutoPoi 导出Excel
 		ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-		List<SysRole> pageList = sysRoleService.listExport(sysRole);
+		List<SysRole> pageList = sysRoleService.listExport(sysRole,ids);
 		//导出文件名称
 		mv.addObject(NormalExcelConstants.FILE_NAME,"角色列表");
 		mv.addObject(NormalExcelConstants.CLASS,SysRole.class);

+ 1 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/SysRoleMapper.java

@@ -76,7 +76,7 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
     @Select("select count(*) from sys_role where id=#{id} and tenant_id=#{tenantId}")
     Long getRoleCountByTenantId(@Param("id") String id, @Param("tenantId") Integer tenantId);
 
-    List<SysRole> listExport(@Param("role") SysRole role);
+    List<SysRole> listExport(@Param("role") SysRole role, @Param("ids")String ids);
 
     List<String> listRoleIdsByAppId(@Param("appId") String appId);
 

+ 3 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysRoleMapper.xml

@@ -57,6 +57,9 @@
         INNER JOIN
         app_base_info sa ON r.app_id = sa.id
         WHERE 1=1
+          <if test="ids!=null">
+            AND r.id in (#{ids})
+        </if>
         <if test="role.appId!=null">
             AND r.app_id = #{role.appId}
         </if>

+ 1 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysRoleService.java

@@ -80,5 +80,5 @@ public interface ISysRoleService extends IService<SysRole> {
      */
     void checkAdminRoleRejectDel(String ids);
 
-    List<SysRole> listExport(SysRole role);
+    List<SysRole> listExport(SysRole role,String ids);
 }

+ 2 - 2
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysRoleServiceImpl.java

@@ -135,7 +135,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
     }
 
     @Override
-    public List<SysRole> listExport(SysRole role) {
-        return sysRoleMapper.listExport(role);
+    public List<SysRole> listExport(SysRole role, String ids) {
+        return sysRoleMapper.listExport(role,ids);
     }
 }

+ 2 - 1
jeecgboot-vue3/src/views/system/role/components/RoleUserTable.vue

@@ -157,7 +157,8 @@ async function handleEdit(record: Recordable) {
  */
 async function handleDelete(record) {
   await deleteUserRole({ userId: record.id, roleId: roleId.value }, () => {
-    setSelectedRowKeys([]);
+    const updatedKeys = getSelectRowKeys().filter(key => key !== record.id);
+    setSelectedRowKeys(updatedKeys);
     reload()});
 }
 

+ 11 - 2
jeecgboot-vue3/src/views/system/role/index.vue

@@ -113,7 +113,10 @@ const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
   },
   exportConfig: {
     name: '角色列表',
-    url: getExportUrl,
+    url: ()=>{
+      const ids = encodeURIComponent(JSON.stringify(selectedRowKeys))
+      return `${getExportUrl}?ids=${ids}`;
+    },
   },
   importConfig: {
     url: getImportUrl,
@@ -154,7 +157,13 @@ function handleDetail(record) {
  * 删除事件
  */
 async function handleDelete(record) {
-  await deleteRole({ id: record.id }, reload);
+  await deleteRole({ id: record.id }, () => {
+    const index = selectedRowKeys.value.indexOf(record.id);
+    if (index > -1) {
+      selectedRowKeys.value.splice(index, 1);
+    }
+    reload();
+  });
 }
 /**
  * 批量删除事件