浏览代码

删除岗位接口实现

DYaiu 4 年之前
父节点
当前提交
4eab016415
共有 2 个文件被更改,包括 21 次插入2 次删除
  1. 8 0
      src/api/treeAndTable.js
  2. 13 2
      src/views/treeAndTable/tree_and_table.vue

+ 8 - 0
src/api/treeAndTable.js

@@ -67,4 +67,12 @@ export function postJob(data) {
         method: 'post',
         data
     })
+}
+
+// 删除岗位接口
+export function deleteJob(id) {
+    return request({
+        url: url.Job + id + '/',
+        method: 'delete',
+    })
 }

+ 13 - 2
src/views/treeAndTable/tree_and_table.vue

@@ -39,7 +39,7 @@
 
 <script>
 import tree from "@/views/treeAndTable/components/tree";
-import { getJob, postJob } from "@/api/treeAndTable.js";
+import { getJob, postJob, deleteJob } from "@/api/treeAndTable.js";
 
 export default {
   name: "tree_table",
@@ -71,7 +71,18 @@ export default {
     },
     // 岗位标签页的删除按钮
     // eslint-disable-next-line no-unused-vars
-    deleteJob: function (id) {},
+    deleteJob: function (id) {
+      deleteJob(id).then((res) => {
+        console.log(res);
+        if (res.status == 204) {
+          this.$message({
+            message: "删除岗位成功",
+            type: "warning",
+          });
+          this.tabClick({ name: "job" });
+        }
+      });
+    },
     // tabs点击的时候获取当前标签页下的所有信息
     tabClick: function (tabNode) {
       if (tabNode.name == "job") {