Bladeren bron

关联节点

ZaiZai 1 jaar geleden
bovenliggende
commit
d654cbbb90
1 gewijzigde bestanden met toevoegingen van 128 en 100 verwijderingen
  1. 128 100
      src/views/manager/projectinfo/tree.vue

+ 128 - 100
src/views/manager/projectinfo/tree.vue

@@ -1,8 +1,8 @@
 <template>
   <div style="height: 100%;">
     <basic-container v-show="showType == 1" >
-       <el-row class="titlerow"> 
-     
+       <el-row class="titlerow">
+
           <el-col >
               <div style="position:relative" >
                 <span style="float: left; margin-top: 15px;color: white;">{{projectName }}</span>
@@ -34,11 +34,11 @@
                                 v-show="isshowSyncbtn"
                                 class="contextmenu selectBtn"
                               >
-                                <li v-for="item in menuoptions" :key="item"  @click="menuClick($event,item,data)"   v-loading="item.load"> 
+                                <li v-for="item in menuoptions" :key="item"  @click="menuClick($event,item,data)"   v-loading="item.load">
                                     {{item.label}}
                                 </li>
                             </ul>
-                
+
                     <el-button
                       size="medium"
                       icon="el-icon-s-grid"
@@ -53,7 +53,7 @@
                       v-else
                       >元素设置</el-button
                     >
-                
+
                     <!-- <el-button
                       class="el-btn-purple"
                       type="primary"
@@ -63,7 +63,7 @@
                       @click="syncInfoHandle"
                       >同步节点参数</el-button
                     > -->
-                
+
                     <el-button
                       size="medium"
                       icon="el-icon-help"
@@ -98,8 +98,8 @@
           </el-col>
         </el-row>
       <el-row :gutter="20" class="h-100p" style="padding:10px">
-       
-        <el-col :span="10" style="height: 85%;">
+
+        <el-col :span="8" style="height: 85%;">
           <div class="h-100p flex flex-d-c">
             <p style="margin-top:2px">工程节点信息</p>
             <div class="flex " style="align-items: center;justify-content: space-between;">
@@ -117,8 +117,8 @@
               inline-prompt
               active-text="按节点"
               inactive-text="按表名"
-             
-             
+
+
             />
             <el-button type="primary" @click="searchTreeClick">搜索</el-button>
             </div>
@@ -153,30 +153,30 @@
                               class="el-icon-menu "
                               @click.stop="showMenu($event,data, node)"
                               v-if="node.level != 1"
-                            
+
                             ></i>
                           </el-link>
-                  
-                      
+
+
                     <!-- 因右键自定义菜单事件需要获取当前点击的位置,所以此处绑定动态样式来控制菜单实时跟踪鼠标右键点击位置 -->
                           <ul
                             v-show="menuvisible"
                             :style="{ left: menuleft + 'px', top: menutop + 'px' }"
                             class="contextmenu"
                           >
-                            <li v-for="item in menusData" :key="item"  @click="menuClick($event,item,data)"> 
+                            <li v-for="item in menusData" :key="item"  @click="menuClick($event,item,data)">
                                   <i :class="item.icon"></i>
                                  <el-tooltip class="item" effect="light" :content="item.content" placement="right-start">
                                   <span>{{item.label}}</span>
                                 </el-tooltip>
 
                             </li>
-                  
+
                           </ul>
                       </div>
 
                     </div>
-                         
+
                    </div>
                 </span>
               </el-tree>
@@ -206,23 +206,23 @@
                                 class="el-icon-menu "
                                 @click="showMenu($event,data, node)"
                                 v-if="node.level != 1"
-                              
+
                               ></i>
                             </el-link>
-                        
-                      
+
+
                               <ul
                                 v-show="menuvisible"
                                 :style="{ left: menuleft + 'px', top: menutop + 'px' }"
                                 class="contextmenu"
                               >
-                                <li v-for="item in menusData" :key="item"  @click="menuClick($event,item,data)"> 
+                                <li v-for="item in menusData" :key="item"  @click="menuClick($event,item,data)">
                                       <i :class="item.icon"></i>{{item.label}}
                                 </li>
                               </ul>
                         </div>
                       </div>
-                          
+
                     </div>
                   </span>
               </el-tree>
@@ -231,8 +231,8 @@
             </div>
           </div>
         </el-col>
-        <el-col :span="14" class="h-100p flex flex-d-c">
-        
+        <el-col :span="16" class="h-100p flex flex-d-c">
+
           <template v-if="leftType == 5">
             <div class="mg-b-10">节点信息</div>
             <div>
