|
@@ -10,13 +10,15 @@
|
|
|
<div>
|
|
|
<el-button type="primary" @click="postUser">新增</el-button>
|
|
|
<el-table :data="tableDataPeople" style="width: 100%">
|
|
|
- <el-table-column prop="name" label="姓名" width="180"></el-table-column>
|
|
|
- <el-table-column prop="job" label="岗位" width="180">
|
|
|
- <el-tag v-for="(name,index) in job" :key="index">{{name}}</el-tag>
|
|
|
+ <el-table-column prop="user_name" label="姓名" width="180"></el-table-column>
|
|
|
+ <el-table-column prop="jobs" label="岗位" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag v-for="(val,index) in scope.row.jobs" :key="index">{{val.job_name}}</el-tag>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作">
|
|
|
<template slot-scope="scope" width="200px0">
|
|
|
- <el-button @click="deleteJob(scope.row.id)" type="danger">删除</el-button>
|
|
|
+ <el-button @click="deleteUser(scope.row.id)" type="danger">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -65,7 +67,13 @@
|
|
|
|
|
|
<script>
|
|
|
import tree from "@/views/treeAndTable/components/tree";
|
|
|
-import { getJob, postJob, deleteJob, postUser } from "@/api/treeAndTable.js";
|
|
|
+import {
|
|
|
+ getJob,
|
|
|
+ postJob,
|
|
|
+ deleteJob,
|
|
|
+ postUser,
|
|
|
+ getUsers,
|
|
|
+} from "@/api/treeAndTable.js";
|
|
|
|
|
|
export default {
|
|
|
name: "tree_table",
|
|
@@ -122,8 +130,17 @@ export default {
|
|
|
getJob({
|
|
|
dept_id: this.dept_id,
|
|
|
}).then((res) => {
|
|
|
+ console.log("tableData");
|
|
|
+ console.log(res.data);
|
|
|
this.tableData = res.data;
|
|
|
});
|
|
|
+ } else if (tabNode.name == "people") {
|
|
|
+ getUsers({
|
|
|
+ dept_id: this.dept_id,
|
|
|
+ }).then((res) => {
|
|
|
+ console.log(res.data);
|
|
|
+ this.tableDataPeople = res.data;
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
// 弹窗的取消按钮
|
|
@@ -158,7 +175,7 @@ export default {
|
|
|
message: "新增人员成功",
|
|
|
type: "success",
|
|
|
});
|
|
|
- this.tabClick({ name: "user" });
|
|
|
+ this.tabClick({ name: "people" });
|
|
|
});
|
|
|
}
|
|
|
},
|