<template>
|
<div style="height: 100%">
|
<el-card style="height: 100%">
|
<template slot="header">
|
<el-form :inline="true" :model="queryInfo" class="demo-form-inline">
|
<el-form-item label="姓名:">
|
<el-input placeholder="请输入" v-model="queryInfo.realName"></el-input>
|
</el-form-item>
|
<el-form-item label="手机号:">
|
<el-input placeholder="请输入" v-model="queryInfo.userMobile"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click="search">查询</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click="addPublicityVisibel = true">添加</el-button>
|
</el-form-item>
|
</el-form>
|
</template>
|
<template>
|
<el-table :data="publicityList" style="width: 100%">
|
<el-table-column prop="realName" label="姓名" width="180" align="center">
|
</el-table-column>
|
<el-table-column prop="userMobile" label="手机号" width="180" header-align="center" align="center">
|
</el-table-column>
|
<el-table-column prop="ctime" label="创建时间" width="180" header-align="center" align="center">
|
</el-table-column>
|
<el-table-column label="操作" align="conter">
|
<template slot-scope="scope">
|
<el-button type="text" size="medium" @click="details(scope.row)">修改密码</el-button>
|
<!-- <el-button type="text" size="medium" @click="reset(scope.row)">修改密码</el-button> -->
|
<el-button type="text" size="medium" @click="remove(scope.row.id)" style="color:#ff0000">删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</template>
|
<el-pagination @current-change="handleCurrentChange" :current-page="queryInfo.current" :page-size="queryInfo.size"
|
layout="prev, pager, next" :total="total"></el-pagination>
|
</el-card>
|
|
<!--添加用户弹窗-->
|
<el-dialog title="警员添加" :visible.sync="addPublicityVisibel" width="50%" :before-close="addPublicityClose"
|
:append-to-body="true">
|
<el-row :gutter="15">
|
<el-form ref="addPublicityForm" :model="addPublicityForm" :rules="rules" size="medium" label-width="100px">
|
|
<el-col :span="12">
|
<el-form-item label="姓名" prop="realName">
|
<el-input v-model="addPublicityForm.realName" clearable placeholder="姓名"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="手机号" prop="phoneNumber">
|
<el-input v-model="addPublicityForm.phoneNumber" clearable placeholder="请输入手机号"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="密码" prop="password">
|
<el-input v-model="addPublicityForm.password" clearable show-password :style="{width: '100%'}" placeholder="请输入密码"></el-input>
|
</el-form-item>
|
</el-col>
|
<!-- <el-col :span="12">
|
<el-form-item label="身份证" prop="userIdcard">
|
<el-input v-model="addPublicityForm.userIdcard" clearable placeholder="请输入身份证"> </el-input>
|
</el-form-item>
|
</el-col> -->
|
</el-form>
|
</el-row>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="addPublicityVisibel = false">取 消</el-button>
|
<el-button type="primary" @click="add">确 定</el-button>
|
</span>
|
</el-dialog>
|
|
<el-dialog title="编辑" :visible.sync="detailsVisible" width="50%" :append-to-body="true"
|
:before-close="detailsVisibleclose">
|
<el-row :gutter="15">
|
<el-form ref="detailsRow" :model="detailsRow" :rule="ruless" size="medium"
|
label-width="100px">
|
<el-col :span="12">
|
<el-form-item label="姓名" prop="realName">
|
<el-input v-model="detailsRow.realName"
|
:style="{ width: '100%' }">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="手机号" prop="phoneNumber">
|
<el-input v-model="detailsRow.userMobile"
|
:style="{ width: '100%' }">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="密码" prop="password" >
|
<el-input v-model="detailsRow.password" show-password placeholder="请输入新密码" clearable
|
:style="{ width: '100%' }">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
|
</el-form>
|
</el-row>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="detailsVisible = false">取 消</el-button>
|
<el-button type="primary" @click="update">确 定</el-button>
|
</span>
|
</el-dialog>
|
|
</div>
|
</template>
|
|
<script>
|
import {
|
getPublicityList,
|
addPublicityList
|
} from '@/api/Police'
|
|
|
export default {
|
name: "Police",
|
data() {
|
return {
|
|
rules: {
|
realName: [{
|
required: true,
|
message: '请输入姓名 ',
|
trigger: 'blur'
|
}],
|
phoneNumber: [{
|
required: true,
|
message: '请输入手机号 ',
|
trigger: 'blur'
|
}],
|
password: [{
|
required: true,
|
message: '请输入密码 ',
|
trigger: 'blur'
|
}]
|
},
|
ruless:{
|
password: [{
|
required: true,
|
message: '请输入密码 ',
|
trigger: 'blur'
|
}]
|
},
|
//详细内容弹框
|
detailsVisible: false,
|
//详细内容
|
detailsRow:
|
{
|
}
|
,
|
//表单提交内容
|
addPublicityForm: {
|
nickName: '',
|
realName: ''
|
},
|
//添加弹框
|
addPublicityVisibel: false,
|
//序号当前页
|
current: 1,
|
//序号数目
|
size: 10,
|
//页面查询总数
|
total: null,
|
//查询条件
|
queryInfo: {
|
nickName: '',
|
current: 1,
|
size: 10
|
},
|
options: [
|
{
|
value: null,
|
label: '全部'
|
},
|
{
|
value: '0',
|
label: '未发布'
|
},
|
{
|
value: '1',
|
label: '已发布'
|
}
|
, {
|
value: '2',
|
label: '下架 '
|
}
|
],
|
publicityList: []
|
,
|
}
|
},
|
created() {
|
this.init();
|
|
},
|
methods:
|
{
|
//删除
|
remove(val) {
|
this.$http.delete('/api/user/manager', { params: { id: val } }).then(res => {
|
console.log(res)
|
if (res.data.code==200){
|
this.$message({
|
message: '删除成功',
|
type: 'success'
|
})
|
}else {
|
this.$message({
|
message: res.data.msg,
|
type: 'error'
|
})
|
}
|
this.search();
|
})
|
},
|
// //发布/下架
|
// punlish(val, val2) {
|
// if (val2 == 0) {
|
// this.$http.get('/api/commonQuestion/release/' + val).then(res => {
|
// this.$message({
|
// message: '发布成功',
|
// type: 'success'
|
// })
|
|
// this.search();
|
// }
|
// )
|
// }
|
// if (val2 == 1) {
|
// this.$http.get('/api/commonQuestion/offline/' + val).then(res => {
|
// this.$message({
|
// message: '下架成功',
|
// type: 'success'
|
// })
|
// this.search();
|
// }
|
// );
|
// }
|
// },
|
|
//编辑
|
details(val) {
|
this.detailsVisible = true;
|
this.detailsRow = Object.assign({}, val);
|
},
|
// 更新
|
update(){
|
this.detailsRow.phoneNumber=this.detailsRow.userMobile
|
this.$http.put('/api/user/manager',this.detailsRow).then(res => {this.$message({
|
message: '编辑成功',
|
type: 'success'}
|
)
|
this.search();}
|
);
|
this.detailsVisible =false;
|
},
|
|
//重置密码
|
reset(val) {
|
this.$http.get('/api/user/resetPassword/' + val).then(res => this.$message({
|
message: '重置成功',
|
type: 'success'
|
}));
|
},
|
//添加
|
add() {
|
this.$refs.addPublicityForm.validate(async (vaild) => {
|
if (!vaild) return this.$message.error('输入有误')
|
let param = null;
|
param = this.addPublicityForm;
|
addPublicityList(param).then(res => {
|
this.$message({
|
message: '操作成功',
|
type: 'success'
|
});
|
this.addPublicityForm={};
|
this.init();
|
}
|
)
|
this.addPublicityVisibel = false;
|
})
|
},
|
//关闭之前
|
addPublicityClose() {
|
this.addPublicityVisibel = false;
|
},
|
detailsVisibleclose() {
|
this.detailsVisible = false;
|
},
|
//分页方法
|
handleCurrentChange(val) {
|
this.queryInfo.current = val;
|
this.search();
|
},
|
|
//公共宣传加载
|
init() {
|
let param = {}
|
param.current = this.queryInfo.current
|
param.size = this.queryInfo.size
|
getPublicityList(param).then(res => {
|
this.publicityList = res.records;
|
this.total = res.total
|
})
|
},
|
//查询
|
search() {
|
let param = {}
|
param.realName = this.queryInfo.realName
|
param.userMobile = this.queryInfo.userMobile
|
param.current = this.queryInfo.current
|
param.size = this.queryInfo.size
|
getPublicityList(param).then(res => {
|
this.publicityList = res.records;
|
this.total = res.total
|
this.current = res.current
|
})
|
},
|
|
}
|
}
|
</script>
|
|
<style scoped>
|
::v-deep(.el-table thead) {
|
color: #000000;
|
}
|
</style>
|