@@ -398,16 +398,12 @@
                   :formatter="formatOwner"
                   label="所属方"
                 ></el-table-column>
-                <el-table-column label="操作" width="450" align="center">
+                <el-table-column label="操作" width="520" align="center">
                   <template slot-scope="scope">
                     <el-link type="primary" @click="Associationlist(scope)"
                       >关联清表</el-link
                     >
-                    <el-link
-                      class="mg-l-10"
-                      type="primary"
-                      :disabled="scope.row.excelId == -1||scope.row.excelId == null"
-                      @click="
+                    <el-link class="mg-l-10" type="primary" :disabled="scope.row.excelId == -1||scope.row.excelId == null" @click="
                         rightClick(
                           scope.row.pkeyId,
                           scope.row.excelId,
@@ -416,33 +412,12 @@
                           scope.row.initTableId
                         )
                       "
-                      >编辑元素</el-link
-                    >
-                    <el-link
-                      class="mg-l-10"
-                      type="primary"
-                      :disabled="scope.row.excelId == -1||scope.row.excelId == null"
-                      @click="adjustExcel(scope.row.pkeyId, scope.row.excelId)"
-                      >调整表单</el-link
-                    >
-                    <el-link
-                      class="mg-l-10"
-                      type="primary"
-                      @click="handleEditFormula(scope.$index, scope.row)"
-                      >编辑元素公式.</el-link
-                    >
-                    <el-button
-                      class="mg-l-10"
-                      type="text"
-                      :loading="handlesyncLoad"
-                      @click="handlesync(scope.$index, scope.row)"
-                      >表单同步</el-button>
-                    <el-link
-                      class="mg-l-10"
-                      type="danger"
-                      @click="handleDelete(scope.$index, scope.row)"
-                      >删除表单</el-link
-                    >
+                    >编辑元素</el-link>
+                    <el-link class="mg-l-10" type="primary" :disabled="scope.row.excelId == -1||scope.row.excelId == null" @click="adjustExcel(scope.row.pkeyId, scope.row.excelId)">调整表单</el-link>
+                    <el-link class="mg-l-10" type="primary" @click="handleEditFormula(scope.$index, scope.row)">编辑元素公式</el-link>
+                    <el-button class="mg-l-10" type="text" :loading="handlesyncLoad" @click="handlesync(scope.$index, scope.row)">表单同步</el-button>
+                    <el-button class="mg-l-10" type="text" :loading="handlesyncLoad" @click="handleLinkNodes(scope.$index, scope.row)">关联节点</el-button>
+                    <el-link class="mg-l-10" type="danger" @click="handleDelete(scope.$index, scope.row)">删除表单</el-link>
                   </template>
                 </el-table-column>
               </el-table>
@@ -545,7 +520,7 @@
                       @click="handleEditFormula(scope.$index, scope.row)"
                       >编辑元素公式</el-link
                     >
-               
+
                     <el-link
                       class="mg-l-10"
                       type="danger"
@@ -790,7 +765,7 @@
         <el-form-item label="节点类型" prop="nodeType">
           <el-select
             v-model="nodeDetail.nodeType"
-          
+
             placeholder="请选择"
             class="w-100p"
             @change="nodeTypeChange"
@@ -830,7 +805,7 @@
         >
           <el-select
             v-model="nodeDetail.majorDataType"
-           
+
             placeholder="请选择"
             class="w-100p"
           >
@@ -1168,7 +1143,7 @@
 <!-- 元素公式 -->
     <el-dialog
     :title="(curEleTable.tableName?curEleTable.tableName:'')+'  元素公式'"
-     
+
       :visible.sync="editEleFormulaVisible"
       width="800px"
       append-to-body
@@ -1289,7 +1264,7 @@
                 v-model="scope.row.k"
                 placeholder="请选择"
                 class="w-100p"
-              
+
               >
                 <el-option
                   v-for="item in namelist"
@@ -1343,7 +1318,7 @@
       append-to-body
       class="jiedian"
       :close-on-click-modal="false"
-   
+
     >
       <div>
         <div class="flexEnd">
@@ -1422,7 +1397,7 @@
 
     <!-- 节点公式 -->
     <el-dialog
-     
+
       :title="(curEleTable.tableName?curEleTable.tableName:'')+'  元素公式(元素库)'"
       :visible.sync="formulaCompVisible"
       fullscreen
@@ -1432,7 +1407,7 @@
     >
       <FormulaEdit
         :fromcurNode="curTreeData"
