|
@@ -1,21 +1,45 @@
|
|
<template>
|
|
<template>
|
|
<el-container style="height:900px;border: 5px solid #eee">
|
|
<el-container style="height:900px;border: 5px solid #eee">
|
|
<el-aside width="25%">
|
|
<el-aside width="25%">
|
|
- <tree style="height:300px"></tree>
|
|
|
|
|
|
+ <tree style="height:300px" @nodeClick="getTreeDeptId"></tree>
|
|
</el-aside>
|
|
</el-aside>
|
|
<el-container>
|
|
<el-container>
|
|
<el-main>
|
|
<el-main>
|
|
- <el-tabs value="people" type="border-card">
|
|
|
|
|
|
+ <el-tabs value="people" type="border-card" @tab-click="tabClick">
|
|
<el-tab-pane label="人员" name="people"></el-tab-pane>
|
|
<el-tab-pane label="人员" name="people"></el-tab-pane>
|
|
- <el-tab-pane label="岗位" name="job"></el-tab-pane>
|
|
|
|
|
|
+ <el-tab-pane label="岗位" name="job">
|
|
|
|
+ <div>
|
|
|
|
+ <el-button type="primary" @click="postJob">新增</el-button>
|
|
|
|
+ <el-table :data="tableData" style="width: 100%">
|
|
|
|
+ <el-table-column prop="name" label="姓名" width="180"></el-table-column>
|
|
|
|
+ <el-table-column label="操作">
|
|
|
|
+ <template slot-scope="scope" width="200px0">
|
|
|
|
+ <el-button @click="deleteJob(scope.row.id)" type="danger">删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </div>
|
|
|
|
+ </el-tab-pane>
|
|
</el-tabs>
|
|
</el-tabs>
|
|
</el-main>
|
|
</el-main>
|
|
</el-container>
|
|
</el-container>
|
|
|
|
+ <el-dialog :title="dialog.title" :visible="dialog.visible" @close="handleCancel">
|
|
|
|
+ <el-form :model="dialog" label-width="120px" ref="form">
|
|
|
|
+ <el-form-item label="名字" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }" prop="name">
|
|
|
|
+ <el-input v-model="dialog.name" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <template slot="footer">
|
|
|
|
+ <el-button @click="handleCancel">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="dataFormSubmitHandle">保存</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
</el-container>
|
|
</el-container>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import tree from "@/views/treeAndTable/components/tree";
|
|
import tree from "@/views/treeAndTable/components/tree";
|
|
|
|
+import { getJob } from "@/api/treeAndTable.js";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "tree_table",
|
|
name: "tree_table",
|
|
@@ -23,8 +47,47 @@ export default {
|
|
tree,
|
|
tree,
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
- return {};
|
|
|
|
|
|
+ return {
|
|
|
|
+ dept_id: 0,
|
|
|
|
+ tableData: [],
|
|
|
|
+ dialog: {
|
|
|
|
+ type: 0, // 1是人员,2是岗位
|
|
|
|
+ title: "",
|
|
|
|
+ name: "",
|
|
|
|
+ visible: false,
|
|
|
|
+ },
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // eslint-disable-next-line no-unused-vars
|
|
|
|
+ getTreeDeptId: function (data, node, that) {
|
|
|
|
+ console.log(data);
|
|
|
|
+ this.dept_id = data.data.id;
|
|
|
|
+ },
|
|
|
|
+ postJob: function () {
|
|
|
|
+ this.dialog.visible = true;
|
|
|
|
+ this.dialog.title = "新增";
|
|
|
|
+ this.dialog.type = 2;
|
|
|
|
+ },
|
|
|
|
+ // 岗位标签页的删除按钮
|
|
|
|
+ // eslint-disable-next-line no-unused-vars
|
|
|
|
+ deleteJob: function (id) {},
|
|
|
|
+ // tabs点击的时候获取当前标签页下的所有信息
|
|
|
|
+ tabClick: function (tabNode) {
|
|
|
|
+ if (tabNode.name == "job") {
|
|
|
|
+ getJob({
|
|
|
|
+ dept_id: this.dept_id,
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ this.tableData = res.data;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 弹窗的取消按钮
|
|
|
|
+ handleCancel: function () {
|
|
|
|
+ this.dialog.type = 0;
|
|
|
|
+ this.dialog.name = "";
|
|
|
|
+ this.dialog.visible = false;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- methods: {},
|
|
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|