Browse Source

ETA逻辑图优化

hbchen 1 năm trước cách đây
mục cha
commit
2bacf671a4

+ 42 - 15
src/views/sandbox_manage/index_new_version.vue

@@ -110,7 +110,7 @@
     </div>
     <!-- 目录自定义按钮区域 -->
     <div id="custom-button-zone" class="custom-button-zone">
-      <img src="~@/assets/img/data_m/move_ico.png" v-permission="permissionBtn.sandboxPermission.sandbox_classify_move"/>
+      <img src="~@/assets/img/data_m/move_ico.png" style="pointer-events: none;" v-permission="permissionBtn.sandboxPermission.sandbox_classify_move"/>
       <img src="~@/assets/img/sand_new/add_outline.png" class="add-classify-img" v-permission="permissionBtn.sandboxPermission.sandbox_classify_addEdit"/>
       <img src="~@/assets/img/sand_new/edit_outline.png" class="edit-classify-img" v-permission="permissionBtn.sandboxPermission.sandbox_classify_addEdit"/>
       <img src="~@/assets/img/sand_new/delete_outline.png" class="delete-classify-img" v-permission="permissionBtn.sandboxPermission.sandbox_classify_del"/>
@@ -134,11 +134,14 @@
           </el-form-item>
           <el-form-item label="关联品种" prop="ChartPermissionId" v-if="hasVariety">
             <el-cascader 
+              @change="chartPermissionIdChange"
 							:options="classifyArr"
 							:props="classifyProps"
 							v-model="classifyForm.ChartPermissionId" 
 							placeholder="请选择对应品种" 
               id="classifyAddCascader"
+              ref="chartPermissionCascader"
+              :disabled="(classifyForm.SandboxClassifyId && classifyForm.Level!=1) || (!classifyForm.SandboxClassifyId && classifyForm.Level!=0)"
 						/>
           </el-form-item>
         </el-form>
@@ -274,6 +277,7 @@ import { myGraph } from './common/gragh';
         viewSandbox:{},
         activeNode:{},
         addClassifyNodeTid:'',
+        locationNode:'',
         movingRecoveData:{
           targetNode:null,
           treeNode:null,
@@ -289,7 +293,8 @@ import { myGraph } from './common/gragh';
         classifyForm:{
           SandboxClassifyId:0,
           SandboxClassifyName:'',
-          ChartPermissionId:null,
+          ChartPermissionId:0,
+          ChartPermissionName:'',
           ParentId:0,
           Level:0
         },
@@ -373,11 +378,12 @@ import { myGraph } from './common/gragh';
             }else{
               this.treeData = nodesData
             }
-            if(locationNode){
+            let location = locationNode || this.locationNode
+            if(location){
               let searchNode
-              let locationId = locationNode.isCatalogue?locationNode.SandboxClassifyId:locationNode.SandboxId
+              let locationId = location.isCatalogue?location.SandboxClassifyId:location.SandboxId
               if(parentNode){
-                if(locationNode.isCatalogue){
+                if(location.isCatalogue){
                   searchNode=this.zTreeObj.getNodesByParam('SandboxClassifyId',+locationId,parentNode)
                 }else{
                   searchNode=this.zTreeObj.getNodesByParam('SandboxId',+locationId,parentNode)
@@ -393,6 +399,7 @@ import { myGraph } from './common/gragh';
                   this.zTreeObj.selectNode(searchNode[0])
                 })
               }
+              this.locationNode=''
             }else if(this.locationParentIds && this.locationParentIds.length>0){
               // 获取分类列表后需要定位
               requestAnimationFrame(()=>{
@@ -502,7 +509,6 @@ import { myGraph } from './common/gragh';
         }
       },
       zTreeClick(event, treeId, treeNode,clickFlag){
-
         if(clickFlag==1){
           if(this.activeNode.SandboxClassifyId == treeNode.SandboxClassifyId &&
           this.activeNode.SandboxId == treeNode.SandboxId){
@@ -597,6 +603,8 @@ import { myGraph } from './common/gragh';
         this.classifyAddTitle="添加分类"
         this.classifyForm.Level = node.Level
         this.classifyForm.ParentId = node.SandboxClassifyId
+        this.classifyForm.ChartPermissionId = node.ChartPermissionId
+        this.classifyForm.ChartPermissionName = node.ChartPermissionName
         this.classifyAddShow=true
       },
       getParentNodeName(node){
@@ -609,10 +617,14 @@ import { myGraph } from './common/gragh';
       },
       editClassify(e,node){
         e.stopPropagation()
+        this.locationNode = node
         let pNode = node.getParentNode()
         this.lastLevelClassifyName = pNode ? pNode.SandboxClassifyName:''
         this.classifyForm.SandboxClassifyId = node.SandboxClassifyId
+        this.classifyForm.Level = node.Level
         this.classifyForm.SandboxClassifyName = node.SandboxClassifyName
+        this.classifyForm.ChartPermissionId = node.ChartPermissionId
+        this.classifyForm.ChartPermissionName = node.ChartPermissionName
         this.classifyAddTitle="编辑分类"
         this.classifyAddShow=true
       },
@@ -668,6 +680,11 @@ import { myGraph } from './common/gragh';
           }
         });
       },
