diff --git a/fuintAdmin_zt/src/assets/styles/element-ui.scss b/fuintAdmin_zt/src/assets/styles/element-ui.scss index f69dc5743..44f149632 100644 --- a/fuintAdmin_zt/src/assets/styles/element-ui.scss +++ b/fuintAdmin_zt/src/assets/styles/element-ui.scss @@ -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; +} diff --git a/fuintAdmin_zt/src/views/Site/add.vue b/fuintAdmin_zt/src/views/Site/add.vue index 7a3cbc9f8..cfd25a55b 100644 --- a/fuintAdmin_zt/src/views/Site/add.vue +++ b/fuintAdmin_zt/src/views/Site/add.vue @@ -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 { - 全选 + 全选 + 展开 + + sources = null; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/service/impl/DutyServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/service/impl/DutyServiceImpl.java index cd742bb7f..24872bc6c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/service/impl/DutyServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/role/service/impl/DutyServiceImpl.java @@ -153,6 +153,7 @@ public class DutyServiceImpl extends ServiceImpl 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());