king
2023-06-27 656ea3139db54b8dc9a29b8cb239d0f0df9a6c05
src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx
File was renamed from src/menu/components/chart/antv-X6/nodeupdate/index.jsx
@@ -52,20 +52,16 @@
    }
    if (node.shape === 'edge') {
      // let fontSize = 14
      // if (node.attrs && node.attrs.text) {
      //   fontSize = node.attrs.text.fontSize || 14
      // }
      let stroke = ''
      if (node.attrs && node.attrs.line) {
        stroke = node.attrs.line.stroke || '#A2B1C3'
        stroke = node.attrs.line.stroke || '#000000'
      }
      let strokeWidth = ''
      if (node.attrs && node.attrs.line) {
        strokeWidth = node.attrs.line.strokeWidth || 2
        strokeWidth = node.attrs.line.strokeWidth || 1
      }
      let lineType = 'solid'
@@ -110,19 +106,132 @@
            {value: 'solid', text: '实线'},
            {value: 'dash', text: '虚线'}
          ]
        }
      ]
    } else if (node.shape === 'lane') {
      let fontFill = '#262626'
      if (node.attrs && node.attrs.text) {
        fontFill = node.attrs.text.fill || '#262626'
      }
      let fill = ''
      if (node.attrs && node.attrs['name-rect']) {
        fill = node.attrs['name-rect'].fill || ''
      }
      let width = 100
      if (node.size) {
        width = node.size.width || 100
      }
      let height = 100
      if (node.size) {
        height = node.size.height || 100
      }
      let fontSize = 12
      if (node.attrs && node.attrs.text) {
        fontSize = node.attrs.text.fontSize || 12
      }
      let stroke = ''
      if (node.attrs && node.attrs.body) {
        stroke = node.attrs.body.stroke || ''
      }
      return [
        {
          type: 'title',
          label: '标题'
        },
        // {
        //   type: 'number',
        //   field: 'fontSize',
        //   label: '字号',
        //   initval: fontSize
        // },
        // {
        //   type: 'color',
        //   field: 'fontFill',
        //   label: '颜色',
        //   initval: fontFill
        // }
        {
          type: 'text',
          field: 'title',
          label: '标签',
          initval: title
        },
        {
          type: 'title',
          label: '样式'
        },
        {
          type: 'color',
          field: 'stroke',
          label: '边框',
          initval: stroke
        },
        {
          type: 'number',
          field: 'width',
          label: '宽度',
          help: '宽度不可小于100',
          initval: width
        },
        {
          type: 'number',
          field: 'height',
          label: '高度',
          help: '高度不可小于100',
          initval: height
        },
        {
          type: 'title',
          label: '标题样式'
        },
        {
          type: 'color',
          field: 'fill',
          label: '背景',
          initval: fill
        },
        {
          type: 'number',
          field: 'fontSize',
          label: '字号',
          initval: fontSize
        },
        {
          type: 'color',
          field: 'fontFill',
          label: '颜色',
          initval: fontFill
        }
      ]
    } else if (node.shape === 'mk-text') {
      let fontFill = '#262626'
      if (node.attrs && node.attrs.text) {
        fontFill = node.attrs.text.fill || '#262626'
      }
      let fontSize = 12
      if (node.attrs && node.attrs.text) {
        fontSize = node.attrs.text.fontSize || 12
      }
      return [
        {
          type: 'title',
          label: '内容'
        },
        {
          type: 'text',
          field: 'title',
          label: '标签',
          initval: title
        },
        {
          type: 'title',
          label: '文本样式'
        },
        {
          type: 'number',
          field: 'fontSize',
          label: '字号',
          initval: fontSize
        },
        {
          type: 'color',
          field: 'fontFill',
          label: '颜色',
          initval: fontFill
        }
      ]
    } else {
      let fontFill = '#262626'
@@ -186,7 +295,17 @@
          field: 'fontFill',
          label: '颜色',
          initval: fontFill
        }
        },
        {
          type: 'title',
          label: '自定义信息'
        },
        {
          type: 'text',
          field: 'mksign',
          label: '标记',
          initval: node.mksign || ''
        },
      ]
    }
  }
@@ -194,6 +313,12 @@
  change = (value, key) => {
    if (key === 'fontSize') {
      if (typeof(value) !== 'number' || value < 0) {
        return
      }
    } else if (key === 'width' || key === 'height') {
      if (typeof(value) !== 'number') {
        return
      } else if (value < 100) {
        return
      }
    }
@@ -225,7 +350,7 @@
      } else if (item.type === 'number') {
        fields.push(
          <Col span={24} key={index}>
            <Form.Item label={item.label}>
            <Form.Item label={item.label} help={item.help || null}>
              <InputNumber defaultValue={item.initval} precision={0} min={0} onChange={(value) => this.change(value, item.field)} />
            </Form.Item>
          </Col>
@@ -278,9 +403,11 @@
  render() {
    return (
      <Form className="node-edit-form">
        <Row>{this.getFields()}</Row>
      </Form>
      <div className="node-edit-form-wrap">
        <Form className="node-edit-form">
          <Row>{this.getFields()}</Row>
        </Form>
      </div>
    )
  }
}