+      chartPermissionIdChange(value){
+        this.classifyForm.ChartPermissionName=
+        this.$refs.chartPermissionCascader.getCheckedNodes()[0] ?
+        this.$refs.chartPermissionCascader.getCheckedNodes()[0].label+'' || '':''
+      },
       classifyAddSubmit(){
         //提交
         this.$refs.classifyFormRef.validate(valid=>{
@@ -676,17 +693,23 @@ import { myGraph } from './common/gragh';
               //编辑
               let params={
                 SandboxClassifyId:this.classifyForm.SandboxClassifyId,
-                SandboxClassifyName:this.classifyForm.SandboxClassifyName
+                SandboxClassifyName:this.classifyForm.SandboxClassifyName,
+                ChartPermissionId:this.classifyForm.ChartPermissionId,
+                ChartPermissionName:this.classifyForm.ChartPermissionName,
               }
               sandInterface.editSandboxClassify(params).then(res=>{
                 if(res.Ret == 200){
                   this.classifyAddShow=false
                   this.$message.success(this.classifyAddTitle+"成功")
-                  let currentNode = this.zTreeObj.getSelectedNodes()[0]
+                  let parentNode = this.locationNode.getParentNode()
 
-                  currentNode.SandboxClassifyName = this.classifyForm.SandboxClassifyName
-                  this.zTreeObj.updateNode(currentNode)
-                  // this.getSandboxClassify()
+                  if(!parentNode){
+                    this.getSandboxClassify(null,this.locationNode)
+                  }else{
+                    this.zTreeObj.removeChildNodes(parentNode)
+                    this.zTreeObj.expandNode(parentNode,true,false,false,true)
+                    this.zTreeClick(null,'',this.locationNode,1)
+                  }
                 }
               })
             }else{
@@ -695,7 +718,8 @@ import { myGraph } from './common/gragh';
                 SandboxClassifyName:this.classifyForm.SandboxClassifyName,
                 ParentId:this.classifyForm.ParentId,
                 Level:this.classifyForm.Level,
-                ChartPermissionId:this.classifyForm.ChartPermissionId
+                ChartPermissionId:this.classifyForm.ChartPermissionId,
+                ChartPermissionName:this.classifyForm.ChartPermissionName,
               }
               sandInterface.addSandboxClassify(params).then(res=>{
                 if(res.Ret == 200){
@@ -719,7 +743,8 @@ import { myGraph } from './common/gragh';
         this.classifyForm={
           SandboxClassifyId:0,
           SandboxClassifyName:'',
-          ChartPermissionId:null,
+          ChartPermissionId:0,
+          ChartPermissionName:'',
           ParentId:0,
           Level:0
         }
@@ -868,8 +893,10 @@ import { myGraph } from './common/gragh';
                 }
               }else{
                 // 在沙盘图详情删除
-                this.sandboxLocation([result.SandboxClassifyId])
                 this.zTreeObj.removeNode(result)
+                let parentNode = result.getParentNode()
+                this.zTreeObj.selectNode(parentNode)
+                this.zTreeClick(null,'',parentNode,1)
               }
               this.getSandboxList('setCurrentIndex')
               
@@ -1091,7 +1118,7 @@ import { myGraph } from './common/gragh';
       //==============================画布
       // 初始化画布
       init() {
-        const graph = new myGraph('sand-chart-body',null,'','view');
+        const graph = new myGraph('sand-chart-body',null,'view');
         this.graph = graph;
         graph.on('node:mouseenter', ({ node, e }) => {
           let data = node.data

+ 26 - 8
src/views/sandbox_manage/sandFlowNew/index.vue

@@ -74,6 +74,7 @@
             <i slot="prefix" class="el-input__icon el-icon-search"></i>
           </el-input>
           <el-cascader 
+            ref="classifyIdRef"
             :options="treeData"
             :props="{children: 'Children',
               label: 'SandboxClassifyName',
@@ -91,7 +92,7 @@
           v-if="$route.query.SandboxId">返回</el-button>
           <el-button size="large" type="primary" plain @click="copySandHandle" style="margin-right: 20px;min-width: 120px;"
           v-permission="permissionBtn.sandboxPermission.sandbox_addMy">复制图片</el-button>
-          <el-button type="primary" size="large" @click="saveChart" style="min-width: 120px;" v-permission="permissionBtn.sandboxPermission.sandbox_saveView">保存</el-button>
+          <el-button type="primary" size="large" @click="saveChart(null)" style="min-width: 120px;" v-permission="permissionBtn.sandboxPermission.sandbox_saveView">保存</el-button>
         </div>
       </div>
       <div class="sand-mainBody-chart" id="sand-mainBody-chart">
@@ -499,6 +500,7 @@ import addLInkDia from './components/addLInkDia.vue';
           SandboxClassifyId:'',
           SandboxId:+this.$route.query.SandboxId || 0,
         },
+        parentIds:[],
         treeData:[],
         lockLoding: null,
         loopTimer:null,
@@ -583,6 +585,7 @@ import addLInkDia from './components/addLInkDia.vue';
       document.getElementById('sand-mainBody-chart').removeEventListener("drop",this.edgeDrop)
       this.popoverDom.removeEventListener('mouseenter',this.clearPopoverTimeout)
       this.popoverDom.removeEventListener('mouseleave',this.closePopover)
+      clearInterval(this.loopTimer)
     },
     methods: {
       getSandboxClassify(){
@@ -601,7 +604,12 @@ import addLInkDia from './components/addLInkDia.vue';
             this.sandSaveParams.SandboxClassifyId=res.Data.SandboxClassifyId
             this.initData = JSON.parse(res.Data.Content)
             this.mindmapAssistData.mindmapDataUse = res.Data.MindmapData?JSON.parse(res.Data.MindmapData):[]
-            this.styleActive = res.Data.style||3
+            this.styleActive = res.Data.Style||1
+            setTimeout(()=>{
+              if(this.$refs.classifyIdRef && this.$refs.classifyIdRef.getCheckedNodes()[0]){
+                this.parentIds=this.$refs.classifyIdRef.getCheckedNodes()[0].path
+              }
+            },50)
             this.autoSave();
           }
         })
@@ -618,9 +626,12 @@ import addLInkDia from './components/addLInkDia.vue';
             Content: JSON.stringify(this.graph.toJSON()),
             PicUrl:'',
             MindmapData:this.mindmapAssistData.mindmapDataUse.length>0?JSON.stringify(this.mindmapAssistData.mindmapDataUse):'',
-            style:this.styleActive||1
+            Style:this.styleActive||1
           }).then((res) => {
             if(res.Ret !== 200) return
+            if(this.$refs.classifyIdRef && this.$refs.classifyIdRef.getCheckedNodes()[0]){
+              this.parentIds=this.$refs.classifyIdRef.getCheckedNodes()[0].path
+            }
           });
         }, 10000);
       },
