Skip to content

Commit

Permalink
更新角色列表
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Sep 19, 2018
1 parent 41fe696 commit 5fbd23e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
20 changes: 10 additions & 10 deletions src/api/system/role.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
import fetch from '@/utils/fetch'
export function GetRoles(params){
return fetch({
url: '/admin/pullrolelist',
url: '/role/list',
method: 'post',
params
})
}

export function GetRolesOptions(){
return fetch({
url: '/admin/pullrolelist',
url: '/role/list',
method: 'post',

})
}

export function DeleteRole(ID){
export function DeleteRole(id){
return fetch({
url: '/admin/Delrole',
url: '/role/delete',
method: 'post',
params:{ID}
params:{id}
})
}

export function GetRoleDetail(ID){
export function GetRoleDetail(id){
return fetch({
url: '/admin/PullroleDetail',
url: '/role/detail',
method: 'post',
params:{ID}
params:{id}
})
}

export function SaveNewRole(data){
return fetch({
url: '/admin/SaveNewrole',
url: '/role/add',
method: 'post',
data
})
}

export function UpdateRole(data){
return fetch({
url: '/admin/Updaterole',
url: '/role/update',
method: 'post',
data
})
Expand Down
42 changes: 22 additions & 20 deletions src/views/system/role.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
<br>

<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>
<el-table-column align="center" label='ID' width="95">
<el-table-column align="center" label='id' width="95">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</el-table-column>
<el-table-column label="角色名">
<template slot-scope="scope">
{{scope.row.RoleName}}
{{scope.row.rolename}}
</template>
</el-table-column>
<el-table-column label="排序码">
<template slot-scope="scope">
{{scope.row.Rank}}
{{scope.row.rank}}
</template>
</el-table-column>

<el-table-column label="操作" align="center" min-width="110px">
<template slot-scope="scope">
<el-button @click="Edit(scope.row.ID)" type="success" size="small">编辑</el-button>
<el-button @click="Edit(scope.row.id)" type="success" size="small">编辑</el-button>

<el-button @click="Delete(scope.row.ID)" type="danger" size="small">删除</el-button>
<el-button @click="Delete(scope.row.id)" type="danger" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
Expand All @@ -39,12 +39,12 @@
<el-form class="small-space" :model="temp" label-position="left" label-width="70px">

<el-form-item label="角色名">
<el-input class="filter-item" v-model="temp.RoleName" placeholder="请输入角色名">
<el-input class="filter-item" v-model="temp.rolename" placeholder="请输入角色名">

</el-input>
</el-form-item>
<el-form-item label="排序码">
<el-input class="filter-item" v-model="temp.Rank" placeholder="请输入排序码">
<el-input class="filter-item" v-model="temp.rank" placeholder="请输入排序码">

</el-input>
</el-form-item>
Expand Down Expand Up @@ -89,15 +89,15 @@ export default {
list: null,
listLoading: true,
temp: {
ID: "",
RoleName: "",
Rank: "",
IsDeleted: false,
RoleAuthName: null
id: "",
rolename: "",
rank: "",
isdeleted: false,
roleauthname: null
},
menu: null,
listQuery: {
totalCount: "",
totalCount: 0,
pageSize: "10",
pageNumber: "1"
},
Expand Down Expand Up @@ -133,8 +133,9 @@ export default {
fetchData(params) {
this.listLoading = true;
GetRoles(params).then(response => {
this.list = response.data.rows;
this.listQuery.totalCount = response.data.total;
this.list = response.data.data.list;
console.log(this.list)
this.listQuery.totalCount = parseInt(response.data.data.total)
this.listLoading = false;
});
},
Expand All @@ -146,13 +147,13 @@ export default {
this.dialogStatus = "create";
},
Delete(ID) {
Delete(id) {
this.$confirm("确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
DeleteRole(ID).then(response => {
DeleteRole(id).then(response => {
this.$message({
type: "success",
message: "删除成功!"
Expand All @@ -161,12 +162,13 @@ export default {
});
});
},
Edit(ID) {
Edit(id) {
this.dialogStatus = "update";
GetRoleDetail(ID).then(response => {
GetRoleDetail(id).then(response => {
this.dialogStatus = "update";
this.temp = response.data;
this.temp = response.data.data;
console.log(response.data.data)
this.dialogFormVisible = true;
});
},
Expand Down

0 comments on commit 5fbd23e

Please sign in to comment.