jinlin
2024-08-02 2fef10f07e65ce6f703c8043085e5728bd311d1e
web/src/views/modules/taskReliability/TimeDiagram.vue
@@ -118,7 +118,7 @@
    },
    mounted() {
      this.getProductList()
      this.init()
    },
    components: {
      ProductModelTree,
@@ -151,19 +151,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
@@ -204,7 +191,6 @@
            },
            // anchor: 'center',
            connectionPoint: 'anchor',
            allowBlank: false,
            snap: {
              radius: 20,
            },
@@ -230,14 +216,6 @@
                      text: ''
                    }
                  },
                  // position: {
                  //   distance: 0.5,
                  //   angle: 180,
                  //   options: {
                  //     keepGradient: true,
                  //     ensureLegibility: true
                  //   }
                  // }
                }],
                zIndex: 0,
              })
@@ -292,6 +270,7 @@
            rowHeight: 100,
          },
        })
        document.getElementById('stencil').appendChild(stencil.container)
        Graph.registerNode(
          'custom-rect',
          {
@@ -345,36 +324,11 @@
                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: [
@@ -686,7 +640,10 @@
        })
        this.graph.on('blank:click', ({cell}) => {
          // this.reset()
          // this.type.value = "grid"
          this.type = 'grid'
          // this.id = cell.id
        })
        this.graph.on('cell:click', ({cell}) => {
@@ -713,16 +670,14 @@
        // 单击node节点
        this.graph.on('node:click', ({node}) => {
          // this.reset()
          if (node.getData().dataId) {
            this.dialogVisible2 = true
            let param = {
              id: node.getData().dataId,
              modelName: node.attr('label/textWrap/text'),
            }
            this.$nextTick(() => {
              this.$refs.rbdEditImg.init(param)
            })
          }
          node.attr('line/stroke', '#5F95FF')
          node.prop('labels/0', {
            attrs: {
              body: {
                stroke: '#5F95FF',
              },
            },
          })
        })
        // 控制连接桩显示/隐藏
        this.graph.on('node:delete', ({view, e}) => {
@@ -873,6 +828,7 @@
        this.dataForm.simulatFrequency = result.data.simulatFrequency
      },
      async getDiagram() {
        this.init()
        let params = {
          productId: this.dataForm.productId,
          taskId: this.dataForm.taskModelId,