This commit is contained in:
shiziyuan9527 2020-09-24 15:16:33 +08:00
commit 56491903de
1 changed files with 301 additions and 288 deletions

View File

@ -50,7 +50,8 @@
</el-card> </el-card>
<!--Create user--> <!--Create user-->
<el-dialog :close-on-click-modal="false" :title="$t('user.create')" :visible.sync="createVisible" width="35%" @closed="handleClose" <el-dialog :close-on-click-modal="false" :title="$t('user.create')" :visible.sync="createVisible" width="35%"
@closed="handleClose"
:destroy-on-close="true"> :destroy-on-close="true">
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="createUserForm"> <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="createUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
@ -81,10 +82,11 @@
:label="$t('role.' + item.id)" :label="$t('role.' + item.id)"
:value="item.id" :value="item.id"
> >
{{$t('role.' + item.id)}} {{ $t('role.' + item.id) }}
</el-option> </el-option>
</el-select> </el-select>
<el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">{{$t('commons.delete')}} <el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">
{{ $t('commons.delete') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
<div v-if="role.id === 'org_admin'"> <div v-if="role.id === 'org_admin'">
@ -151,7 +153,9 @@
<el-form-item> <el-form-item>
<template> <template>
<el-button type="success" style="width: 100%;" @click="addRole('createUserForm')" :disabled="btnAddRole">{{$t('role.add')}}</el-button> <el-button type="success" style="width: 100%;" @click="addRole('createUserForm')" :disabled="btnAddRole">
{{ $t('role.add') }}
</el-button>
</template> </template>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -163,7 +167,8 @@
</el-dialog> </el-dialog>
<!--Modify user information in system settings--> <!--Modify user information in system settings-->
<el-dialog :close-on-click-modal="false" :title="$t('user.modify')" :visible.sync="updateVisible" width="35%" :destroy-on-close="true" <el-dialog :close-on-click-modal="false" :title="$t('user.modify')" :visible.sync="updateVisible" width="35%"
:destroy-on-close="true"
@close="handleClose" v-loading="result.loading"> @close="handleClose" v-loading="result.loading">
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm"> <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
@ -191,7 +196,8 @@
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
<el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">{{$t('commons.delete')}} <el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">
{{ $t('commons.delete') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
<div v-if="role.id === 'org_admin'"> <div v-if="role.id === 'org_admin'">
@ -257,7 +263,9 @@
</div> </div>
<el-form-item> <el-form-item>
<template> <template>
<el-button type="success" style="width: 100%;" @click="addRole('updateUserForm')" :disabled="btnAddRole">{{$t('role.add')}}</el-button> <el-button type="success" style="width: 100%;" @click="addRole('updateUserForm')" :disabled="btnAddRole">
{{ $t('role.add') }}
</el-button>
</template> </template>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -268,7 +276,8 @@
</template> </template>
</el-dialog> </el-dialog>
<!--Changing user password in system settings--> <!--Changing user password in system settings-->
<el-dialog :close-on-click-modal="false" :title="$t('member.edit_password')" :visible.sync="editPasswordVisible" width="30%" <el-dialog :close-on-click-modal="false" :title="$t('member.edit_password')" :visible.sync="editPasswordVisible"
width="30%"
:destroy-on-close="true" @close="handleClose" left> :destroy-on-close="true" @close="handleClose" left>
<el-form :model="ruleForm" label-position="right" label-width="120px" size="small" :rules="rule" <el-form :model="ruleForm" label-position="right" label-width="120px" size="small" :rules="rule"
ref="editPasswordForm" class="demo-ruleForm"> ref="editPasswordForm" class="demo-ruleForm">
@ -290,16 +299,17 @@
</template> </template>
<script> <script>
import MsCreateBox from "../CreateBox"; import MsCreateBox from "../CreateBox";
import MsTablePagination from "../../common/pagination/TablePagination"; import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader"; import MsTableHeader from "../../common/components/MsTableHeader";
import MsTableOperator from "../../common/components/MsTableOperator"; import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton"; import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {hasRole, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import MsRolesTag from "../../common/components/MsRolesTag"; import MsRolesTag from "../../common/components/MsRolesTag";
import {ROLE_ADMIN} from "@/common/js/constants";
export default { export default {
name: "MsUser", name: "MsUser",
components: { components: {
MsCreateBox, MsCreateBox,
@ -482,6 +492,9 @@
}) })
}, },
search() { search() {
if (!hasRole(ROLE_ADMIN)) {
return;
}
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => { this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
@ -580,7 +593,7 @@
}) })
} }
} }
} }
</script> </script>
<style scoped> <style scoped>