| | |
| | | class MenuDesign extends Component { |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | MenuId: this.props.match.params.MenuId, |
| | | MenuType: '', |
| | | MenuId: '', |
| | | ParentId: '', |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | tableFields: [], |
| | | activeKey: 'basedata', |
| | | menuloading: false, |
| | | oriConfig: null, |
| | | openEdition: '', |
| | | config: null, |
| | | editElem: null |
| | | editElem: null, |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | this.getMenuParam() |
| | | // this.testFunc() |
| | | try { |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | | |
| | | this.setState({ |
| | | MenuType: param.MenuType, |
| | | MenuId: param.MenuId, |
| | | ParentId: param.ParentId || '', |
| | | MenuName: param.MenuName || '', |
| | | MenuNo: param.MenuNo || '', |
| | | }, () => { |
| | | this.getMenuParam() |
| | | }) |
| | | } catch { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单信息解析错误!', |
| | | duration: 5 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | |
| | | submitConfig = () => { |
| | | const { config, openEdition } = this.state |
| | | const { config, MenuType, openEdition } = this.state |
| | | |
| | | if (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId) { |
| | | if (!config.MenuID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (MenuType === 'custom' && (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: _config.fstMenuId, |
| | | FstID: _config.fstMenuId || '', |
| | | SndID: _config.parentId, |
| | | ParentID: _config.parentId, |
| | | MenuID: _config.uuid, |
| | |
| | | } |
| | | |
| | | getMenuParam = () => { |
| | | const { MenuId, ParentId, MenuName, MenuNo } = this.state |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: this.props.match.params.MenuId |
| | | MenuID: MenuId |
| | | }).then(result => { |
| | | if (result.status) { |
| | | let config = null |
| | |
| | | if (!config) { |
| | | config = { |
| | | version: 1.0, |
| | | uuid: this.props.match.params.MenuId, |
| | | MenuID: this.props.match.params.MenuId, |
| | | parentId: this.props.match.params.ParentId, |
| | | uuid: MenuId, |
| | | MenuID: MenuId, |
| | | parentId: ParentId, |
| | | Template: 'CustomPage', |
| | | easyCode: '', |
| | | enabled: false, |
| | | MenuName: this.props.match.params.MenuName, |
| | | MenuNo: this.props.match.params.MenuNo, |
| | | MenuName: MenuName, |
| | | MenuNo: MenuNo, |
| | | tables: [], |
| | | components: [], |
| | | style: {backgroundColor: '#ffffff', backgroundImage: ''} |
| | | } |
| | | } else { |
| | | config.uuid = this.props.match.params.MenuId |
| | | config.MenuID = this.props.match.params.MenuId |
| | | config.uuid = MenuId |
| | | config.MenuID = MenuId |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | verifyConfig = (show) => { |
| | | const { config } = this.state |
| | | const { config, MenuType } = this.state |
| | | let error = '' |
| | | |
| | | if (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId) { |
| | | if (!config.MenuID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | | duration: 5 |
| | | }) |
| | | return 'false' |
| | | return |
| | | } else if (MenuType === 'custom' && (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | config.components.forEach(item => { |
| | | if (!error && item.setting) { |
| | | if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) { |
| | | error = `组件《${item.name}》未设置数据源` |
| | | error = `组件《${item.name}》未设置数据源!` |
| | | } else if (item.setting.interType === 'system' && item.setting.execute === 'false' && item.scripts.length === 0) { |
| | | error = `组件《${item.name}》未设置数据源` |
| | | error = `组件《${item.name}》未设置数据源!` |
| | | } else if (item.setting.interType && !item.setting.primaryKey) { |
| | | error = `组件《${item.name}》未设置主键` |
| | | error = `组件《${item.name}》未设置主键!` |
| | | } |
| | | } |
| | | if (!error && (item.type === 'bar' || item.type === 'line' || item.type === 'pie')) { |
| | | if (!item.plot.Xaxis) { |
| | | error = `组件《${item.name}》图表字段尚未设置!` |
| | | } |
| | | } |
| | | }) |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { activeKey, dict, MenuId, config } = this.state |
| | | const { activeKey, MenuType, dict, MenuId, config, ParentId, MenuName, MenuNo } = this.state |
| | | |
| | | return ( |
| | | <ConfigProvider locale={_locale}> |
| | |
| | | {/* 基本信息 */} |
| | | <Panel header={dict['mob.basemsg']} key="basedata"> |
| | | {/* 菜单信息 */} |
| | | <MenuForm |
| | | {MenuType === 'custom' ? <MenuForm |
| | | dict={dict} |
| | | config={config} |
| | | MenuId={MenuId} |
| | | parentId={this.props.match.params.ParentId} |
| | | MenuName={this.props.match.params.MenuName} |
| | | MenuNo={this.props.match.params.MenuNo} |
| | | parentId={ParentId} |
| | | MenuName={MenuName} |
| | | MenuNo={MenuNo} |
| | | initMenuList={this.initMenuList} |
| | | updateConfig={this.updateConfig} |
| | | /> |
| | | /> : null} |
| | | {/* 表名添加 */} |
| | | {config ? <TableComponent config={config} updatetable={this.updatetable}/> : null} |
| | | </Panel> |