|
|
@@ -0,0 +1,156 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-breadcrumb separator=">">
|
|
|
+ <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item>
|
|
|
+ <a href="#">系统管理</a>
|
|
|
+ </el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item>
|
|
|
+ <a href="/job/workCategory">岗位分类管理</a>
|
|
|
+ </el-breadcrumb-item>
|
|
|
+ </el-breadcrumb>
|
|
|
+ <el-divider></el-divider>
|
|
|
+ <el-row class="button-group">
|
|
|
+ <el-button type="primary" size="small" plain icon="el-icon-circle-plus" @click="handleAdd(1)">添加一级分类</el-button>
|
|
|
+ </el-row>
|
|
|
+ <el-table :data="tableData" style="min-height: 400px" v-loading="loading" stripe row-key="id" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">>
|
|
|
+ <el-table-column prop="name" label="名称" width="180"></el-table-column>
|
|
|
+ <el-table-column prop="sortNo" label="排序" width="180"></el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-button v-if="row.level==1" size="mini" type="text" @click="handleAdd(2,row)">添加二级分类</el-button>
|
|
|
+ <el-button v-if="row.level==2" size="mini" type="text" @click="handleAdd(3,row)">添加新岗位</el-button>
|
|
|
+ <el-button size="mini" type="text" @click="handleEdit(row)">编辑</el-button>
|
|
|
+ <el-button size="mini" type="text" @click="handleDelete(row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <workCategory-detail
|
|
|
+ v-if="showModal"
|
|
|
+ :businessKey="businessKey"
|
|
|
+ :level="level"
|
|
|
+ :fId="fId"
|
|
|
+ :title="modalTitle"
|
|
|
+ @close="onDetailModalClose"
|
|
|
+ ></workCategory-detail>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import Constant from "@/constant";
|
|
|
+import WorkCategoryDetail from "./workCategory-detail";
|
|
|
+import workCategoryApi from "@/api/job/workCategory";
|
|
|
+import NProgress from "nprogress"; // progress bar
|
|
|
+import "nprogress/nprogress.css"; // progress bar style
|
|
|
+
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ tableData: [],
|
|
|
+ showModal: false,
|
|
|
+ modalTitle: "",
|
|
|
+ businessKey: "",
|
|
|
+ level: "",
|
|
|
+ fId: "",
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ changePage(pageIndex) {
|
|
|
+ var self = this;
|
|
|
+
|
|
|
+ self.loading = true;
|
|
|
+
|
|
|
+ self.pageIndex = pageIndex;
|
|
|
+ var formData = new FormData();
|
|
|
+
|
|
|
+ workCategoryApi
|
|
|
+ .list(formData)
|
|
|
+ .then(function (response) {
|
|
|
+ self.loading = false;
|
|
|
+
|
|
|
+ var jsonData = response.data.data;
|
|
|
+
|
|
|
+ self.tableData = jsonData;
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ self.loading = false;
|
|
|
+ // self.$message.error(error + "");
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleAdd(level,row) {
|
|
|
+ this.modalTitle = "添加一级分类";
|
|
|
+ this.level = level;
|
|
|
+ if(row != null){
|
|
|
+ this.fId = row.id;
|
|
|
+ }
|
|
|
+ this.businessKey = "";
|
|
|
+ this.showModal = true;
|
|
|
+ },
|
|
|
+ handleEdit(record) {
|
|
|
+ this.modalTitle = "编辑";
|
|
|
+ this.businessKey = record.id;
|
|
|
+ this.showModal = true;
|
|
|
+ },
|
|
|
+ handleDelete(record) {
|
|
|
+ var self = this;
|
|
|
+
|
|
|
+ self
|
|
|
+ .$confirm("是否确认删除?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ workCategoryApi.remove(record.id).then(function (response) {
|
|
|
+ var jsonData = response.data;
|
|
|
+
|
|
|
+ if (jsonData.result) {
|
|
|
+ // var index = self.tableData.indexOf(record);
|
|
|
+ // self.tableData.splice(index, 1);
|
|
|
+ self.changePage(self.pageIndex);
|
|
|
+
|
|
|
+ self.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "删除成功!",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onDetailModalClose(refreshed) {
|
|
|
+ //保存成功后回调
|
|
|
+ this.showModal = false;
|
|
|
+
|
|
|
+ if (refreshed) {
|
|
|
+ this.changePage(this.pageIndex);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted: function () {
|
|
|
+ this.changePage(1);
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ "workCategory-detail": WorkCategoryDetail,
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.el-breadcrumb {
|
|
|
+ margin: 10px;
|
|
|
+ line-height: 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.el-divider {
|
|
|
+ margin: 5px 0;
|
|
|
+}
|
|
|
+
|
|
|
+.demo-form-inline {
|
|
|
+ margin-left: 10px;
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+
|
|
|
+.button-group {
|
|
|
+ margin-left: 10px;
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+</style>
|