|
@@ -0,0 +1,219 @@
|
|
|
+<template>
|
|
|
+ <div class="height_100">
|
|
|
+ <el-container>
|
|
|
+ <el-header>
|
|
|
+ <div class="header">
|
|
|
+ <el-form :inline="true">
|
|
|
+ <el-form-item label="姓名:" prop="name">
|
|
|
+ <el-input v-model="queryParams.name" placeholder="请输入"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="tenant">
|
|
|
+ <el-select v-model="queryParams.tenant" @change="getList" clearable placeholder="根据租户查询">
|
|
|
+ <el-option
|
|
|
+ v-for="item in tenantList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </el-header>
|
|
|
+ <el-main class="padding_10">
|
|
|
+ <el-table ref="table" border :data="tableData" row-key="id" style="width: 100%" height="calc(100% - 0px)" v-loading="loading">
|
|
|
+ <el-table-column type="index" label="#" width="55" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ (scope.$index + 1) + ((queryParams.current - 1) * queryParams.size) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="name" label="姓名" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="username" label="账号" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="vipTypeName" label="会员类型" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="email" label="邮箱" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="mobile" label="联系方式" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="tenantName" label="所属租户" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column label="是否启用" align="center" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-switch
|
|
|
+ v-model="scope.row.state"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949"
|
|
|
+ @change="handleSwitchChange(scope.row)"
|
|
|
+ ></el-switch>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <!-- <el-button size="mini" type="text" icon="el-icon-refresh-right" @click="handleReset(scope.row)">重置密码</el-button> -->
|
|
|
+ <!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">修改</el-button> -->
|
|
|
+ <el-button v-if="scope.row.id != 0" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-main>
|
|
|
+ <el-footer class="pagination">
|
|
|
+ <el-pagination background layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :current-page.sync="queryParams.current" :page-size.sync="queryParams.size"
|
|
|
+ @current-change="handleCurrentChange" @size-change="changeSize" :total="total">
|
|
|
+ </el-pagination>
|
|
|
+ </el-footer>
|
|
|
+ </el-container>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+const defaultSearchForm = {
|
|
|
+ name:'',
|
|
|
+ tenant:''
|
|
|
+}
|
|
|
+export default {
|
|
|
+ components: {},
|
|
|
+ props: {},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: false,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ tableData: [],
|
|
|
+ tenantList: [],
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ current: 1,
|
|
|
+ size: 10,
|
|
|
+ departmentIds:[],
|
|
|
+ positionIds:[],
|
|
|
+ ...defaultSearchForm
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
+ computed: {},
|
|
|
+ created() {},
|
|
|
+ mounted() {
|
|
|
+ this.getList();
|
|
|
+ this.getTenantList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询部门列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ this.$api.getPersonnelList(this.queryParams).then(response=>{
|
|
|
+ if(response.code == 200){
|
|
|
+ this.tableData = response.data
|
|
|
+ this.total = response.pageColumn.total
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ }).catch(error=>{
|
|
|
+ this.tableData = []
|
|
|
+ this.total = 0
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //切换分页
|
|
|
+ handleCurrentChange(val){
|
|
|
+ this.queryParams.current = val
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ //切换也大小
|
|
|
+ changeSize(val){
|
|
|
+ this.queryParams.current = 1
|
|
|
+ this.queryParams.size = val
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ //排序
|
|
|
+ sortChange({ column, prop, order }){
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.current = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.queryParams={
|
|
|
+ ...this.queryParams,
|
|
|
+ ...defaultSearchForm
|
|
|
+ }
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 切换开关时调用
|
|
|
+ handleSwitchChange(row) {
|
|
|
+ const params = {
|
|
|
+ id: row.id,
|
|
|
+ state: row.state
|
|
|
+ }
|
|
|
+ this.$api.updateState(params).then(response => {
|
|
|
+ if (row.state == 1) {
|
|
|
+ this.$message.success('启用成功')
|
|
|
+ } else {
|
|
|
+ this.$message.success('禁用成功')
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ if (row.state == 1) {
|
|
|
+ this.row.state = 0
|
|
|
+ this.$message.success('启用失败')
|
|
|
+ } else {
|
|
|
+ this.row.state = 1
|
|
|
+ this.$message.success('禁用失败')
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ handleDelete(row) {
|
|
|
+ this.$confirm('确认删除本条数据吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.loading = true
|
|
|
+ this.$api.deletePersonnel({ id: row.id }).then(response => {
|
|
|
+ this.$message.success('删除成功')
|
|
|
+ this.loading = false
|
|
|
+ this.delFinish()
|
|
|
+ }).catch(error => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ delFinish(){
|
|
|
+ if(this.tableData.length == 1){
|
|
|
+ this.queryParams.current -= 1
|
|
|
+ }
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ getTenantList() {
|
|
|
+ console.log(123456)
|
|
|
+ this.$api.getAllTenantList().then(response => {
|
|
|
+ this.tenantList = response.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.header{
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
+</style>
|