提交 f903a92c authored 作者: 龙菲's avatar 龙菲

用户管理

上级 223ea709
......@@ -159,18 +159,11 @@ export default {
},
async handleSubmit() {
// debugger
// console.log(this.dialogForm);
// return
let params = JSON.parse(JSON.stringify(this.dialogForm));
// 回填文件
let file = this.$refs.pdf.getFiles();
let formData = new FormData();
// console.log("file", file);
// return
// debugger;
if (file[0].status == "ready") {
// debugger;
formData.append("files", file[0].raw);
let upLoadRes = await uploadFile(formData);
if (upLoadRes.code == 0) {
......
......@@ -19,6 +19,13 @@ export const title = [{
label: "手机号",
columnAlign: 'center',
},
{
prop: "status",
label: "状态",
columnAlign: 'center',
isStatus: true,
width: 100
},
]
export const operates = {
......
<!-- -->
<template>
<div class='users app-container'>
<div class="users app-container">
<el-row :gutter="16">
<el-col :span="4">
<el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" default-expand-all></el-tree>
<el-tree
:data="treeData"
:props="defaultProps"
@node-click="handleNodeClick"
default-expand-all
:expand-on-click-node="false"
></el-tree>
</el-col>
<el-col :span="20">
<div class="top-bar">
<SearchBar :config="searchConfig" @search="search" @reset="reset" />
<el-button type="primary" @click.native="handleOperation({ type: 'add' })" icon="el-icon-s-promotion">
发布</el-button>
<el-button
type="primary"
@click.native="handleOperation({ type: 'add' })"
icon="el-icon-s-promotion"
>
新增</el-button
>
</div>
<TablePage :data="list.records" :tableTitle="tableTitle" :operates="tableOperates">
<TablePage
:data="list.records"
:tableTitle="tableTitle"
:operates="tableOperates"
>
<template v-slot:status="data">
<el-popconfirm :title="getStatusTitle(data.scope.status)" @onConfirm="handleChangeStatus(data.scope)">
<el-switch slot="reference" :value="Boolean(Number(data.scope.status))"></el-switch>
<el-popconfirm
:title="getStatusTitle(data.scope.status)"
@onConfirm="handleChangeStatus(data.scope)"
>
<el-switch
slot="reference"
:value="Boolean(Number(data.scope.status))"
></el-switch>
</el-popconfirm>
</template>
<template v-slot:operates="scope">
<TableOperation :operations="tableOperations" :rawData="scope.scope.row" @handleOperation="handleOperation">
<TableOperation
:operations="tableOperations"
:rawData="scope.scope.row"
@handleOperation="handleOperation"
>
</TableOperation>
</template>
</TablePage>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="Number(list.current)" :page-sizes="[10, 20, 40, 50]" :page-size="Number(list.size)"
layout="total, sizes, prev, pager, next, jumper" :total="Number(list.total)" class="pagination">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="Number(list.current)"
:page-sizes="[10, 20, 40, 50]"
:page-size="Number(list.size)"
layout="total, sizes, prev, pager, next, jumper"
:total="Number(list.total)"
class="pagination"
>
</el-pagination>
</el-col>
</el-row>
<InfoEditDialog
:visible="dialogVisible"
:form="form"
:orgTreeData="treeData"
@handleClose="handleClose"
@refresh="loadData"
/>
</div>
</template>
<script>
import TablePage from "@/components/Table/TablePage.vue";
import TableOperation from "@/components/Table/TableOperation.vue";
import SearchBar from "@/components/SearchBar";
import { title, operates, operations } from "./config";
import { getDeptTree, getUserList } from '@/api/user'
export default {
components: {
TablePage,
TableOperation,
SearchBar
// InfoEditDialog,
import TablePage from "@/components/Table/TablePage.vue";
import TableOperation from "@/components/Table/TableOperation.vue";
import SearchBar from "@/components/SearchBar";
import { title, operates, operations } from "./config";
import { getDeptTree, getUserList } from "@/api/user";
export default {
components: {
TablePage,
TableOperation,
SearchBar,
// InfoEditDialog,
},
computed: {
tableTitle() {
return title;
},
computed: {
tableTitle() {
return title;
},
tableOperates() {
return operates;
tableOperates() {
return operates;
},
tableOperations() {
return operations;
},
},
data() {
return {
treeData: [],
defaultProps: {
children: "children",
label: "label",
},
tableOperations() {
return operations;
list: {
records: [],
size: 10,
current: 1,
total: 0,
},
},
data() {
return {
treeData: [
],
defaultProps: {
children: 'children',
label: 'label'
searchConfig: [
{
prop: "username",
type: "input",
label: "用户名",
},
list: {
records: [],
size: 10,
current: 1,
total: 0,
{
prop: "nickName",
type: "input",
label: "昵称",
},
searchConfig: [
{
prop: "username",
type: "input",
label: "用户名",
},
{
prop: "nickName",
type: "input",
label: "昵称",
},
],
],
currentDeptNo: null,
form: {
username: "", //用户名
nickname: "", //昵称
password: "", //密码
phone: "", //手机号
realName: "", //真实姓名
deptNo: "",
},
};
},
mounted() {
this.loadTreeData();
},
methods: {
// 加载树结构数据
async loadTreeData() {
const res = await getDeptTree();
console.log(111, res);
if (res.code == 0) {
this.treeData = res.data;
this.currentDeptNo = this.treeData[0].deptNo;
this.loadListData();
}
},
// 加载表格数据
async loadListData() {
var params = {
page: this.list.current,
limit: this.list.size,
deptNo: this.currentDeptNo,
};
const res = await getUserList(params);
if (res.code == 0) {
this.list = res.data;
}
},
mounted() {
this.loadTreeData()
this.loadListData()
async search(form) {
var params = {
page: this.list.current,
limit: this.list.size,
deptNo: this.currentDeptNo,
...form,
};
const res = await getUserList(params);
if (res.code == 0) {
this.list = res.data;
}
},
reset() {
this.loadListData();
},
methods: {
// 加载树结构数据
async loadTreeData() {
const res = await getDeptTree()
console.log(111, res);
if (res.code == 0) {
this.treeData = res.data
}
},
// 加载表格数据
async loadListData() {
var params = {
page: this.list.current,
limit: this.list.size,
};
const res = await getUserList(params)
if (res.code == 0) {
this.list = res.data;
}
},
async search(form) {
var params = {
page: this.list.current,
limit: this.list.size,
...form,
};
const res = await getUserList(params)
if (res.code == 0) {
this.list = res.data;
}
},
reset() {
this.loadListData();
},
handleNodeClick(e) {
console.log(e);
},
// 改变页容量
handleSizeChange(value) {
this.list.size = value;
this.loadListData();
},
handleNodeClick(e) {
console.log(e);
const { deptNo } = e;
this.currentDeptNo = deptNo;
this.loadListData();
},
// 改变页容量
handleSizeChange(value) {
this.list.size = value;
this.loadListData();
},
// 改变当前显示页
handleCurrentChange(value) {
this.list.current = value;
this.loadListData();
},
// 改变当前显示页
handleCurrentChange(value) {
this.list.current = value;
this.loadListData();
},
async handleOperation(value, row) {
console.log("handleOperation", value, row);
switch (value.type) {
case "add":
// this.drawerVisible = true;
break;
case "edit":
// this.form = row;
// this.drawerVisible = true;
break;
case "delete":
// let deleteRes = await deleteLt([row.literatureId]);
// if (deleteRes.code == 0) {
// this.$message.success("删除成功!");
// this.loadData();
// }
break;
}
},
async handleOperation(value, row) {
console.log("handleOperation", value, row);
switch (value.type) {
case "add":
this.dialogVisible = true;
break;
case "edit":
// this.form = row;
this.dialogVisible = true;
break;
case "delete":
// let deleteRes = await deleteLt([row.literatureId]);
// if (deleteRes.code == 0) {
// this.$message.success("删除成功!");
// this.loadData();
// }
break;
}
},
};
},
};
</script>
<style lang="scss" scoped>
.top-bar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.top-bar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.pagination {
margin: 16px;
}
.pagination {
margin: 16px;
}
.el-button {
margin-bottom: 22px;
}
.el-button {
margin-bottom: 22px;
}
</style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论