提交代码

dev_xd
姜玉琦 2024-08-25 21:25:51 +08:00
parent 589f8e7132
commit 77fa7476d8
37 changed files with 971 additions and 411 deletions

View File

@ -34,6 +34,7 @@
<jjwt.version>0.9.1</jjwt.version>
<minio.version>8.2.2</minio.version>
<poi.version>4.1.2</poi.version>
<pinyin4j.version>2.5.1</pinyin4j.version>
<transmittable-thread-local.version>2.14.2</transmittable-thread-local.version>
</properties>
@ -143,6 +144,13 @@
<version>${transmittable-thread-local.version}</version>
</dependency>
<!-- Belerweb Pinyin4j -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>${pinyin4j.version}</version>
</dependency>
<!-- 核心模块 -->
<dependency>
<groupId>com.yanzhu</groupId>

View File

@ -31,6 +31,18 @@ public class SysDept extends BaseEntity
/** 部门名称 */
private String deptName;
/** 部门简称 */
private String deptShortName;
/** 部门简称 */
private String deptCode;
/** 部门详情 */
private String deptType;
/** 部门详情 */
private String deptInfos;
/** 显示顺序 */
private Integer orderNum;
@ -181,6 +193,38 @@ public class SysDept extends BaseEntity
this.children = children;
}
public String getDeptShortName() {
return deptShortName;
}
public void setDeptShortName(String deptShortName) {
this.deptShortName = deptShortName;
}
public String getDeptCode() {
return deptCode;
}
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
public String getDeptType() {
return deptType;
}
public void setDeptType(String deptType) {
this.deptType = deptType;
}
public String getDeptInfos() {
return deptInfos;
}
public void setDeptInfos(String deptInfos) {
this.deptInfos = deptInfos;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -188,6 +232,10 @@ public class SysDept extends BaseEntity
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("deptName", getDeptName())
.append("deptShortName", getDeptShortName())
.append("deptCode", getDeptCode())
.append("deptType", getDeptType())
.append("deptInfos", getDeptInfos())
.append("orderNum", getOrderNum())
.append("leader", getLeader())
.append("phone", getPhone())

View File

@ -1,5 +1,6 @@
package com.yanzhu.system.api.domain;
import java.util.List;
import java.util.Set;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@ -58,12 +59,17 @@ public class SysRole extends BaseEntity
/** 菜单组 */
private Long[] menuIds;
/** 部门主键 */
private Long deptId;
/** 部门组(数据权限) */
private Long[] deptIds;
/** 角色菜单权限 */
private Set<String> permissions;
private List<SysRoleDept> roleDeptList;
public SysRole()
{
@ -219,6 +225,22 @@ public class SysRole extends BaseEntity
this.permissions = permissions;
}
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public List<SysRoleDept> getRoleDeptList() {
return roleDeptList;
}
public void setRoleDeptList(List<SysRoleDept> roleDeptList) {
this.roleDeptList = roleDeptList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,4 +1,4 @@
package com.yanzhu.system.domain;
package com.yanzhu.system.api.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -16,6 +16,9 @@ public class SysRoleDept
/** 部门ID */
private Long deptId;
/** 部门名称 */
private String deptName;
public Long getRoleId()
{
return roleId;
@ -36,6 +39,14 @@ public class SysRoleDept
this.deptId = deptId;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -37,6 +37,22 @@ public class SysUser extends BaseEntity
@Excel(name = "用户名称")
private String nickName;
/** 用户类型 */
@Excel(name = "用户类型")
private String userType;
/** 证件类型 */
@Excel(name = "证件类型")
private String cardType;
/** 证件号码 */
@Excel(name = "证件号码")
private String cardCode;
/** 用户详情 */
@Excel(name = "用户详情")
private String userInfos;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
@ -129,6 +145,19 @@ public class SysUser extends BaseEntity
this.deptId = deptId;
}
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
@Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName()
@ -141,17 +170,36 @@ public class SysUser extends BaseEntity
this.nickName = nickName;
}
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName()
{
return userName;
public String getUserType() {
return userType;
}
public void setUserName(String userName)
{
this.userName = userName;
public void setUserType(String userType) {
this.userType = userType;
}
public String getCardType() {
return cardType;
}
public void setCardType(String cardType) {
this.cardType = cardType;
}
public String getCardCode() {
return cardCode;
}
public void setCardCode(String cardCode) {
this.cardCode = cardCode;
}
public String getUserInfos() {
return userInfos;
}
public void setUserInfos(String userInfos) {
this.userInfos = userInfos;
}
@Email(message = "邮箱格式不正确")
@ -296,6 +344,7 @@ public class SysUser extends BaseEntity
{
this.roleId = roleId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -303,6 +352,10 @@ public class SysUser extends BaseEntity
.append("deptId", getDeptId())
.append("userName", getUserName())
.append("nickName", getNickName())
.append("userType", getUserType())
.append("cardType", getCardType())
.append("cardCode", getCardCode())
.append("userInfos", getUserInfos())
.append("email", getEmail())
.append("phonenumber", getPhonenumber())
.append("sex", getSex())

View File

@ -41,6 +41,9 @@ public class BaseEntity implements Serializable
/** 选中页签 */
private String activeName;
/** 所属单位 */
private Long activeDeptId;
/** 请求参数 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
@ -126,4 +129,12 @@ public class BaseEntity implements Serializable
public void setActiveName(String activeName) {
this.activeName = activeName;
}
public Long getActiveDeptId() {
return activeDeptId;
}
public void setActiveDeptId(Long activeDeptId) {
this.activeDeptId = activeDeptId;
}
}

View File

@ -22,6 +22,10 @@ public class ProProjectInfo extends BaseEntity
@Excel(name = "所属单位")
private Long deptId;
/** 单位名称 */
@Excel(name = "单位名称")
private String deptName;
/** 部门主键 */
@Excel(name = "部门主键")
private Long visDeptId;
@ -48,7 +52,7 @@ public class ProProjectInfo extends BaseEntity
/** 项目等级 */
@Excel(name = "项目等级")
private String projiectLevel;
private String projectLevel;
/** 项目区县 */
@Excel(name = "项目区县")
@ -222,14 +226,14 @@ public class ProProjectInfo extends BaseEntity
{
return projectType;
}
public void setProjiectLevel(String projiectLevel)
public void setprojectLevel(String projectLevel)
{
this.projiectLevel = projiectLevel;
this.projectLevel = projectLevel;
}
public String getProjiectLevel()
public String getprojectLevel()
{
return projiectLevel;
return projectLevel;
}
public void setProjectRegional(String projectRegional)
{
@ -457,6 +461,14 @@ public class ProProjectInfo extends BaseEntity
return isDel;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -468,7 +480,7 @@ public class ProProjectInfo extends BaseEntity
.append("projectCode", getProjectCode())
.append("simpleName", getSimpleName())
.append("projectType", getProjectType())
.append("projiectLevel", getProjiectLevel())
.append("projectLevel", getprojectLevel())
.append("projectRegional", getProjectRegional())
.append("projectAddress", getProjectAddress())
.append("projectNature", getProjectNature())

View File

@ -22,10 +22,18 @@ public class ProProjectInfoSubdepts extends BaseEntity
@Excel(name = "单位主键")
private Long deptId;
/** 单位名称 */
@Excel(name = "单位名称")
private String deptName;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 分包单位 */
@Excel(name = "分包单位")
private Long subDeptId;
@ -210,6 +218,22 @@ public class ProProjectInfoSubdepts extends BaseEntity
return isDel;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -22,6 +22,10 @@ public class ProProjectInfoSubdeptsGroup extends BaseEntity
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 分包单位 */
@Excel(name = "分包单位")
private Long subDeptId;
@ -236,6 +240,14 @@ public class ProProjectInfoSubdeptsGroup extends BaseEntity
return isDel;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -25,6 +25,10 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 分包单位 */
@Excel(name = "分包单位")
private Long subDeptId;
@ -253,6 +257,14 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity
return isDel;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -22,10 +22,18 @@ public class ProProjectInfoUsers extends BaseEntity
@Excel(name = "单位主键")
private Long deptId;
/** 单位名称 */
@Excel(name = "单位名称")
private String deptName;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 用户主键 */
@Excel(name = "用户主键")
private Long userId;
@ -132,6 +140,22 @@ public class ProProjectInfoUsers extends BaseEntity
return isDel;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -22,15 +22,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectProProjectInfoDeptsVo">
select pd.id, pd.project_id, pi.project_name, pd.dept_type, pd.dept_name, pd.dept_code, pd.is_del, pd.create_by, pd.create_time, pd.update_by, pd.update_time, pd.remark from pro_project_info_depts pd
left join pro_project_info pi on pi.id = pd.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql>
<select id="selectProProjectInfoDeptsList" parameterType="ProProjectInfoDepts" resultMap="ProProjectInfoDeptsResult">
<include refid="selectProProjectInfoDeptsVo"/>
<where>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectId != null "> and pd.project_id = #{projectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="deptType != null and deptType != ''"> and pd.dept_type = #{deptType}</if>
<if test="deptName != null and deptName != ''"> and pd.dept_name like concat('%', #{deptName}, '%')</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="deptCode != null and deptCode != ''"> and pd.dept_code = #{deptCode}</if>
<if test="isDel != null "> and pd.is_del = #{isDel}</if>
</where>

View File

@ -7,13 +7,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfo" id="ProProjectInfoResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="visDeptId" column="vis_dept_id" />
<result property="disDeptId" column="dis_dept_id" />
<result property="projectName" column="project_name" />
<result property="projectCode" column="project_code" />
<result property="simpleName" column="simple_name" />
<result property="projectType" column="project_type" />
<result property="projiectLevel" column="projiect_level" />
<result property="projectLevel" column="project_level" />
<result property="projectRegional" column="project_regional" />
<result property="projectAddress" column="project_address" />
<result property="projectNature" column="project_nature" />
@ -47,30 +48,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectProProjectInfoVo">
select id, dept_id, vis_dept_id, dis_dept_id, project_name, project_code, simple_name, project_type, projiect_level, project_regional, project_address, project_nature, licence_number, project_person, project_person_phone, longitude, latitude, project_time_limit, total_investment, floor_area, total_output_value, planned_completion_time, scheduled_start_time, actual_operating_time, actual_completion_time, contract_amount, paid_amount, on_account_amount, project_schedule, project_summarize, project_qr_code, project_status, project_sort, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info
select pi.id, pi.dept_id, sd.dept_name, pi.vis_dept_id, pi.dis_dept_id, pi.project_name, pi.project_code, pi.simple_name, pi.project_type, pi.project_level, pi.project_regional, pi.project_address, pi.project_nature, pi.licence_number, pi.project_person, pi.project_person_phone, pi.longitude, pi.latitude, pi.project_time_limit, pi.total_investment, pi.floor_area, pi.total_output_value, pi.planned_completion_time, pi.scheduled_start_time, pi.actual_operating_time, pi.actual_completion_time, pi.contract_amount, pi.paid_amount, pi.on_account_amount, pi.project_schedule, pi.project_summarize, pi.project_qr_code, pi.project_status, pi.project_sort, pi.is_del, pi.create_by, pi.create_time, pi.update_by, pi.update_time, pi.remark from pro_project_info pi
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql>
<select id="selectProProjectInfoList" parameterType="ProProjectInfo" resultMap="ProProjectInfoResult">
<include refid="selectProProjectInfoVo"/>
<where>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="visDeptId != null "> and vis_dept_id = #{visDeptId}</if>
<if test="disDeptId != null "> and dis_dept_id = #{disDeptId}</if>
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
<if test="projectCode != null and projectCode != ''"> and project_code = #{projectCode}</if>
<if test="simpleName != null and simpleName != ''"> and simple_name like concat('%', #{simpleName}, '%')</if>
<if test="projectType != null and projectType != ''"> and project_type = #{projectType}</if>
<if test="projiectLevel != null and projiectLevel != ''"> and projiect_level = #{projiectLevel}</if>
<if test="projectPerson != null and projectPerson != ''"> and project_person = #{projectPerson}</if>
<if test="projectPersonPhone != null and projectPersonPhone != ''"> and project_person_phone = #{projectPersonPhone}</if>
<if test="projectStatus != null and projectStatus != ''"> and project_status = #{projectStatus}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="deptId != null "> and pi.dept_id = #{deptId}</if>
<if test="visDeptId != null "> and pi.vis_dept_id = #{visDeptId}</if>
<if test="disDeptId != null "> and pi.dis_dept_id = #{disDeptId}</if>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="projectCode != null and projectCode != ''"> and pi.project_code = #{projectCode}</if>
<if test="simpleName != null and simpleName != ''"> and pi.simple_name like concat('%', #{simpleName}, '%')</if>
<if test="projectType != null and projectType != ''"> and pi.project_type = #{projectType}</if>
<if test="projectLevel != null and projectLevel != ''"> and pi.project_level = #{projectLevel}</if>
<if test="projectPerson != null and projectPerson != ''"> and pi.project_person = #{projectPerson}</if>
<if test="projectPersonPhone != null and projectPersonPhone != ''"> and pi.project_person_phone = #{projectPersonPhone}</if>
<if test="projectStatus != null and projectStatus != ''"> and pi.project_status = #{projectStatus}</if>
<if test="isDel != null "> and pi.is_del = #{isDel}</if>
</where>
order by id project_sort, id desc
</select>
<select id="selectProProjectInfoById" parameterType="Long" resultMap="ProProjectInfoResult">
<include refid="selectProProjectInfoVo"/>
where id = #{id}
where pi.id = #{id}
</select>
<insert id="insertProProjectInfo" parameterType="ProProjectInfo" useGeneratedKeys="true" keyProperty="id">
@ -83,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectCode != null">project_code,</if>
<if test="simpleName != null">simple_name,</if>
<if test="projectType != null">project_type,</if>
<if test="projiectLevel != null">projiect_level,</if>
<if test="projectLevel != null">project_level,</if>
<if test="projectRegional != null">project_regional,</if>
<if test="projectAddress != null">project_address,</if>
<if test="projectNature != null">project_nature,</if>
@ -123,7 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectCode != null">#{projectCode},</if>
<if test="simpleName != null">#{simpleName},</if>
<if test="projectType != null">#{projectType},</if>
<if test="projiectLevel != null">#{projiectLevel},</if>
<if test="projectLevel != null">#{projectLevel},</if>
<if test="projectRegional != null">#{projectRegional},</if>
<if test="projectAddress != null">#{projectAddress},</if>
<if test="projectNature != null">#{projectNature},</if>
@ -167,7 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectCode != null">project_code = #{projectCode},</if>
<if test="simpleName != null">simple_name = #{simpleName},</if>
<if test="projectType != null">project_type = #{projectType},</if>
<if test="projiectLevel != null">projiect_level = #{projiectLevel},</if>
<if test="projectLevel != null">project_level = #{projectLevel},</if>
<if test="projectRegional != null">project_regional = #{projectRegional},</if>
<if test="projectAddress != null">project_address = #{projectAddress},</if>
<if test="projectNature != null">project_nature = #{projectNature},</if>

View File

@ -24,14 +24,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectProProjectInfoSettingVo">
select ps.id, ps.project_id, pi.project_name, ps.org_name, ps.org_logo, ps.org_image, ps.org_video, ps.org_plane, ps.is_del, ps.create_by, ps.create_time, ps.update_by, ps.update_time, ps.remark from pro_project_info_setting ps
left join pro_project_info pi on pi.id = ps.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql>
<select id="selectProProjectInfoSettingList" parameterType="ProProjectInfoSetting" resultMap="ProProjectInfoSettingResult">
<include refid="selectProProjectInfoSettingVo"/>
<where>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectId != null "> and ps.project_id = #{projectId}</if>
<if test="orgName != null and orgName != ''"> and ps.org_name like concat('%', #{orgName}, '%')</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="orgName != null and orgName != ''"> and ps.org_name like concat('%', #{orgName}, '%')</if>
<if test="isDel != null "> and ps.is_del = #{isDel}</if>
</where>
</select>

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfoSubdeptsGroup" id="ProProjectInfoSubdeptsGroupResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="subDeptId" column="sub_dept_id" />
<result property="subDeptType" column="sub_dept_type" />
<result property="subDeptName" column="sub_dept_name" />
@ -30,34 +31,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectProProjectInfoSubdeptsGroupVo">
select id, project_id, sub_dept_id, sub_dept_type, sub_dept_name, sub_dept_code, group_name, group_code, craft_type, craft_post, group_leader_name, group_leader_code, group_leader_phone, use_status, approve_status, qr_code, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info_subdepts_group
select psg.id, psg.project_id, pi.project_name, psg.sub_dept_id, psg.sub_dept_type, psg.sub_dept_name, psg.sub_dept_code, psg.group_name, psg.group_code, psg.craft_type, psg.craft_post, psg.group_leader_name, psg.group_leader_code, psg.group_leader_phone, psg.use_status, psg.approve_status, psg.qr_code, psg.is_del, psg.create_by, psg.create_time, psg.update_by, psg.update_time, psg.remark from pro_project_info_subdepts_group psg
left join pro_project_info pi on pi.id = psg.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql>
<select id="selectProProjectInfoSubdeptsGroupList" parameterType="ProProjectInfoSubdeptsGroup" resultMap="ProProjectInfoSubdeptsGroupResult">
<include refid="selectProProjectInfoSubdeptsGroupVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="subDeptId != null "> and sub_dept_id = #{subDeptId}</if>
<if test="subDeptType != null and subDeptType != ''"> and sub_dept_type = #{subDeptType}</if>
<if test="subDeptName != null and subDeptName != ''"> and sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="subDeptCode != null and subDeptCode != ''"> and sub_dept_code = #{subDeptCode}</if>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
<if test="groupCode != null and groupCode != ''"> and group_code = #{groupCode}</if>
<if test="craftType != null and craftType != ''"> and craft_type = #{craftType}</if>
<if test="craftPost != null and craftPost != ''"> and craft_post = #{craftPost}</if>
<if test="groupLeaderName != null and groupLeaderName != ''"> and group_leader_name like concat('%', #{groupLeaderName}, '%')</if>
<if test="groupLeaderCode != null and groupLeaderCode != ''"> and group_leader_code = #{groupLeaderCode}</if>
<if test="groupLeaderPhone != null and groupLeaderPhone != ''"> and group_leader_phone = #{groupLeaderPhone}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
<if test="approveStatus != null "> and approve_status = #{approveStatus}</if>
<if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectId != null "> and psg.project_id = #{projectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="subDeptId != null "> and psg.sub_dept_id = #{subDeptId}</if>
<if test="subDeptType != null and subDeptType != ''"> and psg.sub_dept_type = #{subDeptType}</if>
<if test="subDeptName != null and subDeptName != ''"> and psg.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="subDeptCode != null and subDeptCode != ''"> and psg.sub_dept_code = #{subDeptCode}</if>
<if test="groupName != null and groupName != ''"> and psg.group_name like concat('%', #{groupName}, '%')</if>
<if test="groupCode != null and groupCode != ''"> and psg.group_code = #{groupCode}</if>
<if test="craftType != null and craftType != ''"> and psg.craft_type = #{craftType}</if>
<if test="craftPost != null and craftPost != ''"> and psg.craft_post = #{craftPost}</if>
<if test="groupLeaderName != null and groupLeaderName != ''"> and psg.group_leader_name like concat('%', #{groupLeaderName}, '%')</if>
<if test="groupLeaderCode != null and groupLeaderCode != ''"> and psg.group_leader_code = #{groupLeaderCode}</if>
<if test="groupLeaderPhone != null and groupLeaderPhone != ''"> and psg.group_leader_phone = #{groupLeaderPhone}</if>
<if test="useStatus != null and useStatus != ''"> and psg.use_status = #{useStatus}</if>
<if test="approveStatus != null "> and psg.approve_status = #{approveStatus}</if>
<if test="isDel != null "> and psg.is_del = #{isDel}</if>
</where>
</select>
<select id="selectProProjectInfoSubdeptsGroupById" parameterType="Long" resultMap="ProProjectInfoSubdeptsGroupResult">
<include refid="selectProProjectInfoSubdeptsGroupVo"/>
where id = #{id}
where psg.id = #{id}
</select>
<insert id="insertProProjectInfoSubdeptsGroup" parameterType="ProProjectInfoSubdeptsGroup" useGeneratedKeys="true" keyProperty="id">

View File

@ -7,7 +7,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfoSubdepts" id="ProProjectInfoSubdeptsResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="subDeptId" column="sub_dept_id" />
<result property="subDeptType" column="sub_dept_type" />
<result property="subDeptName" column="sub_dept_name" />
@ -28,32 +30,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectProProjectInfoSubdeptsVo">
select id, dept_id, project_id, sub_dept_id, sub_dept_type, sub_dept_name, sub_dept_code, sub_dept_leader_id, sub_dept_leader_name, sub_dept_leader_code, sub_dept_leader_phone, use_status, approve_status, qr_code, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info_subdepts
select ps.id, dept_id, sd.dept_name, ps.project_id, pi.project_name, ps.sub_dept_id, ps.sub_dept_type, ps.sub_dept_name, ps.sub_dept_code, ps.sub_dept_leader_id, ps.sub_dept_leader_name, ps.sub_dept_leader_code, ps.sub_dept_leader_phone, ps.use_status, ps.approve_status, ps.qr_code, ps.is_del, ps.create_by, ps.create_time, ps.update_by, ps.update_time, ps.remark from pro_project_info_subdepts ps
left join pro_project_info pi on pi.id = ps.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql>
<select id="selectProProjectInfoSubdeptsList" parameterType="ProProjectInfoSubdepts" resultMap="ProProjectInfoSubdeptsResult">
<include refid="selectProProjectInfoSubdeptsVo"/>
<where>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="subDeptId != null "> and sub_dept_id = #{subDeptId}</if>
<if test="subDeptType != null and subDeptType != ''"> and sub_dept_type = #{subDeptType}</if>
<if test="subDeptName != null and subDeptName != ''"> and sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="subDeptCode != null and subDeptCode != ''"> and sub_dept_code = #{subDeptCode}</if>
<if test="subDeptLeaderId != null "> and sub_dept_leader_id = #{subDeptLeaderId}</if>
<if test="subDeptLeaderName != null and subDeptLeaderName != ''"> and sub_dept_leader_name like concat('%', #{subDeptLeaderName}, '%')</if>
<if test="subDeptLeaderCode != null and subDeptLeaderCode != ''"> and sub_dept_leader_code = #{subDeptLeaderCode}</if>
<if test="subDeptLeaderPhone != null and subDeptLeaderPhone != ''"> and sub_dept_leader_phone = #{subDeptLeaderPhone}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
<if test="approveStatus != null "> and approve_status = #{approveStatus}</if>
<if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="deptId != null "> and ps.dept_id = #{deptId}</if>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectId != null "> and ps.project_id = #{projectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="subDeptId != null "> and ps.sub_dept_id = #{subDeptId}</if>
<if test="subDeptType != null and subDeptType != ''"> and ps.sub_dept_type = #{subDeptType}</if>
<if test="subDeptName != null and subDeptName != ''"> and ps.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="subDeptCode != null and subDeptCode != ''"> and ps.sub_dept_code = #{subDeptCode}</if>
<if test="subDeptLeaderId != null "> and ps.sub_dept_leader_id = #{subDeptLeaderId}</if>
<if test="subDeptLeaderName != null and subDeptLeaderName != ''"> and ps.sub_dept_leader_name like concat('%', #{subDeptLeaderName}, '%')</if>
<if test="subDeptLeaderCode != null and subDeptLeaderCode != ''"> and ps.sub_dept_leader_code = #{subDeptLeaderCode}</if>
<if test="subDeptLeaderPhone != null and subDeptLeaderPhone != ''"> and ps.sub_dept_leader_phone = #{subDeptLeaderPhone}</if>
<if test="useStatus != null and useStatus != ''"> and ps.use_status = #{useStatus}</if>
<if test="approveStatus != null "> and ps.approve_status = #{approveStatus}</if>
<if test="isDel != null "> and ps.is_del = #{isDel}</if>
</where>
order by ps.id desc
</select>
<select id="selectProProjectInfoSubdeptsById" parameterType="Long" resultMap="ProProjectInfoSubdeptsResult">
<include refid="selectProProjectInfoSubdeptsVo"/>
where id = #{id}
where ps.id = #{id}
</select>
<insert id="insertProProjectInfoSubdepts" parameterType="ProProjectInfoSubdepts" useGeneratedKeys="true" keyProperty="id">

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfoSubdeptsUsers" id="ProProjectInfoSubdeptsUsersResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="subDeptId" column="sub_dept_id" />
<result property="subDeptName" column="sub_dept_name" />
<result property="userId" column="user_id" />
@ -31,35 +32,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectProProjectInfoSubdeptsUsersVo">
select id, project_id, sub_dept_id, sub_dept_name, user_id, user_name, craft_type, craft_post, edu_status, edu_file_path, edu_sign_path, edu_date, approve_status, use_status, sub_step, illness_status, sup_illness_status, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info_subdepts_users
select psu.id, psu.project_id, pi.project_name, psu.sub_dept_id, psu.sub_dept_name, psu.user_id, psu.user_name, psu.craft_type, psu.craft_post, psu.edu_status, psu.edu_file_path, psu.edu_sign_path, psu.edu_date, psu.approve_status, psu.use_status, psu.sub_step, psu.illness_status, psu.sup_illness_status, psu.is_del, psu.create_by, psu.create_time, psu.update_by, psu.update_time, psu.remark from pro_project_info_subdepts_users psu
left join pro_project_info pi on pi.id = psu.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql>
<select id="selectProProjectInfoSubdeptsUsersList" parameterType="ProProjectInfoSubdeptsUsers" resultMap="ProProjectInfoSubdeptsUsersResult">
<include refid="selectProProjectInfoSubdeptsUsersVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="subDeptId != null "> and sub_dept_id = #{subDeptId}</if>
<if test="subDeptName != null and subDeptName != ''"> and sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="craftType != null and craftType != ''"> and craft_type = #{craftType}</if>
<if test="craftPost != null and craftPost != ''"> and craft_post = #{craftPost}</if>
<if test="eduStatus != null and eduStatus != ''"> and edu_status = #{eduStatus}</if>
<if test="eduFilePath != null and eduFilePath != ''"> and edu_file_path = #{eduFilePath}</if>
<if test="eduSignPath != null and eduSignPath != ''"> and edu_sign_path = #{eduSignPath}</if>
<if test="eduDate != null "> and edu_date = #{eduDate}</if>
<if test="approveStatus != null "> and approve_status = #{approveStatus}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
<if test="subStep != null "> and sub_step = #{subStep}</if>
<if test="illnessStatus != null "> and illness_status = #{illnessStatus}</if>
<if test="supIllnessStatus != null "> and sup_illness_status = #{supIllnessStatus}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectId != null "> and psu.project_id = #{projectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="subDeptId != null "> and psu.sub_dept_id = #{subDeptId}</if>
<if test="subDeptName != null and subDeptName != ''"> and psu.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="userId != null "> and psu.user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and psu.user_name like concat('%', #{userName}, '%')</if>
<if test="craftType != null and craftType != ''"> and psu.craft_type = #{craftType}</if>
<if test="craftPost != null and craftPost != ''"> and psu.craft_post = #{craftPost}</if>
<if test="eduStatus != null and eduStatus != ''"> and psu.edu_status = #{eduStatus}</if>
<if test="approveStatus != null "> and psu.approve_status = #{approveStatus}</if>
<if test="useStatus != null and useStatus != ''"> and psu.use_status = #{useStatus}</if>
<if test="subStep != null "> and psu.sub_step = #{subStep}</if>
<if test="illnessStatus != null "> and psu.illness_status = #{illnessStatus}</if>
<if test="supIllnessStatus != null "> and psu.sup_illness_status = #{supIllnessStatus}</if>
<if test="isDel != null "> and psu.is_del = #{isDel}</if>
</where>
order by psu.id desc
</select>
<select id="selectProProjectInfoSubdeptsUsersById" parameterType="Long" resultMap="ProProjectInfoSubdeptsUsersResult">
<include refid="selectProProjectInfoSubdeptsUsersVo"/>
where id = #{id}
where psu.id = #{id}
</select>
<insert id="insertProProjectInfoSubdeptsUsers" parameterType="ProProjectInfoSubdeptsUsers" useGeneratedKeys="true" keyProperty="id">

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProProjectInfoUsers" id="ProProjectInfoUsersResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="projectId" column="project_id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
@ -22,26 +23,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectProProjectInfoUsersVo">
select id, dept_id, project_id, user_id, user_name, user_code, user_phone, use_status, is_del, create_by, create_time, update_by, update_time, remark from pro_project_info_users
select pu.id, pu.dept_id, sd.dept_name, pu.project_id, pi.project_name, pu.user_id, pu.user_name, pu.user_code, pu.user_phone, pu.use_status, pu.is_del, pu.create_by, pu.create_time, pu.update_by, pu.update_time, pu.remark from pro_project_info_users pu
left join pro_project_info pi on pi.id = pu.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
</sql>
<select id="selectProProjectInfoUsersList" parameterType="ProProjectInfoUsers" resultMap="ProProjectInfoUsersResult">
<include refid="selectProProjectInfoUsersVo"/>
<where>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="userCode != null and userCode != ''"> and user_code = #{userCode}</if>
<if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="deptId != null "> and pu.dept_id = #{deptId}</if>
<if test="projectId != null "> and pu.project_id = #{projectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="userId != null "> and pu.user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and pu.user_name like concat('%', #{userName}, '%')</if>
<if test="userCode != null and userCode != ''"> and pu.user_code = #{userCode}</if>
<if test="userPhone != null and userPhone != ''"> and pu.user_phone = #{userPhone}</if>
<if test="useStatus != null and useStatus != ''"> and pu.use_status = #{useStatus}</if>
<if test="isDel != null "> and pu.is_del = #{isDel}</if>
</where>
order by pu.id desc
</select>
<select id="selectProProjectInfoUsersById" parameterType="Long" resultMap="ProProjectInfoUsersResult">
<include refid="selectProProjectInfoUsersVo"/>
where id = #{id}
where pu.id = #{id}
</select>
<insert id="insertProProjectInfoUsers" parameterType="ProProjectInfoUsers" useGeneratedKeys="true" keyProperty="id">

View File

@ -78,11 +78,19 @@
<groupId>com.yanzhu</groupId>
<artifactId>yanzhu-common-swagger</artifactId>
</dependency>
<!-- YanZhu Common Datascope -->
<dependency>
<groupId>com.yanzhu</groupId>
<artifactId>yanzhu-common-datascope</artifactId>
</dependency>
<!-- Belerweb Pinyin4j -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -245,10 +245,26 @@ public class SysRoleController extends BaseController
return ajax;
}
/**
*
*/
@ApiOperation(value = "指定流程办理组列表")
@GetMapping("/roleList")
public AjaxResult roleList(SysRole role) {
List<SysRole> list = roleService.selectRoleList(role);
return AjaxResult.success(list);
}
/**
* ID
* @param deptId
* @return
*/
@GetMapping("/deptRole/{deptId}")
public AjaxResult list(@PathVariable("roleId") Long deptId)
{
List<SysRole> list = roleService.findDeptRoleList(deptId);
return success(list);
}
}

View File

@ -224,7 +224,7 @@ public class SysUserController extends BaseController
@PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user)
{
if (!userService.checkUserNameUnique(user))
if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
}
@ -251,7 +251,7 @@ public class SysUserController extends BaseController
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
if (!userService.checkUserNameUnique(user))
if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
}
@ -320,7 +320,7 @@ public class SysUserController extends BaseController
{
AjaxResult ajax = AjaxResult.success();
SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId);
List<SysRole> roles = roleService.findDeptRoleList(user.getDeptId());
ajax.put("user", user);
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
return ajax;

View File

@ -1,7 +1,7 @@
package com.yanzhu.system.mapper;
import java.util.List;
import com.yanzhu.system.domain.SysRoleDept;
import com.yanzhu.system.api.domain.SysRoleDept;
/**
*

View File

@ -104,4 +104,12 @@ public interface SysRoleMapper
* @return
*/
public int deleteRoleByIds(Long[] roleIds);
/**
* ID
*
* @param deptId ID
* @return
*/
public List<SysRole> findDeptRoleList(Long deptId);
}

View File

@ -170,4 +170,12 @@ public interface ISysRoleService
* @return
*/
public int insertAuthUsers(Long roleId, Long[] userIds);
/**
* ID
*
* @param deptId ID
* @return
*/
public List<SysRole> findDeptRoleList(Long deptId);
}

View File

@ -7,7 +7,7 @@ import java.util.List;
import java.util.Set;
import com.yanzhu.common.datascope.annotation.DataScope;
import com.yanzhu.system.domain.SysRoleDept;
import com.yanzhu.system.api.domain.SysRoleDept;
import com.yanzhu.system.domain.SysRoleMenu;
import com.yanzhu.system.domain.SysUserRole;
import com.yanzhu.system.mapper.SysRoleDeptMapper;
@ -234,7 +234,12 @@ public class SysRoleServiceImpl implements ISysRoleService
{
// 新增角色信息
roleMapper.insertRole(role);
return insertRoleMenu(role);
int res = insertRoleMenu(role);
// 角色和部门信息
if(res>0 && role.getDeptId()!=null){
insertRoleDept(role);
}
return res;
}
/**
@ -248,10 +253,15 @@ public class SysRoleServiceImpl implements ISysRoleService
public int updateRole(SysRole role)
{
// 修改角色信息
roleMapper.updateRole(role);
int res = roleMapper.updateRole(role);
// 删除角色与菜单关联
roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId());
return insertRoleMenu(role);
insertRoleMenu(role);
// 角色和部门信息
if(res>0 && role.getDeptId()!=null){
insertRoleDept(role);
}
return res;
}
/**
@ -281,7 +291,7 @@ public class SysRoleServiceImpl implements ISysRoleService
// 删除角色与部门关联
roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId());
// 新增角色和部门信息(数据权限)
return insertRoleDept(role);
return insertRoleDeptList(role);
}
/**
@ -314,6 +324,27 @@ public class SysRoleServiceImpl implements ISysRoleService
* @param role
*/
public int insertRoleDept(SysRole role)
{
int rows = 1;
// 新增角色与部门(数据权限)管理
List<SysRoleDept> list = new ArrayList<SysRoleDept>();
SysRoleDept rd = new SysRoleDept();
rd.setRoleId(role.getRoleId());
rd.setDeptId(role.getDeptId());
list.add(rd);
if (list.size() > 0)
{
rows = roleDeptMapper.batchRoleDept(list);
}
return rows;
}
/**
* ()
*
* @param role
*/
public int insertRoleDeptList(SysRole role)
{
int rows = 1;
// 新增角色与部门(数据权限)管理
@ -422,4 +453,15 @@ public class SysRoleServiceImpl implements ISysRoleService
}
return userRoleMapper.batchUserRole(list);
}
/**
* ID
*
* @param deptId ID
* @return
*/
@Override
public List<SysRole> findDeptRoleList(Long deptId){
return roleMapper.findDeptRoleList(deptId);
}
}

View File

@ -12,6 +12,8 @@ import com.yanzhu.system.domain.SysUserRole;
import com.yanzhu.system.mapper.SysRoleMapper;
import com.yanzhu.system.mapper.SysUserMapper;
import com.yanzhu.system.mapper.SysUserPostMapper;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -270,6 +272,7 @@ public class SysUserServiceImpl implements ISysUserService
public int insertUser(SysUser user)
{
// 新增用户信息
user.setUserName(userNameAndCout(user.getNickName()));
int rows = userMapper.insertUser(user);
// 新增用户岗位关联
insertUserPost(user);
@ -309,9 +312,43 @@ public class SysUserServiceImpl implements ISysUserService
userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理
insertUserPost(user);
//这里不允许修改密码
user.setPassword(null);
return userMapper.updateUser(user);
}
/**
*
* @param name
* @return
*/
private String userNameAndCout(String name){
// 设置不带声调的输出选项
HanyuPinyinOutputFormat format = new net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat();
format.setToneType(net.sourceforge.pinyin4j.format.HanyuPinyinToneType.WITHOUT_TONE);
StringBuilder output = new StringBuilder();
for (char c : name.toCharArray()) {
try {
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c, format);
if (pinyinArray != null && pinyinArray.length > 0) {
output.append(pinyinArray[0]);
} else {
output.append(c);
}
} catch (Exception e) {
output.append(c);
}
}
SysUser query = new SysUser();
query.setUserName(output.toString());
List<SysUser> cout = userMapper.selectUserList(query);
if(StringUtils.isNotEmpty(cout)){
output.append(String.format("%02d", cout.size()));
}
return output.toString();
}
/**
*
*

View File

@ -9,6 +9,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="deptShortName" column="dept_short_name" />
<result property="deptCode" column="dept_code" />
<result property="deptType" column="dept_type" />
<result property="deptInfos" column="dept_infos" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
@ -23,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.dept_short_name, d.dept_code, d.dept_type, d.dept_infos, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
</sql>
@ -31,16 +35,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
AND d.dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
AND d.parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
AND d.dept_name like concat('%', #{deptName}, '%')
</if>
<if test="deptShortName != null and deptShortName != ''">
AND d.dept_short_name like concat('%', #{deptShortName}, '%')
</if>
<if test="deptType != null and deptType != ''">
AND d.dept_type = #{deptType}
</if>
<if test="status != null and status != ''">
AND status = #{status}
AND d.status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
@ -89,8 +99,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="deptShortName != null and deptName != ''">dept_short_name,</if>
<if test="deptCode != null and deptName != ''">dept_code,</if>
<if test="deptType != null and deptName != ''">dept_type,</if>
<if test="deptInfos != null and deptName != ''">dept_infos,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
@ -101,8 +115,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="deptShortName != null and deptShortName != ''">#{deptShortName},</if>
<if test="deptCode != null and deptCode != ''">#{deptCode},</if>
<if test="deptType != null and deptType != ''">#{deptType},</if>
<if test="deptInfos != null and deptInfos != ''">#{deptInfos},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
@ -117,8 +135,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="deptShortName != null and deptShortName != ''">dept_short_name = #{deptShortName},</if>
<if test="deptCode != null and deptCode != ''">dept_code = #{deptCode},</if>
<if test="deptType != null and deptType != ''">dept_type = #{deptType},</if>
<if test="deptInfos != null and deptInfos != ''">dept_infos = #{deptInfos},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>

View File

@ -21,21 +21,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" />
</resultMap>
<resultMap id="SysRoleSysRoleDeptResult" type="SysRole" extends="SysRoleResult">
<collection property="roleDeptList" notNullColumn="sub_role_id" javaType="java.util.List" resultMap="SysRoleDeptResult" />
</resultMap>
<resultMap id="SysRoleDeptResult" type="SysRoleDept">
<result property="roleId" column="sub_role_id" />
<result property="deptId" column="sub_dept_id" />
<result property="deptName" column="sub_dept_name" />
</resultMap>
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark
r.status, r.del_flag, r.create_time, r.remark, rd.role_id as sub_role_id, rd.dept_id as sub_dept_id, rdd.dept_name as sub_dept_name
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
left join sys_role_dept rd on rd.role_id = r.role_id
left join sys_dept rdd on rd.dept_id = rdd.dept_id
</sql>
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/>
where r.del_flag = '0'
<if test="roleId != null and roleId != 0">
AND r.role_id = #{roleId}
</if>
<if test="deptId != null and deptId != 0">
AND rdd.dept_id = #{deptId}
</if>
<if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%')
</if>
@ -56,12 +71,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by r.role_sort
</select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
<select id="findDeptRoleList" parameterType="Long" resultMap="SysRoleResult">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark
from sys_role r
left join sys_role_dept rd on rd.role_id = r.role_id
where r.del_flag = '0' and rd.dept_id = ${deptId}
order by r.role_sort
</select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and ur.user_id = #{userId}
</select>
<select id="selectRoleAll" resultMap="SysRoleResult">
<select id="selectRoleAll" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/>
</select>
@ -73,22 +97,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where u.user_id = #{userId}
</select>
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/>
where r.role_id = #{roleId}
</select>
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and u.user_name = #{userName}
</select>
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/>
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleSysRoleDeptResult">
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select>

View File

@ -9,6 +9,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="userType" column="user_type" />
<result property="cardType" column="card_type" />
<result property="cardCode" column="card_code" />
<result property="userInfos" column="user_infos" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
@ -30,8 +34,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="ancestors" column="ancestors" />
<result property="deptShortName" column="dept_short_name" />
<result property="deptCode" column="dept_code" />
<result property="deptType" column="dept_type" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
@ -47,8 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.card_type, u.card_code, u.user_infos, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.dept_short_name, d.dept_code, d.dept_type, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
@ -57,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.user_type, u.card_type, u.card_code, u.user_infos, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userId != null and userId != 0">
@ -66,6 +73,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="nickName != null and nickName != ''">
AND u.nick_name = #{nickName}
</if>
<if test="cardCode != null and cardCode != ''">
AND u.card_code like concat('%', #{cardCode}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
@ -86,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.card_type, u.card_code, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
@ -103,7 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.card_type, u.card_code, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
@ -152,6 +168,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="userType != null and userType != ''">user_type,</if>
<if test="cardType != null and cardType != ''">card_type,</if>
<if test="cardCode != null and cardCode != ''">card_code,</if>
<if test="userInfos != null and userInfos != ''">user_infos,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
@ -166,6 +186,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="userType != null and userType != ''">#{userType},</if>
<if test="cardType != null and cardType != ''">#{cardType},</if>
<if test="cardCode != null and cardCode != ''">#{cardCode},</if>
<if test="userInfos != null and userInfos != ''">#{userInfos},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
@ -184,6 +208,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="userType != null and userType != ''">user_type = #{userType},</if>
<if test="cardType != null and cardType != ''">card_type = #{cardType},</if>
<if test="cardCode != null and cardCode != ''">card_code = #{cardCode},</if>
<if test="userInfos != null and userInfos != ''">user_infos = #{userInfos},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>

View File

@ -117,3 +117,11 @@ export function deptTreeSelect(roleId) {
method: 'get'
})
}
//根据部门选择角色
export function getDeptRole(deptId) {
return request({
url: '/system/role/deptRole/' + deptId,
method: 'get'
})
}

View File

@ -133,3 +133,11 @@ export function deptTreeSelect() {
method: 'get'
})
}
// 查询部门下拉树结构
export function deptFirTreeSelect() {
return request({
url: '/system/user/deptTree',
method: 'get'
})
}

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="所属单位" prop="deptId">
<el-form-item label="所属单位" prop="deptId" v-hasPermi="['manage:dept:project']">
<el-input
v-model="queryParams.deptId"
placeholder="请输入所属单位"
@ -49,9 +49,9 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="项目等级" prop="projiectLevel">
<el-form-item label="项目等级" prop="projectLevel">
<el-input
v-model="queryParams.projiectLevel"
v-model="queryParams.projectLevel"
placeholder="请输入项目等级"
clearable
@keyup.enter="handleQuery"
@ -141,7 +141,7 @@
<el-table-column label="项目编号" align="center" prop="projectCode" />
<el-table-column label="项目简称" align="center" prop="simpleName" />
<el-table-column label="项目类型" align="center" prop="projectType" />
<el-table-column label="项目等级" align="center" prop="projiectLevel" />
<el-table-column label="项目等级" align="center" prop="projectLevel" />
<el-table-column label="项目区县" align="center" prop="projectRegional" />
<el-table-column label="项目地址" align="center" prop="projectAddress" />
<el-table-column label="项目建设属性" align="center" prop="projectNature" />
@ -213,8 +213,8 @@
<el-form-item label="项目简称" prop="simpleName">
<el-input v-model="form.simpleName" placeholder="请输入项目简称" />
</el-form-item>
<el-form-item label="项目等级" prop="projiectLevel">
<el-input v-model="form.projiectLevel" placeholder="请输入项目等级" />
<el-form-item label="项目等级" prop="projectLevel">
<el-input v-model="form.projectLevel" placeholder="请输入项目等级" />
</el-form-item>
<el-form-item label="项目区县" prop="projectRegional">
<el-input v-model="form.projectRegional" placeholder="请输入项目区县" />
@ -337,7 +337,7 @@ const data = reactive({
projectCode: null,
simpleName: null,
projectType: null,
projiectLevel: null,
projectLevel: null,
projectPerson: null,
projectPersonPhone: null,
projectStatus: null,
@ -376,7 +376,7 @@ function reset() {
projectCode: null,
simpleName: null,
projectType: null,
projiectLevel: null,
projectLevel: null,
projectRegional: null,
projectAddress: null,
projectNature: null,

View File

@ -1,10 +1,10 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目主键" prop="projectId">
<el-form-item label="项目名称" prop="projectName">
<el-input
v-model="queryParams.projectId"
placeholder="请输入项目主键"
v-model="queryParams.projectName"
placeholder="请输入项目名称"
clearable
@keyup.enter="handleQuery"
/>
@ -27,24 +27,6 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="参建单位编号" prop="deptCode">
<el-input
v-model="queryParams.deptCode"
placeholder="请输入参建单位编号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="删除标识" prop="isDel">
<el-select v-model="queryParams.isDel" placeholder="请选择删除标识" clearable>
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
@ -95,8 +77,7 @@
<el-table v-loading="loading" :data="proProjectInfoDeptsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="项目主键" align="center" prop="projectId" />
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="参建单位类型" align="center" prop="deptType">
<template #default="scope">
<dict-tag :options="pro_dept_type" :value="scope.row.deptType"/>
@ -104,7 +85,7 @@
</el-table-column>
<el-table-column label="参建单位名称" align="center" prop="deptName" />
<el-table-column label="参建单位编号" align="center" prop="deptCode" />
<el-table-column label="删除标识" align="center" prop="isDel">
<el-table-column label="数据状态" align="center" prop="isDel">
<template #default="scope">
<dict-tag :options="sys_is_del" :value="scope.row.isDel"/>
</template>
@ -126,10 +107,10 @@
/>
<!-- 添加或修改参建单位对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="proProjectInfoDeptsRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目主键" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目主键" />
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
<el-form ref="proProjectInfoDeptsRef" :model="form" :rules="rules" label-width="120px">
<el-form-item label="项目主键" prop="projectName">
<el-input v-model="form.projectName" :disabled="form.id" placeholder="请输入项目主键" />
</el-form-item>
<el-form-item label="参建单位类型" prop="deptType">
<el-select v-model="form.deptType" placeholder="请选择参建单位类型">
@ -147,19 +128,6 @@
<el-form-item label="参建单位编号" prop="deptCode">
<el-input v-model="form.deptCode" placeholder="请输入参建单位编号" />
</el-form-item>
<el-form-item label="删除标识" prop="isDel">
<el-select v-model="form.isDel" placeholder="请选择删除标识">
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
@ -192,11 +160,9 @@ const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
projectId: null,
projectName: null,
deptType: null,
deptName: null,
deptCode: null,
isDel: null,
},
rules: {
}

View File

@ -56,13 +56,19 @@
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
<el-table-column prop="deptShortName" label="部门简称"></el-table-column>
<el-table-column prop="sys_dept_type" label="部门类型">
<template #default="scope">
<dict-tag :options="sys_dept_type" :value="scope.row.deptType" />
</template>
</el-table-column>
<el-table-column prop="orderNum" label="排序" width="100"></el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
@ -77,8 +83,8 @@
</el-table>
<!-- 添加或修改部门对话框 -->
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
<el-form ref="deptRef" :model="form" :rules="rules" label-width="80px">
<el-dialog :title="title" v-model="open" width="680px" append-to-body>
<el-form ref="deptRef" :model="form" :rules="rules" label-width="88px">
<el-row>
<el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级部门" prop="parentId">
@ -89,35 +95,43 @@
value-key="deptId"
placeholder="选择上级部门"
check-strictly
style="width:100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="24">
<el-form-item label="部门名称" prop="deptName">
<el-input v-model="form.deptName" placeholder="请输入部门名称" />
<el-input v-model="form.deptName" placeholder="请输入部门名称" maxlength="64"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门类型" prop="deptType">
<el-select v-model="form.deptType" placeholder="请选择部门类型" style="width: 100%">
<el-option
v-for="dict in sys_dept_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" style="width:100%"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人" prop="leader">
<el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />
<el-form-item label="部门简称" prop="deptShortName">
<el-input v-model="form.deptShortName" placeholder="请输入部门简称" maxlength="32"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
<el-form-item label="部门编号" prop="deptCode">
<el-input v-model="form.deptCode" placeholder="请输入部门编号" maxlength="32"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="24">
<el-form-item label="部门状态">
<el-radio-group v-model="form.status">
<el-radio
@ -128,6 +142,16 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门主管" prop="leader">
<el-input v-model="form.leader" placeholder="请输入部门主管" maxlength="20" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
@ -144,7 +168,7 @@
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const { sys_dept_type, sys_normal_disable } = proxy.useDict("sys_dept_type", "sys_normal_disable");
const deptList = ref([]);
const open = ref(false);
@ -164,6 +188,9 @@ const data = reactive({
rules: {
parentId: [{ required: true, message: "上级部门不能为空", trigger: "blur" }],
deptName: [{ required: true, message: "部门名称不能为空", trigger: "blur" }],
deptType: [{ required: true, message: "部门类型不能为空", trigger: "change" }],
deptShortName: [{ required: false, message: "部门简称不能为空", trigger: "blur" }],
deptCode: [{ required: false, message: "部门编号不能为空", trigger: "blur" }],
orderNum: [{ required: true, message: "显示排序不能为空", trigger: "blur" }],
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
@ -191,6 +218,9 @@ function reset() {
deptId: undefined,
parentId: undefined,
deptName: undefined,
deptShortName: undefined,
deptType: undefined,
deptCode: undefined,
orderNum: 0,
leader: undefined,
phone: undefined,

View File

@ -1,144 +1,187 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true" label-width="68px">
<el-form-item label="角色名称" prop="roleName">
<el-input
v-model="queryParams.roleName"
placeholder="请输入角色名称"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="权限字符" prop="roleKey">
<el-input
v-model="queryParams.roleKey"
placeholder="请输入权限字符"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="角色状态"
clearable
style="width: 240px"
>
<el-option
v-for="dict in sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入部门名称"
clearable
prefix-icon="Search"
style="margin-bottom: 20px"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" style="width: 308px">
<el-date-picker
v-model="dateRange"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['system:role:add']"
>新增</el-button>
</div>
<div class="head-container">
<el-tree
:data="deptFirOptions"
:props="{ label: 'label', children: 'children' }"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="deptTreeRef"
node-key="id"
highlight-current
accordion
:default-expanded-keys="defaultEK"
@node-click="handleNodeClick"
/>
</div>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:role:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:role:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['system:role:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
<!--角色数据-->
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true" label-width="68px">
<el-form-item label="角色名称" prop="roleName">
<el-input
v-model="queryParams.roleName"
placeholder="请输入角色名称"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="权限字符" prop="roleKey">
<el-input
v-model="queryParams.roleKey"
placeholder="请输入权限字符"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="角色状态"
clearable
style="width: 240px"
>
<el-option
v-for="dict in sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" style="width: 308px">
<el-date-picker
v-model="dateRange"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['system:role:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:role:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:role:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['system:role:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 表格数据 -->
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="角色编号" prop="roleId" width="120" />
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
<el-table-column label="所属部门">
<template #default="scope">
<div class="flex gap-2">
<el-tag
v-for="item in scope.row.roleDeptList"
effect="dark"
>
{{ item.deptName }}
</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
<el-table-column label="显示顺序" prop="roleSort" width="100" />
<el-table-column label="状态" align="center" width="100">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:role:remove']"></el-button>
</el-tooltip>
<el-tooltip content="数据权限" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="CircleCheck" @click="handleDataScope(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
<el-tooltip content="分配用户" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="User" @click="handleAuthUser(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<!-- 表格数据 -->
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="角色编号" prop="roleId" width="120" />
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
<el-table-column label="显示顺序" prop="roleSort" width="100" />
<el-table-column label="状态" align="center" width="100">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:role:remove']"></el-button>
</el-tooltip>
<el-tooltip content="数据权限" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="CircleCheck" @click="handleDataScope(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
<el-tooltip content="分配用户" placement="top" v-if="scope.row.roleId !== 1">
<el-button link type="primary" icon="User" @click="handleAuthUser(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改角色配置对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="roleRef" :model="form" :rules="rules" label-width="100px">
@ -214,6 +257,17 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属部门" prop="deptId">
<el-tree-select
v-model="form.deptId"
:data="deptFirOptions"
:props="{ value: 'id', label: 'label', children: 'children' }"
value-key="id"
placeholder="请选择所属部门"
check-strictly
style="width:100%"
/>
</el-form-item>
<el-form-item label="数据权限" v-show="form.dataScope == 2">
<el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">/</el-checkbox>
<el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">/</el-checkbox>
@ -242,6 +296,7 @@
</template>
<script setup name="Role">
import { deptFirTreeSelect } from "@/api/system/user";
import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role";
import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu";
@ -268,6 +323,10 @@ const deptOptions = ref([]);
const openDataScope = ref(false);
const menuRef = ref(null);
const deptRef = ref(null);
const deptName = ref("");
const deptFirOptions = ref(undefined);
const defaultEK = ref([100]);
/** 数据范围选项*/
const dataScopeOptions = ref([
@ -288,6 +347,7 @@ const data = reactive({
status: undefined
},
rules: {
deptId: [{ required: true, message: "所属部门不能为空", trigger: "change" }],
roleName: [{ required: true, message: "角色名称不能为空", trigger: "blur" }],
roleKey: [{ required: true, message: "权限字符不能为空", trigger: "blur" }],
roleSort: [{ required: true, message: "角色顺序不能为空", trigger: "blur" }]
@ -296,6 +356,15 @@ const data = reactive({
const { queryParams, form, rules } = toRefs(data);
/** 通过条件过滤节点 */
const filterNode = (value, data) => {
if (!value) return true;
return data.label.indexOf(value) !== -1;
};
/** 根据名称筛选部门树 */
watch(deptName, val => {
proxy.$refs["deptTreeRef"].filter(val);
});
/** 查询角色列表 */
function getList() {
loading.value = true;
@ -305,6 +374,11 @@ function getList() {
loading.value = false;
});
}
/** 节点单击事件 */
function handleNodeClick(data) {
queryParams.value.deptId = data.id;
handleQuery();
};
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
@ -440,8 +514,14 @@ function getRoleMenuTreeselect(roleId) {
return response;
});
}
/** 查询部门下拉树结构 */
function getDeptTree() {
deptFirTreeSelect().then(response => {
deptFirOptions.value = response.data;
});
};
/** 根据角色ID查询部门树结构 */
function getDeptTree(roleId) {
function getDeptRoleTree(roleId) {
return deptTreeSelect(roleId).then(response => {
deptOptions.value = response.depts;
return response;
@ -522,7 +602,7 @@ function dataScopeSelectChange(value) {
/** 分配数据权限操作 */
function handleDataScope(row) {
reset();
const deptTreeSelect = getDeptTree(row.roleId);
const deptTreeSelect = getDeptRoleTree(row.roleId);
getRole(row.roleId).then(response => {
form.value = response.data;
openDataScope.value = true;
@ -556,4 +636,5 @@ function cancelDataScope() {
}
getList();
getDeptTree();
</script>

View File

@ -23,7 +23,7 @@
<span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column>
<el-table-column type="selection" :reserve-selection="true" width="55" />
<el-table-column label="角色编号" align="center" prop="roleId" />
<el-table-column label="角色名称" align="center" prop="roleName" />
<el-table-column label="权限字符" align="center" prop="roleKey" />

View File

@ -21,7 +21,8 @@
ref="deptTreeRef"
node-key="id"
highlight-current
default-expand-all
accordion
:default-expanded-keys="defaultEK"
@node-click="handleNodeClick"
/>
</div>
@ -29,9 +30,9 @@
<!--用户数据-->
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户名称" prop="userName">
<el-form-item label="用户名称" prop="nickName">
<el-input
v-model="queryParams.userName"
v-model="queryParams.nickName"
placeholder="请输入用户名称"
clearable
style="width: 240px"
@ -47,7 +48,7 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-form-item label="用户状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="用户状态"
@ -132,11 +133,16 @@
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
<el-table-column label="登录账号" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户名称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="所属部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户类型" align="center" v-if="columns[4].visible" >
<template #default="scope">
<dict-tag :options="sys_user_type" :value="scope.row.userType" />
</template>
</el-table-column>
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[5].visible" width="120" />
<el-table-column label="用户状态" align="center" key="status" v-if="columns[6].visible">
<template #default="scope">
<el-switch
v-model="scope.row.status"
@ -146,7 +152,7 @@
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[7].visible" width="160">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
@ -179,55 +185,53 @@
</el-row>
<!-- 添加或修改用户配置对话框 -->
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
<el-form :model="form" :rules="rules" ref="userRef" label-width="80px">
<el-dialog :title="title" v-model="open" width="680px" append-to-body>
<el-form :model="form" :rules="rules" ref="userRef" label-width="88px">
<el-row>
<el-col :span="12">
<el-form-item label="用户昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<el-col :span="24">
<el-form-item label="所属部门" prop="deptId">
<el-tree-select
v-model="form.deptId"
:data="deptOptions"
:props="{ value: 'id', label: 'label', children: 'children' }"
value-key="id"
placeholder="请选择属部门"
placeholder="请选择属部门"
check-strictly
style="width:100%"
@change="handleChangeDept"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="用户名称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入用户名称" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户类型" prop="userType">
<el-select v-model="form.userType" placeholder="请选择用户类型" style="width: 100%">
<el-option
v-for="dict in sys_user_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
<el-input v-model="form.phonenumber" :disabled="form.userId" placeholder="请输入手机号码" maxlength="11" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
<el-form-item label="登录密码" prop="password">
<el-input v-model="form.password" placeholder="请输入登录密码" type="password" maxlength="20" :disabled="form.userId" :show-password="!form.userId" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="用户性别">
<el-select v-model="form.sex" placeholder="请选择">
<el-select v-model="form.sex" placeholder="请选择用户性别" style="width:100%">
<el-option
v-for="dict in sys_user_sex"
:key="dict.value"
@ -238,7 +242,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态">
<el-form-item label="用户状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in sys_normal_disable"
@ -248,11 +252,9 @@
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="岗位">
<el-select v-model="form.postIds" multiple placeholder="请选择">
<el-form-item label="用户岗位">
<el-select v-model="form.postIds" multiple placeholder="请选择用户岗位" style="width:100%">
<el-option
v-for="item in postOptions"
:key="item.postId"
@ -264,8 +266,8 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择">
<el-form-item label="用户角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择用户角色" style="width:100%">
<el-option
v-for="item in roleOptions"
:key="item.roleId"
@ -277,13 +279,6 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
@ -331,11 +326,12 @@
<script setup name="User">
import { getToken } from "@/utils/auth";
import { getDeptRole } from "@/api/system/role";
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user";
const router = useRouter();
const { proxy } = getCurrentInstance();
const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex");
const { sys_user_type, sys_normal_disable, sys_user_sex } = proxy.useDict("sys_user_type", "sys_normal_disable", "sys_user_sex");
const userList = ref([]);
const open = ref(false);
@ -352,6 +348,9 @@ const deptOptions = ref(undefined);
const initPassword = ref(undefined);
const postOptions = ref([]);
const roleOptions = ref([]);
const defaultEK = ref([100]);
/*** 用户导入参数 */
const upload = reactive({
//
@ -369,13 +368,14 @@ const upload = reactive({
});
//
const columns = ref([
{ key: 0, label: `用户编号`, visible: true },
{ key: 1, label: `用户名称`, visible: true },
{ key: 2, label: `用户昵称`, visible: true },
{ key: 3, label: `部门`, visible: true },
{ key: 4, label: `手机号码`, visible: true },
{ key: 5, label: `状态`, visible: true },
{ key: 6, label: `创建时间`, visible: true }
{ key: 0, label: `用户编号`, visible: false },
{ key: 1, label: `登录账号`, visible: true },
{ key: 2, label: `用户名称`, visible: true },
{ key: 3, label: `所属部门`, visible: true },
{ key: 4, label: `用户类型`, visible: true },
{ key: 5, label: `手机号码`, visible: true },
{ key: 6, label: `用户状态`, visible: true },
{ key: 7, label: `创建时间`, visible: true }
]);
const data = reactive({
@ -384,16 +384,18 @@ const data = reactive({
pageNum: 1,
pageSize: 10,
userName: undefined,
nickName: undefined,
phonenumber: undefined,
status: undefined,
deptId: undefined
},
rules: {
deptId: [{ required: true, message: "所属单位不能为空", trigger: "change" }],
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
nickName: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }],
nickName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
userType: [{ required: true, message: "用户类型不能为空", trigger: "change" }],
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }],
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
}
});
@ -560,7 +562,6 @@ function handleAdd() {
reset();
getUser().then(response => {
postOptions.value = response.posts;
roleOptions.value = response.roles;
open.value = true;
title.value = "添加用户";
form.value.password = initPassword.value;
@ -573,14 +574,23 @@ function handleUpdate(row) {
getUser(userId).then(response => {
form.value = response.data;
postOptions.value = response.posts;
roleOptions.value = response.roles;
form.value.postIds = response.postIds;
form.value.roleIds = response.roleIds;
open.value = true;
title.value = "修改用户";
form.password = "";
});
handleChangeDept(row.deptId);
};
/** 根据单位选择角色 */
function handleChangeDept(value){
form.roleIds = null;
getDeptRole(value).then(response => {
roleOptions.value = response.data;
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["userRef"].validate(valid => {