|
|
@@ -33,6 +33,7 @@
|
|
|
<el-form-item label="角色名称:">
|
|
|
<el-input
|
|
|
v-model="formInline.roleName"
|
|
|
+ clearable
|
|
|
placeholder="输入角色名称"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
@@ -116,7 +117,7 @@
|
|
|
v-model="row.rolePermissions[item]"
|
|
|
@change="rowChange(row)"
|
|
|
/>
|
|
|
- <span>{{ row.rolePermissions[item] }}</span>
|
|
|
+ <!-- <span>{{ row.rolePermissions[item] }}</span> -->
|
|
|
</template>
|
|
|
<!-- <span>{{ row }} -{{ column }}-{{ $index }}</span> -->
|
|
|
</el-table-column>
|
|
|
@@ -230,52 +231,54 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- const id = setTimeout(() => {
|
|
|
+ this.search().then(() => {
|
|
|
this.handleTableHeight()
|
|
|
- clearTimeout(id)
|
|
|
- }, 300)
|
|
|
- this.search()
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
search() {
|
|
|
this.loading = true
|
|
|
- // this.handleResize()
|
|
|
- try {
|
|
|
- searchPagePermission({
|
|
|
- requestPage: {
|
|
|
- limit: this.pagination.limit,
|
|
|
- pageNo: this.pagination.pageNo
|
|
|
- },
|
|
|
- customs: this.formInline
|
|
|
- }).then((res) => {
|
|
|
- this.loading = false
|
|
|
- if (res.state === 200 && res.data) {
|
|
|
- const { data, pageResult } = res.data || {
|
|
|
- data: {},
|
|
|
- pageResult: {}
|
|
|
- }
|
|
|
- this.pagination = pageResult
|
|
|
- this.columns = data.roles
|
|
|
- console.log('permissions===>', data.permissions)
|
|
|
- this.ibpsData = data.permissions
|
|
|
- } else {
|
|
|
- this.pagination = {
|
|
|
- pageNo: 1,
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ try {
|
|
|
+ searchPagePermission({
|
|
|
+ requestPage: {
|
|
|
limit: this.pagination.limit,
|
|
|
- totalCount: 0,
|
|
|
- totalPages: 1
|
|
|
+ pageNo: this.pagination.pageNo
|
|
|
+ },
|
|
|
+ customs: this.formInline
|
|
|
+ }).then((res) => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.state === 200 && res.data) {
|
|
|
+ const { data, pageResult } = res.data || {
|
|
|
+ data: {},
|
|
|
+ pageResult: {}
|
|
|
+ }
|
|
|
+ this.pagination = pageResult
|
|
|
+ this.columns = data.roles
|
|
|
+ console.log('permissions===>', data.permissions)
|
|
|
+ this.ibpsData = data.permissions
|
|
|
+ } else {
|
|
|
+ this.pagination = {
|
|
|
+ pageNo: 1,
|
|
|
+ limit: this.pagination.limit,
|
|
|
+ totalCount: 0,
|
|
|
+ totalPages: 1
|
|
|
+ }
|
|
|
+ this.ibpsData = []
|
|
|
}
|
|
|
- this.ibpsData = []
|
|
|
- }
|
|
|
- })
|
|
|
- } catch (error) {
|
|
|
- this.loading = false
|
|
|
- }
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
+ } catch (error) {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
rowChange(row) {
|
|
|
- const flag = this.changeRows.some((t) => t.pageId === row.pageId)
|
|
|
- if (!flag) {
|
|
|
+ const index = this.changeRows.findIndex((t) => t.pageId === row.pageId)
|
|
|
+ if (index === -1) {
|
|
|
this.changeRows.push(row)
|
|
|
+ } else {
|
|
|
+ this.changeRows.splice(index, 1, row)
|
|
|
}
|
|
|
},
|
|
|
// 计算列宽:根据文字长度,加一些边距
|
|
|
@@ -308,10 +311,10 @@ export default {
|
|
|
this.editFalg = false
|
|
|
return
|
|
|
}
|
|
|
- this.loading = true
|
|
|
savePagePermission({
|
|
|
permissions: this.changeRows
|
|
|
}).then((res) => {
|
|
|
+ this.changeRows = []
|
|
|
this.editFalg = false
|
|
|
this.search()
|
|
|
})
|