Browse Source

私有WBS,删除节点,工序节点也不能新增子节点,搜索框加上清空按钮

gangyj 3 years ago
parent
commit
e8db53ae43
2 changed files with 41 additions and 1 deletions
  1. 9 0
      src/api/manager/wbsprivate.js
  2. 32 1
      src/views/manager/projectinfo/tree.vue

+ 9 - 0
src/api/manager/wbsprivate.js

@@ -60,3 +60,12 @@ export const removeTableByCondition = (id,projectId,wbsId, params) => {
   })
 }
 
+export const removePrivateTreeNode = (pKeyId) => {
+  return request({
+    url: '/api/blade-manager/wbsPrivate/remove',
+    method: 'post',
+    params: {
+      pKeyId,
+    }
+  })
+}

+ 32 - 1
src/views/manager/projectinfo/tree.vue

@@ -9,6 +9,7 @@
               placeholder="输入关键字进行过滤"
               v-model="filterText"
               @input="filterChange"
+              clearable
             ></el-input>
             <!-- <el-button type="info" class="mg-l-20">导入划分</el-button> -->
           </div>
@@ -49,6 +50,7 @@
                         <el-dropdown-item
                           @click.native="setLeftType(1,data,node)"
                           icon="el-icon-circle-plus-outline"
+                          v-if="data.deptCategory != 6 && data.isExistForm != 1"
                         >新增子级</el-dropdown-item>
                         <el-dropdown-item
                           @click.native="setLeftType(2,data,node)"
@@ -58,6 +60,11 @@
                           @click.native="setLeftType(3,data,node)"
                           icon="el-icon-document-copy"
                         >复制节点</el-dropdown-item>
+                        <el-dropdown-item
+                          @click.native="deleNode(data,node)"
+                          icon="el-icon-close"
+                          v-if="node.level !=1"
+                        >删除节点</el-dropdown-item>
                         <el-dropdown-item
                           @click.native="setLeftType(4,data,node)"
                           icon="iconfont hcicon-danganziliao-biaogetianxie"
@@ -119,6 +126,7 @@
                         <el-dropdown-item
                           @click.native="setLeftType(1,data,node)"
                           icon="el-icon-circle-plus-outline"
+                          v-if="data.deptCategory != 6 && data.isExistForm != 1"
                         >新增子级</el-dropdown-item>
                         <el-dropdown-item
                           @click.native="setLeftType(2,data,node)"
@@ -128,6 +136,11 @@
                           @click.native="setLeftType(3,data,node)"
                           icon="el-icon-document-copy"
                         >复制节点</el-dropdown-item>
+                        <el-dropdown-item
+                          @click.native="deleNode(data,node)"
+                          icon="el-icon-close"
+                          v-if="node.level !=1"
+                        >删除节点</el-dropdown-item>
                         <el-dropdown-item
                           @click.native="setLeftType(4,data,node)"
                           icon="iconfont hcicon-danganziliao-biaogetianxie"
@@ -1344,7 +1357,7 @@ import {
   saveElement, remove as removeElement, updateBatchElements, getTemplate,
   importWbsElement
 } from "@/api/manager/wbsformelement";
-import { getLazytree, getDetail, update, findNodeTableByCondition as selectByNodeTable, removeTableByCondition as removeTableById } from "@/api/manager/wbsprivate";
+import { getLazytree, getDetail, update, findNodeTableByCondition as selectByNodeTable, removeTableByCondition as removeTableById ,removePrivateTreeNode} from "@/api/manager/wbsprivate";
 import { findProjectTree as getAlltree } from "@/api/manager/projectinfo";
 import { getList as getAttchFromOriginalName } from "@/api/resource/attach";
 import { getDictionary } from "@/api/system/dict";
@@ -1670,6 +1683,24 @@ export default {
       })
     },
 
+    deleNode (data, node) {
+      this.$confirm('此操作将删除节点【' + data.title + '】, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        removePrivateTreeNode(data.primaryKeyId).then(() => {
+          this.$refs.tree.remove(node);
+          this.$message({
+            type: "success",
+            message: "删除成功!"
+          });
+        })
+      }).catch(() => {
+
+      });
+    },
+
     importHandle () {
 
     },