@@ -838,7 +849,11 @@ import addLInkDia from './components/addLInkDia.vue';
         this.addLinkShow=false
       },
       backList(){
-        sessionStorage.setItem("sandboxEditBack",'423,390,135')
+        let ids = ''
+        if(this.parentIds && this.parentIds.length>0){
+          ids=this.parentIds.join(',')+','+this.sandSaveParams.SandboxId
+        }
+        sessionStorage.setItem("sandboxEditBack",ids)
         this.$router.push({path:"/sandlist"})
       },
       copySandHandle: _.debounce(function() {
@@ -913,7 +928,7 @@ import addLInkDia from './components/addLInkDia.vue';
             
         })
       },500),
-      saveChart: _.debounce(function(routerType='goEdit', callback=null) {
+      saveChart: _.debounce(function(callback=null) {
         if(!this.sandSaveParams.Name) 
           return this.$message.warning('请填写逻辑图名称');
         if(!this.sandSaveParams.SandboxClassifyId) 
@@ -921,7 +936,7 @@ import addLInkDia from './components/addLInkDia.vue';
 
         if(!this.graph.toJSON().cells.length) return this.$message.warning('请绘制画布内容');
 
-        const { Name, SandboxClassifyId,SandboxId} = this.sandSaveParams;
+        const { Name, SandboxClassifyId} = this.sandSaveParams;
 
         this.lockLoding = this.$loading({
           lock: true,
@@ -945,17 +960,20 @@ import addLInkDia from './components/addLInkDia.vue';
             PicUrl: Data?Data.ResourceUrl:'',
             SvgData: dataUri,
             MindmapData:JSON.stringify(this.mindmapAssistData.mindmapDataUse),
-            style:this.styleActive||1
+            Style:this.styleActive||1
           })
 
           if(Ret !== 200){
             this.lockLoding.close();
             return;
           }
+          if(this.$refs.classifyIdRef && this.$refs.classifyIdRef.getCheckedNodes()[0]){
+            this.parentIds=this.$refs.classifyIdRef.getCheckedNodes()[0].path
+          }
           this.$message.success(`${SandboxId ? '编辑成功' : '保存成功'}`);
           this.lockLoding.close();
           //如果是新增,直接跳转到编辑页面
-          if(!SandboxId && routerType=='goEdit'){
+          if(!SandboxId){
             this.$router.replace({
               path: '/sandflow',
               query: {