xyc
2024-08-02 a43fd8f15c7da7f4a14ba4ebb79970dad4ce1fae
web/src/views/modules/taskReliability/TimeDiagram.vue
@@ -118,7 +118,6 @@
    },
    mounted() {
      this.getProductList()
      this.init()
    },
    components: {
      ProductModelTree,
@@ -151,19 +150,6 @@
              })
            }
          },
          // translating: {
          //   restrict(view) {
          //     const cell = view.cell
          //     if (cell.isNode()) {
          //       const parent = cell.getParent()
          //       if (parent) {
          //         return parent.getBBox()
          //       }
          //     }
          //
          //     return null
          //   },
          // },
          onToolItemCreated({tool}) {
            const handle = tool
            const options = handle.options
@@ -173,9 +159,6 @@
          },
          autoResize: true,
          history: true,
          // panning: {
          //   enabled: true,
          // },
          scroller: {
            enabled: true,
            pageVisible: true,
@@ -230,21 +213,10 @@
                      text: ''
                    }
                  },
                  // position: {
                  //   distance: 0.5,
                  //   angle: 180,
                  //   options: {
                  //     keepGradient: true,
                  //     ensureLegibility: true
                  //   }
                  // }
                }],
                zIndex: 0,
              })
            },
            // validateConnection({targetMagnet}) {
            //   return !!targetMagnet
            // },
          },
          highlighting: {
            magnetAdsorbed: {
@@ -345,133 +317,14 @@
                stroke: '#5F95FF',
                fill: '#EFF4FF',
              },
              // title:{
              //   text:'',
              //   refX: 40,
              //   refY: 38,
              //   fontSize: 20,
              //   fill: '#262626',
              //   'text-anchor': 'start',
              // },
              text: {
                // refX: 40,
                // refY: 20,
                fontSize: 20,
                fill: '#262626',
                // 'text-anchor': 'start',
              },
            },
            // markup: [
            //   {
            //     tagName: 'polygon',
            //     selector: 'body',
            //   },
            //   {
            //     tagName: 'text',
            //     selector: 'title',
            //   },
            //   {
            //     tagName: 'text',
            //     selector: 'text',
            //   },
            // ],
            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,
        )
@@ -873,6 +726,7 @@
        this.dataForm.simulatFrequency = result.data.simulatFrequency
      },
      async getDiagram() {
        this.init()
        let params = {
          productId: this.dataForm.productId,
          taskId: this.dataForm.taskModelId,