From 46773828b8c46e450a67eb1fc5e6124d87d97ab6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 23 九月 2023 19:51:11 +0800 Subject: [PATCH] 2023-09-23 --- src/tabviews/custom/components/chart/antv-X6/index.jsx | 162 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 133 insertions(+), 29 deletions(-) diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx index 6e05732..97525bc 100644 --- a/src/tabviews/custom/components/chart/antv-X6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx @@ -386,6 +386,8 @@ node: null, loading: false, status: 0, + flowname: '', + flowcode: '', orgs: [] } @@ -487,7 +489,7 @@ title: com.OrgName, shortName: com.ShortName, checkable: false, - disabled: true, + selectable: false, children: [] } let _works = [] @@ -497,7 +499,7 @@ key: dep.co_pro_code, title: dep.co_pro_name, checkable: false, - disabled: true, + selectable: false, children: [] } @@ -506,7 +508,7 @@ key: job.jobcode, title: job.jobname, checkable: false, - disabled: true, + selectable: false, children: [] } @@ -535,7 +537,7 @@ key: group.work_group, title: group.work_group, checkable: false, - disabled: true, + selectable: false, children: [] } @@ -620,6 +622,8 @@ this.setState({ status: item.status || 0, + flowname: item.works_flow_name || '', + flowcode: item.works_flow_code || '', loading: false }) @@ -995,11 +999,29 @@ this.setState({node: null}) }) + graph.on('edge:connected', ({ isNew, edge }) => { + if (!isNew) return + + let target = edge.getTargetCell() + + if (!target) return + + let mkdata = target.prop('mkdata') + + if (target.prop('mknode') === 'end') { + edge.prop('mknode', 'endEdge') + } else if (target.prop('mknode') === 'start') { + edge.prop('mknode', 'startEdge') + } + if (mkdata) { + edge.prop('mkdata', {status: mkdata.status, statusName: mkdata.statusName}) + } + }) const r1 = graph.createNode({ shape: 'mk-rect', mknode: 'start', - mkdata: {status: 0, statusName: '寮�濮�'}, + mkdata: {status: 0, statusName: '鏈彁浜�'}, attrs: { body: { rx: 20, @@ -1097,7 +1119,7 @@ const r8 = graph.createNode({ shape: 'mk-rect', mknode: 'end', - mkdata: {status: '', statusName: '缁撴潫'}, + mkdata: {status: 888, statusName: '宸插畬鎴�'}, attrs: { body: { rx: 20, @@ -1523,7 +1545,7 @@ } save = () => { - const { BID, plot, status } = this.state + const { BID, plot, status, flowname, flowcode } = this.state if (!BID) { Modal.error({ @@ -1536,10 +1558,23 @@ let _status = status if (plot.subtype === 'xflow' && status === 10) { - let start_num = nodes.cells.filter(cell => cell.mknode === 'start').length - let end_num = nodes.cells.filter(cell => cell.mknode === 'end').length + let start_num = 0 + let end_num = 0 + let unvalid = false - if (start_num !== 1 || end_num !== 1) { + nodes.cells.forEach(item => { + if (item.mknode === 'start') { + start_num++ + } else if (item.mknode === 'end') { + end_num++ + } else if (item.shape === 'edge' && item.mknode !== 'endEdge' && item.mknode !== 'startEdge') { + if (!item.mkdata.members || item.mkdata.members.length === 0) { + unvalid = true + } + } + + }) + if (start_num !== 1 || end_num !== 1 || unvalid) { _status = 0 } } @@ -1557,18 +1592,52 @@ ID: BID, BID: '' } + + let ssoParam = { + func: 's_works_flow_param_sso_upt_v6', + status: status, + ID: BID, + works_flow_code: flowcode, + works_flow_name: flowname, + long_param: window.btoa(window.encodeURIComponent(JSON.stringify(nodes))) + } Api.genericInterface(param).then(res => { if (res.status) { - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛锛�', - duration: 2 - }) - this.setState({ - loading: false, - status: _status - }) + if (plot.subtype === 'xflow') { + Api.getSystemConfig(ssoParam).then(result => { + if (result.status) { + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛锛�', + duration: 2 + }) + this.setState({ + loading: false, + status: _status + }) + } else { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + this.setState({ + loading: false + }) + } + }) + } else { + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛锛�', + duration: 2 + }) + this.setState({ + loading: false, + status: _status + }) + } } else { notification.error({ top: 92, @@ -1891,20 +1960,23 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (plot.click === 'menu') { let menuId = plot.menu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && plot.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (plot.MenuID) { + menu = { MenuID: plot.MenuID, MenuName: plot.MenuName, - MenuNo: plot.MenuNo, type: plot.tabType } - } else if (!newtab) { - return } - MKEmitter.emit('modifyTabs', {...newtab, param: {$BID: sign}}, true) + if (!menu) return + + menu.param = {$BID: sign} + + MKEmitter.emit('modifyTabs', menu, true) } else { MKEmitter.emit('resetSelectLine', config.uuid, sign, {}) } @@ -1917,8 +1989,22 @@ if (plot.subtype === 'xflow' && _status === 10) { let nodes = this.mkGraph.toJSON() - let start_num = nodes.cells.filter(cell => cell.mknode === 'start').length - let end_num = nodes.cells.filter(cell => cell.mknode === 'end').length + + let start_num = 0 + let end_num = 0 + let unvalidId = '' + + nodes.cells.forEach(item => { + if (item.mknode === 'start') { + start_num++ + } else if (item.mknode === 'end') { + end_num++ + } else if (item.shape === 'edge' && item.mknode !== 'endEdge' && item.mknode !== 'startEdge') { + if (!item.mkdata.members || item.mkdata.members.length === 0) { + unvalidId = item.id + } + } + }) if (start_num === 0) { notification.warning({ @@ -1944,6 +2030,23 @@ message: '缁撴潫鑺傜偣涓嶅彲娣诲姞澶氫釜锛�', duration: 2 }) + } else if (unvalidId) { + let edge = this.mkGraph.getCellById(unvalidId) + + let node = edge.getTargetCell() + + let title = '' + if (node.attrs && node.attrs.text) { + title = node.attrs.text.text + '' + } else if (node.mkdata) { + title = '鐘舵�侊細' + node.mkdata.status + ' - ' + node.mkdata.statusName + } + + notification.warning({ + top: 92, + message: '杩炴帴锛�' + title + '锛夌殑绾挎湭璁剧疆瀹℃壒浜猴紒', + duration: 2 + }) } else { this.setState({status: _status}) } @@ -1967,7 +2070,7 @@ } render() { - const { loading, config, node, orgs, status } = this.state + const { loading, config, node, orgs, status, flowname } = this.state let style = {...config.style} @@ -2033,6 +2136,7 @@ <QuestionCircleOutlined /> </Tooltip> </div> + <div className="flow-name">{flowname}</div> <div className="right-tool"> <Tooltip title="鍚敤/鍋滅敤"> <Switch size="small" style={{marginRight: '10px'}} checked={status === 10} onChange={this.changeStatus} /> -- Gitblit v1.8.0