优化代码

This commit is contained in:
shiziyuan9527 2020-05-08 12:11:02 +08:00
parent ae288e8ace
commit d38fe65d2b
1 changed files with 13 additions and 10 deletions

View File

@ -12,7 +12,8 @@
<el-table-column prop="organizationName" :label="$t('workspace.organization_name')"/> <el-table-column prop="organizationName" :label="$t('workspace.organization_name')"/>
<el-table-column :label="$t('commons.member')"> <el-table-column :label="$t('commons.member')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-button type="text" class="member-size" @click="cellClick(scope.row)">{{scope.row.memberSize}} <el-button type="text" class="member-size" @click="cellClick(scope.row)">
{{scope.row.memberSize}}
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -85,7 +86,7 @@
</el-dialog> </el-dialog>
<!-- dialog of workspace member --> <!-- dialog of workspace member -->
<el-dialog :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true" @close="closeMemberFunc"> <el-dialog :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true" @close="closeWsMemberDialog">
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch" <ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
:create-tip="dialogBtnTips" :title="$t('commons.member')"/> :create-tip="dialogBtnTips" :title="$t('commons.member')"/>
<!-- organization member table --> <!-- organization member table -->
@ -112,7 +113,7 @@
<!-- add workspace member dialog --> <!-- add workspace member dialog -->
<el-dialog :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible" width="30%" <el-dialog :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible" width="30%"
:destroy-on-close="true" :destroy-on-close="true"
@close="closeFunc"> @close="closeWsMemberAddDialog">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px" <el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px"
size="small"> size="small">
<el-form-item :label="$t('commons.member')" prop="userIds"> <el-form-item :label="$t('commons.member')" prop="userIds">
@ -152,7 +153,7 @@
<!-- update workspace member dialog --> <!-- update workspace member dialog -->
<el-dialog :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible" width="30%" <el-dialog :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible" width="30%"
:destroy-on-close="true" :destroy-on-close="true"
@close="closeFunc"> @close="closeWsMemberUpdateDialog">
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm"> <el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="memberForm.id" autocomplete="off" :disabled="true"/> <el-input v-model="memberForm.id" autocomplete="off" :disabled="true"/>
@ -180,7 +181,7 @@
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button type="primary" @click="updateOrgMember('updateUserForm')" @keydown.enter.native.prevent <el-button type="primary" @click="updateWorkspaceMember('updateUserForm')" @keydown.enter.native.prevent
size="medium">{{$t('commons.save')}} size="medium">{{$t('commons.save')}}
</el-button> </el-button>
</span> </span>
@ -232,7 +233,6 @@
}, },
addMember() { addMember() {
this.dialogWsMemberAddVisible = true; this.dialogWsMemberAddVisible = true;
this.memberForm = {};
this.result = this.$get('/user/list/', response => { this.result = this.$get('/user/list/', response => {
this.$set(this.memberForm, "userList", response.data); this.$set(this.memberForm, "userList", response.data);
}); });
@ -318,13 +318,16 @@
}); });
}, },
closeFunc() { closeWsMemberAddDialog() {
this.form = {}; this.memberForm = {};
}, },
closeMemberFunc() { closeWsMemberDialog() {
this.memberLineData = []; this.memberLineData = [];
this.list(); this.list();
}, },
closeWsMemberUpdateDialog() {
this.dialogSearch();
},
list() { list() {
let url = '/workspace/list/all/' + this.currentPage + '/' + this.pageSize; let url = '/workspace/list/all/' + this.currentPage + '/' + this.pageSize;
this.result = this.$post(url, this.condition, response => { this.result = this.$post(url, this.condition, response => {
@ -385,7 +388,7 @@
this.$info(this.$t('commons.delete_cancel')); this.$info(this.$t('commons.delete_cancel'));
}); });
}, },
updateOrgMember() { updateWorkspaceMember() {
let param = { let param = {
id: this.memberForm.id, id: this.memberForm.id,
name: this.memberForm.name, name: this.memberForm.name,