| | |
| | | import SearchForm from './searchform' |
| | | import ActionForm from './actionform' |
| | | import ColumnForm from './columnform' |
| | | import ColspanForm from './colspanform' |
| | | import SettingForm from './settingform' |
| | | import EditCard from './editcard' |
| | | import MenuForm from './menuform' |
| | |
| | | closeVisible: false, // 关闭模态框 |
| | | tables: [], // 可用表名 |
| | | selectedTables: [], // 已选表名 |
| | | originMenu: null // 原始菜单 |
| | | originMenu: null, // 原始菜单 |
| | | originActions: null |
| | | } |
| | | |
| | | /** |
| | |
| | | _config = _LongParam |
| | | } |
| | | |
| | | let _oriActions = _config.action |
| | | if (_config.type === 'user' || _config.type === 'system') { |
| | | _oriActions = [] |
| | | } |
| | | |
| | | this.setState({ |
| | | originActions: _oriActions, |
| | | config: _config, |
| | | operaType: _type, |
| | | originMenu: JSON.parse(JSON.stringify({...menu})), |
| | |
| | | } |
| | | |
| | | handleColumn = (card) => { |
| | | if (card.type !== 'colspan') { |
| | | this.setState({ |
| | | visible: true, |
| | | formtemp: 'columns', |
| | |
| | | } |
| | | ] |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | visible: true, |
| | | formtemp: 'columns', |
| | | card: card |
| | | }) |
| | | } |
| | | } |
| | | |
| | | handleSubmit = () => { |
| | |
| | | }) |
| | | } |
| | | |
| | | deleteElement = () => { |
| | | let _config = this.state.config |
| | | _config[this.state.formtemp] = _config[this.state.formtemp].filter(item => { |
| | | if (item.uuid === this.state.card.uuid) { |
| | | deleteElement = (element) => { |
| | | let _this = this |
| | | confirm({ |
| | | content: `确定删除<<${element.card.label}>>吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let _config = JSON.parse(JSON.stringify(_this.state.config)) |
| | | _config[element.type] = _config[element.type].filter(item => { |
| | | if (item.uuid === element.card.uuid) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }) |
| | | this.setState({ |
| | | _this.setState({ |
| | | config: _config, |
| | | [this.state.formtemp + 'loading']: true, |
| | | [element.type + 'loading']: true, |
| | | visible: false |
| | | }, () => { |
| | | this.setState({ |
| | | [this.state.formtemp + 'loading']: false |
| | | _this.setState({ |
| | | [element.type + 'loading']: false |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | |
| | | this.props.handleConfig('template') |
| | | } |
| | | |
| | | /** |
| | | * @description 三级菜单保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | } catch (e) { |
| | |
| | | return |
| | | } |
| | | |
| | | if (this.state.operaType === 'add') { |
| | | if (this.state.operaType === 'add') { // 新建菜单 |
| | | let param = { |
| | | func: 'sPC_TrdMenu_Add', |
| | | ParentID: res.parentId, |
| | |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | } else { // 修改菜单 |
| | | let param = { |
| | | func: 'sPC_TrdMenu_Upt', |
| | | ParentID: res.parentId, |
| | |
| | | duration: 10 |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 保存或修改菜单按钮 |
| | | */ |
| | | submitAction = () => { |
| | | if (!is(fromJS(this.state.originActions), fromJS())) { |
| | | |
| | | } |
| | | } |
| | | |
| | | cancelConfig = () => { |
| | |
| | | placeholder={this.state.dict['header.form.search.placeholder']} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleSearch} |
| | | deleteMenu={this.deleteElement} |
| | | /> : null |
| | | } |
| | | </div> |
| | |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleAction} |
| | | copyElement={this.handleAction} |
| | | deleteMenu={this.deleteElement} |
| | | /> : null |
| | | } |
| | | </div> |
| | |
| | | placeholder={this.state.dict['header.form.column.placeholder']} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleColumn} |
| | | deleteMenu={this.deleteElement} |
| | | /> : null |
| | | } |
| | | </div> |
| | |
| | | visible={this.state.visible} |
| | | width={700} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | footer={[ |
| | | <Button key="delete" type="danger" onClick={this.deleteElement}>{this.state.dict['header.delete']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false }) }}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | | onOk={this.handleSubmit} |
| | | // footer={[ |
| | | // <Button key="delete" type="danger" onClick={this.deleteElement}>{this.state.dict['header.delete']}</Button>, |
| | | // <Button key="cancel" onClick={() => { this.setState({ visible: false }) }}>{this.state.dict['header.cancel']}</Button>, |
| | | // <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> |
| | | // ]} |
| | | destroyOnClose |
| | | > |
| | | {this.state.formtemp === 'search' ? |
| | |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.formtemp === 'columns' ? |
| | | {this.state.formtemp === 'columns' && this.state.card.type !== 'colspan' ? |
| | | <ColumnForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.formtemp === 'columns' && this.state.card.type === 'colspan' ? |
| | | <ColspanForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | columns={this.state.config.columns} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> : null |
| | | } |
| | | </Modal> |
| | | {/* 根据字段名添加显示列及搜索条件 */} |
| | | <Modal |