diff --git a/src/views/admin/role/index.vue b/src/views/admin/role/index.vue index 78fb638..41e274d 100644 --- a/src/views/admin/role/index.vue +++ b/src/views/admin/role/index.vue @@ -8,76 +8,51 @@ 公司角色 代理商角色 系统角色 - -
- +
-
- 批量删除 + 批量删除 添加
- + - + @@ -87,13 +62,28 @@ 查询 - 重置 + 重置
- + @@ -101,117 +91,118 @@ - - + - - -
- - + + - + @@ -226,7 +217,12 @@ --> - + - + +
+ + 设备低电提醒 + 未开启录音提醒 + 接待延时提醒 + 日报 + 周报 + 月报 + 违禁提醒 + +
+ + +
+ +
- +
- +
- +
- @@ -340,6 +393,7 @@ export default { roleDesc: "", //描述 orgCode: "", //公司 lockFlag: "0", //状态 + messageType: "", }, addFlag: true, rules: { @@ -360,7 +414,6 @@ export default { roleManager_btn_del: false, roleManager_btn_perm: false, - geTmenuList: [], geTmenuListisshow: false, checkedKeys2: [], @@ -368,10 +421,12 @@ export default { label: "name", value: "id", }, - roleId2: '', - roleCode2: '', - menuIds2: '' + roleId2: "", + roleCode2: "", + menuIds2: "", + pushMessageShow: false, // 推送消息权限弹窗 + checkList: [], // 选中权限的id数组 }; }, async created() { @@ -391,24 +446,66 @@ export default { ...mapGetters(["elements", "permissions"]), }, methods: { - geTmenu(row) { - fetchRoleTree2(row.roleId).then((response) => { - this.checkedKeys2 = response.data; - return fetchMenuTree2(); - }).then((response) => { - this.geTmenuList = response.data; - console.log(this.geTmenuList, '55555555555') - // 解析出所有的太监节点 - this.checkedKeys2 = this.resolveAllEunuchNodeId( - this.geTmenuList, - this.checkedKeys2, - [] - ); - this.geTmenuListisshow = true; - this.roleId2 = row.roleId; - this.roleCode2 = row.roleCode; + // 编辑 + // 展示推送权限复选框 + showPushMenu(row, boolean) { + this.form = { ...this.form, ...row }; + console.log(row); + this.pushMessageShow = !this.pushMessageShow; + this.addFlag = boolean; + if (row.messageType) { + console.log(row.messageType, "这里是messagetype"); + this.checkList = row.messageType.split(',') + } + }, + + // 取消推送 + cancelAddPush() { + this.pushMessageShow = false; + this.checkList = []; + }, + + // 确认添加 + addPush() { + if (this.checkList.length == 0) { + this.$message.info("请选择需要推送的权限"); + return; + } + if (this.checkList.length > 0) { + this.form.messageType = this.checkList.join(","); + } + + putObj(this.form).then((res) => { + console.log(res); + this.cancelAddPush(); + if (res.data) { + this.$message.success("编辑成功"); + } else { + this.$message.error(res.msg); + } }); }, + + geTmenu(row) { + fetchRoleTree2(row.roleId) + .then((response) => { + this.checkedKeys2 = response.data; + return fetchMenuTree2(); + }) + .then((response) => { + this.geTmenuList = response.data; + console.log(this.geTmenuList, "55555555555"); + // 解析出所有的太监节点 + this.checkedKeys2 = this.resolveAllEunuchNodeId( + this.geTmenuList, + this.checkedKeys2, + [] + ); + this.geTmenuListisshow = true; + this.roleId2 = row.roleId; + this.roleCode2 = row.roleCode; + }); + }, updatePermession2(roleId) { this.menuIds2 = ""; this.menuIds2 = this.$refs.menuTree @@ -424,7 +521,7 @@ export default { // 单选框改变 radioChange(e) { // console.log(e) - this.filterText = '' + this.filterText = ""; this.treeDataList = []; if (e == 0 || e == 1) { this.findMyOrg(); @@ -451,7 +548,6 @@ export default { }); this.treeDataList = res.data; this.orgCode = res.data[0].id; - // console.log(this.orgCode); this.selectKeys = [res.data[0].id]; this.$nextTick(() => { // this.selectKeys=[res.data[0].id] @@ -479,23 +575,14 @@ export default { }); }, getList() { - // fetchList(Object.assign({ - // current: this.page.currentPage, - // size: this.page.pageSize, - // orgCode:this.orgCode - // }, params, this.searchForm)).then(response => { - // this.list = response.data.records - // this.page.total = response.data.total - // }).catch(() => { - // }) let obj = { current: this.page.currentPage, size: this.page.pageSize, - ...this.searchMsg + ...this.searchMsg, }; if (this.tabselect == 0 || this.tabselect == 1) { obj.orgCode = this.orgCode; - this.tabselect == 0 ? obj.orgType = 3 : obj.orgType = 2 + this.tabselect == 0 ? (obj.orgType = 3) : (obj.orgType = 2); } if (this.tabselect == 2) { obj.agentId = this.orgCode; @@ -549,8 +636,8 @@ export default { addRole() { // console.log(1); if (this.tabselect == 4) { - this.$message.warning('运营角色不能添加!') - return + this.$message.warning("运营角色不能添加!"); + return; } this.dialogFormVisible = true; this.addFlag = true; @@ -572,19 +659,18 @@ export default { return; } if (this.tabselect == 0 || this.tabselect == 1) { - this.tabselect == 0 ? this.form.orgType = 3 : this.form.orgType = 2 + this.tabselect == 0 ? (this.form.orgType = 3) : (this.form.orgType = 2); this.form.orgCode = this.orgCode; this.form.agentId = null; - } - else if (this.tabselect == 2) { + } else if (this.tabselect == 2) { this.form.orgCode = null; this.form.agentId = this.orgCode; - } - else { + } else { this.form.orgCode = null; this.form.agentId = null; } console.log(this.form); + // return if (this.addFlag) { this.$refs.form.validate((valid) => { @@ -653,21 +739,23 @@ export default { this.geTmenuListisshow = false; }, handlePermission(row) { - fetchRoleTree(row.roleId).then((response) => { - this.checkedKeys = response.data; - return fetchMenuTree(); - }).then((response) => { - this.treeData = response.data; - // 解析出所有的太监节点 - this.checkedKeys = this.resolveAllEunuchNodeId( - this.treeData, - this.checkedKeys, - [] - ); - this.dialogPermissionVisible = true; - this.roleId = row.roleId; - this.roleCode = row.roleCode; - }); + fetchRoleTree(row.roleId) + .then((response) => { + this.checkedKeys = response.data; + return fetchMenuTree(); + }) + .then((response) => { + this.treeData = response.data; + // 解析出所有的太监节点 + this.checkedKeys = this.resolveAllEunuchNodeId( + this.treeData, + this.checkedKeys, + [] + ); + this.dialogPermissionVisible = true; + this.roleId = row.roleId; + this.roleCode = row.roleCode; + }); }, /** * 解析出所有的太监节点id @@ -796,7 +884,13 @@ export default { margin-left: 20% !important; } } -/deep/ .el-button--primary{ - background: #2671E2 !important; - border: 1px solid #2671E2 !important; +/deep/ .el-button--primary { + background: #2671e2 !important; + border: 1px solid #2671e2 !important; +} + +.dialog-main { + width: 800px; + height: 150px; } + \ No newline at end of file