dev
parent
5023090b5d
commit
32681d8bf1
@ -0,0 +1,90 @@
|
||||
export const columns = [
|
||||
{
|
||||
title: "用户名",
|
||||
width: "8%",
|
||||
dataIndex: "userName",
|
||||
},
|
||||
{
|
||||
title: "姓名",
|
||||
width: "6%",
|
||||
dataIndex: "actualName",
|
||||
},
|
||||
{
|
||||
title: "密码",
|
||||
width: "10%",
|
||||
dataIndex: "password",
|
||||
},
|
||||
{
|
||||
title: "手机号",
|
||||
width: "10%",
|
||||
dataIndex: "tel",
|
||||
},
|
||||
{
|
||||
title: "性别",
|
||||
width: "6%",
|
||||
dataIndex: "sex",
|
||||
customRender: function(status) {
|
||||
switch(status) {
|
||||
case 1: return '男';
|
||||
case 2: return '女';
|
||||
case 3: return '保密';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "员工编号",
|
||||
width: "10%",
|
||||
dataIndex: "userCode",
|
||||
},
|
||||
{
|
||||
title: "是否启用",
|
||||
width: "6%",
|
||||
dataIndex: "status",
|
||||
scopedSlots: { customRender: "status" },
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
width: "10%",
|
||||
dataIndex: "createDate",
|
||||
customRender: function(createDate) {
|
||||
let date = new Date(createDate).toLocaleString();
|
||||
return date
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "最后登录ip",
|
||||
width: "12%",
|
||||
dataIndex: "lastLoginIp",
|
||||
},
|
||||
{
|
||||
title: "最后登录时间",
|
||||
width: "10%",
|
||||
dataIndex: "lastLoginDate",
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action",
|
||||
width: "180",
|
||||
fixed: "right",
|
||||
scopedSlots: { customRender: "action" },
|
||||
},
|
||||
]
|
||||
|
||||
export const pagination= {
|
||||
current: 1,
|
||||
total: 0,
|
||||
pageSize: 10,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
};
|
||||
|
||||
export const rules = {
|
||||
communityId: [{ required: true, message: "请选择小区", trigger: "change" }],
|
||||
userName: [{ required: true, message: "请输入用户名", trigger: "blur" }],
|
||||
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
||||
actualName: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
||||
tel: [{ required: true, message: "请输入手机号", trigger: "blur" }],
|
||||
sex: [{ required: true, message: "请选择性别", trigger: "change" }],
|
||||
}
|
@ -0,0 +1,251 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="cardTitle">管理员账号</div>
|
||||
<div class="search-box">
|
||||
<a-space size="large">
|
||||
<a-form-model layout="inline">
|
||||
<a-form-model-item label="真实姓名">
|
||||
<a-input v-model="form.actualName" placeholder="请输入真实姓名"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="用户名">
|
||||
<a-input v-model="form.userName" placeholder="请输入用户名"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="手机号">
|
||||
<a-input v-model="form.tel" placeholder="请输入手机号"></a-input>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
<a-button type="primary" @click="handlerSearch">查 询</a-button>
|
||||
<a-button @click="handlerReset">重 置</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<div id="commonTable">
|
||||
<div style="margin-bottom: 16px">
|
||||
<a-button icon="plus" @click="hanlderAdd" type="primary" ghost>
|
||||
新增管理员
|
||||
</a-button>
|
||||
</div>
|
||||
<a-table :columns="columns" :data-source="tableData" :scroll="{ x: 2200 }" :pagination="pagination" @change="pageChange" :row-key="(record) => {return record.id}">
|
||||
<template slot="status" slot-scope="text,record">
|
||||
<a-switch :checked="record.status==2 ? false : true" checked-children="启用" un-checked-children="停用" @change="onChange(record)" />
|
||||
</template>
|
||||
<template slot="action" slot-scope="text,record">
|
||||
<a @click="alipayEdit(record)">编辑</a>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
<a-drawer :title="activeMode == 1 ? '新增管理员':'编辑'" :visible="drawerVisible" @close="drawerClose" width="512">
|
||||
<div class="drawer-content">
|
||||
<a-form-model :rules="rules" :model="alipayForm">
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="绑定小区" prop="communityId">
|
||||
<a-select v-model="alipayForm.communityId" placeholder="请选择小区">
|
||||
<a-select-option v-for="(item) in comList" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="用户名" prop="userName">
|
||||
<a-input v-model="alipayForm.userName" placeholder="请输入用户名"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="密码" prop="password">
|
||||
<a-input v-model="alipayForm.password" placeholder="请输入密码"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="真实姓名" prop="actualName">
|
||||
<a-input v-model="alipayForm.actualName" placeholder="请输入姓名"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="手机号" prop="tel">
|
||||
<a-input v-model="alipayForm.tel" placeholder="请输入手机号"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="性别" prop="sex">
|
||||
<a-select v-model="alipayForm.sex" placeholder="请选择性别">
|
||||
<a-select-option :value="1">男</a-select-option>
|
||||
<a-select-option :value="2">女</a-select-option>
|
||||
<a-select-option :value="3">保密</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="生日">
|
||||
<a-date-picker v-model="selTime" @change="timeChange" value-format="YYYY-MM-DD HH:mm:ss"></a-date-picker>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="电子邮箱">
|
||||
<a-input v-model="alipayForm.email" placeholder="请输入邮箱"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="身份证号">
|
||||
<a-input v-model="alipayForm.idCard" placeholder="请输入身份证号"></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
</div>
|
||||
<div class="drawer-footer">
|
||||
<a-button @click="drawerClose">关闭</a-button>
|
||||
<a-button style="margin-left: 8px" v-if="activeMode == 1" @click="addComfirm" type="primary">确定</a-button>
|
||||
<a-button style="margin-left: 8px" v-else-if="activeMode == 2" @click="editConfirm" type="primary">确定</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getAllCommunityInfo} from "@/api/basic/console"
|
||||
import {getSuperUserList, addSuperUser, findSuperUser,updateSuperUser, enableSuperUser} from "@/api/manage"
|
||||
import {columns,pagination, rules} from "./config"
|
||||
export default {
|
||||
name: 'PaymentSet',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
actualName: '',
|
||||
userName: '',
|
||||
tel: ''
|
||||
},
|
||||
alipayForm: {
|
||||
communityId: undefined,
|
||||
userName: '',
|
||||
password: '',
|
||||
actualName: '',
|
||||
tel: '',
|
||||
sex: undefined,
|
||||
birthday: undefined,
|
||||
email: '',
|
||||
idCard: ''
|
||||
},
|
||||
selTime: '',
|
||||
boundForm: {
|
||||
alipaySettingId: undefined,
|
||||
communityIds: []
|
||||
},
|
||||
tableData: [],
|
||||
columns: columns,
|
||||
pagination: pagination,
|
||||
rules: rules,
|
||||
//新建 编辑抽屉
|
||||
activeMode: 1, //1新增 2编辑
|
||||
activeId: undefined,
|
||||
drawerVisible: false,
|
||||
//绑定小区抽屉
|
||||
comList: [],
|
||||
boundVisible: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getApi();
|
||||
this.getData()
|
||||
},
|
||||
methods: {
|
||||
getApi() {
|
||||
getAllCommunityInfo().then(res => {
|
||||
let data = res.data;
|
||||
this.comList = data;
|
||||
})
|
||||
},
|
||||
getData() {
|
||||
let obj = Object.assign(this.form, {pageNum:this.pagination.current,size:this.pagination.pageSize});
|
||||
getSuperUserList(obj).then(res => {
|
||||
let data = res.data.rows;
|
||||
this.pagination.total = res.data.total;
|
||||
this.tableData = data;
|
||||
})
|
||||
},
|
||||
handlerSearch() {
|
||||
this.getData()
|
||||
},
|
||||
handlerReset() {
|
||||
this.form= {
|
||||
actualName: '',
|
||||
userName: '',
|
||||
tel: ''
|
||||
},
|
||||
this.getData()
|
||||
},
|
||||
hanlderAdd() {
|
||||
this.activeMode = 1;
|
||||
this.drawerVisible = true;
|
||||
},
|
||||
//确认添加
|
||||
addComfirm() {
|
||||
addSuperUser(this.alipayForm).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success(res.msg);
|
||||
this.getData();
|
||||
this.drawerClose();
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
//点击编辑的回调
|
||||
alipayEdit(record) {
|
||||
this.activeMode = 2;
|
||||
findSuperUser({manageUserId: record.id}).then(res => {
|
||||
let data = res.data;
|
||||
this.activeId = data.id;
|
||||
this.alipayForm.communityId = data.communityId;
|
||||
this.alipayForm.userName = data.userName;
|
||||
this.alipayForm.password = data.password;
|
||||
this.alipayForm.actualName = data.actualName;
|
||||
this.alipayForm.tel = data.tel;
|
||||
this.alipayForm.sex = data.sex;
|
||||
this.alipayForm.birthday = data.birthday;
|
||||
this.alipayForm.email = data.email;
|
||||
this.alipayForm.idCard = data.idCard;
|
||||
this.selTime = new Date(data.birthday).toLocaleString()
|
||||
})
|
||||
this.drawerVisible = true;
|
||||
},
|
||||
//分页
|
||||
pageChange(val) {
|
||||
this.pagination.pageSize = val.pageSize;
|
||||
this.pagination.current = val.current;
|
||||
this.getData()
|
||||
},
|
||||
//改变状态
|
||||
onChange(record) {
|
||||
let obj = {manageUserId: record.id}
|
||||
enableSuperUser(obj).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success(res.msg);
|
||||
this.getData();
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
//抽屉
|
||||
drawerClose() {
|
||||
this.drawerVisible = false;
|
||||
this.alipayForm = {
|
||||
communityId: undefined,
|
||||
userName: '',
|
||||
password: '',
|
||||
actualName: '',
|
||||
tel: '',
|
||||
sex: undefined,
|
||||
birthday: '',
|
||||
email: '',
|
||||
idCard: ''
|
||||
}
|
||||
},
|
||||
boundClose() {this.boundVisible = false},
|
||||
//编辑确认
|
||||
editConfirm() {
|
||||
let obj = Object.assign(this.alipayForm, {id: this.activeId})
|
||||
updateSuperUser(obj).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success(res.msg);
|
||||
this.getData();
|
||||
this.drawerVisible = false;
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
//修改时间
|
||||
timeChange(val) {
|
||||
this.alipayForm.birthday = val
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue