Explorar el Código

新增添加岗位到指定部门

DYaiu hace 4 años
padre
commit
b97e8b345f
Se han modificado 2 ficheros con 30 adiciones y 1 borrados
  1. 12 0
      src/api/treeAndTable.js
  2. 18 1
      src/views/treeAndTable/tree_and_table.vue

+ 12 - 0
src/api/treeAndTable.js

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

+ 18 - 1
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 } from "@/api/treeAndTable.js";
 
 export default {
   name: "tree_table",
@@ -88,6 +88,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>