|
@@ -6,18 +6,35 @@
|
|
|
<div class="userManagement_list_headerSelect">
|
|
|
<el-form slot="form" style="display: inline" inline :addList="true">
|
|
|
<el-form-item class="header_top_form" label="账号:">
|
|
|
- <el-input placeholder="请输入" size="small"></el-input>
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入"
|
|
|
+ size="small"
|
|
|
+ v-model.trim="form.account"
|
|
|
+ clearable
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item class="header_top_form" label="姓名:">
|
|
|
- <el-input placeholder="请输入" size="small"></el-input>
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入"
|
|
|
+ size="small"
|
|
|
+ v-model.trim="form.name"
|
|
|
+ clearable
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button size="small" type="primary" style="width: 88px"
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ style="width: 88px"
|
|
|
+ @click="search"
|
|
|
>查询</el-button
|
|
|
>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <el-button size="small" style="width: 104px; margin-right: 23px"
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ style="width: 104px; margin-right: 23px"
|
|
|
+ @click="addList"
|
|
|
>新增</el-button
|
|
|
>
|
|
|
</div>
|
|
@@ -44,6 +61,7 @@
|
|
|
v-model="scope.row[scope.column.property]"
|
|
|
active-color="#17A8FF"
|
|
|
inactive-color="#AFAFAF"
|
|
|
+ @change="statusChange($event, scope.row)"
|
|
|
>
|
|
|
</el-switch>
|
|
|
</div>
|
|
@@ -57,7 +75,10 @@
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
|
|
|
- <el-button type="text" @click="resetPasswords(scope.row)" style="color:#F4453E"
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="resetPasswords(scope.row)"
|
|
|
+ style="color: #f4453e"
|
|
|
>重置密码</el-button
|
|
|
>
|
|
|
</div>
|
|
@@ -69,10 +90,10 @@
|
|
|
@current-change="handleCurrentChange"
|
|
|
:current-page="form.pageNum"
|
|
|
:page-sizes="[100, 200, 300, 400]"
|
|
|
- :page-size="10"
|
|
|
+ :page-size="form.pageSize"
|
|
|
background
|
|
|
layout="total,prev, pager, next,jumper"
|
|
|
- :total="100"
|
|
|
+ :total="form.total"
|
|
|
>
|
|
|
</el-pagination>
|
|
|
<editDialog ref="editDialogRefs" />
|
|
@@ -82,6 +103,7 @@
|
|
|
<script>
|
|
|
import editDialog from './edit'
|
|
|
import detailDialog from './detail'
|
|
|
+import * as api from '@/api/api'
|
|
|
export default {
|
|
|
name: 'userManagement',
|
|
|
components: {
|
|
@@ -93,43 +115,144 @@ export default {
|
|
|
fullscreenLoading: false,
|
|
|
tableData: [],
|
|
|
listData: [
|
|
|
- { name: '账号', value: '', width: '', minWidth: '', align: 'center' },
|
|
|
- { name: '姓名', value: '', width: '', minWidth: '', align: 'center' },
|
|
|
+ {
|
|
|
+ name: '账号',
|
|
|
+ value: 'account',
|
|
|
+ width: '',
|
|
|
+ minWidth: '',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '姓名',
|
|
|
+ value: 'name',
|
|
|
+ width: '',
|
|
|
+ minWidth: '',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
{
|
|
|
name: '禁用/启用',
|
|
|
- value: '',
|
|
|
+ value: 'status',
|
|
|
width: '',
|
|
|
minWidth: '',
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
name: '创建时间',
|
|
|
- value: '',
|
|
|
+ value: 'createTime',
|
|
|
width: '',
|
|
|
minWidth: '',
|
|
|
align: 'center'
|
|
|
}
|
|
|
],
|
|
|
form: {
|
|
|
- pageNum: 4
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ account: '',
|
|
|
+ name: '',
|
|
|
+ start: '',
|
|
|
+ total: 0
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.tableData = [{}]
|
|
|
- })
|
|
|
+ this.listDataInit()
|
|
|
},
|
|
|
methods: {
|
|
|
- handleSizeChange() {},
|
|
|
- handleCurrentChange() {},
|
|
|
+ /**
|
|
|
+ * @method 搜索
|
|
|
+ * **/
|
|
|
+ search() {
|
|
|
+ this.form.pageNum = 1
|
|
|
+ this.listDataInit()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @method 用户数据列表
|
|
|
+ * **/
|
|
|
+ listDataInit() {
|
|
|
+ this.fullscreenLoading = true
|
|
|
+ let code = {
|
|
|
+ account: this.form.account,
|
|
|
+ name: this.form.name,
|
|
|
+ page: this.form.pageNum,
|
|
|
+ pageSize: this.form.pageSize,
|
|
|
+ start: this.form.start
|
|
|
+ }
|
|
|
+ api
|
|
|
+ .POST('/user/list', code)
|
|
|
+ .then(res => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.tableData = res.data.list
|
|
|
+ this.tableData.forEach(item => {
|
|
|
+ item.status == 1 ? (item.status = true) : (item.status = false)
|
|
|
+ })
|
|
|
+ this.form.pageNum = res.data.currPage
|
|
|
+ this.form.pageSize = res.data.pageSize
|
|
|
+ this.form.total = res.data.totalCount
|
|
|
+ this.fullscreenLoading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.fullscreenLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @method 条数分页
|
|
|
+ * **/
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.form.pageSize = val
|
|
|
+ this.form.pageNum = 1
|
|
|
+ this.listDataInit()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @method 分页
|
|
|
+ * **/
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.form.pageNum = val
|
|
|
+ this.listDataInit()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @method 新增
|
|
|
+ * **/
|
|
|
+ addList() {
|
|
|
+ let code = {
|
|
|
+ title: '新增用户',
|
|
|
+ show: true
|
|
|
+ }
|
|
|
+ this.$refs.editDialogRefs.openClose(code)
|
|
|
+ },
|
|
|
// 编辑
|
|
|
- edit() {
|
|
|
- this.$refs.editDialogRefs.openClose()
|
|
|
+ edit(val) {
|
|
|
+ let code = {
|
|
|
+ title: '编辑用户',
|
|
|
+ show: false,
|
|
|
+ id: val.userId
|
|
|
+ }
|
|
|
+ this.$refs.editDialogRefs.openClose(code)
|
|
|
},
|
|
|
// 重置密码
|
|
|
- resetPasswords() {
|
|
|
- this.$refs.detailDialogRefs.openClose()
|
|
|
+ resetPasswords(val) {
|
|
|
+ let code = {
|
|
|
+ id: val.userId
|
|
|
+ }
|
|
|
+ this.$refs.detailDialogRefs.openClose(code)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @method 状态修改
|
|
|
+ * **/
|
|
|
+ statusChange(val, item) {
|
|
|
+ val ? (val = 1) : (val = 0)
|
|
|
+ let code = {
|
|
|
+ id: item.userId,
|
|
|
+ status: val
|
|
|
+ }
|
|
|
+ api.PUT('/user/updateSwitch', code).then(data => {
|
|
|
+ if (data.code == 0) {
|
|
|
+ this.search()
|
|
|
+ this.$message.success(data.message)
|
|
|
+ }
|
|
|
+ }).catch(()=>{
|
|
|
+ this.search()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|