fix(acl-ui):operation history (#363)

This commit is contained in:
wang-liang0615 2024-01-03 17:41:42 +08:00 committed by GitHub
parent f3ca1fbea3
commit cdf7506b5d
6 changed files with 214 additions and 212 deletions

View File

@ -129,45 +129,7 @@ export default {
start: '',
end: '',
},
}
},
async created() {
await this.getTable(this.queryParams)
},
updated() {
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
},
watch: {
'$route.name': async function(oldName, newName) {
this.app_id = this.$route.name.split('_')[0]
await this.getTable(this.queryParams)
},
allResources: {
deep: true,
immediate: true,
handler(val) {
this.permissionTableAttrList[4].choice_value = val
},
},
},
computed: {
operateTypeMap() {
return new Map([
['grant', this.$t('grant')],
['revoke', this.$t('acl.cancel')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
windowHeightMinus() {
return this.isExpand ? 374 : 310
},
tableDataLength() {
return this.tableData.length
},
permissionTableAttrList() {
return [
permissionTableAttrList: [
{
alias: this.$t('acl.date'),
is_choice: false,
@ -209,7 +171,43 @@ export default {
value_type: '2',
choice_value: [{ [this.$t('grant')]: 'grant' }, { [this.$t('acl.cancel')]: 'revoke' }],
},
]
],
}
},
async created() {
await this.getTable(this.queryParams)
},
updated() {
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
},
watch: {
'$route.name': async function(oldName, newName) {
this.app_id = this.$route.name.split('_')[0]
await this.getTable(this.queryParams)
},
allResources: {
deep: true,
immediate: true,
handler(val) {
this.permissionTableAttrList[4].choice_value = val
},
},
},
computed: {
operateTypeMap() {
return new Map([
['grant', this.$t('grant')],
['revoke', this.$t('acl.cancel')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
windowHeightMinus() {
return this.isExpand ? 374 : 310
},
tableDataLength() {
return this.tableData.length
},
},
methods: {

View File

@ -112,6 +112,39 @@ export default {
start: '',
end: '',
},
resourceTableAttrList: [
{
alias: this.$t('acl.date'),
is_choice: false,
name: 'datetime',
value_type: '3',
},
{
alias: this.$t('acl.operator'),
is_choice: true,
name: 'operate_uid',
value_type: '2',
choice_value: this.allUsers,
},
{
alias: this.$t('operation'),
is_choice: true,
name: 'operate_type',
value_type: '2',
choice_value: [
{ [this.$t('create')]: 'create' },
{ [this.$t('update')]: 'update' },
{ [this.$t('delete')]: 'delete' },
],
},
{
alias: this.$t('acl.resourceName'),
is_choice: true,
name: 'link_id',
value_type: '2',
choice_value: this.allResources,
},
],
}
},
async created() {
@ -146,37 +179,6 @@ export default {
tableDataLength() {
return this.tableData.length
},
resourceTableAttrList() {
return [
{
alias: this.$t('acl.date'),
is_choice: false,
name: 'datetime',
value_type: '3',
},
{
alias: this.$t('acl.operator'),
is_choice: true,
name: 'operate_uid',
value_type: '2',
choice_value: this.allUsers,
},
{
alias: this.$t('operation'),
is_choice: true,
name: 'operate_type',
value_type: '2',
choice_value: [{ [this.$t('create')]: 'create' }, { [this.$t('update')]: 'update' }, { [this.$t('delete')]: 'delete' }],
},
{
alias: this.$t('acl.resourceName'),
is_choice: true,
name: 'link_id',
value_type: '2',
choice_value: this.allResources,
},
]
},
},
methods: {
async getTable(queryParams) {

View File

@ -99,42 +99,7 @@ export default {
start: '',
end: '',
},
}
},
async created() {
this.$watch(
function () {
return this.resourceTableAttrList[3].choice_value
},
function () {
delete this.$refs.child.queryParams.link_id
}
)
await Promise.all([this.getAllApps(), this.getAllUsers()])
await this.getTable(this.queryParams)
},
updated() {
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
},
computed: {
operateTypeMap() {
return new Map([
['create', this.$t('create')],
['update', this.$t('update')],
['delete', this.$t('delete')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
windowHeightMinus() {
return this.isExpand ? 374 : 310
},
tableDataLength() {
return this.tableData.length
},
resourceTableAttrList() {
return [
resourceTableAttrList: [
{
alias: this.$t('acl.date'),
is_choice: false,
@ -167,9 +132,46 @@ export default {
is_choice: true,
name: 'operate_type',
value_type: '2',
choice_value: [{ [this.$t('create')]: 'create' }, { [this.$t('update')]: 'update' }, { [this.$t('delete')]: 'delete' }],
choice_value: [
{ [this.$t('create')]: 'create' },
{ [this.$t('update')]: 'update' },
{ [this.$t('delete')]: 'delete' },
],
},
]
],
}
},
async created() {
this.$watch(
function() {
return this.resourceTableAttrList[3].choice_value
},
function() {
delete this.$refs.child.queryParams.link_id
}
)
await Promise.all([this.getAllApps(), this.getAllUsers()])
await this.getTable(this.queryParams)
},
updated() {
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
},
computed: {
operateTypeMap() {
return new Map([
['create', this.$t('create')],
['update', this.$t('update')],
['delete', this.$t('delete')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
windowHeightMinus() {
return this.isExpand ? 374 : 310
},
tableDataLength() {
return this.tableData.length
},
},
methods: {

View File

@ -90,42 +90,7 @@ export default {
start: '',
end: '',
},
}
},
async created() {
this.$watch(
function () {
return this.resourceTableAttrList[3].choice_value
},
function () {
delete this.$refs.child.queryParams.link_id
}
)
await Promise.all([this.getAllApps(), this.getAllUsers()])
await this.getTable(this.queryParams)
},
updated() {
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
},
computed: {
operateTypeMap() {
return new Map([
['create', this.$t('create')],
['update', this.$t('update')],
['delete', this.$t('delete')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
windowHeightMinus() {
return this.isExpand ? 374 : 310
},
tableDataLength() {
return this.tableData.length
},
resourceTableAttrList() {
return [
resourceTableAttrList: [
{
alias: this.$t('acl.date'),
is_choice: false,
@ -158,9 +123,46 @@ export default {
is_choice: true,
name: 'operate_type',
value_type: '2',
choice_value: [{ [this.$t('create')]: 'create' }, { [this.$t('update')]: 'update' }, { [this.$t('delete')]: 'delete' }],
choice_value: [
{ [this.$t('create')]: 'create' },
{ [this.$t('update')]: 'update' },
{ [this.$t('delete')]: 'delete' },
],
},
]
],
}
},
async created() {
this.$watch(
function() {
return this.resourceTableAttrList[3].choice_value
},
function() {
delete this.$refs.child.queryParams.link_id
}
)
await Promise.all([this.getAllApps(), this.getAllUsers()])
await this.getTable(this.queryParams)
},
updated() {
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
},
computed: {
operateTypeMap() {
return new Map([
['create', this.$t('create')],
['update', this.$t('update')],
['delete', this.$t('delete')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
windowHeightMinus() {
return this.isExpand ? 374 : 310
},
tableDataLength() {
return this.tableData.length
},
},
methods: {
@ -312,7 +314,8 @@ export default {
}
const currentPerms =
item.extra.permission_ids?.current === undefined ? this.$t('acl.none') : item.extra.permission_ids?.current
const originPerms = item.extra.permission_ids?.origin === undefined ? this.$t('acl.none') : item.extra.permission_ids?.origin
const originPerms =
item.extra.permission_ids?.origin === undefined ? this.$t('acl.none') : item.extra.permission_ids?.origin
if (!_.isEqual(currentPerms, originPerms)) {
item.changeDescription += ` permission_ids : ${originPerms} -> ${currentPerms} `
}
@ -321,7 +324,8 @@ export default {
}
case 'delete': {
const description = item.origin?.description === undefined ? this.$t('acl.none') : item.origin?.description
const permission = item.extra.permission_ids?.origin === undefined ? this.$t('acl.none') : item.extra.permission_ids?.origin
const permission =
item.extra.permission_ids?.origin === undefined ? this.$t('acl.none') : item.extra.permission_ids?.origin
item.changeDescription = `${this.$t('acl.deleteResourceType')}: ${item.origin.name}\n${this.$t(
'desc'
)}${description}\n${this.$t('acl.permission')}: ${permission}`

View File

@ -108,26 +108,7 @@ export default {
start: '',
end: '',
},
}
},
computed: {
operateTypeMap() {
return new Map([
['create', this.$t('create')],
['update', this.$t('update')],
['delete', this.$t('delete')],
['role_relation_add', this.$t('acl.roleRelationAdd')],
['role_relation_delete', this.$t('acl.roleRelationDelete')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
tableDataLength() {
return this.tableData.length
},
roleTableAttrList() {
return [
roleTableAttrList: [
{
alias: this.$t('acl.date'),
is_choice: false,
@ -161,7 +142,24 @@ export default {
{ [this.$t('acl.roleRelationDelete')]: 'role_relation_delete' },
],
},
]
],
}
},
computed: {
operateTypeMap() {
return new Map([
['create', this.$t('create')],
['update', this.$t('update')],
['delete', this.$t('delete')],
['role_relation_add', this.$t('acl.roleRelationAdd')],
['role_relation_delete', this.$t('acl.roleRelationDelete')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
tableDataLength() {
return this.tableData.length
},
},
async created() {
@ -294,7 +292,6 @@ export default {
const str = ` ${key} : -> ${newVal} `
item.description += str
} else {
const str = ` ${key} : ${oldVal} -> ${newVal} `
item.description += ` ${key} : ${oldVal} -> ${newVal} `
}
}
@ -329,7 +326,9 @@ export default {
resourceMap.forEach((value, key) => {
permsArr.push(`${id2resources[key].name}${value}`)
})
item.description = `${this.$t('acl.heir')}${child_ids}\n${this.$t('acl.inheritedFrom')}${parent_ids}\n${this.$t('acl.involvingRP')}\n${permsArr.join(`\n`)}`
item.description = `${this.$t('acl.heir')}${child_ids}\n${this.$t(
'acl.inheritedFrom'
)}${parent_ids}\n${this.$t('acl.involvingRP')}\n${permsArr.join(`\n`)}`
break
}
}

View File

@ -96,44 +96,7 @@ export default {
start: '',
end: '',
},
}
},
async created() {
this.$watch(
function() {
return this.triggerTableAttrList[3].choice_value
},
function() {
delete this.$refs.child.queryParams.trigger_id
}
)
await Promise.all([this.getAllApps(), this.getAllUsers()])
await this.getTable(this.queryParams)
},
updated() {
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
},
computed: {
operateTypeMap() {
return new Map([
['create', this.$t('create')],
['update', this.$t('update')],
['delete', this.$t('delete')],
['trigger_apply', this.$t('acl.apply')],
['trigger_cancel', this.$t('cancel')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
windowHeightMinus() {
return this.isExpand ? 374 : 310
},
tableDataLength() {
return this.tableData.length
},
triggerTableAttrList() {
return [
triggerTableAttrList: [
{
alias: this.$t('acl.date'),
is_choice: false,
@ -174,7 +137,42 @@ export default {
{ [this.$t('cancel')]: 'trigger_cancel' },
],
},
]
],
}
},
async created() {
this.$watch(
function() {
return this.triggerTableAttrList[3].choice_value
},
function() {
delete this.$refs.child.queryParams.trigger_id
}
)
await Promise.all([this.getAllApps(), this.getAllUsers()])
await this.getTable(this.queryParams)
},
updated() {
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
},
computed: {
operateTypeMap() {
return new Map([
['create', this.$t('create')],
['update', this.$t('update')],
['delete', this.$t('delete')],
['trigger_apply', this.$t('acl.apply')],
['trigger_cancel', this.$t('cancel')],
])
},
windowHeight() {
return this.$store.state.windowHeight
},
windowHeightMinus() {
return this.isExpand ? 374 : 310
},
tableDataLength() {
return this.tableData.length
},
},
methods: {
@ -292,7 +290,6 @@ export default {
const str = ` ${key} : -> ${newVal} `
item.changeDescription += str
} else {
const str = ` ${key} : ${oldVal} -> ${newVal} `
item.changeDescription += ` ${key} :${oldVal} -> ${newVal} `
}
}