|
@@ -2,7 +2,7 @@
|
|
|
<el-dialog
|
|
|
:title="title"
|
|
|
:visible.sync="modal"
|
|
|
- width="80%"
|
|
|
+ width="40%"
|
|
|
:close-on-click-modal="false"
|
|
|
@close="
|
|
|
res => {
|
|
@@ -10,7 +10,7 @@
|
|
|
}
|
|
|
"
|
|
|
>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="150px">
|
|
|
+ <el-form ref="form" :model="form" label-width="80px">
|
|
|
<el-form-item label="角色列表" prop="auditStatus">
|
|
|
<el-checkbox-group v-model="form.roles">
|
|
|
<el-checkbox
|
|
@@ -40,62 +40,62 @@ export default {
|
|
|
id: {
|
|
|
type: String,
|
|
|
default: ''
|
|
|
- },
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- data() {
|
|
|
- return {
|
|
|
- title: '用户分配角色',
|
|
|
- modal: true,
|
|
|
- form: {
|
|
|
- roles: []
|
|
|
- },
|
|
|
- options: []
|
|
|
- };
|
|
|
- },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ title: '用户分配角色',
|
|
|
+ modal: true,
|
|
|
+ form: {
|
|
|
+ roles: []
|
|
|
+ },
|
|
|
+ options: []
|
|
|
+ };
|
|
|
+ },
|
|
|
|
|
|
- watch: {
|
|
|
- id: {
|
|
|
- handler(id) {
|
|
|
- id && this.loadData();
|
|
|
- },
|
|
|
- immediate: true
|
|
|
- }
|
|
|
- },
|
|
|
+ watch: {
|
|
|
+ id: {
|
|
|
+ handler(id) {
|
|
|
+ id && this.loadData();
|
|
|
+ },
|
|
|
+ immediate: true
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- mounted() {
|
|
|
- this.loadList();
|
|
|
- },
|
|
|
+ mounted() {
|
|
|
+ this.loadList();
|
|
|
+ },
|
|
|
|
|
|
- methods: {
|
|
|
- async loadList() {
|
|
|
- const { data } = await getList();
|
|
|
- this.options = data.map(x => ({ key: x.code, label: x.name }));
|
|
|
- },
|
|
|
- async loadData() {
|
|
|
- const { success, data, msg } = await getUserRole({
|
|
|
- id: this.id
|
|
|
- });
|
|
|
- if (success) {
|
|
|
- this.form = data;
|
|
|
- }
|
|
|
- },
|
|
|
+ methods: {
|
|
|
+ async loadList() {
|
|
|
+ const { data } = await getList();
|
|
|
+ this.options = data.map(x => ({ key: x.code, label: x.name }));
|
|
|
+ },
|
|
|
+ async loadData() {
|
|
|
+ const { success, data, msg } = await getUserRole({
|
|
|
+ id: this.id
|
|
|
+ });
|
|
|
+ if (success) {
|
|
|
+ this.form = data;
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- handleConfirm() {
|
|
|
- this.$refs.form.validate(async valid => {
|
|
|
- if (valid) {
|
|
|
- const params = {
|
|
|
- roles: this.form.roles
|
|
|
- };
|
|
|
- if (this.id) params.id = this.id;
|
|
|
- const { success, msg } = await updateUserRole(params);
|
|
|
- if (success) {
|
|
|
- this.$success('保存成功!');
|
|
|
- this.modal = false;
|
|
|
- this.$g_emit('account_reload');
|
|
|
- }
|
|
|
+ handleConfirm() {
|
|
|
+ this.$refs.form.validate(async valid => {
|
|
|
+ if (valid) {
|
|
|
+ const params = {
|
|
|
+ roles: this.form.roles
|
|
|
+ };
|
|
|
+ if (this.id) params.id = this.id;
|
|
|
+ const { success, msg } = await updateUserRole(params);
|
|
|
+ if (success) {
|
|
|
+ this.$success('保存成功!');
|
|
|
+ this.modal = false;
|
|
|
+ this.$g_emit('account_reload');
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|