feat(ui):批量导入模型根据create权限过滤&&模型配置页面权限 (#323)

This commit is contained in:
wang-liang0615
2023-12-21 14:23:38 +08:00
committed by GitHub
parent 4beece5a6e
commit f143e30cf5
4 changed files with 58 additions and 31 deletions

View File

@@ -77,7 +77,7 @@ const genCmdbRoutes = async () => {
path: '/cmdb/ci_types',
name: 'ci_type',
component: () => import('../views/ci_types/index'),
meta: { title: '模型配置', icon: 'ops-cmdb-citype', selectedIcon: 'ops-cmdb-citype-selected', keepAlive: false }
meta: { title: '模型配置', icon: 'ops-cmdb-citype', selectedIcon: 'ops-cmdb-citype-selected', keepAlive: false, permission: ['cmdb_admin', 'admin'] }
},
{
path: '/cmdb/disabled3',

View File

@@ -89,10 +89,12 @@
<script>
import _ from 'lodash'
import { mapState } from 'vuex'
import { downloadExcel } from '../../../utils/helper'
import { getCITypes } from '@/modules/cmdb/api/CIType'
import { getCITypeAttributesById } from '@/modules/cmdb/api/CITypeAttr'
import { getCITypeParent, getCanEditByParentIdChildId } from '@/modules/cmdb/api/CITypeRelation'
import { searchPermResourceByRoleId } from '@/modules/acl/api/permission'
export default {
name: 'CiTypeChoice',
@@ -112,9 +114,21 @@ export default {
canEdit: {},
}
},
created: function() {
computed: {
...mapState({
rid: (state) => state.user.rid,
}),
},
async created() {
const { resources } = await searchPermResourceByRoleId(this.rid, {
resource_type_id: 'CIType',
app_id: 'cmdb',
})
getCITypes().then((res) => {
this.ciTypeList = res.ci_types
this.ciTypeList = res.ci_types.filter((type) => {
const _findRe = resources.find((re) => re.name === type.name)
return _findRe?.permissions.includes('create') ?? false
})
})
},
watch: {