| | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | editTab: PropTypes.any, |
| | | btnParam: PropTypes.object, |
| | | editAction: PropTypes.object, |
| | | handleConfig: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | menu: null, // 上级菜单,三级菜单或标签 |
| | | dict: CommonDict, // 字典 |
| | | config: null, // 页面配置,包括模板类型、模态框设置、添加表名、表单列表 |
| | | visible: false, // 表单编辑模态框,显示控制 |
| | |
| | | closeVisible: false, // 关闭模态框 |
| | | tables: [], // 可用表名 |
| | | selectedTables: [], // 已选表名 |
| | | originConfig: null, // 原始菜单 |
| | | originConfig: null, // 原始菜单 |
| | | groupVisible: false, // 全局配置模态框 |
| | | curgroup: null // 当前组,新建或编辑 |
| | | } |
| | |
| | | * 4、设置按钮基本信息 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const {menu, editAction} = this.props |
| | | console.log(menu) |
| | | let _config = '' |
| | | const {menu, editAction, editTab, btnParam} = this.props |
| | | |
| | | if (editAction.pageParam) { |
| | | _config = editAction.pageParam |
| | | let _config = '' |
| | | let _menu = { |
| | | type: editTab ? editTab.Template : menu.type, |
| | | tables: editTab ? editTab.tables : menu.LongParam.tables, |
| | | MenuID: editTab ? editTab.uuid : menu.MenuID, |
| | | MenuNo: editTab ? editTab.tabNo : menu.MenuNo, |
| | | MenuName: editTab ? editTab.tabName : menu.MenuName |
| | | } |
| | | |
| | | if (btnParam) { |
| | | _config = btnParam |
| | | } else { |
| | | _config = JSON.parse(JSON.stringify((Source.baseConfig))) |
| | | } |
| | |
| | | _config.setting.title = editAction.label |
| | | } |
| | | |
| | | if (menu.LongParam.tables && menu.LongParam.tables.length > 0 && _config.tables.length === 0) { |
| | | // 主菜单已有选择的表名,模态框没有表名时,复制主菜单表名 |
| | | _config.tables = menu.LongParam.tables |
| | | } |
| | | // 主菜单已有选择的表名,模态框没有表名时,复制主菜单表名 |
| | | _config.tables = _config.tables.length === 0 ? _menu.tables : _config.tables |
| | | |
| | | this.setState({ |
| | | menu: _menu, |
| | | config: _config, |
| | | selectedTables: _config.tables || [], |
| | | originConfig: JSON.parse(JSON.stringify(_config)), |
| | |
| | | type: 'text', |
| | | key: 'supMenu', |
| | | label: this.state.dict['header.menu.supMenu'], |
| | | initVal: menu.MenuName, |
| | | initVal: _menu.MenuName, |
| | | required: true, |
| | | readonly: true |
| | | }, |
| | |
| | | tableColumns: _columns |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = (state, callback) => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | submitConfig = () => { |
| | | const { menu, editAction } = this.props |
| | | const { config } = this.state |
| | | const { editAction } = this.props |
| | | const { config, menu } = this.state |
| | | |
| | | if ((!config.groups[0] && !config.fields[0]) || (config.fields[0] && config.fields[0].origin)) { |
| | | notification.warning({ |
| | |
| | | } |
| | | |
| | | cancelConfig = () => { |
| | | const { menu } = this.props |
| | | const { config, originConfig } = this.state |
| | | const { menu, config, originConfig } = this.state |
| | | let _this = this |
| | | |
| | | let isOrigin = config.fields.filter(item => item.origin).length > 0 |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { menu } = this.props |
| | | const { config } = this.state |
| | | const { menu, config } = this.state |
| | | |
| | | return ( |
| | | <div className="modal-form-board"> |