mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-06 05:58:46 +08:00
refactor(系统设置): 简化代码
This commit is contained in:
parent
2a0cc4c7ea
commit
3423c05f60
@ -28,8 +28,8 @@
|
|||||||
<el-dialog :title="$t('member.create')" :visible.sync="createVisible" width="30%" :destroy-on-close="true"
|
<el-dialog :title="$t('member.create')" :visible.sync="createVisible" width="30%" :destroy-on-close="true"
|
||||||
@close="handleClose">
|
@close="handleClose">
|
||||||
<el-form :model="form" ref="form" :rules="rules" label-position="right" label-width="100px" size="small">
|
<el-form :model="form" ref="form" :rules="rules" label-position="right" label-width="100px" size="small">
|
||||||
|
<el-form-item :label="$t('commons.member')" prop="ids"
|
||||||
<el-form-item :label="$t('commons.member')" prop="ids" :rules="{required: true, message: $t('member.input_id_or_email'), trigger: 'blur'}">
|
:rules="{required: true, message: $t('member.input_id_or_email'), trigger: 'blur'}">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.ids"
|
v-model="form.ids"
|
||||||
multiple
|
multiple
|
||||||
@ -51,9 +51,9 @@
|
|||||||
<span class="org-member-email">{{item.email}}</span>
|
<span class="org-member-email">{{item.email}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="$t('commons.role')" prop="roleIds">
|
<el-form-item :label="$t('commons.role')" prop="roleIds">
|
||||||
<el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
|
<el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
|
||||||
<el-option
|
<el-option
|
||||||
@ -65,6 +65,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<ms-dialog-footer
|
<ms-dialog-footer
|
||||||
@cancel="createVisible = false"
|
@cancel="createVisible = false"
|
||||||
@ -87,7 +88,8 @@
|
|||||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||||
<el-input v-model="form.phone" autocomplete="off" :disabled="true"/>
|
<el-input v-model="form.phone" autocomplete="off" :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
<el-form-item :label="$t('commons.role')" prop="roleIds"
|
||||||
|
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
||||||
<el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
|
<el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in form.allroles"
|
v-for="item in form.allroles"
|
||||||
@ -127,7 +129,6 @@
|
|||||||
result: {},
|
result: {},
|
||||||
createVisible: false,
|
createVisible: false,
|
||||||
updateVisible: false,
|
updateVisible: false,
|
||||||
userList: [],
|
|
||||||
form: {},
|
form: {},
|
||||||
queryPath: "/user/org/member/list",
|
queryPath: "/user/org/member/list",
|
||||||
condition: {},
|
condition: {},
|
||||||
@ -146,7 +147,6 @@
|
|||||||
total: 0,
|
total: 0,
|
||||||
options: [],
|
options: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
ids: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -184,7 +184,7 @@
|
|||||||
let roleIds = this.form.roles.map(r => r.id);
|
let roleIds = this.form.roles.map(r => r.id);
|
||||||
this.result = this.$get('/role/list/org', response => {
|
this.result = this.$get('/role/list/org', response => {
|
||||||
this.$set(this.form, "allroles", response.data);
|
this.$set(this.form, "allroles", response.data);
|
||||||
})
|
});
|
||||||
// 编辑使填充角色信息
|
// 编辑使填充角色信息
|
||||||
this.$set(this.form, 'roleIds', roleIds);
|
this.$set(this.form, 'roleIds', roleIds);
|
||||||
},
|
},
|
||||||
@ -196,7 +196,7 @@
|
|||||||
phone: this.form.phone,
|
phone: this.form.phone,
|
||||||
roleIds: this.form.roleIds,
|
roleIds: this.form.roleIds,
|
||||||
organizationId: this.currentUser().lastOrganizationId
|
organizationId: this.currentUser().lastOrganizationId
|
||||||
}
|
};
|
||||||
this.$refs[formName].validate((valid) => {
|
this.$refs[formName].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.result = this.$post("/organization/member/update", param, () => {
|
this.result = this.$post("/organization/member/update", param, () => {
|
||||||
@ -229,9 +229,6 @@
|
|||||||
}
|
}
|
||||||
this.form = {};
|
this.form = {};
|
||||||
this.createVisible = true;
|
this.createVisible = true;
|
||||||
// this.result = this.$get('/user/list/', response => {
|
|
||||||
// this.userList = response.data;
|
|
||||||
// });
|
|
||||||
this.result = this.$get('/role/list/org', response => {
|
this.result = this.$get('/role/list/org', response => {
|
||||||
this.$set(this.form, "roles", response.data);
|
this.$set(this.form, "roles", response.data);
|
||||||
})
|
})
|
||||||
@ -256,7 +253,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
remoteMethod(query) {
|
remoteMethod(query) {
|
||||||
query = query.trim()
|
query = query.trim();
|
||||||
if (query !== '') {
|
if (query !== '') {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -285,10 +282,6 @@
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-with-autocomplete {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.select-width {
|
.select-width {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user