| | |
| | | export default { |
| | | name: "classifyAuthDialog.vue", |
| | | props: { |
| | | // 当前点击节点的顶层节点 |
| | | classifyData: { |
| | | type: "Object", |
| | | default: "", |
| | |
| | | type: "Boolean", |
| | | default: false, |
| | | }, |
| | | // 当前点击的节点 |
| | | TreeNode:{ |
| | | type:Object |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | let form = { |
| | | classifyAuthList: [], |
| | | isCLear: false, //默认是清空 |
| | | classifyId: this.classifyData.oid, |
| | | classifyId: this.TreeNode.oid, |
| | | }; |
| | | let isRepeat = false; |
| | | if(this.classifyAuthData.length > 0){ |
| | |
| | | let data = { |
| | | oid: item.oid, |
| | | roleId: item.roleData, |
| | | classifyId: this.classifyData.oid, |
| | | classifyId: this.TreeNode.oid, |
| | | buttonIds: itemButtonList.join(","), |
| | | authType: "classify_auth", |
| | | }; |
| | |
| | | }); |
| | | // 获取该分类下已授权的分类授权信息 |
| | | getClassifyAuthList({ |
| | | classifyId: this.classifyData.oid, |
| | | classifyId: this.TreeNode.oid, |
| | | authType: "classify_auth", |
| | | }).then((res) => { |
| | | //console.log(res.data.data); |
| | |
| | | export default { |
| | | name: "dataAuthDialog.vue", |
| | | props: { |
| | | // 当前点击节点的顶层节点 |
| | | classifyData: { |
| | | type: "Object", |
| | | default: "", |
| | |
| | | type: "Boolean", |
| | | default: false, |
| | | }, |
| | | // 当前点击的节点 |
| | | TreeNode:{ |
| | | type:Object |
| | | } |
| | |
| | | return; |
| | | } |
| | | //filteredItems 未授权数组 |
| | | getButtonsByRoleId({roleId: id, code: this.TreeNode.id}).then(res => { |
| | | getButtonsByRoleId({roleId: id, code: this.classifyData.attributes.id}).then(res => { |
| | | const filteredItems = this.classifyAuthButton.filter(item => |
| | | !res.data.data.some(x => x.id === item.id) |
| | | ); |
| | |
| | | async roleChange(row, currentRow) { |
| | | try { |
| | | this.currentRow = currentRow; |
| | | const res = await getButtonsByRoleId({roleId: row, code: this.TreeNode.id}); |
| | | const res = await getButtonsByRoleId({roleId: row, code: this.classifyData.attributes.id}); |
| | | |
| | | const filteredItems = this.classifyAuthButton.filter(item => { |
| | | return !res.data.data.find(x => x.id === item.id); |
| | |
| | | let form = { |
| | | classifyAuthList: [], |
| | | isCLear: false, //默认是清空 |
| | | classifyId: this.classifyData.oid, |
| | | classifyId: this.TreeNode.oid, |
| | | }; |
| | | let isRepeat = false; |
| | | if (this.classifyAuthData.length > 0) { |
| | |
| | | let data = { |
| | | oid: item.oid, |
| | | roleId: item.roleData, |
| | | classifyId: this.classifyData.oid, |
| | | classifyId: this.TreeNode.oid, |
| | | buttonIds: itemButtonList.join(","), |
| | | authType: "data_auth", |
| | | } |
| | |
| | | return; |
| | | } |
| | | // console.log(form) |
| | | // 调用保存分类授权的接口 |
| | | await saveOrUpdate(form).then(res => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: res.data.msg, |
| | | }); |
| | | // this.isShowDialog = false |
| | | }, (error) => { |
| | | window.console.log(error); |
| | | }) |
| | | }else{ |
| | | // 为空证明是清空授权列表 |
| | | form.isCLear = true; |
| | | } |
| | | // 调用保存分类授权的接口 |
| | | await saveOrUpdate(form).then(res => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: res.data.msg, |
| | | }); |
| | | // this.isShowDialog = false |
| | | }, (error) => { |
| | | window.console.log(error); |
| | | }) |
| | | this.classifyAuthData = []; |
| | | this.loadAuthPage(); |
| | | }, |
| | |
| | | }, |
| | | loadAuthPage() { |
| | | return new Promise((resolve, reject) => { |
| | | console.log(this.classifyData); |
| | | // console.log(this.classifyData); |
| | | getButtonByParentCode({code: this.classifyData.attributes.id}).then(res => { |
| | | // 记录按钮数据 |
| | | this.classifyAuthButton = res.data.data; |
| | |
| | | this.roleList = res.data.data.records; |
| | | }); |
| | | // 获取该分类下已授权的分类授权信息 |
| | | getClassifyAuthList({classifyId: this.classifyData.oid, authType: "data_auth"}).then(res => { |
| | | getClassifyAuthList({classifyId: this.TreeNode.oid, authType: "data_auth"}).then(res => { |
| | | //console.log(res.data.data); |
| | | let authDatas = res.data.data; |
| | | if (authDatas.length > 0) { |
| | |
| | | </el-dialog> |
| | | <!-- 分类授权对话框--> |
| | | <classify-auth-dialog |
| | | :TreeNode="TreeEditObj" |
| | | :classifyData="classifyData" |
| | | :visible.sync="classifyAuthVisible" |
| | | ></classify-auth-dialog> |
| | |
| | | this.$message.warning('请至少选择一条数据!') |
| | | return; |
| | | } |
| | | this.classifyData = this.nodeClickList; |
| | | // this.classifyData = this.nodeClickList; |
| | | this.classifyAuthVisible = true; |
| | | }, |
| | | // 数据授权对话框打开 |
| | |
| | | this.$message.warning('请至少选择一条数据!') |
| | | return; |
| | | } |
| | | this.classifyData = this.nodeClickList; |
| | | // this.classifyData = this.nodeClickList; |
| | | this.dataAuthVisible = true; |
| | | }, |
| | | flowingDependHandler() { |
| | |
| | | //树点击事件 |
| | | async nodeClick(data) { |
| | | const response = this.findTheTopLevelNode(data,this.Treedata) |
| | | console.log(response) |
| | | console.log('response',response.attributes.id) |
| | | this.classifyData = response; |
| | | // console.log(response) |
| | | // console.log('response',response.attributes.id) |
| | | this.allButtons = true; |
| | | getAuthButtonList({classifyId: data.oid, code: "classifyTree", authType: "classify_auth"}).then(res => { |
| | | this.btnAuthList = res.data.data; |