Ver Fonte

增加分配WBS按钮

duy há 1 ano atrás
pai
commit
8cc639b315

+ 143 - 0
src/views/manager/projectinfo/allocateDialog.vue

@@ -0,0 +1,143 @@
+<template>
+        <el-dialog
+            :visible.sync="allocatedialogVisible"
+            title="关联WBS"
+            width="500"
+            append-to-body
+        >
+        <div class="flex1 ov-hidden" style="height: 500px;">
+            <el-scrollbar class="h-100p">
+                <div v-loading="treeLoad">
+                  <el-tree
+                    class="filter-tree"
+                    lazy
+                    :load="loadNode"
+                    :props="defaultProps"
+                    :expand-on-click-node="false"
+                    highlight-current
+                    node-key="id"
+                    ref="tree"
+                    :render-content="renderContent"
+                  
+                   
+                    >
+                  
+                    </el-tree>
+        
+                </div>
+              </el-scrollbar>
+        </div>
+            <template #footer>
+            <div class="dialog-footer">
+                <el-button @click="allocatedialogVisible = false">取消</el-button>
+                <el-button type="primary" @click="allocatedialogVisible = false">
+                确认
+                </el-button>
+            </div>
+            </template>
+      </el-dialog>
+ </template>
+  
+  <script>
+  import { getLazytree,} from "@/api/manager/wbsprivate";
+  import { mapGetters } from "vuex";
+  
+  export default {
+    props:{
+        projectId:'',
+        wbsId:'',
+        wbsType:''
+    },
+    data () {
+     return {
+        allocatedialogVisible:false,
+        treeLoad:false,
+        defaultProps: {
+        children: "children",
+        label: "title",
+        isLeaf: function (data) {
+          //console.log(data, !data.hasChildren, data.isExistForm);
+          let tag = false;
+          if (!data.hasChildren) {
+            tag = true;
+          }
+          if (data.isExistForm == 1) {
+            tag = true;
+          }
+          if (data.nodeType >= 6 && data.nodeType <= 13) {
+            tag = true;
+          }
+          //中间交工。开工报告、质量评定)
+          if (
+            data.majorDataType == 1 ||
+            data.majorDataType == 2 ||
+            data.majorDataType == 3
+          ) {
+            tag = true;
+          }
+          return tag;
+          // return !data.hasChildren || (data.isExistForm == 1);
+        },
+      },
+     }
+    },
+    computed: {
+        ...mapGetters(["userInfo"]),
+    },
+    watch: {
+      
+    },
+    
+    created () {
+     
+    },
+    mounted () {
+      
+    },
+    methods: {
+     show(){
+        this.allocatedialogVisible=true
+     },
+     renderContent(h, { node, data, store }) {
+      // 只有当节点没有子节点时才显示复选框
+      if (!data.hasChildren ) {
+        return (
+          <span>
+            <el-checkbox v-model={data.checked}></el-checkbox>
+            <span>{node.label}</span>
+          </span>
+        );
+      } else {
+        return (
+          <span>{node.label}</span>
+        );
+      }
+    },
+     loadNode(node, resolve) {
+        let pid = 0;
+        if (node.level != 0) {
+            pid = node.data.id;
+        }
+        getLazytree(this.wbsId, pid, this.userInfo.tenant_id, this.projectId, {
+            wbsType: this.wbsType,
+        }).then((res) => {
+            let arr = [];
+            if (Array.isArray(res.data.data)) {
+            arr = res.data.data;
+            }
+
+            return resolve(arr);
+        });
+    },
+    handleCheckChange(checkedNodes) {
+   
+      console.log('当前选中的节点:',checkedNodes);
+    }
+  
+    }
+  };
+  </script>
+  
+  <style scoped lang="scss">
+  </style>
+  

+ 20 - 2
src/views/manager/projectinfo/independent.vue

@@ -99,6 +99,7 @@
                       <el-button  :size="size" :type="type"  :disabled="row.excelIds == -1" @click="rightClick(row)">编辑元素</el-button>
                       <el-button  :size="size" :type="type"  :disabled="row.excelIds == -1" @click="adjustExcel(row.id,row.excelIds)">调整表单</el-button>
                       <el-button  :size="size" :type="type" @click="handleEditFormula(row)">编辑公式</el-button>
+                      <el-button  :size="size" :type="type" @click="allocatWbs(row)">分配WBS</el-button>
 
                 </template>
             </avue-crud>
@@ -108,6 +109,8 @@
     </div>
     <Qute ref="Qute" :projectid="projectid" :wbsid="wbsid" :onLoad1="onLoad1" :refreshTree="refreshTree"> </Qute>
     <Relation ref="Relation" :GLExcelFrom="GLExcelFrom" :wbsid="wbsid"  :onLoad1="onLoad1" :refreshTree="refreshTree"></Relation>
+       <!-- 分配Wbs -->
+       <allocateDialog ref="allocateRef"></allocateDialog>
     <!-- 编辑元素 -->
        <!-- 编辑元素 -->
     <el-dialog
@@ -230,6 +233,11 @@
         <el-button type="primary" @click="editSort()">确 定</el-button>
       </span>
     </el-dialog>
+      <!-- 分配wbs -->
+  <allocateDialog ref="allocateRef" :projectId="projectid"  :wbsId="wbsid" :wbsType="wbsType"></allocateDialog>
+  
+  
+  
   </div>
 </template>
 
@@ -245,10 +253,12 @@ import EditElement from "@/views/manager/projectinfo/editElement/editElement.vue
 import dynamicExcel from "./treeTemplate/dynamicExcel.vue";
 import FormulaEdit from "@/views/formula/edit1.vue";
 import ManualSorting from '@/components/WbsTree/ManualSorting'
+import allocateDialog from "./allocateDialog.vue";//分配WBS
+
 
 
 export default {
-   components: { dynamicExcel, EditElement, Qute,Relation,FormulaEdit,ManualSorting },
+   components: { dynamicExcel, EditElement, Qute,Relation,FormulaEdit,ManualSorting,allocateDialog},
   computed:{
      ids () {
       let ids = [];
@@ -413,7 +423,8 @@ export default {
       curNode:{},
       sortTag: false,
       sortTag2: false,
-      sort:[]
+      sort:[],
+      allocatedialogVisible:false//分配WBS弹窗
 
 
     };
@@ -421,6 +432,7 @@ export default {
   created() {
      this.projectid = this.$route.query.pid;
      this.wbsid=this.$route.query.wbsid;
+     this.wbsType=this.$route.query.wbsType;
   },
   methods: {
       //关闭公式弹窗
@@ -785,6 +797,12 @@ export default {
         this.$refs.trees.setCurrentKey(this.curNode.data.id);
       });
     },
+    //分配WBS
+    allocatWbs(row){
+      console.log(row,'row');
+     this.$refs.allocateRef.show()
+      
+    }
 
   },
 

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

@@ -3586,7 +3586,7 @@ export default {
     independent(){
       this.$router.push({
         path: '/project/independent',
-        query: { pid: this.projectid,wbsid:this.$route.query.wbsid }
+        query: { pid: this.projectid,wbsid:this.$route.query.wbsid,wbsType:this.wbsType }
 
 
       });