|
|
|
@ -1,9 +1,9 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<div class="page"> |
|
|
|
|
<h6 class="l-title">用户列表</h6> |
|
|
|
|
<div class="page" style="margin-bottom: 20px"> |
|
|
|
|
<h6 class="l-title">筛选</h6> |
|
|
|
|
<div class="page-content"> |
|
|
|
|
<div class="tool"> |
|
|
|
|
<div class="tool" style="margin-bottom: 0"> |
|
|
|
|
<ul class="filter"> |
|
|
|
|
<li> |
|
|
|
|
<label>创建时间:</label> |
|
|
|
@ -33,8 +33,11 @@ |
|
|
|
|
</ul> |
|
|
|
|
<div></div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="tool"> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="page"> |
|
|
|
|
<div class="page-content"> |
|
|
|
|
<div class="tool" style="margin-bottom: 20px"> |
|
|
|
|
<ul class="filter"> |
|
|
|
|
<li style="margin-bottom: 0"> |
|
|
|
|
<label>搜索:</label> |
|
|
|
@ -47,93 +50,93 @@ |
|
|
|
|
<el-button type="primary" size="small" round @click="delAllSelection" v-auth>批量删除</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange"> |
|
|
|
|
<el-table-column type="selection" width="80" align="center"></el-table-column> |
|
|
|
|
<el-table-column type="index" label="序号" width="55" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="account" label="账号" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="userName" label="姓名" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="workNumber" label="工号/学号" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="权限状态" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{scope.row.isEnable ? '启用' : '禁用'}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="roleName" label="账号角色" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="loginNumber" label="登录次数" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{scope.row.loginNumber ? scope.row.loginNumber : 0}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="lastLoginTime" label="上次登录时间" width="160" align="center"></el-table-column> |
|
|
|
|
<el-table-column width="300" label="操作" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" @click="show(scope.row)" v-auth>查看</el-button> |
|
|
|
|
<el-button type="text" @click="edit(scope.row)" v-auth>编辑</el-button> |
|
|
|
|
<el-button type="text" @click="resetPassword(scope.row)" v-auth>重置密码</el-button> |
|
|
|
|
<el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button> |
|
|
|
|
<el-switch v-model="scope.row.isEnable" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px" :active-text="scope.row.isEnable ? '开' : '关'" @change="switchOff($event,scope.row,scope.$index)" v-auth="'/user/list:禁用'"></el-switch> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background layout="total,prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog :title="isDetail ? '查看账号' : (form.userId ? '编辑账号' : '新增账号')" :visible.sync="userVisible" width="576px" @close="closeUser" class="dialog" :close-on-click-modal="false"> |
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="110px" label-suffix=":" :disabled="isDetail"> |
|
|
|
|
<el-form-item prop="account" label="账号"> |
|
|
|
|
<el-input v-model="form.account" ref="account" placeholder="请输入账号" @change="accountChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="userName" label="用户姓名"> |
|
|
|
|
<el-input v-model="form.userName" placeholder="请输入姓名"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="roleIds" label="账号角色"> |
|
|
|
|
<div class="role-wrap"> |
|
|
|
|
<el-checkbox-group v-model="form.roleIds"> |
|
|
|
|
<template v-for="(item,index) in roleList"> |
|
|
|
|
<el-checkbox v-if="item.roleName != '超级管理员'" :key="index" :label="item.id" :title="item.roleName">{{item.roleName}}</el-checkbox> |
|
|
|
|
</template> |
|
|
|
|
</el-checkbox-group> |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="uniqueIdentification" label="唯一标识"> |
|
|
|
|
<el-input disabled v-model="form.uniqueIdentification" placeholder="唯一标识"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
|
<el-input v-model="form.email" placeholder="请输入邮箱" @change="emailChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="workNumber" label="工号/学号"> |
|
|
|
|
<el-input v-model="form.workNumber" placeholder="请输入工号/学号" @change="workNumberChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
|
<el-input v-model="form.phone" maxlength="11" @change="phoneChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
|
<el-button size="small" @click="userVisible = false">取 消</el-button> |
|
|
|
|
<el-button size="small" type="primary" @click="confirm">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange"> |
|
|
|
|
<el-table-column type="selection" width="80" align="center"></el-table-column> |
|
|
|
|
<el-table-column type="index" label="序号" width="55" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="account" label="账号" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="userName" label="姓名" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="workNumber" label="工号/学号" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="权限状态" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{scope.row.isEnable ? '启用' : '禁用'}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="roleName" label="账号角色" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="loginNumber" label="登录次数" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{scope.row.loginNumber ? scope.row.loginNumber : 0}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="lastLoginTime" label="上次登录时间" width="160" align="center"></el-table-column> |
|
|
|
|
<el-table-column width="300" label="操作" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" @click="show(scope.row)" v-auth>查看</el-button> |
|
|
|
|
<el-button type="text" @click="edit(scope.row)" v-auth>编辑</el-button> |
|
|
|
|
<el-button type="text" @click="resetPassword(scope.row)" v-auth>重置密码</el-button> |
|
|
|
|
<el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button> |
|
|
|
|
<el-switch v-model="scope.row.isEnable" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px" :active-text="scope.row.isEnable ? '开' : '关'" @change="switchOff($event,scope.row,scope.$index)" v-auth="'/user/list:禁用'"></el-switch> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background layout="total,prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog title="批量导入" :visible.sync="importVisible" width="400px" @close="closeImport" :close-on-click-modal="false"> |
|
|
|
|
<div class="upload-wrap" :class="{lg: uploadFaild}"> |
|
|
|
|
<el-button class="download" size="small" @click="downLoad"><img src="../../../assets/img/download.png" alt=""> 模板下载</el-button> |
|
|
|
|
<el-upload ref="import" accept=".xls,.xlsx" :headers="{token}" :on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" :limit="1" :on-exceed="handleExceed" :action="this.api.uploadFile" :file-list="uploadList" :data="{schoolId: this.schoolId}" name="file" :auto-upload="false"> |
|
|
|
|
<el-button size="small"><img src="../../../assets/img/upload.png" alt=""> 上传文件</el-button> |
|
|
|
|
</el-upload> |
|
|
|
|
<div class="link" v-if="uploadFaild"> |
|
|
|
|
<el-link type="primary" @click="showFaild">导入失败,查看原因</el-link> |
|
|
|
|
</div> |
|
|
|
|
<el-dialog :title="isDetail ? '查看账号' : (form.userId ? '编辑账号' : '新增账号')" :visible.sync="userVisible" width="576px" @close="closeUser" class="dialog" :close-on-click-modal="false"> |
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="110px" label-suffix=":" :disabled="isDetail"> |
|
|
|
|
<el-form-item prop="account" label="账号"> |
|
|
|
|
<el-input v-model="form.account" ref="account" placeholder="请输入账号" @change="accountChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="userName" label="用户姓名"> |
|
|
|
|
<el-input v-model="form.userName" placeholder="请输入姓名"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="roleIds" label="账号角色"> |
|
|
|
|
<div class="role-wrap"> |
|
|
|
|
<el-checkbox-group v-model="form.roleIds"> |
|
|
|
|
<template v-for="(item,index) in roleList"> |
|
|
|
|
<el-checkbox v-if="item.roleName != '超级管理员'" :key="index" :label="item.id" :title="item.roleName">{{item.roleName}}</el-checkbox> |
|
|
|
|
</template> |
|
|
|
|
</el-checkbox-group> |
|
|
|
|
</div> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button size="small" @click="importVisible = false">取 消</el-button> |
|
|
|
|
<el-button size="small" type="primary" @click="confirmImport">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="uniqueIdentification" label="唯一标识"> |
|
|
|
|
<el-input disabled v-model="form.uniqueIdentification" placeholder="唯一标识"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
|
<el-input v-model="form.email" placeholder="请输入邮箱" @change="emailChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="workNumber" label="工号/学号"> |
|
|
|
|
<el-input v-model="form.workNumber" placeholder="请输入工号/学号" @change="workNumberChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
|
<el-input v-model="form.phone" maxlength="11" @change="phoneChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
|
<el-button size="small" @click="userVisible = false">取 消</el-button> |
|
|
|
|
<el-button size="small" type="primary" @click="confirm">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="批量导入" :visible.sync="importVisible" width="400px" @close="closeImport" :close-on-click-modal="false"> |
|
|
|
|
<div class="upload-wrap" :class="{lg: uploadFaild}"> |
|
|
|
|
<el-button class="download" size="small" @click="downLoad"><img src="../../../assets/img/download.png" alt=""> 模板下载</el-button> |
|
|
|
|
<el-upload ref="import" accept=".xls,.xlsx" :headers="{token}" :on-remove="handleRemove" :on-error="uploadError" :on-success="uploadSuccess" :before-remove="beforeRemove" :limit="1" :on-exceed="handleExceed" :action="this.api.uploadFile" :file-list="uploadList" :data="{schoolId: this.schoolId}" name="file" :auto-upload="false"> |
|
|
|
|
<el-button size="small"><img src="../../../assets/img/upload.png" alt=""> 上传文件</el-button> |
|
|
|
|
</el-upload> |
|
|
|
|
<div class="link" v-if="uploadFaild"> |
|
|
|
|
<el-link type="primary" @click="showFaild">导入失败,查看原因</el-link> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button size="small" @click="importVisible = false">取 消</el-button> |
|
|
|
|
<el-button size="small" type="primary" @click="confirmImport">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
@ -250,7 +253,8 @@ export default { |
|
|
|
|
originalAccount: '', |
|
|
|
|
originalWorkNumber: '', |
|
|
|
|
originalPhone: '', |
|
|
|
|
originalEmail: '' |
|
|
|
|
originalEmail: '', |
|
|
|
|
submiting: false |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
@ -431,10 +435,12 @@ export default { |
|
|
|
|
confirm(){ |
|
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
if(this.accountRepeat) return util.errorMsg('该账号已存在!') |
|
|
|
|
if(this.workNumberRepeat) return util.errorMsg('该学号/工号已存在!') |
|
|
|
|
if(this.phoneRepeat) return util.errorMsg('该手机号已存在!') |
|
|
|
|
if(this.emailRepeat) return util.errorMsg('该邮箱已存在!') |
|
|
|
|
this.submiting = true |
|
|
|
|
let data = this.form |
|
|
|
|
// 如果是新增,则取当前用户的schoolId |
|
|
|
|
data.schoolId = data.schoolId ? data.schoolId : this.schoolId |
|
|
|
@ -447,13 +453,19 @@ export default { |
|
|
|
|
this.userVisible = false |
|
|
|
|
util.successMsg('编辑成功') |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
this.submiting = false |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.$post(this.api.saveUser,data).then(res => { |
|
|
|
|
this.userVisible = false |
|
|
|
|
util.successMsg('添加成功') |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
this.submiting = false |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -584,9 +596,6 @@ export default { |
|
|
|
|
.l-title{ |
|
|
|
|
margin-bottom: 24px; |
|
|
|
|
} |
|
|
|
|
.page .page-content .tool{ |
|
|
|
|
margin-bottom: 30px; |
|
|
|
|
} |
|
|
|
|
.filter{ |
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
li{ |
|
|
|
|