From b106dc00fc0ff552e0f86a2f7fa675e296ba2287 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 27 三月 2024 21:37:39 +0800 Subject: [PATCH] 2024-03-27 --- src/tabviews/custom/components/chart/antv-X6/index.jsx | 35 +++++++++++++++++++++++++++-------- 1 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx index bbbc859..4e155ba 100644 --- a/src/tabviews/custom/components/chart/antv-X6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx @@ -1,8 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, Tooltip, message, Modal, notification, Switch } from 'antd' -import { UndoOutlined, RedoOutlined, VerticalAlignTopOutlined, VerticalAlignBottomOutlined, SaveOutlined, ZoomInOutlined, ZoomOutOutlined, OneToOneOutlined, QuestionCircleOutlined, ClearOutlined } from '@ant-design/icons' +import { Spin, Tooltip, message, Modal, notification, Switch, Button } from 'antd' +import { UndoOutlined, RedoOutlined, VerticalAlignTopOutlined, VerticalAlignBottomOutlined, ZoomInOutlined, ZoomOutOutlined, OneToOneOutlined, QuestionCircleOutlined, ClearOutlined } from '@ant-design/icons' import { Graph, Shape } from '@antv/x6' import { Stencil } from '@antv/x6-plugin-stencil' import { Transform } from '@antv/x6-plugin-transform' @@ -1544,6 +1544,26 @@ this.mkGraph.zoomTo(1) } + close = () => { + const { config } = this.state + + let nodes = this.mkGraph.toJSON() + + if (!is(fromJS(nodes.cells), fromJS(this.cells))) { + confirm({ + title: '娴佺▼鍥惧凡淇敼锛岀‘瀹氬叧闂悧?', + okText: '纭畾', + cancelText: '鍙栨秷', + onOk() { + MKEmitter.emit('closeTabView', config.$pageId) + }, + onCancel() {} + }) + } else { + MKEmitter.emit('closeTabView', config.$pageId) + } + } + save = () => { const { BID, plot, status, flowname, flowcode } = this.state @@ -1638,6 +1658,7 @@ loading: false, status: _status }) + this.cells = nodes.cells } else { notification.error({ top: 92, @@ -1659,6 +1680,7 @@ loading: false, status: _status }) + this.cells = nodes.cells } } else { notification.error({ @@ -2270,12 +2292,9 @@ </div> <div className="flow-name">{flowname}</div> <div className="right-tool"> - <Tooltip title="鍚敤/鍋滅敤"> - <Switch size="large" style={{marginRight: '10px'}} checked={status === 10} onChange={this.changeStatus} /> - </Tooltip> - <Tooltip title="淇濆瓨"> - <SaveOutlined style={{marginRight: '10px'}} onClick={this.save}/> - </Tooltip> + <Switch size="large" checked={status === 10} checkedChildren="鍚�" unCheckedChildren="鍋�" onChange={this.changeStatus} /> + <Button className="save" onClick={this.save}>淇濆瓨</Button> + <Button className="close" onClick={this.close}>鍏抽棴</Button> </div> </div> <div className="canvas" style={{width: '100%', minHeight: config.plot.height, height: config.plot.height}} id={config.uuid + 'canvas'}> -- Gitblit v1.8.0