| | |
| | | { pattern: formRule.func.pattern, message: formRule.func.message }, |
| | | { max: formRule.func.max, message: formRule.func.maxMessage } |
| | | ) |
| | | } else if (item.key === 'outerBlacklist') { |
| | | rules.push( |
| | | { max: 512, message: '最多512个字符' } |
| | | ) |
| | | } else if (item.key === 'output') { |
| | | if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) { |
| | | rules = [{ |
| | |
| | | node: null, |
| | | loading: false, |
| | | status: 0, |
| | | rolelist: [] |
| | | orgs: [] |
| | | } |
| | | |
| | | selectNode = null |
| | |
| | | this.loadData() |
| | | |
| | | if (_config.plot.function === 'edit') { |
| | | this.getrolelist() |
| | | this.getorganizations() |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | getrolelist = () => { |
| | | getorganizations = () => { |
| | | Api.genericInterface({func: 's_get_organizations_v1'}).then(res => { |
| | | if (!res.status) { |
| | | notification.error({ |
| | |
| | | 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, |
| | | disabled: true, |
| | | children: [] |
| | | } |
| | | |
| | | com.departments.forEach(dep => { |
| | | let _dep = { |
| | | key: dep.co_pro_code, |
| | | title: dep.co_pro_name, |
| | | checkable: false, |
| | | disabled: true, |
| | | children: [] |
| | | } |
| | | |
| | | dep.jobs.forEach(job => { |
| | | let _job = { |
| | | key: job.jobcode, |
| | | title: job.jobname, |
| | | checkable: false, |
| | | disabled: true, |
| | | 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 || '', |
| | | } |
| | | |
| | | _job.children.push(_work) |
| | | }) |
| | | } else { |
| | | let _group = { |
| | | key: group.work_group, |
| | | title: group.work_group, |
| | | checkable: false, |
| | | disabled: true, |
| | | 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 || '', |
| | | } |
| | | |
| | | _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) { |
| | | orgs.push(_com) |
| | | } |
| | | }) |
| | | |
| | | this.setState({orgs: orgs}) |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { loading, config, node, rolelist, status } = this.state |
| | | const { loading, config, node, orgs, status } = this.state |
| | | |
| | | let style = {...config.style} |
| | | |
| | |
| | | <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> |
| | |
| | | class NodeUpdate extends Component { |
| | | static propTpyes = { |
| | | node: PropTypes.object, |
| | | rolelist: PropTypes.array |
| | | orgs: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | |
| | | onCancel={() => this.setState({visible: false})} |
| | | destroyOnClose |
| | | > |
| | | <NodeForm node={mknode} data={mkdata} rolelist={this.props.rolelist} handleSubmit={() => this.confirm()} wrappedComponentRef={(inst) => this.nodeRef = inst}/> |
| | | <NodeForm node={mknode} data={mkdata} orgs={this.props.orgs} handleSubmit={() => this.confirm()} wrappedComponentRef={(inst) => this.nodeRef = inst}/> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .member-modal { |
| | | .ant-modal { |
| | | top: 50px; |
| | | } |
| | | .ant-modal-body { |
| | | min-height: 150px; |
| | | max-height: calc(100vh - 200px); |
| | | overflow-y: auto; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar { |
| | | width: 7px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
| | |
| | | ) |
| | | } |
| | | |
| | | const treeData = [ |
| | | { |
| | | key: '0-0', |
| | | title: '0-0', |
| | | checkable: false, |
| | | children: [{ key: '0-0-0', title: '0-0-0' }, { key: '0-0-1', title: '0-0-1' }] |
| | | }, |
| | | { |
| | | key: '0-1', |
| | | title: '0-1', |
| | | checkable: false, |
| | | children: [{ key: '0-1-0', title: '0-1-0' }, { key: '0-1-1', title: '0-1-1' }], |
| | | }, |
| | | { key: '0-2', title: '0-3' }, |
| | | ] |
| | | |
| | | class MemberForm extends Component { |
| | | static propTpyes = { |
| | | node: PropTypes.any, |
| | | data: PropTypes.any, |
| | | rolelist: PropTypes.array |
| | | orgs: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | | visible: false, |
| | | targetKeys: [] |
| | | targetKeys: ['sifuweoifuweifuo'] |
| | | } |
| | | |
| | | onChange = targetKeys => { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { orgs } = this.props |
| | | const { visible, targetKeys } = this.state |
| | | |
| | | return ( |
| | | <> |
| | | <div className="member-input">0人<FormOutlined onClick={() => this.setState({visible: true})} /></div> |
| | | <Modal |
| | | wrapClassName="member-modal" |
| | | title="选择人员" |
| | | visible={visible} |
| | | closable={false} |
| | | maskClosable={false} |
| | | width={800} |
| | | width={1000} |
| | | onOk={this.confirm} |
| | | onCancel={() => this.setState({visible: false})} |
| | | destroyOnClose |
| | | > |
| | | <TreeTransfer dataSource={treeData} targetKeys={targetKeys} onChange={this.onChange} /> |
| | | <TreeTransfer dataSource={orgs} targetKeys={targetKeys} onChange={this.onChange} /> |
| | | </Modal> |
| | | </> |
| | | ) |
| | |
| | | static propTpyes = { |
| | | node: PropTypes.any, |
| | | data: PropTypes.any, |
| | | rolelist: PropTypes.array |
| | | orgs: PropTypes.array |
| | | } |
| | | |
| | | state = {} |
| | | |
| | | handleConfirm = () => { |
| | | const { rolelist } = this.props |
| | | |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | if (values.roleId) { |
| | | values.roleName = '' |
| | | rolelist.forEach(item => { |
| | | if (item.RoleID === values.roleId) { |
| | | values.roleName = item.RoleName |
| | | } |
| | | }) |
| | | } |
| | | if (values.depId) { |
| | | values.depName = '' |
| | | rolelist.forEach(item => { |
| | | if (item.RoleID === values.depId) { |
| | | values.depName = item.RoleName |
| | | } |
| | | }) |
| | | } |
| | | resolve(values) |
| | | } else { |
| | | reject(err) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { node } = this.props |
| | | const { node, orgs } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <MemberForm /> |
| | | <MemberForm orgs={orgs}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | {getFieldDecorator('depId', { |
| | | initialValue: data.depId || '' |
| | | })( |
| | | <MemberForm /> |
| | | <MemberForm orgs={orgs}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |