From a7892d2ab77735063408c24be9bddfba01740e1d Mon Sep 17 00:00:00 2001
From: wente <329538422@qq.com>
Date: 星期四, 31 十月 2024 14:46:26 +0800
Subject: [PATCH] 时序图模板修改

---
 web/src/views/modules/taskReliability/TimeDiagram.vue |  210 ----------------------------------------------------
 1 files changed, 1 insertions(+), 209 deletions(-)

diff --git a/web/src/views/modules/taskReliability/TimeDiagram.vue b/web/src/views/modules/taskReliability/TimeDiagram.vue
index 4001449..cf48ad0 100644
--- a/web/src/views/modules/taskReliability/TimeDiagram.vue
+++ b/web/src/views/modules/taskReliability/TimeDiagram.vue
@@ -23,8 +23,6 @@
           </zt-form-item>
           <zt-form-item>
             <zt-button @click="getDiagram(null)">鏌ョ湅鏃跺簭鍥�</zt-button>
-<!--            <zt-button @click="graphRightTranslate()">鐢诲竷鍙崇Щ</zt-button>-->
-<!--            <zt-button @click="graphLeftTranslate()">鐢诲竷宸︾Щ</zt-button>-->
           </zt-form-item>
         </el-form>
         <div style="display: flex">
@@ -141,7 +139,6 @@
       window.removeEventListener('scroll', this.handleScroll,true);
     },
     mounted() {
-      // alert(`mounted鎵ц浜哷)
       this.getProductList()
       this.init()
       this.$refs.textDiagram.init()
@@ -158,7 +155,6 @@
       handleScroll(){
         this.graph.getScrollbarPosition()
         let left = this.graph.getScrollbarPosition().left
-        console.log(left,'left left')
         let top = this.graph.getScrollbarPosition().top
         this.$refs.textDiagram.setScroll(top)
         this.$refs.timeDiagramThumbnail.getNodePointX(left,this.bigWidth)
@@ -205,20 +201,6 @@
             minVisibleHeight:300,
             pannable: true,
           },
-          // minimap: {
-          //   enabled: true,
-          //   container: document.getElementById('thumbnail'),
-          //   scalable:false,
-          //   width: document.documentElement.clientWidth - 400,
-          //   height: 150,
-          // },
-          // mousewheel: {
-          //   enabled: true,
-          //   zoomAtMousePosition: true,
-          //   modifiers: 'ctrl',
-          //   minScale: 0.1,
-          //   maxScale: 10,
-          // },
           createEdge() {
             return new Shape.Edge({
               data: {
@@ -277,169 +259,12 @@
                 textVerticalAnchor: 'middle',
                 textWrap: {
                   text: '鏂囧瓧妯℃澘',
-                  width: -10,      // 瀹藉害鍑忓皯 10px
+                  width: 120,      // 瀹藉害鍑忓皯 10px
                   ellipsis: false,  // 鏂囨湰瓒呭嚭鏄剧ず鑼冨洿鏃讹紝鑷姩娣诲姞鐪佺暐鍙�
                   breakWord: true, // 鏄惁鎴柇鍗曡瘝
                 }
               },
             },
-            ports: {...this.ports},
-          },
-          true,
-        )
-
-        Graph.registerNode(
-          'custom-polygon',
-          {
-            inherit: 'polygon',
-            width: 86,
-            height: 56,
-            attrs: {
-              body: {
-                strokeWidth: 1,
-                stroke: '#5F95FF',
-                fill: '#EFF4FF',
-              },
-              text: {
-                fontSize: 20,
-                fill: '#262626',
-              },
-            },
-            ports: {
-              ...this.ports
-              // items: [
-              //   {
-              //     group: 'top',
-              //   },
-              //   {
-              //     group: 'bottom',
-              //   },
-              // ],
-            },
-          },
-          true,
-        )
-        //
-        Graph.registerNode(
-          'custom-circle',
-          {
-            inherit: 'ellipse',
-            width: 120,
-            height: 120,
-            data: {
-              dataId: '',
-              finishDate: ''
-            },
-            attrs: {
-              body: {
-                strokeWidth: 1,
-                stroke: '#5F95FF',
-                fill: '#EFF4FF',
-              },
-              //鏃ユ湡
-              title: {
-                text: '',
-                fontSize: 12,
-                fill: '#262626',
-                refX: 0.5,
-                refY: '100%',
-                refY2: -10,
-                textAnchor: 'middle',
-                textVerticalAnchor: 'bottom',
-              },
-              // 鍚嶇О
-              text: {
-                // fontFamily: '浠垮畫',
-                fontSize: 20,
-                fill: '#262626',
-                textWrap: {
-                  width: 80,      // 瀹藉害涓� 80px鎹㈣
-                  ellipsis: false,  // 鏂囨湰瓒呭嚭鏄剧ず鑼冨洿鏃讹紝鑷姩娣诲姞鐪佺暐鍙�
-                  breakWord: true, // 鏄惁鎴柇鍗曡瘝
-                }
-              },
-            },
-            markup: [
-              {
-                tagName: 'ellipse',
-                selector: 'body',
-              },
-              {
-                tagName: 'text',
-                selector: 'title',
-              },
-              {
-                tagName: 'text',
-                selector: 'text',
-              },
-            ],
-            ports: {...this.ports},
-          },
-          true,
-        )
-        Graph.registerNode(
-          'custom-circle1',
-          {
-            inherit: 'ellipse',
-            width: 65,
-            height: 65,
-            data: {
-              dataId: '',
-              finishDate: ''
-            },
-            attrs: {
-              body: {
-                strokeWidth: 1,
-                stroke: '#5F95FF',
-                fill: '#EFF4FF',
-              },
-              //鏃ユ湡
-              text: {
-                // fontFamily: '浠垮畫',
-                fontSize: 12,
-                text: '鏃ユ湡鑺傜偣',
-                fill: '#262626',
-              },
-            },
-            ports: {...this.ports},
-          },
-          true,
-        )
-        Graph.registerNode(
-          'custom-text',
-          {
-            inherit: 'text-block',
-            width: 86,
-            height: 56,
-            attrs: {
-              body: {
-                strokeWidth: 1,
-                stroke: '#5F95FF',
-                fill: '#EFF4FF',
-              },
-              text: {
-                text: '涓撲笟',
-                fontSize: 20,
-                style: {
-                  color: this.globalGridAttr.nodeColor
-                },
-                refX: '0',
-                refY: -0.5,
-                refY2: 1,
-                textAnchor: 'middle',
-                textVerticalAnchor: 'middle',
-              },
-            },
-            markup: [
-              {
-                tagName: 'rect',
-                selector: 'body',
-              },
-              {
-                tagName: 'text',
-                selector: 'text',
-              },
-            ],
             ports: {...this.ports},
           },
           true,
@@ -460,34 +285,12 @@
         })
 
         this.graph.on('blank:click', ({cell}) => {
-          // this.reset()
-          // this.type.value = "grid"
           this.type = 'grid'
-          // this.id = cell.id
         })
