Forráskód Böngészése

Merge branch 'dev' of http://94.191.59.107:3000/wukai/lzga-doc into dev

# Conflicts:
#	lzga-ui/src/router/index.js
yxc 2 éve
szülő
commit
e8ab885f30

+ 30 - 16
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocGroupUserController.java

@@ -4,6 +4,11 @@ import java.util.List;
 import java.io.IOException;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+
+import com.jjt.common.security.utils.SecurityUtils;
+import com.jjt.doc.domain.DocGroup;
+import com.jjt.doc.service.IDocGroupService;
+import com.jjt.system.api.domain.SysUser;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -24,37 +29,50 @@ import com.jjt.common.core.web.page.TableDataInfo;
 
 /**
  * 分组成员Controller
- * 
+ *
  * @author wukai
  * @date 2023-04-20
  */
 @RestController
 @RequestMapping("/groupUser")
-public class DocGroupUserController extends BaseController
-{
+public class DocGroupUserController extends BaseController {
     @Resource
     private IDocGroupUserService docGroupUserService;
+    @Resource
+    private IDocGroupService groupService;
 
     /**
      * 查询分组成员列表
      */
     @RequiresPermissions("doc:groupUser:list")
     @GetMapping("/list")
-    public TableDataInfo list(DocGroupUser docGroupUser)
-    {
+    public TableDataInfo list(DocGroupUser docGroupUser) {
         startPage();
+        //通过登录账号查询分组
+        DocGroup group = new DocGroup();
+        group.setGroupManager(SecurityUtils.getUserId());
         List<DocGroupUser> list = docGroupUserService.selectDocGroupUserList(docGroupUser);
         return getDataTable(list);
     }
 
     /**
+     * 查询未分配成员列表
+     */
+    @RequiresPermissions("system:role:list")
+    @GetMapping("/unallocatedList")
+    public TableDataInfo unallocatedList(DocGroupUser docGroupUser) {
+        startPage();
+        List<SysUser> list = docGroupUserService.selectUnallocatedList(docGroupUser);
+        return getDataTable(list);
+    }
+
+    /**
      * 导出分组成员列表
      */
     @RequiresPermissions("doc:groupUser:export")
     @Log(title = "分组成员", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, DocGroupUser docGroupUser)
-    {
+    public void export(HttpServletResponse response, DocGroupUser docGroupUser) {
         List<DocGroupUser> list = docGroupUserService.selectDocGroupUserList(docGroupUser);
         ExcelUtil<DocGroupUser> util = new ExcelUtil<DocGroupUser>(DocGroupUser.class);
         util.exportExcel(response, list, "分组成员数据");
@@ -65,8 +83,7 @@ public class DocGroupUserController extends BaseController
      */
     @RequiresPermissions("doc:groupUser:query")
     @GetMapping(value = "/{groupId}")
-    public AjaxResult getInfo(@PathVariable("groupId") Long groupId)
-    {
+    public AjaxResult getInfo(@PathVariable("groupId") Long groupId) {
         return success(docGroupUserService.selectDocGroupUserByGroupId(groupId));
     }
 
@@ -76,8 +93,7 @@ public class DocGroupUserController extends BaseController
     @RequiresPermissions("doc:groupUser:add")
     @Log(title = "分组成员", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody DocGroupUser docGroupUser)
-    {
+    public AjaxResult add(@RequestBody DocGroupUser docGroupUser) {
         return toAjax(docGroupUserService.insertDocGroupUser(docGroupUser));
     }
 
@@ -87,8 +103,7 @@ public class DocGroupUserController extends BaseController
     @RequiresPermissions("doc:groupUser:edit")
     @Log(title = "分组成员", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody DocGroupUser docGroupUser)
-    {
+    public AjaxResult edit(@RequestBody DocGroupUser docGroupUser) {
         return toAjax(docGroupUserService.updateDocGroupUser(docGroupUser));
     }
 
@@ -97,9 +112,8 @@ public class DocGroupUserController extends BaseController
      */
     @RequiresPermissions("doc:groupUser:remove")
     @Log(title = "分组成员", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{groupIds}")
-    public AjaxResult remove(@PathVariable Long[] groupIds)
-    {
+    @DeleteMapping("/{groupIds}")
+    public AjaxResult remove(@PathVariable Long[] groupIds) {
         return toAjax(docGroupUserService.deleteDocGroupUserByGroupIds(groupIds));
     }
 }

+ 7 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocGroupUserMapper.java

@@ -2,6 +2,7 @@ package com.jjt.doc.mapper;
 
 import java.util.List;
 import com.jjt.doc.domain.DocGroupUser;
+import com.jjt.system.api.domain.SysUser;
 
 /**
  * 分组成员Mapper接口
@@ -58,4 +59,10 @@ public interface DocGroupUserMapper
      * @return 结果
      */
     public int deleteDocGroupUserByGroupIds(Long[] groupIds);
+    /**
+     * 查询未分配成员列表
+     *
+     * @param docGroupUser
+     */
+    List<SysUser> selectUnallocatedList(DocGroupUser docGroupUser);
 }

+ 15 - 9
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocGroupUserService.java

@@ -1,19 +1,20 @@
 package com.jjt.doc.service;
 
 import java.util.List;
+
 import com.jjt.doc.domain.DocGroupUser;
+import com.jjt.system.api.domain.SysUser;
 
 /**
  * 分组成员Service接口
- * 
+ *
  * @author wukai
  * @date 2023-04-20
  */
-public interface IDocGroupUserService 
-{
+public interface IDocGroupUserService {
     /**
      * 查询分组成员
-     * 
+     *
      * @param groupId 分组成员主键
      * @return 分组成员
      */
@@ -21,7 +22,7 @@ public interface IDocGroupUserService
 
     /**
      * 查询分组成员列表
-     * 
+     *
      * @param docGroupUser 分组成员
      * @return 分组成员集合
      */
@@ -29,7 +30,7 @@ public interface IDocGroupUserService
 
     /**
      * 新增分组成员
-     * 
+     *
      * @param docGroupUser 分组成员
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface IDocGroupUserService
 
     /**
      * 修改分组成员
-     * 
+     *
      * @param docGroupUser 分组成员
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface IDocGroupUserService
 
     /**
      * 批量删除分组成员
-     * 
+     *
      * @param groupIds 需要删除的分组成员主键集合
      * @return 结果
      */
@@ -53,9 +54,14 @@ public interface IDocGroupUserService
 
     /**
      * 删除分组成员信息
-     * 
+     *
      * @param groupId 分组成员主键
      * @return 结果
      */
     public int deleteDocGroupUserByGroupId(Long groupId);
+
+    /**
+     * 查询未分配成员列表
+     */
+    public List<SysUser> selectUnallocatedList(DocGroupUser docGroupUser);
 }

+ 12 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocGroupUserServiceImpl.java

@@ -1,6 +1,8 @@
 package com.jjt.doc.service.impl;
 
 import java.util.List;
+
+import com.jjt.system.api.domain.SysUser;
 import org.springframework.stereotype.Service;
 import com.jjt.doc.mapper.DocGroupUserMapper;
 import com.jjt.doc.domain.DocGroupUser;
@@ -90,4 +92,14 @@ public class DocGroupUserServiceImpl implements IDocGroupUserService
     {
         return docGroupUserMapper.deleteDocGroupUserByGroupId(groupId);
     }
+
+    /**
+     * 查询未分配成员列表
+     *
+     * @param docGroupUser
+     */
+    @Override
+    public List<SysUser> selectUnallocatedList(DocGroupUser docGroupUser) {
+        return docGroupUserMapper.selectUnallocatedList(docGroupUser);
+    }
 }

+ 32 - 16
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocGroupUserMapper.xml

@@ -1,44 +1,58 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jjt.doc.mapper.DocGroupUserMapper">
-    
+
     <resultMap type="DocGroupUser" id="DocGroupUserResult">
-        <result property="groupId"    column="GROUP_ID"    />
-        <result property="userId"    column="USER_ID"    />
-        <result property="userName"    column="USER_NAME"    />
+        <result property="groupId" column="GROUP_ID"/>
+        <result property="userId" column="USER_ID"/>
+        <result property="userName" column="USER_NAME"/>
     </resultMap>
 
     <sql id="selectDocGroupUserVo">
-        select GROUP_ID, USER_ID, USER_NAME from doc_group_user
+        select GROUP_ID, USER_ID, USER_NAME
+        from doc_group_user
     </sql>
 
     <select id="selectDocGroupUserList" parameterType="DocGroupUser" resultMap="DocGroupUserResult">
         <include refid="selectDocGroupUserVo"/>
-        <where>  
-            <if test="userId != null "> and USER_ID = #{userId}</if>
-            <if test="userName != null  and userName != ''"> and USER_NAME like concat('%', #{userName}, '%')</if>
+        <where>
+            <if test="userId != null ">and USER_ID = #{userId}</if>
+            <if test="userName != null  and userName != ''">and USER_NAME like concat('%', #{userName}, '%')</if>
         </where>
     </select>
-    
+
     <select id="selectDocGroupUserByGroupId" parameterType="Long" resultMap="DocGroupUserResult">
         <include refid="selectDocGroupUserVo"/>
         where GROUP_ID = #{groupId}
     </select>
-        
+    <select id="selectUnallocatedList" resultType="com.jjt.system.api.domain.SysUser">
+        select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
+        from sys_user u
+        where u.del_flag = '0' and u.user_id not in (select u.user_id from doc_group_user where group_id= #{groupId})
+<!--        <if test="userName != null and userName != ''">-->
+<!--            AND u.user_name like concat('%', #{userName}, '%')-->
+<!--        </if>-->
+<!--        <if test="phonenumber != null and phonenumber != ''">-->
+<!--            AND u.phonenumber like concat('%', #{phonenumber}, '%')-->
+<!--        </if>-->
+<!--        &lt;!&ndash; 数据范围过滤 &ndash;&gt;-->
+<!--        ${params.dataScope}-->
+    </select>
+
     <insert id="insertDocGroupUser" parameterType="DocGroupUser">
         insert into doc_group_user
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="groupId != null">GROUP_ID,</if>
             <if test="userId != null">USER_ID,</if>
             <if test="userName != null">USER_NAME,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="groupId != null">#{groupId},</if>
             <if test="userId != null">#{userId},</if>
             <if test="userName != null">#{userName},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateDocGroupUser" parameterType="DocGroupUser">
@@ -51,11 +65,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteDocGroupUserByGroupId" parameterType="Long">
-        delete from doc_group_user where GROUP_ID = #{groupId}
+        delete
+        from doc_group_user
+        where GROUP_ID = #{groupId}
     </delete>
 
     <delete id="deleteDocGroupUserByGroupIds" parameterType="String">
-        delete from doc_group_user where GROUP_ID in 
+        delete from doc_group_user where GROUP_ID in
         <foreach item="groupId" collection="array" open="(" separator="," close=")">
             #{groupId}
         </foreach>

+ 46 - 1
lzga-ui/src/api/doc/groupUser.js

@@ -41,4 +41,49 @@ export function delGroupUser(groupId) {
     url: '/doc/groupUser/' + groupId,
     method: 'delete'
   })
-}
+}
+
+// 查询角色已授权用户列表
+export function allocatedUserList(query) {
+  return request({
+    url: '/doc/groupUser/allocatedList',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询角色未授权用户列表
+export function unallocatedUserList(query) {
+  return request({
+    url: '/doc/groupUser/unallocatedList',
+    method: 'get',
+    params: query
+  })
+}
+
+// 取消用户授权角色
+export function groupUserCancel(data) {
+  return request({
+    url: '/doc/groupUser/cancel',
+    method: 'put',
+    data: data
+  })
+}
+
+// 批量取消用户授权角色
+export function groupUserCancelAll(data) {
+  return request({
+    url: '/doc/groupUser/cancelAll',
+    method: 'put',
+    params: data
+  })
+}
+
+// 授权用户选择
+export function groupUserSelectAll(data) {
+  return request({
+    url: '/doc/groupUser/selectAll',
+    method: 'put',
+    params: data
+  })
+}

+ 216 - 90
lzga-ui/src/router/index.js

@@ -30,6 +30,7 @@ import Layout from '@/layout'
 
 // 公共路由
 export const constantRoutes = [{
+<<<<<<< HEAD
     path: '/redirect',
     component: Layout,
     hidden: true,
@@ -217,99 +218,224 @@ export const constantRoutes = [{
     hidden: true,
   },
 ]
+=======
+  path: '/redirect',
+  component: Layout,
+  hidden: true,
+  children: [{
+    path: '/redirect/:path(.*)',
+    component: () => import('@/views/redirect')
+  }]
+}, {
+  path: '/login',
+  component: () => import('@/views/login'),
+  hidden: true
+}, {
+  path: '/register',
+  component: () => import('@/views/register'),
+  hidden: true
+}, {
+  path: '/404',
+  component: () => import('@/views/error/404'),
+  hidden: true
+}, {
+  path: '/401',
+  component: () => import('@/views/error/401'),
+  hidden: true
+}, {
+  path: '',
+  component: Layout,
+  redirect: 'index',
+  children: [{
+    path: 'index',
+    component: () => import('@/views/index'),
+    name: 'Index',
+    meta: {
+      title: '首页',
+      icon: 'dashboard',
+      affix: true
+    }
+  }]
+}, {
+  path: '/user',
+  component: Layout,
+  hidden: true,
+  redirect: 'noredirect',
+  children: [{
+    path: 'profile',
+    component: () => import('@/views/system/user/profile/index'),
+    name: 'Profile',
+    meta: {
+      title: '个人中心',
+      icon: 'user'
+    }
+  }]
+}, {
+  path: '/home',
+  component: () => import('@/views1/HomeView.vue'),
+  hidden: true,
+  children: [{
+    path: "/home/page",
+    component: () => import('@/views1/Page/PageView.vue')
+  }, {
+    path: "/home/retrieval",
+    component: () => import('@/views1/Retrieval/RetrievalView.vue')
+  }, {
+    path: "/home/retrieval/list",
+    component: () => import('@/views1/Retrieval/List/ListView.vue')
+  }, {
+    path: "/home/file",
+    component: () => import('@/views1/File/FileView.vue')
+  }, {
+    path: "/home/file/part",
+    component: () => import('@/views1/File/Part/PartView.vue')
+  }, {
+    path: "/home/file/publi",
+    component: () => import('@/views1/File/Publi/PublicView.vue')
+  }, {
+    path: "/home/file/individual",
+    component: () => import('@/views1/File/Individual/IndividualView.vue')
+  }, {
+    path: "/home/file/set",
+    component: () => import('@/views1/File/Set/SetView.vue')
+  }, {
+    path: "/home/personal",
+    component: () => import('@/views1/Personal/PersonalView.vue')
+  }, {
+    path: "/home/personal/classify",
+    component: () => import('@/views1/Personal/Classify/ClassifyView.vue')
+  }, {
+    path: "/home/personal/space",
+    component: () => import('@/views1/Personal/Space/SpaceView.vue')
+  }, {
+    path: "/home/personal/modify",
+    component: () => import('@/views1/Personal/Modify/ModifyView.vue')
+  }, {
+    path: "/home/system",
+    component: () => import('@/views1/System/SystemView.vue')
+  }, {
+    path: "/home/system/organization",
+    component: () => import('@/views1/System/Organization/OrganizationView.vue')
+  }, {
+    path: "/home/system/user",
+    component: () => import('@/views1/System/User/UserView.vue')
+  }, {
+    path: "/home/system/authority",
+    component: () => import('@/views1/System/Authority/AuthorityView.vue')
+  }, {
+    path: "/home/system/notes",
+    component: () => import('@/views1/System/Notes/NotesView.vue')
+  }, {
+    path: "/home/system/space",
+    component: () => import('@/views1/System/Space/SpaceView.vue')
+  }],
+}, {
+  path: '/login1',
+  component: () => import('@/views1/LoginView.vue'),
+  hidden: true,
+}, ]
+>>>>>>> 3c521e5fc8e805fdf1ee9d1b439275dd81d08d7c
 
 // 动态路由,基于用户权限动态去加载
 export const dynamicRoutes = [{
-    path: '/system/user-auth',
-    component: Layout,
-    hidden: true,
-    permissions: ['system:user:edit'],
-    children: [{
-      path: 'role/:userId(\\d+)',
-      component: () => import('@/views/system/user/authRole'),
-      name: 'AuthRole',
-      meta: {
-        title: '分配角色',
-        activeMenu: '/system/user'
-      }
-    }]
-  },
-  {
-    path: '/system/role-auth',
-    component: Layout,
-    hidden: true,
-    permissions: ['system:role:edit'],
-    children: [{
-      path: 'user/:roleId(\\d+)',
-      component: () => import('@/views/system/role/authUser'),
-      name: 'AuthUser',
-      meta: {
-        title: '分配用户',
-        activeMenu: '/system/role'
-      }
-    }]
-  },
-  {
-    path: '/system/dict-data',
-    component: Layout,
-    hidden: true,
-    permissions: ['system:dict:list'],
-    children: [{
-      path: 'index/:dictId(\\d+)',
-      component: () => import('@/views/system/dict/data'),
-      name: 'Data',
-      meta: {
-        title: '字典数据',
-        activeMenu: '/system/dict'
-      }
-    }]
-  },
-  {
-    path: '/monitor/job-log',
-    component: Layout,
-    hidden: true,
-    permissions: ['monitor:job:list'],
-    children: [{
-      path: 'index/:jobId(\\d+)',
-      component: () => import('@/views/monitor/job/log'),
-      name: 'JobLog',
-      meta: {
-        title: '调度日志',
-        activeMenu: '/monitor/job'
-      }
-    }]
-  },
-  {
-    path: '/tool/gen-edit',
-    component: Layout,
-    hidden: true,
-    permissions: ['tool:gen:edit'],
-    children: [{
-      path: 'index/:tableId(\\d+)',
-      component: () => import('@/views/tool/gen/editTable'),
-      name: 'GenEdit',
-      meta: {
-        title: '修改生成配置',
-        activeMenu: '/tool/gen'
-      }
-    }]
-  },
-  {
-    path: '/doc/oo-edit',
-    component: Layout,
-    hidden: true,
-    permissions: ['tool:gen:edit'],
-    children: [{
-      path: 'index/:docId(\\d+)',
-      component: () => import('@/views/doc/oo/edit'),
-      name: 'OoEdit',
-      meta: {
-        title: '文件在线编辑',
-        activeMenu: '/doc/info'
-      }
-    }]
-  }
-]
+  path: '/system/user-auth',
+  component: Layout,
+  hidden: true,
+  permissions: ['system:user:edit'],
+  children: [{
+    path: 'role/:userId(\\d+)',
+    component: () => import('@/views/system/user/authRole'),
+    name: 'AuthRole',
+    meta: {
+      title: '分配角色',
+      activeMenu: '/system/user'
+    }
+  }]
+}, {
+  path: '/system/role-auth',
+  component: Layout,
+  hidden: true,
+  permissions: ['system:role:edit'],
+  children: [{
+    path: 'user/:roleId(\\d+)',
+    component: () => import('@/views/system/role/authUser'),
+    name: 'AuthUser',
+    meta: {
+      title: '分配用户',
+      activeMenu: '/system/role'
+    }
+  }]
+}, {
+  path: '/system/dict-data',
+  component: Layout,
+  hidden: true,
+  permissions: ['system:dict:list'],
+  children: [{
+    path: 'index/:dictId(\\d+)',
+    component: () => import('@/views/system/dict/data'),
+    name: 'Data',
+    meta: {
+      title: '字典数据',
+      activeMenu: '/system/dict'
+    }
+  }]
+}, {
+  path: '/monitor/job-log',
+  component: Layout,
+  hidden: true,
+  permissions: ['monitor:job:list'],
+  children: [{
+    path: 'index/:jobId(\\d+)',
+    component: () => import('@/views/monitor/job/log'),
+    name: 'JobLog',
+    meta: {
+      title: '调度日志',
+      activeMenu: '/monitor/job'
+    }
+  }]
+}, {
+  path: '/tool/gen-edit',
+  component: Layout,
+  hidden: true,
+  permissions: ['tool:gen:edit'],
+  children: [{
+    path: 'index/:tableId(\\d+)',
+    component: () => import('@/views/tool/gen/editTable'),
+    name: 'GenEdit',
+    meta: {
+      title: '修改生成配置',
+      activeMenu: '/tool/gen'
+    }
+  }]
+}, {
+  path: '/doc/oo-edit',
+  component: Layout,
+  hidden: true,
+  permissions: ['doc:info:edit'],
+  children: [{
+    path: 'index/:docId(\\d+)',
+    component: () => import('@/views/doc/oo/edit'),
+    name: 'OoEdit',
+    meta: {
+      title: '文件在线编辑',
+      activeMenu: '/doc/info'
+    }
+  }]
+}, {
+  path: '/doc/group-user/',
+  component: Layout,
+  hidden: true,
+  permissions: ['doc:groupUser:edit'],
+  children: [{
+    path: 'user/:groupId(\\d+)',
+    component: () => import('@/views/doc/groupUser/index'),
+    name: 'AuthUser',
+    meta: {
+      title: '分配成员',
+      activeMenu: '/doc/group'
+    }
+  }]
+}]
 
 // 防止连续点击多次路由报错
 let routerPush = Router.prototype.push;

+ 8 - 1
lzga-ui/src/views/doc/group/index.vue

@@ -50,6 +50,8 @@
             v-hasPermi="['doc:group:edit']">修改</el-button>
           <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
             v-hasPermi="['doc:group:remove']">删除</el-button>
+          <el-button size="mini" type="text" icon="el-icon-user" @click="handleGroupUser(scope.row)"
+            v-hasPermi="['doc:group:user']">分配成员</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -189,6 +191,11 @@
         this.open = true;
         this.title = "添加分组";
       },
+      /** 新增按钮操作 */
+      handleGroupUser(row) {
+        const groupId = row.groupId;
+        this.$router.push("/doc/group-user/user/" + groupId);
+      },
       /** 修改按钮操作 */
       handleUpdate(row) {
         this.reset();
@@ -237,4 +244,4 @@
       }
     }
   };
-</script>
+</script>

+ 161 - 212
lzga-ui/src/views/doc/groupUser/index.vue

@@ -2,20 +2,10 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="用户ID" prop="userId">
-        <el-input
-          v-model="queryParams.userId"
-          placeholder="请输入用户ID"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.userId" placeholder="请输入用户ID" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="用户姓名" prop="userName">
-        <el-input
-          v-model="queryParams.userName"
-          placeholder="请输入用户姓名"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.userName" placeholder="请输入用户姓名" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -25,46 +15,15 @@
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['doc:groupUser:add']"
-        >新增</el-button>
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+          v-hasPermi="['doc:groupUser:add']">分配成员</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['doc:groupUser:edit']"
-        >修改</el-button>
+        <el-button type="danger" plain icon="el-icon-circle-close" size="mini" :disabled="multiple"
+          @click="handleDelete" v-hasPermi="['doc:groupUser:remove']">批量取消分配</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['doc:groupUser:remove']"
-        >删除</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['doc:groupUser:export']"
-        >导出</el-button>
+        <el-button type="warning" plain icon="el-icon-close" size="mini" @click="handleClose">关闭</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
@@ -76,181 +35,171 @@
       <el-table-column label="用户姓名" align="center" prop="userName" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['doc:groupUser:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['doc:groupUser:remove']"
-          >删除</el-button>
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+            v-hasPermi="['doc:groupUser:edit']">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+            v-hasPermi="['doc:groupUser:remove']">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-    
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
 
-    <!-- 添加或修改分组成员对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="用户姓名" prop="userName">
-          <el-input v-model="form.userName" placeholder="请输入用户姓名" />
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
+    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+      @pagination="getList" />
+    <select-user ref="select" :groupId="queryParams.groupId" @ok="handleQuery" />
   </div>
 </template>
 
 <script>
-import { listGroupUser, getGroupUser, delGroupUser, addGroupUser, updateGroupUser } from "@/api/doc/groupUser";
-
-export default {
-  name: "GroupUser",
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 分组成员表格数据
-      groupUserList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        userId: null,
-        userName: null
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-      }
-    };
-  },
-  created() {
-    this.getList();
-  },
-  methods: {
-    /** 查询分组成员列表 */
-    getList() {
-      this.loading = true;
-      listGroupUser(this.queryParams).then(response => {
-        this.groupUserList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
+  import {
+    listGroupUser,
+    getGroupUser,
+    delGroupUser,
+    addGroupUser,
+    updateGroupUser
+  } from "@/api/doc/groupUser";
+  import selectUser from "./selectUser";
+  export default {
+    name: "GroupUser",
+    components: {
+      selectUser
     },
-    // 表单重置
-    reset() {
-      this.form = {
-        groupId: null,
-        userId: null,
-        userName: null
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 选中数组
+        ids: [],
+        // 非单个禁用
+        single: true,
+        // 非多个禁用
+        multiple: true,
+        // 显示搜索条件
+        showSearch: true,
+        // 总条数
+        total: 0,
+        // 分组成员表格数据
+        groupUserList: [],
+        // 弹出层标题
+        title: "",
+        // 是否显示弹出层
+        open: false,
+        // 查询参数
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          userId: null,
+          userName: null
+        },
+        // 表单参数
+        form: {},
+        // 表单校验
+        rules: {}
       };
-      this.resetForm("form");
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.groupId)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加分组成员";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const groupId = row.groupId || this.ids
-      getGroupUser(groupId).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改分组成员";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.groupId != null) {
-            updateGroupUser(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addGroupUser(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const groupIds = row.groupId || this.ids;
-      this.$modal.confirm('是否确认删除分组成员编号为"' + groupIds + '"的数据项?').then(function() {
-        return delGroupUser(groupIds);
-      }).then(() => {
+    created() {
+      const groupId = this.$route.params && this.$route.params.groupId;
+      if (groupId) {
+        this.queryParams.groupId = groupId;
         this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+      }
     },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('doc/groupUser/export', {
-        ...this.queryParams
-      }, `groupUser_${new Date().getTime()}.xlsx`)
+    methods: {
+      // 返回按钮
+      handleClose() {
+        const obj = {
+          path: "/group/group"
+        };
+        this.$tab.closeOpenPage(obj);
+      },
+      /** 查询分组成员列表 */
+      getList() {
+        this.loading = true;
+        listGroupUser(this.queryParams).then(response => {
+          this.groupUserList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      },
+      // 取消按钮
+      cancel() {
+        this.open = false;
+        this.reset();
+      },
+      // 表单重置
+      reset() {
+        this.form = {
+          groupId: null,
+          userId: null,
+          userName: null
+        };
+        this.resetForm("form");
+      },
+      /** 搜索按钮操作 */
+      handleQuery() {
+        this.queryParams.pageNum = 1;
+        this.getList();
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      },
+      // 多选框选中数据
+      handleSelectionChange(selection) {
+        this.ids = selection.map(item => item.groupId)
+        this.single = selection.length !== 1
+        this.multiple = !selection.length
+      },
+      /** 新增按钮操作 */
+      handleAdd() {
+        this.$refs.select.show();
+      },
+      /** 修改按钮操作 */
+      handleUpdate(row) {
+        this.reset();
+        const groupId = row.groupId || this.ids
+        getGroupUser(groupId).then(response => {
+          this.form = response.data;
+          this.open = true;
+          this.title = "修改分组成员";
+        });
+      },
+      /** 提交按钮 */
+      submitForm() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if (this.form.groupId != null) {
+              updateGroupUser(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              addGroupUser(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
+          }
+        });
+      },
+      /** 删除按钮操作 */
+      handleDelete(row) {
+        const groupIds = row.groupId || this.ids;
+        this.$modal.confirm('是否确认删除分组成员编号为"' + groupIds + '"的数据项?').then(function() {
+          return delGroupUser(groupIds);
+        }).then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        }).catch(() => {});
+      },
+      /** 导出按钮操作 */
+      handleExport() {
+        this.download('doc/groupUser/export', {
+          ...this.queryParams
+        }, `groupUser_${new Date().getTime()}.xlsx`)
+      }
     }
-  }
-};
-</script>
+  };
+</script>

+ 139 - 0
lzga-ui/src/views/doc/groupUser/selectUser.vue

@@ -0,0 +1,139 @@
+<template>
+  <!-- 授权用户 -->
+  <el-dialog title="选择用户" :visible.sync="visible" width="800px" top="5vh" append-to-body>
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
+      <el-form-item label="用户名称" prop="userName">
+        <el-input
+          v-model="queryParams.userName"
+          placeholder="请输入用户名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="手机号码" prop="phonenumber">
+        <el-input
+          v-model="queryParams.phonenumber"
+          placeholder="请输入手机号码"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <el-row>
+      <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px">
+        <el-table-column type="selection" width="55"></el-table-column>
+        <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
+        <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
+        <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
+        <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
+        <el-table-column label="状态" align="center" prop="status">
+          <template slot-scope="scope">
+            <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
+          </template>
+        </el-table-column>
+        <el-table-column label="创建时间" align="center" prop="createTime" width="180">
+          <template slot-scope="scope">
+            <span>{{ parseTime(scope.row.createTime) }}</span>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="total>0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+      />
+    </el-row>
+    <div slot="footer" class="dialog-footer">
+      <el-button type="primary" @click="handleSelectUser">确 定</el-button>
+      <el-button @click="visible = false">取 消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { unallocatedUserList, groupUserSelectAll } from "@/api/doc/groupUser";
+export default {
+  dicts: ['sys_normal_disable'],
+  props: {
+    // 角色编号
+    groupId: {
+      type: [String]
+    }
+  },
+  data() {
+    return {
+      // 遮罩层
+      visible: false,
+      // 选中数组值
+      userIds: [],
+      // 总条数
+      total: 0,
+      // 未授权用户数据
+      userList: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        groupId: undefined,
+        // userName: undefined,
+        // phonenumber: undefined
+      }
+    };
+  },
+  methods: {
+    // 显示弹框
+    show() {
+      console.log(this.queryParams)
+      this.queryParams.groupId = parseInt(this.groupId);
+      this.getList();
+      this.visible = true;
+    },
+    clickRow(row) {
+      this.$refs.table.toggleRowSelection(row);
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.userIds = selection.map(item => item.userId);
+    },
+    // 查询表数据
+    getList() {
+      unallocatedUserList(this.queryParams).then(res => {
+        this.userList = res.rows;
+        this.total = res.total;
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    /** 选择授权用户操作 */
+    handleSelectUser() {
+      const groupId = this.queryParams.groupId;
+      const userIds = this.userIds.join(",");
+      if (userIds == "") {
+        this.$modal.msgError("请选择要分配的用户");
+        return;
+      }
+      authUserSelectAll({ groupId: groupId, userIds: userIds }).then(res => {
+        this.$modal.msgSuccess(res.msg);
+        if (res.code === 200) {
+          this.visible = false;
+          this.$emit("ok");
+        }
+      });
+    }
+  }
+};
+</script>