[更新] 去除app_id

This commit is contained in:
kdyq007 2019-11-18 22:22:38 +08:00
parent 6a7bb725cc
commit 224a48a5f3
3 changed files with 8 additions and 44 deletions

View File

@ -14,6 +14,7 @@ import {
const app = { const app = {
state: { state: {
name: 'cmdb',
sidebar: true, sidebar: true,
device: 'desktop', device: 'desktop',
theme: '', theme: '',

View File

@ -65,8 +65,7 @@ export default {
drawerTitle: '角色关联', drawerTitle: '角色关联',
drawerVisible: false, drawerVisible: false,
formLayout: 'vertical', formLayout: 'vertical',
allRoles: [], allRoles: []
app_id: 0
} }
}, },
@ -108,7 +107,6 @@ export default {
handleAddRoleRelation (record) { handleAddRoleRelation (record) {
this.drawerVisible = true this.drawerVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.app_id = record.app_id
this.getAllRoles() this.getAllRoles()
this.form.setFieldsValue({ this.form.setFieldsValue({
id: record.id id: record.id
@ -132,7 +130,7 @@ export default {
}) })
}, },
getAllRoles () { getAllRoles () {
searchRole({ page_size: 999, app_id: this.app_id }).then(res => { searchRole({ page_size: 999, app_id: this.$store.state.app.name }).then(res => {
this.allRoles = res.roles this.allRoles = res.roles
}) })
}, },

View File

@ -1,21 +1,9 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<a-form layout="inline">
<a-row :gutter="48"> <div class="action-btn">
<a-col :md="3" :sm="24"> <a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
<div class="action-btn"> </div>
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
</div>
</a-col>
<a-col :md="8" :sm="24">
<a-form-item label="应用列表">
<a-select placeholder="请选择" v-model="queryParam.app_id">
<a-select-option v-for="app in appList" :key="app.id" :label="app.name" :value="app.id">{{ app.name }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
</a-form>
<s-table <s-table
:alert="options.alert" :alert="options.alert"
@ -65,10 +53,6 @@
<template v-else>{{ text }}</template> <template v-else>{{ text }}</template>
</template> </template>
<span slot="app_id" slot-scope="text">
<template>{{ text }}</template>
</span>
<span slot="is_app_admin" slot-scope="text"> <span slot="is_app_admin" slot-scope="text">
<a-icon type="check" v-if="text"/> <a-icon type="check" v-if="text"/>
</span> </span>
@ -117,10 +101,6 @@ export default {
}, },
data () { data () {
return { return {
appList: [{
id: '1',
name: '默认应用'
}],
scroll: { x: 1000, y: 500 }, scroll: { x: 1000, y: 500 },
btnName: '新增角色', btnName: '新增角色',
@ -154,13 +134,6 @@ export default {
} }
} }
}, },
{
title: '应用',
dataIndex: 'app_id',
width: 250,
sorter: false,
scopedSlots: { customRender: 'app_id' }
},
{ {
title: '管理者', title: '管理者',
dataIndex: 'is_app_admin', dataIndex: 'is_app_admin',
@ -185,6 +158,7 @@ export default {
} }
], ],
loadData: parameter => { loadData: parameter => {
parameter.app_id = this.$store.state.app.name
parameter.page = parameter.pageNo parameter.page = parameter.pageNo
parameter.page_size = parameter.pageSize parameter.page_size = parameter.pageSize
delete parameter.pageNo delete parameter.pageNo
@ -231,10 +205,6 @@ export default {
this.form = this.$form.createForm(this) this.form = this.$form.createForm(this)
}, },
created () {
this.queryParam.app_id = this.appList[0].id
},
computed: { computed: {
formItemLayout () { formItemLayout () {
@ -276,11 +246,6 @@ export default {
this.columnSearchText[column.dataIndex] = '' this.columnSearchText[column.dataIndex] = ''
this.queryParam[column.dataIndex] = '' this.queryParam[column.dataIndex] = ''
}, },
searchRoles (params) {
searchRole(params).then(res => {
this.allRoles = res.roles
})
},
setScrollY () { setScrollY () {
this.scroll.y = window.innerHeight - this.$refs.table.$el.offsetTop - 200 this.scroll.y = window.innerHeight - this.$refs.table.$el.offsetTop - 200