fix(用户组和权限): 权限展示问题

This commit is contained in:
shiziyuan9527 2022-01-14 14:43:53 +08:00 committed by shiziyuan9527
parent b874bb0988
commit cf5c0a6c03
1 changed files with 19 additions and 12 deletions

View File

@ -11,7 +11,6 @@
border border
:data="tableData" :data="tableData"
class="permission-table" class="permission-table"
:row-class-name="handleLicenseResource"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="type" prop="type"
@ -97,10 +96,28 @@ export default {
let data = result.data; let data = result.data;
if (data) { if (data) {
this.tableData = data.permissions; this.tableData = data.permissions;
this.handleNoLicensePermissions();
this._getUniteMenu(); this._getUniteMenu();
} }
}) })
}, },
handleNoLicensePermissions() {
let license = hasLicense();
if (license) {
return;
}
for (let i = this.tableData.length - 1; i >= 0; i--) {
if (this.tableData[i].resource.license) {
this.tableData.splice(i, 1);
} else {
for (let j = this.tableData[i].permissions.length - 1; j >= 0; j--) {
if (this.tableData[i].permissions[j].license) {
this.tableData[i].permissions.splice(j, 1);
}
}
}
}
},
_getUniteMenu() { _getUniteMenu() {
let menu = ['TRACK', 'API', 'PERFORMANCE', 'REPORT']; let menu = ['TRACK', 'API', 'PERFORMANCE', 'REPORT'];
for (let i = 0; i < this.tableData.length; i++) { for (let i = 0; i < this.tableData.length; i++) {
@ -158,21 +175,11 @@ export default {
}, },
handleSelectAll(check, permissions) { handleSelectAll(check, permissions) {
permissions.map(p => p.checked = check); permissions.map(p => p.checked = check);
},
handleLicenseResource(row) {
if (!row.row.resource.license) {
return;
}
if (!hasLicense()) {
return 'hidden-row';
}
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.permission-table >>> .hidden-row {
display: none;
}
</style> </style>