-        :projectid="projectid" 
+        :projectid="projectid"
         :wbsid="id"
         :nodeid="curTreeData.id"
         :eleid="formulaCurRow.id"
@@ -1579,6 +1554,17 @@
       </span>
     </el-dialog>
 
+      <!-- 关联节点 -->
+      <el-dialog title="关联节点" :visible="isLinkNodes" append-to-body center destroy-on-close custom-class="hc-link-nodes-dialog" @close="linkNodesClose">
+          <el-tree
+              ref="tree" class="hc-link-nodes-tree" lazy :load="loadNode" :props="defaultProps" show-checkbox check-strictly
+              :default-checked-keys="checkedLinkNodesKeys" highlight-current node-key="id" @check="linkNodesCheck"
+          />
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="linkNodesClose">取 消</el-button>
+            <el-button type="primary" @click="linkNodesSave" v-loading="linkNodesLoad">确 定</el-button>
+          </span>
+      </el-dialog>
   </div>
 </template>
 
@@ -1666,7 +1652,7 @@ export default {
       sortTag2: false,
       sureSortload:false,
       surePrivateSortload:false,
- 
+
       sort:[],
       //#endregion
 
@@ -1869,7 +1855,7 @@ export default {
         {icon: 'el-icon-s-promotion', label: '同步节点基础信息及表单URL', key: "sync2",content:'同步节点的基础信息、类型名称、表单url等信息'},
         {icon: 'el-icon-sort', label: '调整排序', key: "sort",content:'调整排序'},
         {icon: 'el-icon-s-promotion', label: '删除节点', key: "del",content:'删除节点'},
-      
+
       ],//树组件操作菜单
       menuvisible:false,
       menuleft:20,
@@ -1895,8 +1881,10 @@ export default {
       isshowSyncbtn:false,
       projectName:'',
       nodeInfoSaveload:false,
-      handlesyncLoad:false//表单同步
-      
+      handlesyncLoad:false,//表单同步
+        isLinkNodes: false,
+        linkNodesLoad: false,
+        checkedLinkNodesKeys: []
     };
   },
   computed: {
@@ -1933,8 +1921,8 @@ export default {
 
       this.defaultExpandedKeys = getStore({ name: this.expandName });
       this.projectName=this.$route.query.projectName
-    
-      
+
+
     },
     loadNode(node, resolve) {
       let pid = 0;
@@ -2062,7 +2050,7 @@ export default {
           };
         } else {
           this.nodeDetail = Object.assign({}, res.data.data);
-        
+
           this.mixRatioTestIds = this.toSplit(res.data.data.mixRatioTestIds);
         }
         this.nodeDetail.type = 1; //	'1'节点 '2'表单
@@ -2199,6 +2187,25 @@ export default {
       });
       this.editEleVisible = true;
     },
