1
0

2 Commits 1433f4b4ca ... 4eab016415

Autor SHA1 Mensagem Data
  DYaiu 4eab016415 删除岗位接口实现 há 4 anos atrás
  DYaiu b97e8b345f 新增添加岗位到指定部门 há 4 anos atrás
2 ficheiros alterados com 50 adições e 2 exclusões
  1. 20 0
      src/api/treeAndTable.js
  2. 30 2
      src/views/treeAndTable/tree_and_table.vue

+ 20 - 0
src/api/treeAndTable.js

@@ -55,4 +55,24 @@ export function getJob(parent) {
         method: 'get',
         params: parent
     })
+}
+
+/**
+ * 新增岗位到对应部门接口
+ * {"dept_id":"33","name":"舍长"}
+ */
+export function postJob(data) {
+    return request({
+        url: url.Job,
+        method: 'post',
+        data
+    })
+}
+
+// 删除岗位接口
+export function deleteJob(id) {
+    return request({
+        url: url.Job + id + '/',
+        method: 'delete',
+    })
 }

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

@@ -39,7 +39,7 @@
 
 <script>
 import tree from "@/views/treeAndTable/components/tree";
-import { getJob } 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") {
@@ -88,6 +99,23 @@ export default {
       this.dialog.name = "";
       this.dialog.visible = false;
     },
+    dataFormSubmitHandle: function () {
+      if (this.dialog.type == 2) {
+        postJob({
+          dept_id: this.dept_id,
+          name: this.dialog.name,
+        }).then((res) => {
+          this.dialog.visible = false;
+          if (res.data.msg == "success") {
+            this.$message({
+              message: "新增岗位成功",
+              type: "success",
+            });
+            this.tabClick({ name: "job" });
+          }
+        });
+      }
+    },
   },
 };
 </script>