-        this.graph.on('translate', ({ tx, ty }) => {
-          console.log(`褰撳墠鍋忕Щ閲忎綅缃�: x=${tx}, y=${ty}`);
-        });
         this.graph.on('cell:click', ({cell}) => {
-          // this.type.value = cell.isNode() ? "node" : "edge"
           this.type = cell.isNode() ? 'node' : 'edge'
           this.shape = cell.shape
           this.id = cell.id
-          console.log(this.shape, 'this.shape')
-          // this.nodeOpt(this.id, this.globalGridAttr)
-        })
-        //鍗曞嚮杈硅妭鐐�
-        this.graph.on('edge:click', ({edge}) => {
-          // this.reset()
-          edge.attr('line/stroke', '#5F95FF')
-          edge.prop('labels/0', {
-            attrs: {
-              body: {
-                stroke: '#5F95FF',
-              },
-            },
-
-          })
         })
         // 鍗曞嚮node鑺傜偣
         this.graph.on('node:click', ({node}) => {
@@ -617,14 +420,9 @@
           this.diagramJson = JSON.parse(res.data.diagramJson)
           let textDiagramJson = JSON.parse(res.data.textDiagramJson)
           let smallDiagramJson = JSON.parse(res.data.smallDiagramJson)
-          console.log(this.diagramJson, 'this.Diagram json')
-          console.log(smallDiagramJson, 'smallDiagramJson')
           this.graph.fromJSON(this.diagramJson)
-          // this.graph.centerContent()
           this.graph.positionContent('left',{ padding: { left: 0 }})
-          // this.graph.zoomToFit()
           this.bigWidth = this.graph.getContentBBox().width
-          console.log(this.bigWidth,'getContentBBox')
           // this.graph.resize(this.graph.getContentBBox().width,this.graph.getContentBBox().height)
           this.graph.freeze()
           this.$refs.textDiagram.getTextDiagram(textDiagramJson)
@@ -640,13 +438,7 @@
       },
       getPoint(x,smallWidth){
         let pointX = Number((x * (this.bigWidth / smallWidth )).toFixed(0))
-        // console.log(pointX)
         this.graph.setScrollbarPosition(pointX, null)
-        // if(pointX<600){
-        // this.graph.setScrollbarPosition(pointX, null,  { animation: { duration: 400 }})
-        // }else {
-        //   this.graph.scrollToPoint(pointX, null, {animation: {duration: 400}})
-        // }
       }
     }
   }

--
Gitblit v1.9.1