<template>
|
<div class="user">
|
<el-drawer :title="title" :visible.sync="drawerVisible" @close="drawerClose(false)" :direction="direction" :destroy-on-close="true" size="1000px" custom-class="drawer-box">
|
<div class="d-s-c">
|
<div class="common-seach-wrap flex-1">
|
<el-form size="small" :inline="true" :model="formInline" class="demo-form-inline">
|
<el-form-item label="成员搜索:">
|
<el-input placeholder="请输入内容" v-model="formInline.keywords" class="input-with-select selWidth" clearable @keyup.enter.native="changeSearch(1)">
|
<el-select v-model="formInline.search_type" slot="prepend" clearable placeholder="请选择">
|
<el-option label="用户ID" value="user_id">用户ID</el-option>
|
<el-option label="用户昵称" value="nickName">用户昵称</el-option>
|
<el-option label="手机号" value="mobile">手机号</el-option>
|
<el-option label="真实姓名" value="real_name">真实姓名</el-option>
|
</el-select>
|
</el-input>
|
</el-form-item>
|
<el-form-item><el-button type="primary" @click="onSubmit">查询</el-button></el-form-item>
|
</el-form>
|
</div>
|
<!--添加成员-->
|
<div class="common-level-rail add-box">
|
<el-button size="small" type="primary" @click="addClick" icon="el-icon-plus">添加成员</el-button>
|
</div>
|
</div>
|
|
<!--内容-->
|
<div class="product-content">
|
<div class="table-wrap">
|
<el-table size="small" :data="tableData" border style="width: 100%" v-loading="loading">
|
<el-table-column prop="user_id" label="用户ID" width="70"></el-table-column>
|
<el-table-column prop="nickName" label="头像" width="70">
|
<template slot-scope="scope">
|
<img class="radius" v-img-url="scope.row.avatarUrl" width="30" height="30" />
|
</template>
|
</el-table-column>
|
<el-table-column prop="nickName" label="昵称"></el-table-column>
|
<el-table-column prop="real_name" label="姓名"></el-table-column>
|
<el-table-column prop="mobile" label="手机号"></el-table-column>
|
<el-table-column prop="money" label="成员身份">
|
<template slot-scope="scope">
|
<span class="orange">{{ scope.row.position_name }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="create_time" label="入会时间" width="140"></el-table-column>
|
<el-table-column fixed="right" label="操作" width="120">
|
<template slot-scope="scope">
|
<div>
|
<!-- <el-button @click="EditClick(scope.row)" type="text" size="small" v-auth="'/branch/branch/member'">修改</el-button> -->
|
<el-button @click="delClick(scope.row)" type="text" size="small" v-auth="'/branch/branch/member'">删除</el-button>
|
</div>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
|
<!--分页-->
|
<div class="pagination">
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
background
|
:current-page="curPage"
|
:page-size="pageSize"
|
layout="total, prev, pager, next, jumper"
|
:total="totalDataNumber"
|
></el-pagination>
|
</div>
|
</div>
|
</el-drawer>
|
<!--添加-->
|
<Add v-if="open_add" :open_add="open_add" :positionList="positionList" @close="closeDialogFunc($event, 'add')"></Add>
|
<!--编辑-->
|
<!-- <Edit :open_edit="open_edit" :userModel="userModel" @close="closeDialogFunc($event, 'edit')"></Edit> -->
|
|
</div>
|
</template>
|
|
<script>
|
import { deepClone } from '@/utils/base.js'
|
import BranchApi from '@/api/branch.js';
|
// import Edit from './dialog/editMember.vue';
|
import Add from './dialog/addMember.vue';
|
export default {
|
components: {
|
// Edit,
|
Add
|
},
|
data() {
|
return {
|
/*是否加载完成*/
|
loading: true,
|
/*列表数据*/
|
tableData: [],
|
/*一页多少条*/
|
pageSize: 20,
|
/*一共多少条数据*/
|
totalDataNumber: 0,
|
/*当前是第几页*/
|
curPage: 1,
|
/*搜索对象*/
|
formInline: {
|
keywords: '',
|
search_type: 'user_id'
|
},
|
/*是否打开弹窗*/
|
open_dialog: false,
|
/*基础设置当前用户的信息*/
|
basicSetting: [],
|
/*选中的用户*/
|
userModel:{},
|
/*是否打开修改*/
|
open_edit:false,
|
open_add: false,
|
drawerVisible: false, // 抽屉状态
|
direction: 'rtl', // 抽屉呼出方向
|
branch_id: 0,
|
title: '成员管理',
|
positionList: [], // 职务列表
|
};
|
},
|
props: ['open'],
|
watch:{
|
open:function(n, o){
|
this.drawerVisible = this.open;
|
}
|
},
|
methods: {
|
/*选择第几页*/
|
handleCurrentChange(val) {
|
let self = this;
|
self.curPage = val;
|
self.loading = true;
|
self.getData();
|
},
|
|
/*获取数据*/
|
getData() {
|
let self = this;
|
let Params = {
|
branch_id: self.branch_id,
|
keywords: self.formInline.keywords,
|
search_type: self.formInline.search_type
|
};
|
Params.page = self.curPage;
|
Params.list_rows = self.pageSize;
|
BranchApi.memberList(Params, true)
|
.then(res => {
|
self.loading = false;
|
self.tableData = res.data.list.data;
|
self.totalDataNumber = res.data.list.total;
|
self.basicSetting = res.data.basicSetting;
|
})
|
.catch(error => {
|
self.loading = false;
|
});
|
},
|
|
// 获取职务列表
|
getPosition() {
|
let self = this;
|
BranchApi.positionList({}, true)
|
.then(res => {
|
self.positionList = res.data.list;
|
})
|
.catch(error => {
|
});
|
},
|
|
//搜索
|
onSubmit() {
|
this.curPage = 1;
|
this.getData();
|
},
|
|
/*每页多少条*/
|
handleSizeChange(val) {
|
this.curPage = 1;
|
this.pageSize = val;
|
this.getData();
|
},
|
|
/*删除成员*/
|
delClick(row) {
|
let self = this;
|
self
|
.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
self.loading = true;
|
BranchApi.deleteMember(
|
{
|
user_id: row.user_id
|
},
|
true
|
)
|
.then(data => {
|
self.loading = false;
|
self.$message({
|
message: data.msg,
|
type: 'success'
|
});
|
self.getData();
|
})
|
.catch(error => {
|
self.loading = false;
|
});
|
})
|
.catch(() => {
|
self.loading = false;
|
});
|
},
|
|
/*打开添加*/
|
addClick() {
|
this.open_add = true;
|
},
|
|
/*打开编辑用户弹窗*/
|
EditClick(e){
|
this.userModel = deepClone(e);
|
this.open_edit = true;
|
},
|
|
/*关闭用户弹窗*/
|
closeDialogFunc(e, f) {
|
if (f == 'add') {
|
this.open_add = false;
|
if (e.type == 'success'){
|
this.getData();
|
}
|
}
|
if (f == 'edit') {
|
this.open_edit = false;
|
if(e.type == 'success'){
|
this.getData();
|
}
|
}
|
},
|
|
/*关闭抽屉*/
|
drawerClose(e) {
|
this.$emit('closeDrawer', e);
|
},
|
|
}
|
};
|
</script>
|
|
<style scoped="scoped">
|
.el-button{margin-left: 0; margin-right: 10px;}
|
.add-box .el-button { margin-right: 0; }
|
.input-with-select /deep/ .el-input-group__prepend .el-input__inner {
|
width: 100px;
|
}
|
</style>
|