sompe update
This commit is contained in:
parent
3bf181ea4b
commit
0be314cdbf
|
@ -42,10 +42,10 @@
|
||||||
auto-complete="on"
|
auto-complete="on"
|
||||||
@keyup.enter.native="handleLogin"
|
@keyup.enter.native="handleLogin"
|
||||||
/>
|
/>
|
||||||
<span class="show-pwd" @click="sendMsg">
|
<span class="show-pwd" @click="sendMsg" style="color:white">
|
||||||
<el-button :disabled="disabled" plain type="primary">
|
|
||||||
<template>{{buttonmsg}}</template>
|
<template>{{buttonmsg}}</template>
|
||||||
</el-button>
|
|
||||||
<!-- <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" /> -->
|
<!-- <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" /> -->
|
||||||
</span>
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -139,7 +139,7 @@ export default {
|
||||||
timer:null,
|
timer:null,
|
||||||
disabled:false,
|
disabled:false,
|
||||||
buttonmsg:'发送验证码',
|
buttonmsg:'发送验证码',
|
||||||
count:20,
|
count:60,
|
||||||
activeName: "msg",
|
activeName: "msg",
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: "",
|
username: "",
|
||||||
|
@ -196,7 +196,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
sendMsg(){
|
sendMsg(){
|
||||||
if(this.loginForm2.mail.length){
|
if(this.loginForm2.mail.length&&this.buttonmsg=='发送验证码'){
|
||||||
this.getTimer()
|
this.getTimer()
|
||||||
sendMsg({'mail':this.loginForm2.mail}).then(res=>{
|
sendMsg({'mail':this.loginForm2.mail}).then(res=>{
|
||||||
this.$message.success('验证码已发送至该邮箱,请注意查收')
|
this.$message.success('验证码已发送至该邮箱,请注意查收')
|
||||||
|
@ -206,14 +206,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getTimer(){
|
getTimer(){
|
||||||
const TIME_COUNT = 20;
|
const TIME_COUNT = 60;
|
||||||
if (!this.timer) {
|
if (!this.timer) {
|
||||||
this.count = TIME_COUNT;
|
this.count = TIME_COUNT;
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
if (this.count > 0 && this.count <= TIME_COUNT) {
|
if (this.count > 0 && this.count <= TIME_COUNT) {
|
||||||
this.count--;
|
this.count--;
|
||||||
this.buttonmsg = this.count
|
this.buttonmsg = this.count + '秒'
|
||||||
} else {
|
} else {
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
clearInterval(this.timer);
|
clearInterval(this.timer);
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="6">
|
||||||
|
|
||||||
<el-col :md="6">
|
<el-col :xs="24" :md="6">
|
||||||
|
<el-card>
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>部门</span>
|
||||||
|
</div>
|
||||||
<el-input v-model="filterOrgText" placeholder="输入部门名进行过滤" />
|
<el-input v-model="filterOrgText" placeholder="输入部门名进行过滤" />
|
||||||
|
|
||||||
<el-tree
|
<el-tree
|
||||||
ref="tree"
|
ref="tree"
|
||||||
v-loading="treeLoding"
|
v-loading="treeLoding"
|
||||||
|
@ -17,8 +20,13 @@
|
||||||
style="margin-top:10px;"
|
style="margin-top:10px;"
|
||||||
@node-click="handleOrgClick"
|
@node-click="handleOrgClick"
|
||||||
/>
|
/>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="18">
|
<el-col :xs="24" :md="18">
|
||||||
|
<el-card>
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>用户</span>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="listQuery.is_active"
|
v-model="listQuery.is_active"
|
||||||
|
@ -82,6 +90,13 @@
|
||||||
slot-scope="scope"
|
slot-scope="scope"
|
||||||
>{{ scope.row.dept_name }}</template>
|
>{{ scope.row.dept_name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column align="header-center" label="角色" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag style="margin:2px" effect="plain" v-for="(item, index) in scope.row.roles_" :key="index">
|
||||||
|
{{item.name}}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="创建日期">
|
<el-table-column label="创建日期">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.date_joined }}</span>
|
<span>{{ scope.row.date_joined }}</span>
|
||||||
|
@ -116,6 +131,7 @@
|
||||||
:limit.sync="listQuery.page_size"
|
:limit.sync="listQuery.page_size"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
@ -226,7 +242,8 @@ export default {
|
||||||
dialogType: "new",
|
dialogType: "new",
|
||||||
rule1: {
|
rule1: {
|
||||||
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
||||||
username: [{ required: true, message: "请输入账号", trigger: "change" }]
|
username: [{ required: true, message: "请输入账号", trigger: "change" }],
|
||||||
|
roles: [{ required: true, message: "请选择角色", trigger: "change" }]
|
||||||
// password: [
|
// password: [
|
||||||
// { required: true, message: '请输入密码', trigger: 'change' }
|
// { required: true, message: '请输入密码', trigger: 'change' }
|
||||||
// ],
|
// ],
|
||||||
|
|
|
@ -45,6 +45,13 @@ class RoleSerializer(serializers.ModelSerializer):
|
||||||
model = Role
|
model = Role
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
|
class RoleListSerializer(serializers.ModelSerializer):
|
||||||
|
"""
|
||||||
|
角色序列化
|
||||||
|
"""
|
||||||
|
class Meta:
|
||||||
|
model = Role
|
||||||
|
fields = ['id','name']
|
||||||
|
|
||||||
class PermissionSerializer(serializers.ModelSerializer):
|
class PermissionSerializer(serializers.ModelSerializer):
|
||||||
"""
|
"""
|
||||||
|
@ -72,11 +79,11 @@ class UserListSerializer(serializers.ModelSerializer):
|
||||||
用户列表序列化
|
用户列表序列化
|
||||||
"""
|
"""
|
||||||
dept_name = serializers.StringRelatedField(source='dept')
|
dept_name = serializers.StringRelatedField(source='dept')
|
||||||
|
roles_ = RoleListSerializer(source='roles', many=True, read_only=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ('id', 'name', 'phone', 'email', 'position',
|
fields = ('id', 'name', 'phone', 'email', 'position',
|
||||||
'username', 'is_active', 'date_joined', 'dept_name', 'dept', 'roles', 'avatar')
|
'username', 'is_active', 'date_joined', 'dept_name', 'dept', 'roles', 'avatar','roles_')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def setup_eager_loading(queryset):
|
def setup_eager_loading(queryset):
|
||||||
|
|
Loading…
Reference in New Issue