<template>
|
<!-- 面包屑导航区 -->
|
<div>
|
<el-breadcrumb separator-class="el-icon-arrow-right">
|
<el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
|
<el-breadcrumb-item>系统设置</el-breadcrumb-item>
|
<el-breadcrumb-item>人员管理</el-breadcrumb-item>
|
</el-breadcrumb>
|
<!-- 卡片视图区 -->
|
<el-card>
|
<!-- 搜索与添加 -->
|
|
<el-row>
|
<el-col :span="8">
|
|
<el-input v-model="input" placeholder="请输入内容" clearable>
|
<el-button slot="append" icon="el-icon-search"></el-button>
|
</el-input>
|
</el-col>
|
<el-col :span="4">
|
<el-button type="success" plain>添加人员</el-button>
|
</el-col>
|
</el-row>
|
<!-- 显示人员列表 -->
|
<el-table :data="userlist" border stripe>
|
<el-table-column label="ID" prop="id"></el-table-column>
|
<el-table-column label="登录账号" prop="UserName"></el-table-column>
|
<el-table-column label="名称" prop="Name"></el-table-column>
|
<el-table-column label="工号" prop="WorkNo"></el-table-column>
|
<el-table-column label="职位" prop="Position"></el-table-column>
|
<el-table-column label="电话" prop="Tel"></el-table-column>
|
<el-table-column label="状态" prop="Status">
|
<template slot-scope="scope">
|
<el-switch v-model="scope.row.Status" @change="userStatusChange(scope.row)">
|
</el-switch>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" width="200px">
|
<template slot-scope="scope">
|
<!-- 修改按钮 -->
|
<el-button type="primary" icon="el-icon-edit" size="mini"></el-button>
|
<!-- 删除按钮 -->
|
|
<el-button type="danger" icon="el-icon-delete" size="mini"></el-button>
|
<!-- 分配角色按钮 -->
|
|
<el-tooltip :enterable="false" effect="dark" content="分配角色" placement="top">
|
<el-button type="warning" icon="el-icon-setting" size="mini"></el-button>
|
</el-tooltip>
|
</template>
|
</el-table-column>
|
</el-table>
|
<el-pagination :total="total" :page-sizes="[5, 10, 15, 20]" :page-size="queryInfo.pagesize" :current-page="queryInfo.pagenum" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="handleCurrentChange">
|
</el-pagination>
|
</el-card>
|
</div>
|
</template>
|
<script>
|
export default {
|
data() {
|
return {
|
input: "",
|
queryInfo: {
|
query: "",
|
// 当前页
|
pagenum: 1,
|
// 每页显示多少条信息
|
pagesize: 10
|
},
|
userlist: [],
|
total: 0
|
};
|
},
|
created() {},
|
mounted() {
|
this.getUserList();
|
},
|
methods: {
|
async getUserList() {
|
const { data: res } = await this.$http.get("getuser", {
|
params: this.queryInfo
|
});
|
if (res.mssg.status !== 200) return this.$message.error("人员为空");
|
this.userlist = res.data;
|
this.total = res.mssg.total;
|
},
|
// 监听 pagesize 改变
|
handleSizeChange(newSizd) {
|
this.queryInfo.pagesize = newSizd;
|
this.queryInfo.pagenum = 1;
|
this.getUserList();
|
},
|
// 监听 页码值改变
|
handleCurrentChange(newpage) {
|
this.queryInfo.pagenum = newpage;
|
|
this.getUserList();
|
},
|
userStatusChange(userinfo) {
|
console.log(userinfo);
|
}
|
}
|
};
|
</script>
|
<style lang="postcss" scoped>
|
.el-table {
|
margin-top: 10px;
|
line-height: 30px;
|
}
|
.el-col {
|
line-height: 30px;
|
}
|
</style>
|