mirror of https://github.com/veops/cmdb.git
acl 前端
This commit is contained in:
parent
abc83db77b
commit
1436ffb3b2
|
@ -2,7 +2,7 @@ import { axios } from '@/utils/request'
|
||||||
|
|
||||||
const urlPrefix = '/v1/acl'
|
const urlPrefix = '/v1/acl'
|
||||||
|
|
||||||
export function searchResource (params) {
|
export function searchResource(params) {
|
||||||
return axios({
|
return axios({
|
||||||
url: urlPrefix + `/resources`,
|
url: urlPrefix + `/resources`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
@ -10,7 +10,7 @@ export function searchResource (params) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addResource (params) {
|
export function addResource(params) {
|
||||||
return axios({
|
return axios({
|
||||||
url: urlPrefix + '/resources',
|
url: urlPrefix + '/resources',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -18,7 +18,7 @@ export function addResource (params) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateResourceById (id, params) {
|
export function updateResourceById(id, params) {
|
||||||
return axios({
|
return axios({
|
||||||
url: urlPrefix + `/resources/${id}`,
|
url: urlPrefix + `/resources/${id}`,
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
|
@ -26,14 +26,15 @@ export function updateResourceById (id, params) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteResourceById (id) {
|
export function deleteResourceById(id, params) {
|
||||||
return axios({
|
return axios({
|
||||||
url: urlPrefix + `/resources/${id}`,
|
url: urlPrefix + `/resources/${id}`,
|
||||||
method: 'DELETE'
|
method: 'DELETE',
|
||||||
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function searchResourceType (params) {
|
export function searchResourceType(params) {
|
||||||
return axios({
|
return axios({
|
||||||
url: urlPrefix + `/resource_types`,
|
url: urlPrefix + `/resource_types`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
@ -41,7 +42,7 @@ export function searchResourceType (params) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addResourceType (params) {
|
export function addResourceType(params) {
|
||||||
return axios({
|
return axios({
|
||||||
url: urlPrefix + '/resource_types',
|
url: urlPrefix + '/resource_types',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -49,7 +50,7 @@ export function addResourceType (params) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateResourceTypeById (id, params) {
|
export function updateResourceTypeById(id, params) {
|
||||||
return axios({
|
return axios({
|
||||||
url: urlPrefix + `/resource_types/${id}`,
|
url: urlPrefix + `/resource_types/${id}`,
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
|
@ -57,7 +58,7 @@ export function updateResourceTypeById (id, params) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteResourceTypeById (id) {
|
export function deleteResourceTypeById(id) {
|
||||||
return axios({
|
return axios({
|
||||||
url: urlPrefix + `/resource_types/${id}`,
|
url: urlPrefix + `/resource_types/${id}`,
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
|
@ -65,7 +66,7 @@ export function deleteResourceTypeById (id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add resource group
|
// add resource group
|
||||||
export function getResourceGroups (params) {
|
export function getResourceGroups(params) {
|
||||||
return axios({
|
return axios({
|
||||||
url: `${urlPrefix}/resource_groups`,
|
url: `${urlPrefix}/resource_groups`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
@ -73,7 +74,7 @@ export function getResourceGroups (params) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addResourceGroup (data) {
|
export function addResourceGroup(data) {
|
||||||
return axios({
|
return axios({
|
||||||
url: `${urlPrefix}/resource_groups`,
|
url: `${urlPrefix}/resource_groups`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -81,7 +82,7 @@ export function addResourceGroup (data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateResourceGroup (_id, data) {
|
export function updateResourceGroup(_id, data) {
|
||||||
return axios({
|
return axios({
|
||||||
url: `${urlPrefix}/resource_groups/${_id}`,
|
url: `${urlPrefix}/resource_groups/${_id}`,
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
|
@ -89,14 +90,14 @@ export function updateResourceGroup (_id, data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteResourceGroup (_id) {
|
export function deleteResourceGroup(_id) {
|
||||||
return axios({
|
return axios({
|
||||||
url: `${urlPrefix}/resource_groups/${_id}`,
|
url: `${urlPrefix}/resource_groups/${_id}`,
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getResourceGroupItems (_id) {
|
export function getResourceGroupItems(_id) {
|
||||||
return axios({
|
return axios({
|
||||||
url: `${urlPrefix}/resource_groups/${_id}/items`,
|
url: `${urlPrefix}/resource_groups/${_id}/items`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
|
|
|
@ -14,6 +14,7 @@ export function getOnDutyUser() {
|
||||||
return axios({
|
return axios({
|
||||||
url: urlPrefix + '/users/employee',
|
url: urlPrefix + '/users/employee',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
// data: { 'originUrl': 'http://hr.dfc.sh/api/all_users?work_status=在职' }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,12 @@
|
||||||
|
|
||||||
<a-form-item label="是否组">
|
<a-form-item label="是否组">
|
||||||
<a-radio-group v-model="isGroup">
|
<a-radio-group v-model="isGroup">
|
||||||
<a-radio :value="true"> 是 </a-radio>
|
<a-radio :value="true">
|
||||||
<a-radio :value="false"> 否 </a-radio>
|
是
|
||||||
|
</a-radio>
|
||||||
|
<a-radio :value="false">
|
||||||
|
否
|
||||||
|
</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
|
@ -40,11 +44,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { addResource, searchResourceType, addResourceGroup } from '@/modules/acl/api/resource'
|
/* eslint-disable */
|
||||||
|
import { addResource, searchResourceType } from '@/modules/acl/api/resource'
|
||||||
|
import { addResourceGroup } from '@/modules/acl/api/resource'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ResourceForm',
|
name: 'ResourceForm',
|
||||||
components: {},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
drawerTitle: '新增资源',
|
drawerTitle: '新增资源',
|
||||||
|
@ -119,7 +124,7 @@ export default {
|
||||||
// },
|
// },
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route.name': function (newValue, oldValue) {
|
'$route.name': function(newValue, oldValue) {
|
||||||
this.getAllResourceTypes()
|
this.getAllResourceTypes()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,7 +7,14 @@
|
||||||
@close="() => (drawerVisible = false)"
|
@close="() => (drawerVisible = false)"
|
||||||
:hasFooter="false"
|
:hasFooter="false"
|
||||||
>
|
>
|
||||||
<vxe-table :max-height="`${windowHeight - 150}px`" :data="resPerms" ref="rTable">
|
<vxe-table
|
||||||
|
stripe
|
||||||
|
size="mini"
|
||||||
|
class="ops-stripe-table"
|
||||||
|
:max-height="`${windowHeight - 150}px`"
|
||||||
|
:data="resPerms"
|
||||||
|
ref="rTable"
|
||||||
|
>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
field="name"
|
field="name"
|
||||||
title="角色名"
|
title="角色名"
|
||||||
|
@ -57,6 +64,10 @@
|
||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
|
<template slot="empty">
|
||||||
|
<img :src="require(`@/assets/data_empty.png`)" />
|
||||||
|
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
|
||||||
|
</template>
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
<!-- <a-table
|
<!-- <a-table
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
|
|
@ -103,7 +103,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
updateResourceType(id, data) {
|
updateResourceType(id, data) {
|
||||||
updateResourceTypeById(id, data).then(res => {
|
updateResourceTypeById(id, data).then((res) => {
|
||||||
this.$message.success(`更新成功`)
|
this.$message.success(`更新成功`)
|
||||||
this.handleOk()
|
this.handleOk()
|
||||||
this.onClose()
|
this.onClose()
|
||||||
|
@ -112,7 +112,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
createResourceType(data) {
|
createResourceType(data) {
|
||||||
addResourceType(data).then(res => {
|
addResourceType(data).then((res) => {
|
||||||
this.$message.success(`添加成功`)
|
this.$message.success(`添加成功`)
|
||||||
this.handleOk()
|
this.handleOk()
|
||||||
this.onClose()
|
this.onClose()
|
||||||
|
|
|
@ -12,7 +12,14 @@
|
||||||
<a-select-option v-for="type in resourceTypes" :value="type.id" :key="type.id">{{ type.name }}</a-select-option>
|
<a-select-option v-for="type in resourceTypes" :value="type.id" :key="type.id">{{ type.name }}</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<vxe-table :max-height="`${windowHeight - 180}px`" :data="records" ref="rTable">
|
<vxe-table
|
||||||
|
size="mini"
|
||||||
|
stripe
|
||||||
|
class="ops-stripe-table"
|
||||||
|
:max-height="`${windowHeight - 180}px`"
|
||||||
|
:data="records"
|
||||||
|
ref="rTable"
|
||||||
|
>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
field="name"
|
field="name"
|
||||||
title="资源名"
|
title="资源名"
|
||||||
|
@ -46,6 +53,10 @@
|
||||||
<a-tag color="cyan" v-for="(r, index) in row.permissions" :key="index">{{ r }}</a-tag>
|
<a-tag color="cyan" v-for="(r, index) in row.permissions" :key="index">{{ r }}</a-tag>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
|
<template slot="empty">
|
||||||
|
<img :src="require(`@/assets/data_empty.png`)" />
|
||||||
|
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
|
||||||
|
</template>
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
<!-- <a-table
|
<!-- <a-table
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
|
|
@ -10,7 +10,12 @@
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<vxe-table :data="tableData" :max-height="`${windowHeight - 110}px`">
|
<vxe-table
|
||||||
|
size="mini"
|
||||||
|
stripe
|
||||||
|
class="ops-stripe-table"
|
||||||
|
:data="tableData"
|
||||||
|
:max-height="`${windowHeight - 110}px`">
|
||||||
<vxe-table-column field="name" title="资源名"></vxe-table-column>
|
<vxe-table-column field="name" title="资源名"></vxe-table-column>
|
||||||
<vxe-table-column field="uid" title="创建人">
|
<vxe-table-column field="uid" title="创建人">
|
||||||
<template #default="{row}">
|
<template #default="{row}">
|
||||||
|
@ -18,6 +23,10 @@
|
||||||
</template>
|
</template>
|
||||||
</vxe-table-column>
|
</vxe-table-column>
|
||||||
<vxe-table-column field="created_at" title="创建时间"></vxe-table-column>
|
<vxe-table-column field="created_at" title="创建时间"></vxe-table-column>
|
||||||
|
<template slot="empty">
|
||||||
|
<img :src="require(`@/assets/data_empty.png`)" />
|
||||||
|
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
|
||||||
|
</template>
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
</CustomDrawer>
|
</CustomDrawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div :style="{ backgroundColor: '#fff', padding: '24px' }">
|
<div :style="{ backgroundColor: '#fff', padding: '24px' }">
|
||||||
<div class="resource-types-action-btn">
|
<div class="resource-types-action-btn">
|
||||||
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
|
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem">{{ btnName }}</a-button>
|
||||||
<a-input-search
|
<a-input-search
|
||||||
|
class="ops-input"
|
||||||
:style="{ display: 'inline', marginLeft: '10px', width: '200px' }"
|
:style="{ display: 'inline', marginLeft: '10px', width: '200px' }"
|
||||||
placeholder="搜索 | 资源类型名"
|
placeholder="搜索 | 资源类型名"
|
||||||
v-model="searchName"
|
v-model="searchName"
|
||||||
|
@ -15,31 +16,60 @@
|
||||||
"
|
"
|
||||||
></a-input-search>
|
></a-input-search>
|
||||||
</div>
|
</div>
|
||||||
<a-spin
|
<a-spin :spinning="loading">
|
||||||
:spinning="loading"
|
<vxe-table
|
||||||
><vxe-grid :columns="tableColumns" :data="groups" :max-height="`${windowHeight - 185}px`" highlight-hover-row>
|
stripe
|
||||||
<template #id_default="{row}">
|
size="mini"
|
||||||
<a-tag color="cyan" v-for="perm in id2perms[row.id]" :key="perm.id">{{ perm.name }}</a-tag>
|
class="ops-stripe-table"
|
||||||
</template>
|
:data="groups"
|
||||||
<template #action_default="{row}">
|
:max-height="`${windowHeight - 185}px`"
|
||||||
<a @click="handleEdit(row)"><a-icon type="edit"/></a>
|
highlight-hover-row
|
||||||
<a-divider type="vertical" />
|
>
|
||||||
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" okText="是" cancelText="否">
|
<!-- 1 -->
|
||||||
<a style="color: red"><a-icon type="delete"/></a>
|
<vxe-table-column
|
||||||
</a-popconfirm>
|
field="name"
|
||||||
</template>
|
title="资源类型名"
|
||||||
<template #pager>
|
:min-width="175"
|
||||||
<vxe-pager
|
fixed="left"
|
||||||
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
|
show-overflow
|
||||||
:current-page.sync="tablePage.currentPage"
|
></vxe-table-column>
|
||||||
:page-size.sync="tablePage.pageSize"
|
|
||||||
:total="tablePage.total"
|
<!-- 2 -->
|
||||||
:page-sizes="pageSizeOptions"
|
<vxe-table-column field="description" title="描述" :min-width="175"></vxe-table-column>
|
||||||
@page-change="handlePageChange"
|
|
||||||
>
|
<!-- 3 -->
|
||||||
</vxe-pager>
|
<vxe-table-column field="id" title="权限" :min-width="300">
|
||||||
</template> </vxe-grid
|
<template #default="{ row }">
|
||||||
></a-spin>
|
<a-tag color="cyan" v-for="perm in id2perms[row.id]" :key="perm.id">{{ perm.name }}</a-tag>
|
||||||
|
</template>
|
||||||
|
</vxe-table-column>
|
||||||
|
|
||||||
|
<!-- 4 -->
|
||||||
|
<vxe-table-column field="action" title="操作" :min-width="175" fixed="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<a @click="handleEdit(row)"><a-icon type="edit" /></a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" okText="是" cancelText="否">
|
||||||
|
<a style="color: red"><a-icon type="delete" /></a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</template>
|
||||||
|
</vxe-table-column>
|
||||||
|
<template slot="empty">
|
||||||
|
<img :src="require(`@/assets/data_empty.png`)" />
|
||||||
|
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
|
||||||
|
</template>
|
||||||
|
</vxe-table>
|
||||||
|
<vxe-pager
|
||||||
|
size="mini"
|
||||||
|
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
|
||||||
|
:current-page.sync="tablePage.currentPage"
|
||||||
|
:page-size.sync="tablePage.pageSize"
|
||||||
|
:total="tablePage.total"
|
||||||
|
:page-sizes="pageSizeOptions"
|
||||||
|
@page-change="handlePageChange"
|
||||||
|
>
|
||||||
|
</vxe-pager>
|
||||||
|
</a-spin>
|
||||||
|
|
||||||
<resourceTypeForm ref="resourceTypeForm" :handleOk="handleOk"> </resourceTypeForm>
|
<resourceTypeForm ref="resourceTypeForm" :handleOk="handleOk"> </resourceTypeForm>
|
||||||
</div>
|
</div>
|
||||||
|
@ -110,7 +140,7 @@ export default {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route.name': function(newName, oldName) {
|
'$route.name': function (newName, oldName) {
|
||||||
this.tablePage = {
|
this.tablePage = {
|
||||||
total: 0,
|
total: 0,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
@ -141,7 +171,11 @@ export default {
|
||||||
q: this.searchName,
|
q: this.searchName,
|
||||||
}
|
}
|
||||||
searchResourceType(param).then((res) => {
|
searchResourceType(param).then((res) => {
|
||||||
this.tablePage = { ...this.tablePage, total: res.numfound, currentPage: res.page }
|
this.tablePage = {
|
||||||
|
...this.tablePage,
|
||||||
|
total: res.numfound,
|
||||||
|
currentPage: res.page,
|
||||||
|
}
|
||||||
this.groups = res.groups
|
this.groups = res.groups
|
||||||
this.id2perms = res.id2perms
|
this.id2perms = res.id2perms
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button @click="handleCreate" type="primary">{{ btnName }}</a-button>
|
<a-button @click="handleCreate" type="primary">{{ btnName }}</a-button>
|
||||||
<a-input-search
|
<a-input-search
|
||||||
|
class="ops-input"
|
||||||
placeholder="搜索 | 资源名"
|
placeholder="搜索 | 资源名"
|
||||||
v-model="searchName"
|
v-model="searchName"
|
||||||
@search="
|
@search="
|
||||||
|
@ -65,56 +66,88 @@
|
||||||
></a-switch>
|
></a-switch>
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
<a-spin
|
<a-spin :spinning="loading">
|
||||||
:spinning="loading"
|
<vxe-table
|
||||||
><vxe-grid
|
size="mini"
|
||||||
:columns="tableColumns"
|
stripe
|
||||||
:data="tableData"
|
class="ops-stripe-table"
|
||||||
highlight-hover-row
|
:data="tableData"
|
||||||
:max-height="`${windowHeight - 245}px`"
|
highlight-hover-row
|
||||||
:checkbox-config="{ reserve: true }"
|
:height="`${windowHeight - 280}px`"
|
||||||
@checkbox-change="changeCheckbox"
|
:checkbox-config="{ reserve: true }"
|
||||||
@checkbox-all="changeCheckbox"
|
@checkbox-change="changeCheckbox"
|
||||||
ref="xTable"
|
@checkbox-all="changeCheckbox"
|
||||||
row-id="id"
|
ref="xTable"
|
||||||
show-overflow
|
row-id="id"
|
||||||
>
|
show-overflow
|
||||||
<template #name_header>
|
>
|
||||||
{{ isGroup ? '资源组名' : '资源名' }}
|
<!-- 1 -->
|
||||||
</template>
|
<vxe-table-column type="checkbox" fixed="left"></vxe-table-column>
|
||||||
<template #action_default="{row}">
|
|
||||||
<span v-show="isGroup">
|
<!-- 2 -->
|
||||||
<a @click="handleDisplayMember(row)">成员</a>
|
|
||||||
<a-divider type="vertical" />
|
<vxe-table-column field="name" title="资源名" :min-widh="150" fixed="left" show-overflow>
|
||||||
<a @click="handleGroupEdit(row)">编辑</a>
|
<template #title="{row}">
|
||||||
<a-divider type="vertical" />
|
{{ row.isGroup ? '资源组名' : '资源名' }}
|
||||||
</span>
|
</template>
|
||||||
<a-tooltip title="查看授权">
|
</vxe-table-column>
|
||||||
<a @click="handlePerm(row)"><a-icon type="eye"/></a>
|
|
||||||
</a-tooltip>
|
<!-- 3 -->
|
||||||
<a-divider type="vertical" />
|
<vxe-table-column field="user" title="创建者" :min-widh="100"> </vxe-table-column>
|
||||||
<a-tooltip title="授权">
|
|
||||||
<a :style="{ color: '#4bbb13' }" @click="handlePermManage(row)">
|
<!-- 4 -->
|
||||||
<a-icon type="usergroup-add" />
|
<vxe-table-column field="created_at" title="创建时间" :min-widh="220" align="center"> </vxe-table-column>
|
||||||
</a>
|
|
||||||
</a-tooltip>
|
<!-- 5 -->
|
||||||
<a-divider type="vertical" />
|
<vxe-table-column field="updated_at" title="最后修改时间" :min-widh="220" fixed="center"> </vxe-table-column>
|
||||||
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" @cancel="cancel" okText="是" cancelText="否">
|
|
||||||
<a style="color: red"><a-icon type="delete"/></a>
|
<!-- 6 -->
|
||||||
</a-popconfirm>
|
|
||||||
</template>
|
<vxe-table-column
|
||||||
<template #pager>
|
field="action"
|
||||||
<vxe-pager
|
title="操作"
|
||||||
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
|
:min-widh="200"
|
||||||
:current-page.sync="tablePage.currentPage"
|
fixed="right"
|
||||||
:page-size.sync="tablePage.pageSize"
|
align="center"
|
||||||
:total="tablePage.total"
|
show-overflow>
|
||||||
:page-sizes="pageSizeOptions"
|
<template #default="{row}">
|
||||||
@page-change="handlePageChange"
|
<span v-show="row.isGroup">
|
||||||
>
|
<a @click="handleDisplayMember(row)">成员</a>
|
||||||
</vxe-pager>
|
<a-divider type="vertical" />
|
||||||
</template> </vxe-grid
|
<a @click="handleGroupEdit(row)">编辑</a>
|
||||||
></a-spin>
|
<a-divider type="vertical" />
|
||||||
|
</span>
|
||||||
|
<a-tooltip title="查看授权">
|
||||||
|
<a @click="handlePerm(row)"><a-icon type="eye"/></a>
|
||||||
|
</a-tooltip>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-tooltip title="授权">
|
||||||
|
<a :style="{ color: '#4bbb13' }" @click="handlePermManage(row)">
|
||||||
|
<a-icon type="usergroup-add" />
|
||||||
|
</a>
|
||||||
|
</a-tooltip>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" @cancel="cancel" okText="是" cancelText="否">
|
||||||
|
<a style="color: red"><a-icon type="delete"/></a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</template>
|
||||||
|
</vxe-table-column>
|
||||||
|
<template slot="empty">
|
||||||
|
<img :src="require(`@/assets/data_empty.png`)" />
|
||||||
|
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
|
||||||
|
</template>
|
||||||
|
</vxe-table>
|
||||||
|
<vxe-pager
|
||||||
|
size="mini"
|
||||||
|
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
|
||||||
|
:current-page.sync="tablePage.currentPage"
|
||||||
|
:page-size.sync="tablePage.pageSize"
|
||||||
|
:total="tablePage.total"
|
||||||
|
:page-sizes="pageSizeOptions"
|
||||||
|
@page-change="handlePageChange"
|
||||||
|
>
|
||||||
|
</vxe-pager>
|
||||||
|
</a-spin>
|
||||||
</div>
|
</div>
|
||||||
<div v-else style="text-align: center">
|
<div v-else style="text-align: center">
|
||||||
<a-icon style="font-size:50px; margin-bottom: 20px; color: orange" type="info-circle" />
|
<a-icon style="font-size:50px; margin-bottom: 20px; color: orange" type="info-circle" />
|
||||||
|
@ -304,7 +337,7 @@ export default {
|
||||||
},
|
},
|
||||||
deleteResource(id) {
|
deleteResource(id) {
|
||||||
if (!this.isGroup) {
|
if (!this.isGroup) {
|
||||||
deleteResourceById(id).then((res) => {
|
deleteResourceById(id, { app_id: this.$route.name.split('_')[0] }).then((res) => {
|
||||||
this.$message.success(`删除成功`)
|
this.$message.success(`删除成功`)
|
||||||
this.handleOk()
|
this.handleOk()
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<div class="roles-action-btn">
|
<div class="roles-action-btn">
|
||||||
<a-button @click="handleCreate" type="primary">{{ btnName }}</a-button>
|
<a-button @click="handleCreate" type="primary">{{ btnName }}</a-button>
|
||||||
<a-input-search
|
<a-input-search
|
||||||
|
class="ops-input"
|
||||||
allowClear
|
allowClear
|
||||||
:style="{ display: 'inline', marginLeft: '10px', width: '200px' }"
|
:style="{ display: 'inline', marginLeft: '10px', width: '200px' }"
|
||||||
placeholder="搜索 | 角色名"
|
placeholder="搜索 | 角色名"
|
||||||
|
@ -17,8 +18,11 @@
|
||||||
<a-checkbox :checked="is_all" @click="handleClickBoxChange">所有角色</a-checkbox>
|
<a-checkbox :checked="is_all" @click="handleClickBoxChange">所有角色</a-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<a-spin :spinning="loading">
|
<a-spin :spinning="loading">
|
||||||
<vxe-grid
|
<vxe-table
|
||||||
:columns="tableColumns"
|
stripe
|
||||||
|
class="ops-stripe-table"
|
||||||
|
size="mini"
|
||||||
|
resizable
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
:max-height="`${windowHeight - 185}px`"
|
:max-height="`${windowHeight - 185}px`"
|
||||||
highlight-hover-row
|
highlight-hover-row
|
||||||
|
@ -26,54 +30,94 @@
|
||||||
:filter-config="{ remote: true }"
|
:filter-config="{ remote: true }"
|
||||||
@filter-change="filterTableMethod"
|
@filter-change="filterTableMethod"
|
||||||
>
|
>
|
||||||
<template #is_app_admin_default="{row}">
|
|
||||||
<a-icon type="check" v-if="row.is_app_admin" />
|
<vxe-table-column
|
||||||
</template>
|
field="name"
|
||||||
<template #inherit_default="{row}">
|
title="角色名"
|
||||||
<a-tag color="cyan" v-for="role in id2parents[row.id]" :key="role.id">{{ role.name }}</a-tag>
|
:min-width="150"
|
||||||
</template>
|
align="left"
|
||||||
<template #isVisualRole_default="{row}">
|
fixed="left"
|
||||||
{{ row.uid ? '否' : '是' }}
|
sortable
|
||||||
</template>
|
show-overflow>
|
||||||
<template #action_default="{row}">
|
</vxe-table-column>
|
||||||
<div style="width:300px">
|
|
||||||
<span>
|
<!-- 2 -->
|
||||||
<a-tooltip title="资源列表">
|
<vxe-table-column field="is_app_admin" title="管理员" :min-width="100" align="center">
|
||||||
<a
|
<template #default="{row}">
|
||||||
v-if="$route.name !== 'acl_roles'"
|
<a-icon type="check" v-if="row.is_app_admin" />
|
||||||
@click="handleDisplayUserResource(row)"
|
</template>
|
||||||
><a-icon
|
</vxe-table-column>
|
||||||
type="file-search"
|
|
||||||
/></a>
|
<vxe-table-column field="id" title="继承自" :min-width="150">
|
||||||
</a-tooltip>
|
<template #default="{row}">
|
||||||
<a-divider type="vertical" />
|
<a-tag color="cyan" v-for="role in id2parents[row.id]" :key="role.id">{{ role.name }}</a-tag>
|
||||||
<div v-if="!row.uid" style="display: inline-block">
|
</template>
|
||||||
<a-tooltip
|
</vxe-table-column>
|
||||||
title="用户列表"
|
|
||||||
><a @click="handleDisplayUserUnderRole(row)"><a-icon type="team"/></a
|
<vxe-table-column
|
||||||
></a-tooltip>
|
field="uid"
|
||||||
|
title="虚拟角色"
|
||||||
|
:min-width="100"
|
||||||
|
align="center"
|
||||||
|
:filters="[
|
||||||
|
{ label: '是', value: 1 },
|
||||||
|
{ label: '否', value: 0 },
|
||||||
|
]"
|
||||||
|
:filterMultiple="false"
|
||||||
|
:filter-method="({ value, row }) => {
|
||||||
|
return value === !row.uid
|
||||||
|
}">
|
||||||
|
<template #default="{row}">
|
||||||
|
{{ row.uid ? '否' : '是' }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</vxe-table-column>
|
||||||
|
|
||||||
|
<vxe-table-column field="action" title="操作" :min-width="150" fixed="right">
|
||||||
|
<template #default="{row}">
|
||||||
|
<div style="width:300px">
|
||||||
|
<span>
|
||||||
|
<a-tooltip title="资源列表">
|
||||||
|
<a
|
||||||
|
v-if="$route.name !== 'acl_roles'"
|
||||||
|
@click="handleDisplayUserResource(row)"
|
||||||
|
><a-icon
|
||||||
|
type="file-search"
|
||||||
|
/></a>
|
||||||
|
</a-tooltip>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
</div>
|
<div v-if="!row.uid" style="display: inline-block">
|
||||||
<a @click="handleEdit(row)"><a-icon type="edit"/></a>
|
<a-tooltip
|
||||||
<a-divider type="vertical" />
|
title="用户列表"
|
||||||
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" @cancel="cancel" okText="是" cancelText="否">
|
><a @click="handleDisplayUserUnderRole(row)"><a-icon type="team"/></a
|
||||||
<a style="color: red"><a-icon type="delete"/></a>
|
></a-tooltip>
|
||||||
</a-popconfirm>
|
<a-divider type="vertical" />
|
||||||
</span>
|
</div>
|
||||||
</div>
|
<a @click="handleEdit(row)"><a-icon type="edit"/></a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" @cancel="cancel" okText="是" cancelText="否">
|
||||||
|
<a style="color: red"><a-icon type="delete"/></a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</vxe-table-column>
|
||||||
|
|
||||||
|
<template slot="empty">
|
||||||
|
<img :src="require(`@/assets/data_empty.png`)" />
|
||||||
|
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
|
||||||
</template>
|
</template>
|
||||||
<template #pager>
|
</vxe-table>
|
||||||
<vxe-pager
|
<vxe-pager
|
||||||
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
|
size="mini"
|
||||||
:current-page.sync="tablePage.currentPage"
|
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
|
||||||
:page-size.sync="tablePage.pageSize"
|
:current-page.sync="tablePage.currentPage"
|
||||||
:total="tablePage.total"
|
:page-size.sync="tablePage.pageSize"
|
||||||
:page-sizes="pageSizeOptions"
|
:total="tablePage.total"
|
||||||
@page-change="handlePageChange"
|
:page-sizes="pageSizeOptions"
|
||||||
>
|
@page-change="handlePageChange"
|
||||||
</vxe-pager>
|
>
|
||||||
</template>
|
</vxe-pager>
|
||||||
</vxe-grid>
|
|
||||||
</a-spin>
|
</a-spin>
|
||||||
|
|
||||||
<roleForm ref="roleForm" :allRoles="allRoles" :id2parents="id2parents" :handleOk="handleOk"></roleForm>
|
<roleForm ref="roleForm" :allRoles="allRoles" :id2parents="id2parents" :handleOk="handleOk"></roleForm>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<div class="trigger-action-btn">
|
<div class="trigger-action-btn">
|
||||||
<a-button type="primary" @click="handleCreateTrigger">新增触发器</a-button>
|
<a-button type="primary" @click="handleCreateTrigger">新增触发器</a-button>
|
||||||
<a-input-search
|
<a-input-search
|
||||||
|
class="ops-input"
|
||||||
:style="{ display: 'inline', marginLeft: '10px', width: '200px' }"
|
:style="{ display: 'inline', marginLeft: '10px', width: '200px' }"
|
||||||
placeholder="搜索 | 名称"
|
placeholder="搜索 | 名称"
|
||||||
v-model="searchName"
|
v-model="searchName"
|
||||||
|
@ -12,6 +13,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<vxe-grid
|
<vxe-grid
|
||||||
|
stripe
|
||||||
|
size="mini"
|
||||||
|
class="ops-stripe-table"
|
||||||
:columns="tableColumns"
|
:columns="tableColumns"
|
||||||
:data="filterTriggers"
|
:data="filterTriggers"
|
||||||
:max-height="`${windowHeight - 185}px`"
|
:max-height="`${windowHeight - 185}px`"
|
||||||
|
@ -60,6 +64,10 @@
|
||||||
<a @click="handleDeleteTrigger(row)" :style="{ color: 'red' }"><a-icon type="delete"/></a>
|
<a @click="handleDeleteTrigger(row)" :style="{ color: 'red' }"><a-icon type="delete"/></a>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
<template slot="empty">
|
||||||
|
<img :src="require(`@/assets/data_empty.png`)" />
|
||||||
|
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
|
||||||
|
</template>
|
||||||
</vxe-grid>
|
</vxe-grid>
|
||||||
<trigger-form
|
<trigger-form
|
||||||
ref="triggerForm"
|
ref="triggerForm"
|
||||||
|
|
Loading…
Reference in New Issue