bug
This commit is contained in:
parent
fa1e15dde4
commit
ce64a1ea41
@ -131,3 +131,16 @@
|
||||
.el-pagination.is-background .el-pager li:hover{
|
||||
color: #FF9655 !important;/*hover时候的文字颜色*/
|
||||
}
|
||||
//修改选择框的颜色
|
||||
.el-checkbox__input.is-checked .el-checkbox__inner,
|
||||
.el-checkbox__input.is-indeterminate .el-checkbox__inner {
|
||||
border-color: #FF9655!important;
|
||||
background-color: #FF9655!important;
|
||||
}
|
||||
.el-checkbox__input.is-focus .el-checkbox__inner{
|
||||
border-color: #FF9655!important;
|
||||
}
|
||||
//修改选中后文本的颜色
|
||||
.el-checkbox__input.is-checked+.el-checkbox__label{
|
||||
color:#FF9655!important;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
merchantId: "2",
|
||||
isOpen: true,
|
||||
ruleForm: {
|
||||
roleName: '',
|
||||
storeId: '',
|
||||
@ -15,9 +16,11 @@ export default {
|
||||
description: '',
|
||||
dutyId: "",
|
||||
checkedKeys: [],
|
||||
roleCode:"",
|
||||
roleCode:"0",
|
||||
},
|
||||
checked:true,
|
||||
checkedKeys:[],
|
||||
isCashier:false,
|
||||
checked:false,
|
||||
rules: {
|
||||
roleName: [
|
||||
{required: true, message: '请输入角色名称', trigger: 'blur'},
|
||||
@ -94,11 +97,15 @@ export default {
|
||||
// merchantId 代表deptType
|
||||
this.tableData = []
|
||||
menuTreeselect({merchantId: this.merchantId, roleId: this.ruleForm.dutyId}).then(response => {
|
||||
let show = false
|
||||
if (this.isCashier) {
|
||||
show = true
|
||||
}
|
||||
let data = {
|
||||
id: 0,
|
||||
label: '收银台',
|
||||
childrens: [],
|
||||
list: [{id: 0,show: false, name: '选中菜单'},]
|
||||
list: [{id: 0,show: show, name: '选中菜单'},]
|
||||
}
|
||||
this.tableData.push(data);
|
||||
this.tableData.push(...response.data);
|
||||
@ -148,6 +155,11 @@ export default {
|
||||
this.ruleForm.checkedKeys = checkedKeys
|
||||
this.ruleForm.menuIds = checkedKeys
|
||||
this.merchantId = response.data.roleInfo.type
|
||||
if (response.data.roleInfo.roleCode==2 || response.data.roleInfo.roleCode==3){
|
||||
this.isCashier = true
|
||||
}else {
|
||||
this.isCashier = false
|
||||
}
|
||||
this.getMenuTreeselect()
|
||||
// this.tableData = response.data.treeselect;
|
||||
});
|
||||
@ -162,9 +174,114 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
openTable(str) {
|
||||
// if (str == 'open') {
|
||||
// this.isOpen = true;
|
||||
// } else {
|
||||
// this.isOpen = false;
|
||||
// }
|
||||
this.$nextTick(() => {
|
||||
this.handleArr(this.tableData, this.isOpen);
|
||||
});
|
||||
},
|
||||
handleArr(arr, flag) {
|
||||
arr.forEach(i => {
|
||||
this.$refs.table.toggleRowExpansion(i, flag);
|
||||
if (i.children) {
|
||||
this.handleArr(i.children);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 全选
|
||||
chooseAllOrNo(val){
|
||||
let show = val
|
||||
if (val){
|
||||
let ids = []
|
||||
this.tableData.forEach(item => {
|
||||
if (item.id == 0){
|
||||
item.show = show
|
||||
item.list.forEach(item1 => {
|
||||
item1.show = show
|
||||
})
|
||||
return;
|
||||
}
|
||||
ids.push(item.id)
|
||||
item.show = show
|
||||
item.list.forEach(item1 => {
|
||||
ids.push(item1.id)
|
||||
item1.show = show
|
||||
})
|
||||
item.childrens.forEach(item1 => {
|
||||
ids.push(item1.id)
|
||||
item1.show = show
|
||||
item1.list.forEach(item2 => {
|
||||
ids.push(item2.id)
|
||||
item2.show = show
|
||||
})
|
||||
})
|
||||
})
|
||||
this.ruleForm.roleCode = '3'
|
||||
this.ruleForm.checkedKeys = ids.filter((item, index) => ids.indexOf(item) === index);
|
||||
}else {
|
||||
this.tableData.forEach(item => {
|
||||
item.show = show
|
||||
item.list.forEach(item1 => {
|
||||
item1.show = show
|
||||
})
|
||||
item.childrens.forEach(item1 => {
|
||||
item1.show = show
|
||||
item1.list.forEach(item2 => {
|
||||
item2.show = show
|
||||
})
|
||||
})
|
||||
})
|
||||
this.ruleForm.roleCode = '0'
|
||||
this.ruleForm.checkedKeys = []
|
||||
}
|
||||
this.ruleForm.menuIds = this.ruleForm.checkedKeys;
|
||||
},
|
||||
getLengthCheck(){
|
||||
let ids = []
|
||||
this.tableData.forEach(item => {
|
||||
if (item.id == 0){
|
||||
return;
|
||||
}
|
||||
ids.push(item.id)
|
||||
item.list.forEach(item1 => {
|
||||
ids.push(item1.id)
|
||||
})
|
||||
item.childrens.forEach(item1 => {
|
||||
ids.push(item1.id)
|
||||
item1.list.forEach(item2 => {
|
||||
ids.push(item2.id)
|
||||
})
|
||||
})
|
||||
})
|
||||
this.checkedKeys = ids.filter((item, index) => ids.indexOf(item) === index);
|
||||
},
|
||||
chooseImg(row, data) {
|
||||
if (row.id==0){
|
||||
row.show = !row.show
|
||||
if (row.show) {
|
||||
if (this.ruleForm.checkedKeys.length>0){
|
||||
this.ruleForm.roleCode = '3'
|
||||
}else {
|
||||
this.ruleForm.roleCode = '2'
|
||||
}
|
||||
}else {
|
||||
if (this.ruleForm.checkedKeys.length>0){
|
||||
this.ruleForm.roleCode = '1'
|
||||
}else {
|
||||
this.ruleForm.roleCode = '0'
|
||||
}
|
||||
}
|
||||
this.isCashier = row.show
|
||||
this.getLengthCheck();
|
||||
if (this.checkedKeys.length==this.ruleForm.checkedKeys.length && this.isCashier){
|
||||
this.checked = true
|
||||
}else {
|
||||
this.checked = false
|
||||
}
|
||||
return;
|
||||
}
|
||||
let ids = []
|
||||
@ -211,7 +328,12 @@ export default {
|
||||
this.ruleForm.checkedKeys = this.ruleForm.checkedKeys.filter(item => !uniqueArr.includes(item));
|
||||
}
|
||||
this.ruleForm.menuIds = this.ruleForm.checkedKeys;
|
||||
// this.ruleForm.checkedKeys = this.ruleForm.checkedKeys.filter(item => item !== row.id);
|
||||
this.getLengthCheck();
|
||||
if (this.checkedKeys.length==this.ruleForm.checkedKeys.length && this.isCashier){
|
||||
this.checked = true
|
||||
}else {
|
||||
this.checked = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -267,16 +389,21 @@ export default {
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="菜单功能权限" prop="checkedKeys">
|
||||
<el-checkbox v-model="checked">全选</el-checkbox>
|
||||
<el-checkbox v-model="checked" @change="chooseAllOrNo">全选</el-checkbox>
|
||||
<el-checkbox v-model="isOpen" @change="openTable">展开</el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-button size="mini" @click.native="openTable('open')">一键展开</el-button>-->
|
||||
<!-- <el-button size="mini" @click.native="openTable('fold')">折叠</el-button>-->
|
||||
</div>
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tableData"
|
||||
style="width: 100%;margin-bottom: 20px;"
|
||||
row-key="id"
|
||||
border
|
||||
default-expand-all
|
||||
stripe
|
||||
:tree-props="{children: 'childrens', hasChildren: 'hasChildren'}">
|
||||
|
||||
<el-table-column
|
||||
|
@ -43,6 +43,17 @@ public class RoleDto {
|
||||
*/
|
||||
private String status;
|
||||
|
||||
// 是否拥有登录权限
|
||||
private String roleCode;
|
||||
|
||||
public String getRoleCode() {
|
||||
return roleCode;
|
||||
}
|
||||
|
||||
public void setRoleCode(String roleCode) {
|
||||
this.roleCode = roleCode;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
@ -143,6 +143,7 @@ public class BackendDutyController extends BaseController {
|
||||
String type = param.get("deptType").toString();
|
||||
String status = param.get("status").toString();
|
||||
String description = param.get("description").toString();
|
||||
String roleCode = param.get("roleCode").toString();
|
||||
if (ObjectUtil.isEmpty(param.get("storeId"))){
|
||||
return getFailureResult(1001, "请先选择机构");
|
||||
}
|
||||
@ -174,6 +175,7 @@ public class BackendDutyController extends BaseController {
|
||||
tDuty.setStatus(status);
|
||||
tDuty.setDescription(description);
|
||||
tDuty.setStoreId(storeId);
|
||||
tDuty.setRoleCode(roleCode);
|
||||
|
||||
// 添加角色信息
|
||||
try {
|
||||
@ -212,6 +214,7 @@ public class BackendDutyController extends BaseController {
|
||||
roleInfo.setStatus(htDuty.getStatus());
|
||||
roleInfo.setStoreId(htDuty.getStoreId());
|
||||
roleInfo.setDescription(htDuty.getDescription());
|
||||
roleInfo.setRoleCode(htDuty.getRoleCode());
|
||||
|
||||
result.put("roleInfo", roleInfo);
|
||||
|
||||
@ -245,6 +248,7 @@ public class BackendDutyController extends BaseController {
|
||||
String type = param.get("roleType").toString();
|
||||
String status = param.get("status").toString();
|
||||
String description = param.get("description").toString();
|
||||
String roleCode = param.get("roleCode").toString();
|
||||
|
||||
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
||||
if (accountInfo == null) {
|
||||
@ -265,6 +269,7 @@ public class BackendDutyController extends BaseController {
|
||||
duty.setDutyName(name);
|
||||
duty.setStatus(status);
|
||||
duty.setDutyType(type);
|
||||
duty.setRoleCode(roleCode);
|
||||
|
||||
// 获取角色所分配的菜单
|
||||
List<TSource> sources = null;
|
||||
|
@ -153,6 +153,7 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
||||
existsDuty.setDutyType(tduty.getDutyType());
|
||||
existsDuty.setDutyName(tduty.getDutyName());
|
||||
existsDuty.setStatus(tduty.getStatus());
|
||||
existsDuty.setRoleCode(tduty.getRoleCode());
|
||||
|
||||
if (sources != null && sources.size() > 0) {
|
||||
tDutySourceMapper.deleteSourcesByDutyId(tduty.getDutyId());
|
||||
|
Loading…
Reference in New Issue
Block a user