+      //关联节点
+      handleLinkNodes(index, row) {
+        this.linkNodesLoad = false
+        this.isLinkNodes = true
+          //checkedLinkNodesKeys
+      },
+      //关联节点被勾选
+      linkNodesCheck(_,data) {
+          console.log(data)
+      },
+      //确定关联
+      linkNodesSave() {
+
+      },
+      //关闭关联弹窗
+      linkNodesClose() {
+          this.isLinkNodes = false
+          this.linkNodesLoad = false
+      },
     handleDelete(index, row) {
       this.$confirm("是否删除  " + row.tableName + "  ?", "删除元素表", {
         distinguishCancelAndClose: true,
@@ -2345,7 +2352,7 @@ export default {
         // if (this.testTreeData.length > 0) {
         //   return;
         // }
-       
+
         this.testTreeLoad = true;
         // getAlltreeTrial(this.projectid, this.id, this.curTreeData.primaryKeyId).then((res) => {
         //   this.testTreeLoad = false;
@@ -2357,17 +2364,17 @@ export default {
         //       //设置勾选相关联试验全选
         //       this.mixRatioTestIds =trialdata.allStatusIds[0];
         //     }
-               
+
         //   }
-          
+
         // });
         let pid=this.curTreeData.primaryKeyId?this.curTreeData.primaryKeyId:this.curTreeData.pKeyId
-        
+
         getAlltree(this.projectid, this.id, pid).then((res) => {
           this.testTreeLoad = false;
           console.log(res.data.data,'data');
             this.testTreeData=res.data.data
-          
+
         });
       }
     },
@@ -2379,7 +2386,7 @@ export default {
       // const newarr = [...checkedKeys, ...halfCheckedKeys];
        const newarr = [...checkedKeys]
       this.nodeDetail.mixRatioTestIds = this.toJoin(newarr);
-     
+
     },
     // filterChange() {
     //   if (this.treeData.length > 0) {
@@ -2408,7 +2415,7 @@ export default {
         type:this.searchType,
         wbsId:this.id,
         projectId: this.projectid
-        
+
         }).then((res)=>{
           let arr = [];
           if (Array.isArray(res.data.data)) {
@@ -2417,12 +2424,12 @@ export default {
           }else{
             this.searchTreeData=[]
           }
-        
+
         })
       }else{
         this.isSearch=false
       }
- 
+
       this.searchtreeLoad=false
     },
     clearSearch(){
@@ -2627,9 +2634,9 @@ export default {
             this.istableType=true;
       }else{
           this.formulaCompVisible = true;
-         
+
       }
-     
+
     },
   //关闭公式弹窗
     closeformulaComp(){
@@ -2665,21 +2672,21 @@ export default {
       else{
         code='wbs_node_type'//质检
       }
-  
+
       getDictionary({
         code
         // code: type === 2 ? "trial_node_type" : "wbs_node_type",
-     
+
       }).then((res) => {
 
           res.data.data.forEach((element) => {
           element.dictKey = Number(element.dictKey);
         });
-        
-       
+
+
         this.nodeTypelist = res.data.data;
 
-      
+
       });
     },
     getMajorDataTypeList() {
@@ -2861,8 +2868,8 @@ export default {
         this.userInfo.tenant_id,
         this.projectid,
         { wbsType: type,}
-     
-        
+
+
       );
       console.log(res);
       if (res.code == 200) {
@@ -3086,7 +3093,7 @@ export default {
           if (!val.k | !val.v) {
             return (tag = false);
           }
-      
+
           //if (!val.name) {
             for (let i = 0; i < this.namelist.length; i++) {
               if (this.namelist[i].k == val.k) {
@@ -3096,7 +3103,7 @@ export default {
             }
           //}
         });
-  
+
         if (tag) {
           this.nodeInfoSaveload=true
           await this.saveOrUpdateBatch({scopeType:10,projectId:this.projectid,nodeId:this.jiedianId,wps:this.nodeInfoTable,type:1,delIds:this.delids});
@@ -3263,7 +3270,7 @@ export default {
         }
       });
       if (tag) {
-         
+
         this.updateBatchNodeTableInfo2(da);
       } else {
         this.$message({
@@ -3340,7 +3347,7 @@ export default {
       this.nodeTypeChange(this.curTreeData.nodeType);
        this.dialogTitle='编辑节点'
       this.setLeftType(2, this.curTreeData, this.curTreeNode);
-     
+
     },
     addNodeHandle() {
       if (!this.curTreeData.id || !this.curTreeNode.id) {
@@ -3355,8 +3362,8 @@ export default {
       this.nodeTypeChange(this.curTreeData.nodeType);
         this.dialogTitle='新增节点'
       this.setLeftType(1, this.curTreeData, this.curTreeNode);
-      
-    
+
+
     },
     copyNodeHandle() {
       if (!this.curTreeData.id || !this.curTreeNode.id) {
@@ -3430,7 +3437,7 @@ export default {
     }else{
       this.$message.warning('请先选择左侧节点')
     }
-      
+
     },
 
     //显示别名弹窗
@@ -3633,7 +3640,7 @@ export default {
       }else{
         this.$message.warning('请先选择左侧节点')
       }
-    
+
     },
 
 
@@ -3653,7 +3660,7 @@ export default {
           }
         })
       }
-      
+
     },
 
     //关联元素弹框
@@ -3736,7 +3743,7 @@ export default {
         }else{
           this.$message.warning('请先选择关联元素')
         }
-     
+
     },
     //树形控件菜单相关方法
     mouseout(){
@@ -3910,7 +3917,28 @@ background: #eee;
   margin-top: -20px;
   margin-left: -20px;
   margin-right: -20px;
- 
+}
+</style>
 
+<style lang="scss">
+.el-dialog.hc-link-nodes-dialog {
+    width: 500px;
+    margin-top: 50px !important;
+    height: calc(100% - 100px);
+    .el-dialog__body {
+        height: calc(100% - 154px);
+        border-top: 1px solid #eee;
+        border-bottom: 1px solid #eee;
+        padding: 14px;
+        overflow: auto;
+    }
+}
+.el-tree.hc-link-nodes-tree .el-tree-node .el-tree-node__content {
+    .el-checkbox {
+        display: none;
+    }
+    .is-leaf + .el-checkbox{
+        display: inline-block;
+    }
 }
 </style>