|
@@ -7,21 +7,27 @@
|
|
|
<div class="info-top">
|
|
|
<div class="info-left">
|
|
|
<span>按用户状态查看:</span>
|
|
|
- <el-select style="width:90px;" v-model="region" placeholder="请选择">
|
|
|
+ <el-select
|
|
|
+ style="width: 90px"
|
|
|
+ v-model="region"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
<el-option label="全部" value=""></el-option>
|
|
|
<el-option label="启用" :value="0"></el-option>
|
|
|
<el-option label="停用" :value="1"></el-option>
|
|
|
</el-select>
|
|
|
<el-input
|
|
|
- style="width:220px;margin:0 20px;"
|
|
|
+ style="width: 220px; margin: 0 20px"
|
|
|
v-model="inputKey"
|
|
|
placeholder="请输入关键字搜索"
|
|
|
></el-input>
|
|
|
<el-button type="primary" @click="getInformation">查找</el-button>
|
|
|
- <el-button @click="inputKey=''">重置</el-button>
|
|
|
+ <el-button @click="inputKey = ''">重置</el-button>
|
|
|
</div>
|
|
|
<div class="info-right">
|
|
|
- <el-button type="primary" @click="show('','add')">新增用户</el-button>
|
|
|
+ <el-button type="primary" @click="show('', 'add')"
|
|
|
+ >新增用户</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-table :data="tableData" style="width: 100%">
|
|
@@ -33,49 +39,90 @@
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<img
|
|
|
- style="width:80px;height:80px;border-radius:50%;"
|
|
|
+ style="width: 80px; height: 80px; border-radius: 50%"
|
|
|
v-if="item.prop === 'head'"
|
|
|
:src="scope.row[item.prop]"
|
|
|
alt
|
|
|
/>
|
|
|
- <span v-else>{{scope.row[item.prop]}}</span>
|
|
|
+ <span v-else>{{ scope.row[item.prop] }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span class="o-span" @click="show(scope.row,'edit')">修改</span>
|
|
|
- <span class="o-span" @click="changeState(scope.row)">{{scope.row.qiyong==='启用'?'停用':'启用'}}</span>
|
|
|
+ <template
|
|
|
+ slot-scope="scope"
|
|
|
+ v-if="scope.row.roleName !== '超级管理员'"
|
|
|
+ >
|
|
|
+ <span class="o-span" @click="show(scope.row, 'edit')">修改</span>
|
|
|
+ <span class="o-span" @click="changeState(scope.row)">{{
|
|
|
+ scope.row.qiyong === "启用" ? "停用" : "启用"
|
|
|
+ }}</span>
|
|
|
<span class="o-span" @click="del(scope.row)">注销</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <div class="e-pagination">
|
|
|
- <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="size" layout="prev, pager, next, jumper" :total="total">
|
|
|
- </el-pagination>
|
|
|
- </div>
|
|
|
+ <div class="e-pagination">
|
|
|
+ <el-pagination
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page.sync="currentPage"
|
|
|
+ :page-size="size"
|
|
|
+ layout="prev, pager, next, jumper"
|
|
|
+ :total="total"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-dialog :title="editTitle" :visible.sync="dialogFormVisible" width="40%">
|
|
|
<div class="add-con">
|
|
|
<div class="add-left">
|
|
|
<el-form :model="form" :rules="rules" ref="form">
|
|
|
- <el-form-item required prop="userName" label="用户账号:" :label-width="formLabelWidth">
|
|
|
- <el-input :disabled="type==='edit'" v-model="form.userName" autocomplete="off"></el-input>
|
|
|
+ <el-form-item
|
|
|
+ required
|
|
|
+ prop="userName"
|
|
|
+ label="用户账号:"
|
|
|
+ :label-width="formLabelWidth"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ :disabled="type === 'edit'"
|
|
|
+ v-model="form.userName"
|
|
|
+ autocomplete="off"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item required label="用户角色:" :label-width="formLabelWidth">
|
|
|
+ <el-form-item
|
|
|
+ required
|
|
|
+ label="用户角色:"
|
|
|
+ :label-width="formLabelWidth"
|
|
|
+ >
|
|
|
<el-select v-model="form.roleId" placeholder="请选择角色">
|
|
|
- <el-option v-for="item in roleList" :label="item.roleName" :key="item.id" :value="item.id"></el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="item in roleList"
|
|
|
+ :label="item.roleName"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item required label="手机号码:" :label-width="formLabelWidth" prop="phone">
|
|
|
+ <el-form-item
|
|
|
+ required
|
|
|
+ label="手机号码:"
|
|
|
+ :label-width="formLabelWidth"
|
|
|
+ prop="phone"
|
|
|
+ >
|
|
|
<el-input v-model="form.phone" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="是否启用:" :label-width="formLabelWidth">
|
|
|
- <el-radio-group v-model="form.state">
|
|
|
+ <el-radio-group v-model="form.state">
|
|
|
<el-radio :label="0">是</el-radio>
|
|
|
<el-radio :label="1">否</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
+ <div
|
|
|
+ class="passTxt"
|
|
|
+ v-show="type === 'add'"
|
|
|
+ style="color: #f56c6c; padding: 0 0 0 40px"
|
|
|
+ >
|
|
|
+ 初始密码:123456
|
|
|
+ </div>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<!-- <div class="add-right">
|
|
@@ -232,32 +279,33 @@ export default {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.$http.post('/user/resetPassword', data).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$alert('重置成功', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- callback: action => {
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$notify.error({
|
|
|
- title: '错误',
|
|
|
- message: res.msg,
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- }
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$http.post('/user/resetPassword', data).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$alert('重置成功', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: (action) => {}
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '错误',
|
|
|
+ message: res.msg,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消'
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消'
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
},
|
|
|
goto (item) {
|
|
|
window.localStorage.setItem('editInfo', JSON.stringify(item))
|
|
|
- this.$router.push({name: 'edit-information', params: {type: 1}})
|
|
|
+ this.$router.push({ name: 'edit-information', params: { type: 1 } })
|
|
|
this.$bus.$emit('editinfo', item)
|
|
|
},
|
|
|
upload_success (data) {
|
|
@@ -279,58 +327,63 @@ export default {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.$http.post('/user/deleteUser', data).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$alert('注销成功', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- callback: action => {
|
|
|
- this.refresh()
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$notify.error({
|
|
|
- title: '错误',
|
|
|
- message: res.msg,
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- }
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$http.post('/user/deleteUser', data).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$alert('注销成功', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: (action) => {
|
|
|
+ this.refresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '错误',
|
|
|
+ message: res.msg,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消'
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消'
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
},
|
|
|
save () {
|
|
|
- this.$refs['form'].validate().then(res => {
|
|
|
- let {userName, roleId, phone, head, state} = this.form
|
|
|
- let data = {userName, roleId, phone, head, state}
|
|
|
+ this.$refs['form'].validate().then((res) => {
|
|
|
+ let { userName, roleId, phone, head, state } = this.form
|
|
|
+ let data = { userName, roleId, phone, head, state }
|
|
|
|
|
|
- this.$http.post(urlType[this.type], data).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$alert('操作成功', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- callback: action => {
|
|
|
- this.dialogFormVisible = false
|
|
|
- this.refresh()
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
+ this.$http
|
|
|
+ .post(urlType[this.type], data)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$alert('操作成功', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: (action) => {
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.refresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '错误',
|
|
|
+ message: res.message,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
this.$notify.error({
|
|
|
title: '错误',
|
|
|
- message: res.message,
|
|
|
+ message: '添加失败',
|
|
|
duration: 2000
|
|
|
})
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- this.$notify.error({
|
|
|
- title: '错误',
|
|
|
- message: '添加失败',
|
|
|
- duration: 2000
|
|
|
})
|
|
|
- })
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -362,29 +415,31 @@ export default {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.$http.post('/user/updateState', data).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$alert('修改成功', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- callback: action => {
|
|
|
- this.refresh()
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$notify.error({
|
|
|
- title: '错误',
|
|
|
- message: res.msg,
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- }
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$http.post('/user/updateState', data).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$alert('修改成功', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: (action) => {
|
|
|
+ this.refresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '错误',
|
|
|
+ message: res.msg,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消'
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消'
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
},
|
|
|
|
|
|
async getInformation () {
|
|
@@ -407,7 +462,10 @@ export default {
|
|
|
this.tableData = result.data.list
|
|
|
this.total = result.data.total
|
|
|
this.tableData.forEach((item, i) => {
|
|
|
- item['date'] = this.$base.timestampToTime(item['startTime']) + '至' + this.$base.timestampToTime(item['endTime'])
|
|
|
+ item['date'] =
|
|
|
+ this.$base.timestampToTime(item['startTime']) +
|
|
|
+ '至' +
|
|
|
+ this.$base.timestampToTime(item['endTime'])
|
|
|
item['role'] = juese[item['roleId']]
|
|
|
item['qiyong'] = zt[item['state']]
|
|
|
item['idx'] = i + 1 + (this.currentPage - 1) * this.size
|
|
@@ -422,7 +480,7 @@ export default {
|
|
|
},
|
|
|
url: '/user/roleList'
|
|
|
})
|
|
|
- this.roleList = res.data.filter(item => item.roleName !== '超级管理员')
|
|
|
+ this.roleList = res.data.filter((item) => item.roleName !== '超级管理员')
|
|
|
},
|
|
|
handleSearchBtnClick () {
|
|
|
this.params.pageNum = 1
|
|
@@ -438,26 +496,26 @@ export default {
|
|
|
</style>
|
|
|
<style>
|
|
|
.avatar-uploader .el-upload {
|
|
|
- border: 1px dashed #d9d9d9;
|
|
|
- border-radius: 6px;
|
|
|
- cursor: pointer;
|
|
|
- position: relative;
|
|
|
- overflow: hidden;
|
|
|
- }
|
|
|
- .avatar-uploader .el-upload:hover {
|
|
|
- border-color: #409EFF;
|
|
|
- }
|
|
|
- .avatar-uploader-icon {
|
|
|
- font-size: 28px;
|
|
|
- color: #8c939d;
|
|
|
- width: 178px;
|
|
|
- height: 178px;
|
|
|
- line-height: 178px;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- .avatar {
|
|
|
- width: 178px;
|
|
|
- height: 178px;
|
|
|
- display: block;
|
|
|
- }
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+.avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409eff;
|
|
|
+}
|
|
|
+.avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ line-height: 178px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.avatar {
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ display: block;
|
|
|
+}
|
|
|
</style>
|