|
@@ -25,7 +25,8 @@ export default {
|
|
|
roleId: null
|
|
|
},
|
|
|
itemData: {},
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ items: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -46,14 +47,9 @@ export default {
|
|
|
options: {
|
|
|
multiple: true,
|
|
|
placeholder: '请选择角色',
|
|
|
- filterable: true,
|
|
|
- remote: true,
|
|
|
labelText: 'roleName',
|
|
|
labelValue: 'id',
|
|
|
- remoteMethod: this.remoteMethod,
|
|
|
valueKey: 'id',
|
|
|
- defaultFirstOption: true,
|
|
|
- loading: this.loading,
|
|
|
items: this.items
|
|
|
},
|
|
|
rules: [
|
|
@@ -69,23 +65,15 @@ export default {
|
|
|
this.roleFormValue = {
|
|
|
username: item.username,
|
|
|
name: item.name,
|
|
|
- roleId: item.roleId ? item.roleId.split(',').map(e => +e) : []
|
|
|
- }
|
|
|
- if (this.roleFormValue.roleId.length > 0) {
|
|
|
- try {
|
|
|
- const { data } = await getRoleList({ ids: this.roleFormValue.roleId })
|
|
|
- this.items = data.records
|
|
|
- } catch (error) {
|
|
|
- this.items = []
|
|
|
- this.$message.error(error)
|
|
|
- }
|
|
|
+ roleId: item.roleId ? item.roleId.split(',').map(Number) : []
|
|
|
}
|
|
|
+ this.getRoleList()
|
|
|
this.$refs.dialog.open()
|
|
|
},
|
|
|
- async remoteMethod (str) {
|
|
|
+ async getRoleList () {
|
|
|
this.loading = true
|
|
|
try {
|
|
|
- const { data } = await getRoleList({ size: 50, roleName: str })
|
|
|
+ const { data } = await getRoleList({ size: 9999 })
|
|
|
this.items = data.records
|
|
|
} catch (error) {
|
|
|
this.items = []
|