| | |
| | | { |
| | | inherit: 'rect', |
| | | width: 66, |
| | | height: 36, |
| | | height: 40, |
| | | attrs: { |
| | | body: { |
| | | strokeWidth: 1, |
| | |
| | | { |
| | | inherit: 'polygon', |
| | | width: 66, |
| | | height: 36, |
| | | height: 40, |
| | | attrs: { |
| | | body: { |
| | | strokeWidth: 1, |
| | |
| | | { |
| | | inherit: 'polygon', |
| | | width: 66, |
| | | height: 36, |
| | | height: 40, |
| | | attrs: { |
| | | body: { |
| | | strokeWidth: 1, |
| | |
| | | 'mk-circle', |
| | | { |
| | | inherit: 'circle', |
| | | width: 36, |
| | | height: 36, |
| | | width: 40, |
| | | height: 40, |
| | | attrs: { |
| | | body: { |
| | | strokeWidth: 1, |
| | |
| | | { |
| | | inherit: 'ellipse', |
| | | width: 66, |
| | | height: 36, |
| | | height: 40, |
| | | attrs: { |
| | | body: { |
| | | strokeWidth: 1, |
| | |
| | | 'mk-star', |
| | | { |
| | | inherit: 'polygon', |
| | | width: 36, |
| | | height: 36, |
| | | width: 40, |
| | | height: 40, |
| | | points: '100,10 40,198 190,78 10,78 160,198', |
| | | attrs: { |
| | | body: { |
| | |
| | | { |
| | | inherit: 'text-block', |
| | | width: 66, |
| | | height: 36, |
| | | height: 40, |
| | | text: '文本域', |
| | | attrs: { |
| | | body: { |
| | |
| | | node: null, |
| | | loading: false, |
| | | status: 0, |
| | | rolelist: [] |
| | | flowname: '', |
| | | flowcode: '', |
| | | orgs: [] |
| | | } |
| | | |
| | | selectNode = null |
| | |
| | | this.loadData() |
| | | |
| | | if (_config.plot.function === 'edit') { |
| | | this.getrolelist() |
| | | this.getorganizations() |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | getrolelist = () => { |
| | | Api.getSystemConfig({func: 's_get_rolelist', OrderCol: 'RoleID desc', PageIndex: 1, PageSize: 1000}).then(res => { |
| | | getorganizations = () => { |
| | | Api.genericInterface({func: 's_get_organizations_v1'}).then(res => { |
| | | if (!res.status) { |
| | | notification.error({ |
| | | top: 92, |
| | |
| | | return |
| | | } |
| | | |
| | | this.setState({rolelist: res.data || []}) |
| | | let orgs = [] |
| | | res.organizations && res.organizations.forEach(com => { |
| | | let _com = { |
| | | key: com.OrgCode, |
| | | title: com.OrgName, |
| | | shortName: com.ShortName, |
| | | checkable: false, |
| | | selectable: false, |
| | | children: [] |
| | | } |
| | | let _works = [] |
| | | |
| | | com.departments.forEach(dep => { |
| | | let _dep = { |
| | | key: dep.co_pro_code, |
| | | title: dep.co_pro_name, |
| | | checkable: false, |
| | | selectable: false, |
| | | children: [] |
| | | } |
| | | |
| | | dep.jobs.forEach(job => { |
| | | let _job = { |
| | | key: job.jobcode, |
| | | title: job.jobname, |
| | | checkable: false, |
| | | selectable: false, |
| | | children: [] |
| | | } |
| | | |
| | | job.work_group.forEach(group => { |
| | | if (group.work_group === 'normal') { |
| | | group.workers.forEach(work => { |
| | | let _work = { |
| | | key: work.worker_id, |
| | | title: work.workername, |
| | | email: work.email || '', |
| | | images: work.images || '', |
| | | mob: work.mob || '', |
| | | sex: work.sex || '', |
| | | work_grade: work.work_grade || '', |
| | | worker_id: work.worker_id || '', |
| | | workercode: work.workercode || '', |
| | | workername: work.workername || '', |
| | | parentIds: [com.OrgCode, dep.co_pro_code, job.jobcode], |
| | | parentNames: [com.OrgName, dep.co_pro_name, job.jobname] |
| | | } |
| | | |
| | | _job.children.push(_work) |
| | | }) |
| | | } else { |
| | | let _group = { |
| | | key: group.work_group, |
| | | title: group.work_group, |
| | | checkable: false, |
| | | selectable: false, |
| | | children: [] |
| | | } |
| | | |
| | | group.workers.forEach(work => { |
| | | let _work = { |
| | | key: work.worker_id, |
| | | title: work.workername, |
| | | email: work.email || '', |
| | | images: work.images || '', |
| | | mob: work.mob || '', |
| | | sex: work.sex || '', |
| | | work_grade: work.work_grade || '', |
| | | worker_id: work.worker_id || '', |
| | | workercode: work.workercode || '', |
| | | workername: work.workername || '', |
| | | parentIds: [com.OrgCode, dep.co_pro_code, job.jobcode, group.work_group], |
| | | parentNames: [com.OrgName, dep.co_pro_name, job.jobname, group.work_group] |
| | | } |
| | | |
| | | _group.children.push(_work) |
| | | }) |
| | | |
| | | if (_group.children.length > 0) { |
| | | _job.children.push(_group) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | if (_job.children.length > 0) { |
| | | _dep.children.push(_job) |
| | | } |
| | | }) |
| | | |
| | | if (_dep.children.length > 0) { |
| | | _com.children.push(_dep) |
| | | } |
| | | }) |
| | | |
| | | if (_com.children.length > 0) { |
| | | _com.works = _works |
| | | orgs.push(_com) |
| | | } |
| | | }) |
| | | |
| | | this.setState({orgs: orgs}) |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | status: item.status || 0, |
| | | flowname: item.works_flow_name || '', |
| | | flowcode: item.works_flow_code || '', |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | |
| | | 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: '未提交'}, |
| | | attrs: { |
| | | body: { |
| | | rx: 20, |
| | |
| | | } |
| | | }) |
| | | const r4 = graph.createNode({ |
| | | shape: 'mk-rect', |
| | | attrs: { |
| | | body: { |
| | | rx: 0, |
| | | ry: 0, |
| | | fill: '#fff7e6', |
| | | stroke: '#fa8c16' |
| | | }, |
| | | text: { |
| | | text: '节点' |
| | | } |
| | | } |
| | | }) |
| | | const r5 = graph.createNode({ |
| | | shape: 'mk-polygon', |
| | | attrs: { |
| | | body: { |
| | |
| | | } |
| | | } |
| | | }) |
| | | const r5 = graph.createNode({ |
| | | const r6 = graph.createNode({ |
| | | shape: 'mk-paral', |
| | | attrs: { |
| | | body: { |
| | |
| | | } |
| | | } |
| | | }) |
| | | const r6 = graph.createNode({ |
| | | const r7 = graph.createNode({ |
| | | shape: 'mk-circle', |
| | | attrs: { |
| | | body: { |
| | |
| | | } |
| | | }) |
| | | |
| | | const r7 = graph.createNode({ |
| | | const r8 = graph.createNode({ |
| | | shape: 'mk-rect', |
| | | mknode: 'end', |
| | | mkdata: {status: 888, statusName: '已完成'}, |
| | | attrs: { |
| | | body: { |
| | | rx: 20, |
| | |
| | | } |
| | | }) |
| | | |
| | | stencil.load([r1, r2, r3, r4, r5, r6, r7], 'group1') |
| | | stencil.load([r1, r2, r3, r4, r5, r6, r7, r8], 'group1') |
| | | |
| | | const p1 = graph.createNode({ |
| | | shape: 'mk-ellipse', |
| | |
| | | } |
| | | |
| | | save = () => { |
| | | const { BID, plot, status } = this.state |
| | | const { BID, plot, status, flowname, flowcode } = this.state |
| | | |
| | | if (!BID) { |
| | | Modal.error({ |
| | |
| | | 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 |
| | | } |
| | | } |
| | |
| | | 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, |
| | |
| | | } else { |
| | | this.selectNode.attr('line/strokeDasharray', 0) |
| | | } |
| | | } else if (key === 'mkdata') { |
| | | this.selectNode.prop('mkdata', value) |
| | | } |
| | | } else if (node.shape === 'lane') { |
| | | if (key === 'title') { |
| | |
| | | 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, {}) |
| | | } |
| | |
| | | const { plot, status } = this.state |
| | | |
| | | let _status = status === 10 ? 0 : 10 |
| | | let nodes = this.mkGraph.toJSON() |
| | | |
| | | 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 nodes = this.mkGraph.toJSON() |
| | | |
| | | 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({ |
| | | top: 92, |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | 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 { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { loading, config, node, rolelist, status } = this.state |
| | | const { loading, config, node, orgs, status, flowname } = this.state |
| | | |
| | | let style = {...config.style} |
| | | |
| | |
| | | <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} /> |
| | |
| | | <div id={config.uuid + 'container'} className="mk-container"></div> |
| | | <div className="mk-node-edit"> |
| | | <div className="header">设置</div> |
| | | {!node ? <div className="empty">未选中</div> : <NodeUpdate node={node} rolelist={rolelist} onChange={this.changeProps}/>} |
| | | {!node ? <div className="empty">未选中</div> : <NodeUpdate node={node} orgs={orgs} onChange={this.changeProps}/>} |
| | | </div> |
| | | </div> |
| | | </div> |