| | |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = config |
| | | _config.action = Source.baseConfig.action |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | this.setState({config: {...config, [card.groupId]: list}}) |
| | | } else if (type === 'action') { |
| | | if (list.length > config.action.length) { |
| | | list = list.filter(item => !item.origin) |
| | | |
| | | this.handleAction(card) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | handleAction = (card, type) => { |
| | | handleAction = (card) => { |
| | | let ableField = this.props.permFuncField.join(', ') |
| | | let functip = <div> |
| | | <p style={{marginBottom: '5px'}}>{this.state.dict['header.modal.func.innerface'].replace('@ableField', ableField)}</p> |
| | |
| | | </div> |
| | | |
| | | this.setState({ |
| | | modaltype: type === 'copy' ? 'actionCopy' : 'actionEdit', |
| | | modaltype: 'actionEdit', |
| | | card: card, |
| | | formlist: getActionForm(card, functip, this.state.config, this.props.permFuncField) |
| | | }) |
| | |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | | } else if (modaltype === 'actionEdit' || modaltype === 'actionCopy') { |
| | | } else if (modaltype === 'actionEdit') { |
| | | this.actionFormRef.handleConfirm().then(res => { |
| | | let _action = config.action.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | |
| | | return item |
| | | } |
| | | }) |
| | | _action = _action.filter(item => !item.origin) |
| | | |
| | | if (modaltype === 'actionCopy') { |
| | | _action.push(res) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, action: _action}, |
| | |
| | | return item |
| | | } |
| | | }) |
| | | _config.action = _config.action.filter(item => !item.origin) |
| | | |
| | | |
| | | if (!isupdate) { // 操作不是修改,添加元素至列表 |
| | | _config.action.push(btn) |
| | |
| | | if (config.groups[0] && config.groups[0].sublist[0] && config.groups[0].sublist[0].origin) { |
| | | config.groups[0].sublist = config.groups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | } |
| | |
| | | if (_config.tabgroups.length > 1) { |
| | | _config.tabgroups.forEach(group => { |
| | | if (_config[group].length === 0) { |
| | | _config.enabled = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 存在多余的空表单组 |
| | | if (_config.groups.length > 1) { |
| | | _config.groups.forEach(group => { |
| | | if (group.sublist.length === 0) { |
| | | _config.enabled = false |
| | | } |
| | | }) |
| | |
| | | /** |
| | | * @description 设置可配置标签 |
| | | */ |
| | | setSubConfig = (btn, type) => { |
| | | setSubConfig = (btn) => { |
| | | const {menu, btnTab} = this.props |
| | | const { config, originMenu } = this.state |
| | | |
| | |
| | | list={this.state.config.action} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleAction} |
| | | copyElement={(val) => this.handleAction(val, 'copy')} |
| | | deleteMenu={this.deleteElement} |
| | | profileMenu={this.profileAction} |
| | | placeholder={this.state.dict['header.form.action.placeholder']} |
| | |
| | | </Modal> |
| | | {/* 编辑按钮:复制、编辑 */} |
| | | <Modal |
| | | title={modaltype === 'actionEdit' ? this.state.dict['header.modal.action.edit'] : this.state.dict['header.modal.action.copy']} |
| | | visible={modaltype === 'actionEdit' || modaltype === 'actionCopy'} |
| | | title={this.state.dict['header.modal.action.edit']} |
| | | visible={modaltype === 'actionEdit'} |
| | | width={700} |
| | | onCancel={this.editModalCancel} |
| | | footer={[ |
| | | modaltype === 'actionEdit' ? <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button> : null, |
| | | <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button>, |
| | | <Button key="cancel" onClick={this.editModalCancel}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |