角色页面添加角色使用用途
This commit is contained in:
parent
fb937034a7
commit
b1addfbebd
@ -173,6 +173,15 @@
|
||||
>{{dict.dictLabel}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="用途">
|
||||
<el-radio-group v-model="form.purpose">
|
||||
<el-radio
|
||||
v-for="dict in purposeOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictValue"
|
||||
>{{dict.dictLabel}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="菜单权限">
|
||||
<el-tree
|
||||
:data="menuOptions"
|
||||
@ -233,9 +242,24 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRole, getRole, delRole, addRole, updateRole, exportRole, dataScope, changeRoleStatus } from "@/api/system/role";
|
||||
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
|
||||
import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
|
||||
import {
|
||||
listRole,
|
||||
getRole,
|
||||
delRole,
|
||||
addRole,
|
||||
updateRole,
|
||||
exportRole,
|
||||
dataScope,
|
||||
changeRoleStatus
|
||||
} from "@/api/system/role";
|
||||
import {
|
||||
treeselect as menuTreeselect,
|
||||
roleMenuTreeselect
|
||||
} from "@/api/system/menu";
|
||||
import {
|
||||
treeselect as deptTreeselect,
|
||||
roleDeptTreeselect
|
||||
} from "@/api/system/dept";
|
||||
|
||||
export default {
|
||||
name: "Role",
|
||||
@ -263,6 +287,8 @@ export default {
|
||||
dateRange: [],
|
||||
// 状态数据字典
|
||||
statusOptions: [],
|
||||
// 用途数据字典
|
||||
purposeOptions: [],
|
||||
// 数据范围选项
|
||||
dataScopeOptions: [
|
||||
{
|
||||
@ -296,7 +322,8 @@ export default {
|
||||
pageSize: 10,
|
||||
roleName: undefined,
|
||||
roleKey: undefined,
|
||||
status: undefined
|
||||
status: undefined,
|
||||
purpose: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@ -323,6 +350,9 @@ export default {
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getDicts("sys_purpose").then(response => {
|
||||
this.purposeOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询角色列表 */
|
||||
@ -383,15 +413,22 @@ export default {
|
||||
// 角色状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
this.$confirm('确认要"' + text + '""' + row.roleName + '"角色吗?', "警告", {
|
||||
this.$confirm(
|
||||
'确认要"' + text + '""' + row.roleName + '"角色吗?',
|
||||
"警告",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
}
|
||||
)
|
||||
.then(function() {
|
||||
return changeRoleStatus(row.roleId, row.status);
|
||||
}).then(() => {
|
||||
})
|
||||
.then(() => {
|
||||
this.msgSuccess(text + "成功");
|
||||
}).catch(function() {
|
||||
})
|
||||
.catch(function() {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
});
|
||||
},
|
||||
@ -418,7 +455,8 @@ export default {
|
||||
status: "0",
|
||||
menuIds: [],
|
||||
deptIds: [],
|
||||
remark: undefined
|
||||
remark: undefined,
|
||||
purpose: "1"
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@ -435,9 +473,9 @@ export default {
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.roleId)
|
||||
this.single = selection.length!=1
|
||||
this.multiple = !selection.length
|
||||
this.ids = selection.map(item => item.roleId);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
@ -449,7 +487,7 @@ export default {
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const roleId = row.roleId || this.ids
|
||||
const roleId = row.roleId || this.ids;
|
||||
this.$nextTick(() => {
|
||||
this.getRoleMenuTreeselect(roleId);
|
||||
});
|
||||
@ -519,29 +557,39 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const roleIds = row.roleId || this.ids;
|
||||
this.$confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?', "警告", {
|
||||
this.$confirm(
|
||||
'是否确认删除角色编号为"' + roleIds + '"的数据项?',
|
||||
"警告",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
}
|
||||
)
|
||||
.then(function() {
|
||||
return delRole(roleIds);
|
||||
}).then(() => {
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(function() {});
|
||||
})
|
||||
.catch(function() {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有角色数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
this.$confirm("是否确认导出所有角色数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(function() {
|
||||
return exportRole(queryParams);
|
||||
}).then(response => {
|
||||
})
|
||||
.then(response => {
|
||||
this.download(response.msg);
|
||||
}).catch(function() {});
|
||||
})
|
||||
.catch(function() {});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -103,7 +103,7 @@ public class BySchoolController extends BaseController
|
||||
{
|
||||
//从school表中取出当前最大的ID值 并且将其赋值给dept中的ordernumber
|
||||
String maxId = jdbcTemplate.queryForObject(String.format("select MAX(id) from by_school"),String.class);
|
||||
|
||||
//生成32位UUID
|
||||
String uuid = getUUID32();
|
||||
|
||||
//将UUID赋值给xxdm
|
||||
@ -114,12 +114,19 @@ public class BySchoolController extends BaseController
|
||||
|
||||
//创建dept实例 并且向要添加的dept中设置各个参数
|
||||
SysDept dept = new SysDept();
|
||||
if (maxId != "0")
|
||||
{
|
||||
dept.setOrderNum(maxId);
|
||||
System.out.println("------------" + maxId);
|
||||
}else
|
||||
{
|
||||
dept.setOrderNum("6");
|
||||
}
|
||||
dept.setSchoolId(bySchool.getXxdm());
|
||||
dept.setCreateBy(SecurityUtils.getUsername());
|
||||
dept.setParentId(200L);
|
||||
dept.setAncestors("0,100,200");
|
||||
dept.setDeptName(bySchool.getSchoolName());
|
||||
dept.setOrderNum(maxId);
|
||||
dept.setPhone(bySchool.getTel());
|
||||
dept.setLeader(SecurityUtils.getUsername());
|
||||
//插入数据
|
||||
@ -136,6 +143,16 @@ public class BySchoolController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BySchool bySchool)
|
||||
{
|
||||
//创建dept实例 并且向要添加的dept中设置各个参数
|
||||
SysDept dept = new SysDept();
|
||||
|
||||
//设置schoolID为xxdm
|
||||
dept.setSchoolId(bySchool.getXxdm());
|
||||
|
||||
//通过selectdeptlist来获取deptid
|
||||
dept.setDeptId(deptService.selectDeptList(dept).get(0).getDeptId());
|
||||
dept.setStatus(bySchool.getStatus());
|
||||
deptService.updateDept(dept);
|
||||
return toAjax(bySchoolService.updateBySchool(bySchool));
|
||||
}
|
||||
|
||||
@ -152,10 +169,12 @@ public class BySchoolController extends BaseController
|
||||
{
|
||||
//循环找出school表的id
|
||||
Long bySchId = ids[i];
|
||||
|
||||
//用school表ID获取xxdm的值
|
||||
//将值赋给dept中的schoolID
|
||||
SysDept dept = new SysDept();
|
||||
dept.setSchoolId(bySchoolService.selectBySchoolById(bySchId).getXxdm());
|
||||
|
||||
//通过dept表的schoolID来找出dept的List
|
||||
deptService.deleteDeptById(deptService.selectDeptList(dept).get(0).getDeptId());
|
||||
}
|
||||
|
@ -88,9 +88,9 @@ public class BySchool extends BaseEntity
|
||||
@Excel(name = "紧急联系电话")
|
||||
private String emTel;
|
||||
|
||||
/** 状态(0试用,1开通,2停用,3禁用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=试用,1开通,2停用,3禁用")
|
||||
private Long status;
|
||||
/** 状态(0正常,1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1停用")
|
||||
private String status;
|
||||
|
||||
/** 幼儿园规模 */
|
||||
@Excel(name = "幼儿园规模")
|
||||
@ -140,6 +140,12 @@ public class BySchool extends BaseEntity
|
||||
@Excel(name = "当前学期")
|
||||
private String dqxq;
|
||||
|
||||
|
||||
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String isDel;
|
||||
|
||||
//部门
|
||||
private SysDept dept;
|
||||
|
||||
@ -295,12 +301,12 @@ public class BySchool extends BaseEntity
|
||||
{
|
||||
return emTel;
|
||||
}
|
||||
public void setStatus(Long status)
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getStatus()
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
@ -421,7 +427,13 @@ public class BySchool extends BaseEntity
|
||||
this.xxdm = xxdm;
|
||||
}
|
||||
|
||||
public String getIsDel() {
|
||||
return isDel;
|
||||
}
|
||||
|
||||
public void setIsDel(String isDel) {
|
||||
this.isDel = isDel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@ -459,6 +471,7 @@ public class BySchool extends BaseEntity
|
||||
.append("dqxn", getDqxn())
|
||||
.append("dqxq", getDqxq())
|
||||
.append("dept", getDept())
|
||||
.append("isDel",getIsDel())
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,9 @@ public class SysRole extends BaseEntity
|
||||
/** 部门组(数据权限) */
|
||||
private Long[] deptIds;
|
||||
|
||||
/** 角色用途 */
|
||||
private String purpose;
|
||||
|
||||
public SysRole()
|
||||
{
|
||||
|
||||
@ -192,6 +195,15 @@ public class SysRole extends BaseEntity
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("purpose", getPurpose())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String getPurpose() {
|
||||
return purpose;
|
||||
}
|
||||
|
||||
public void setPurpose(String purpose) {
|
||||
this.purpose = purpose;
|
||||
}
|
||||
}
|
||||
|
@ -37,45 +37,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="openDeadline" column="open_deadline" />
|
||||
<result property="dqxn" column="dqxn" />
|
||||
<result property="dqxq" column="dqxq" />
|
||||
<result property="isDel" column="is_del" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBySchoolVo">
|
||||
select id, xxdm, school_name, name_short, type, parent_id, province, provincename, regionid, regionname, area, areaname, address, mastername, tel, em_man, em_tel, status, scale, create_time, create_user, approval_user, approval_time, remark, location, is_demonstr, businesslicenseimg, open_book, fee_status, open_deadline, dqxn, dqxq from by_school
|
||||
select id, xxdm, school_name, name_short, type, parent_id, province, provincename, regionid, regionname, area, areaname, address, mastername, tel, em_man, em_tel, status, scale, create_time, create_user, approval_user, approval_time, remark, location, is_demonstr, businesslicenseimg, open_book, fee_status, open_deadline, dqxn, dqxq, is_del from by_school
|
||||
</sql>
|
||||
|
||||
<select id="selectBySchoolList" parameterType="BySchool" resultMap="BySchoolResult">
|
||||
<include refid="selectBySchoolVo"/>
|
||||
<where>
|
||||
<if test="xxdm != null and xxdm != ''"> and xxdm like concat('%', #{xxdm}, '%')</if>
|
||||
<if test="schoolName != null and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
|
||||
<if test="nameShort != null and nameShort != ''"> and name_short = #{nameShort}</if>
|
||||
<if test="type != null "> and type = #{type}</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="province != null and province != ''"> and province = #{province}</if>
|
||||
<if test="provincename != null and provincename != ''"> and provincename like concat('%', #{provincename}, '%')</if>
|
||||
<if test="regionid != null and regionid != ''"> and regionid = #{regionid}</if>
|
||||
<if test="regionname != null and regionname != ''"> and regionname like concat('%', #{regionname}, '%')</if>
|
||||
<if test="area != null and area != ''"> and area = #{area}</if>
|
||||
<if test="areaname != null and areaname != ''"> and areaname like concat('%', #{areaname}, '%')</if>
|
||||
<if test="address != null and address != ''"> and address = #{address}</if>
|
||||
<if test="mastername != null and mastername != ''"> and mastername like concat('%', #{mastername}, '%')</if>
|
||||
<if test="tel != null and tel != ''"> and tel = #{tel}</if>
|
||||
<if test="emMan != null and emMan != ''"> and em_man = #{emMan}</if>
|
||||
<if test="emTel != null and emTel != ''"> and em_tel = #{emTel}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="scale != null "> and scale = #{scale}</if>
|
||||
<if test="createUser != null "> and create_user = #{createUser}</if>
|
||||
<if test="approvalUser != null "> and approval_user = #{approvalUser}</if>
|
||||
<if test="approvalTime != null "> and approval_time = #{approvalTime}</if>
|
||||
<if test="location != null and location != ''"> and location = #{location}</if>
|
||||
<if test="isDemonstr != null "> and is_demonstr = #{isDemonstr}</if>
|
||||
<if test="businesslicenseimg != null and businesslicenseimg != ''"> and businesslicenseimg = #{businesslicenseimg}</if>
|
||||
<if test="openBook != null "> and open_book = #{openBook}</if>
|
||||
<if test="feeStatus != null "> and fee_status = #{feeStatus}</if>
|
||||
<if test="openDeadline != null "> and open_deadline = #{openDeadline}</if>
|
||||
<if test="dqxn != null and dqxn != ''"> and dqxn = #{dqxn}</if>
|
||||
<if test="dqxq != null and dqxq != ''"> and dqxq = #{dqxq}</if>
|
||||
</where>
|
||||
where is_del = '0'
|
||||
<if test="xxdm != null and xxdm != ''"> and xxdm like concat('%', #{xxdm}, '%')</if>
|
||||
<if test="schoolName != null and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
|
||||
<if test="nameShort != null and nameShort != ''"> and name_short = #{nameShort}</if>
|
||||
<if test="type != null "> and type = #{type}</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="province != null and province != ''"> and province = #{province}</if>
|
||||
<if test="provincename != null and provincename != ''"> and provincename like concat('%', #{provincename}, '%')</if>
|
||||
<if test="regionid != null and regionid != ''"> and regionid = #{regionid}</if>
|
||||
<if test="regionname != null and regionname != ''"> and regionname like concat('%', #{regionname}, '%')</if>
|
||||
<if test="area != null and area != ''"> and area = #{area}</if>
|
||||
<if test="areaname != null and areaname != ''"> and areaname like concat('%', #{areaname}, '%')</if>
|
||||
<if test="address != null and address != ''"> and address = #{address}</if>
|
||||
<if test="mastername != null and mastername != ''"> and mastername like concat('%', #{mastername}, '%')</if>
|
||||
<if test="tel != null and tel != ''"> and tel = #{tel}</if>
|
||||
<if test="emMan != null and emMan != ''"> and em_man = #{emMan}</if>
|
||||
<if test="emTel != null and emTel != ''"> and em_tel = #{emTel}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="scale != null "> and scale = #{scale}</if>
|
||||
<if test="createUser != null "> and create_user = #{createUser}</if>
|
||||
<if test="approvalUser != null "> and approval_user = #{approvalUser}</if>
|
||||
<if test="approvalTime != null "> and approval_time = #{approvalTime}</if>
|
||||
<if test="location != null and location != ''"> and location = #{location}</if>
|
||||
<if test="isDemonstr != null "> and is_demonstr = #{isDemonstr}</if>
|
||||
<if test="businesslicenseimg != null and businesslicenseimg != ''"> and businesslicenseimg = #{businesslicenseimg}</if>
|
||||
<if test="openBook != null "> and open_book = #{openBook}</if>
|
||||
<if test="feeStatus != null "> and fee_status = #{feeStatus}</if>
|
||||
<if test="openDeadline != null "> and open_deadline = #{openDeadline}</if>
|
||||
<if test="dqxn != null and dqxn != ''"> and dqxn = #{dqxn}</if>
|
||||
<if test="dqxq != null and dqxq != ''"> and dqxq = #{dqxq}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectBySchoolById" parameterType="Long" resultMap="BySchoolResult">
|
||||
@ -196,7 +197,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBySchoolByIds" parameterType="String">
|
||||
delete from by_school where id in
|
||||
update by_school set is_del = '2' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
@ -17,11 +17,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="purpose" column="purpose" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRoleVo">
|
||||
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope,
|
||||
r.status, r.del_flag, r.create_time, r.remark
|
||||
r.status, r.del_flag, r.create_time, r.remark, r.purpose
|
||||
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
|
||||
@ -96,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="dataScope != null and dataScope != ''">data_scope,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="purpose != null and purpose != ''">purpose,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
@ -106,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="dataScope != null and dataScope != ''">#{dataScope},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="purpose != null and purpose != ''">#{purpose},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
@ -119,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if>
|
||||
<if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="purpose != null and purpose != ''">purpose = #{purpose},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
|
Loading…
x
Reference in New Issue
Block a user