| | |
| | | }) |
| | | |
| | | const setCurrentUrl = () => { |
| | | // if (!!(window.history && window.history.pushState)) { |
| | | // window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | // window.location.reload() |
| | | // } |
| | | if (!!(window.history && window.history.pushState)) { |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | } |
| | | } |
| | | |
| | | let GlobMap = new Map() |
| | |
| | | |
| | | state = { |
| | | dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS, |
| | | thawmenulist: null, // 已冻结的二级菜单 |
| | | type: '', // 操作类型,新建或编辑菜单 |
| | | tabview: '', // 选择模板窗口(template)、基础表格配置(CommonTable)、表单(Modal)、子表(SubTable) |
| | | editMenu: null, // 编辑菜单 |
| | | editAction: null, // 编辑按钮 |
| | | editTab: null, // 编辑标签 |
| | | thawMvisible: false, // 解除冻结模态框 |
| | | confirmLoading: false, // 提交中。。。 |
| | | selectTemp: '', // 选择模板 |
| | | usedTemplates: null, // 已使用模板列表 |
| | | tempSearchKey: '', // 菜单名称过滤值 |
| | | loading: false, // 编辑菜单或使用已使用模板时,获取配置信息 |
| | | preview: null, // 图片预览url |
| | | pretemplate: null, // 预览模板 |
| | | btnParam: null, // 编辑按钮的配置信息 |
| | | menulist: null, // 编辑中的菜单 |
| | | sysTemplates: sysTemps // 系统模板 |
| | | thawmenulist: null, // 已冻结的二级菜单 |
| | | type: '', // 操作类型,新建或编辑菜单 |
| | | thawMvisible: false, // 解除冻结模态框 |
| | | confirmLoading: false, // 提交中。。。 |
| | | selectTemp: '', // 选择模板 |
| | | usedTemplates: null, // 已使用模板列表 |
| | | tempSearchKey: '', // 菜单名称过滤值 |
| | | loading: false, // 编辑菜单或使用已使用模板时,获取配置信息 |
| | | preview: null, // 图片预览url |
| | | pretemplate: null, // 预览模板 |
| | | btnParam: null, // 编辑按钮的配置信息 |
| | | menulist: null, // 编辑中的菜单 |
| | | sysTemplates: sysTemps, // 系统模板 |
| | | tabview: '', // 选择模板窗口(template)、基础表格配置(CommonTable)、表单(Modal)、子表(SubTable) |
| | | editMenu: null, // 编辑菜单 |
| | | editAction: null, // 编辑按钮 |
| | | editTab: null, // 编辑标签 |
| | | subConfig: null // 子配置信息 |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | return |
| | | } |
| | | this.setState({tabview: 'template', type: 'add'}) |
| | | this.setState({ |
| | | tabview: 'template', |
| | | editMenu: { |
| | | MenuID: '', |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | type: '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | isSubtable: '', // 是否为主子表 |
| | | ParentID: this.props.supMenu.MenuID |
| | | } |
| | | }) |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | } else if (type === 'thaw') { |
| | | if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) { |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 使用模板 |
| | | * 1、使用系统模板时,使用系统配置 |
| | | * 2、使用已有菜单模板时,获取菜单配置信息,标记为user(复制菜单按钮) |
| | | */ |
| | | useTemplate = (template, useType) => { |
| | | const { type, editMenu } = this.state |
| | | const { editMenu } = this.state |
| | | |
| | | new Promise(resolve => { |
| | | if (useType === 'sys') { |
| | |
| | | }) |
| | | } |
| | | }).then(res => { |
| | | if (!res) { |
| | | if (!res) { // 错误时,重置状态 |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | // 选择模板:添加菜单时 |
| | | if (type === 'add') { |
| | | this.setState({ |
| | | tabview: template.type, |
| | | loading: false, |
| | | editMenu: { |
| | | MenuID: Utils.getuuid(), |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | id: this.props.menulist.length, |
| | | src: '', |
| | | text: '', |
| | | type: template.type, |
| | | PageParam: {OpenType: 'newtab', Template: template.type}, |
| | | LongParam: template.baseconfig, |
| | | isSubtable: template.isSubtable, // 是否为主子表 |
| | | ParentID: this.props.supMenu.MenuID |
| | | } |
| | | }) |
| | | } else { |
| | | let _PageParam = {OpenType: editMenu.PageParam.OpenType || 'newtab', Template: template.type} |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | tabview: template.type, |
| | | editMenu: {...editMenu, LongParam: template.baseconfig, PageParam: _PageParam, type: template.type} |
| | | }) |
| | | // 选择模板:添加菜单时(不存在menuId) |
| | | let _PageParam = { |
| | | OpenType: editMenu.PageParam ? editMenu.PageParam.OpenType : 'newtab', |
| | | Template: template.type |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | tabview: template.type, |
| | | editMenu: { |
| | | ...editMenu, |
| | | type: template.type, |
| | | PageParam: _PageParam, |
| | | LongParam: template.baseconfig, |
| | | isSubtable: template.isSubtable |
| | | } |
| | | }) |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | tabHandleConfig = () => { |
| | | |
| | | handleView = (param) => { |
| | | this.setState({ |
| | | tabview: '' |
| | | }, () => { |
| | | if (param) { |
| | | this.setState(param) |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | } else { |
| | | document.getElementById('root').style.overflowY = 'unset' |
| | | } |
| | | }) |
| | | } |
| | | |
| | | handleSubConfig = (item, originMenu, config, type) => { |
| | |
| | | </div>} |
| | | {this.state.tabview === 'CommonTable' && |
| | | <ComTableConfig |
| | | type={this.state.type} |
| | | menu={this.state.editMenu} |
| | | supMenuList={this.props.supMenuList} |
| | | handleConfig={this.handleConfig} |
| | | reloadmenu={() => {this.props.reload()}} |
| | | handleSubConfig={this.handleSubConfig} |
| | | handleView={this.handleView} |
| | | /> |
| | | } |
| | | {this.state.tabview === 'Modal' && |
| | |
| | | menu={this.state.editMenu} |
| | | editTab={this.state.editTab} |
| | | editAction={this.state.editAction} |
| | | btnParam={this.state.btnParam} |
| | | handleConfig={this.handleConfig} |
| | | subConfig={this.state.subConfig} |
| | | handleView={this.handleView} |
| | | /> |
| | | } |
| | | {this.state.tabview === 'SubTable' && |
| | | <SubTable |
| | | config={this.state.editTab} |
| | | menu={this.state.editMenu} |
| | | handleConfig={this.handleConfig} |
| | | handleSubConfig={this.handleSubConfig} |
| | | editTab={this.state.editTab} |
| | | config={this.state.subConfig} |
| | | handleView={this.handleView} |
| | | /> |
| | | } |
| | | {this.state.tabview === 'FormTab' && |
| | |
| | | 'header.menu.table.add': 'Add tables', |
| | | 'header.menu.table.placeholder': 'Please select a table', |
| | | 'header.menu.config.placeholder': 'Configuration has been modified, do you want to save configuration information ?', |
| | | 'header.menu.config.notsave': '菜单尚未保存,请保存菜单配置!', |
| | | 'header.menu.config.update': '菜单配置已修改,请保存!', |
| | | 'header.menu.form': 'The form', |
| | | 'header.menu.form.add': 'Add form', |
| | | 'header.menu.form.configurable': 'Configuration of forms', |
| | |
| | | 'header.form.popform': '弹窗(表单)', |
| | | 'header.form.popview': '弹窗(页面)', |
| | | 'header.form.tab': '标签页', |
| | | 'header.form.linkTab': '关联标签', |
| | | 'header.form.subTab': '下级标签', |
| | | 'header.form.currenttab': '当前菜单', |
| | | 'header.form.excelIn': 'Excel导入', |
| | | 'header.form.excelOut': 'Excel导出', |
| | |
| | | 'header.menu.table.add': '添加表名', |
| | | 'header.menu.table.placeholder': '请选择表名', |
| | | 'header.menu.config.placeholder': '配置已修改,是否保存配置信息?', |
| | | 'header.menu.config.notsave': '菜单尚未保存,请保存菜单配置!', |
| | | 'header.menu.config.update': '菜单配置已修改,请保存!', |
| | | 'header.menu.form': '表单', |
| | | 'header.menu.form.add': '添加表单', |
| | | 'header.menu.form.configurable': '表单配置', |
| | |
| | | 'header.form.popform': '弹窗(表单)', |
| | | 'header.form.popview': '弹窗(页面)', |
| | | 'header.form.tab': '标签页', |
| | | 'header.form.linkTab': '关联标签', |
| | | 'header.form.subTab': '下级标签', |
| | | 'header.form.currenttab': '当前菜单', |
| | | 'header.form.excelIn': '导入Excel', |
| | | 'header.form.excelOut': '导出Excel', |
| | |
| | | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | type: PropTypes.string, |
| | | menu: PropTypes.any, |
| | | supMenuList: PropTypes.array, |
| | | reloadmenu: PropTypes.func, |
| | | handleConfig: PropTypes.func, |
| | | handleSubConfig: PropTypes.func, |
| | | supMenuList: PropTypes.array |
| | | handleView: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu } = this.props |
| | | |
| | | console.log(menu) |
| | | let _LongParam = menu.LongParam |
| | | let _config = '' |
| | | |
| | |
| | | } else { |
| | | _config = _LongParam |
| | | } |
| | | |
| | | // 配置默认值,兼容 |
| | | _config.tabs = _config.tabs || [] |
| | | _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | _config.setting.subtabs = _config.setting.subtabs || [] |
| | | _config.Template = 'CommonTable' |
| | | |
| | | let _oriActions = [] |
| | | if (_config.type === 'user') { |
| | |
| | | } |
| | | |
| | | item.uuid = uuid |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | _config.tabs = _config.tabs || [] |
| | | _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | _config.setting.subtabs = _config.setting.subtabs || [] |
| | | // 重置标签ID |
| | | _config.tabgroups.forEach(group => { |
| | | _config[group] = _config[group].map(tab => { |
| | | tab.uuid = Utils.getuuid() |
| | | |
| | | return tab |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | label: this.state.dict['header.form.linkTab'], |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [] |
| | |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'subtabs', |
| | | label: '下级标签', |
| | | label: this.state.dict['header.form.subTab'], |
| | | initVal: subtabs, |
| | | required: false, |
| | | options: menus |
| | |
| | | * @description 三级菜单切换模板 |
| | | */ |
| | | changeTemplate = () => { |
| | | this.props.handleConfig('template') |
| | | this.props.handleView({tabview: 'template'}) |
| | | } |
| | | |
| | | /** |
| | |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleConfig('') |
| | | this.props.handleView() |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.props.handleConfig('') |
| | | _this.props.handleView() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleConfig('') |
| | | this.props.handleView() |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | |
| | | /** |
| | | * @description 设置可配置按钮 |
| | | */ |
| | | setSubConfig = (btn, type) => { |
| | | setSubConfig = (item, type) => { |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | |
| | | let isAdd = false |
| | | |
| | | if ( |
| | | (config.search[0] && config.search[0].origin) || |
| | | (config.action[0] && config.action[0].origin) || |
| | | (config.columns[0] && config.columns[0].origin) || |
| | | (config.tabs[0] && config.tabs[0].origin) |
| | | ) { |
| | | isAdd = true |
| | | } |
| | | |
| | | if (isAdd) { |
| | | if (!originMenu.MenuID) { // menuID不存在时,为新建菜单,提示菜单尚未保存 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未保存,请保存菜单配置!', |
| | | message: this.state.dict['header.menu.config.notsave'], |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | |
| | | ParentID: res.parentId |
| | | } |
| | | |
| | | if (!is(fromJS(originMenu), fromJS(_originMenu))) { |
| | | if (!is(fromJS(originMenu), fromJS(_originMenu))) { // 菜单信息变化时,提示保存 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单配置已修改,请保存!', |
| | | message: this.state.dict['header.menu.config.update'], |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let uuid = '' |
| | | let _type = type |
| | | if (type === 'button' && btn.OpenType === 'popview') { |
| | | _type = 'tab' |
| | | } else if (type === 'button' && (btn.OpenType === 'tab' || btn.OpenType === 'blank')) { |
| | | _type = 'tabview' |
| | | } |
| | | |
| | | if (_type === 'tab') { |
| | | uuid = btn.linkTab |
| | | } else { |
| | | uuid = btn.uuid |
| | | } |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) |
| | | try { |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_type === 'tab' && !_LongParam) { |
| | | _LongParam = { |
| | | ...btn, |
| | | uuid: btn.linkTab, |
| | | create: true |
| | | } |
| | | } |
| | | |
| | | this.props.handleSubConfig(btn, originMenu, _LongParam, _type) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | console.log(item) |
| | | // 菜单信息验证通过后,跳转子配置页面 |
| | | let _view = '' |
| | | let uuid = item.uuid |
| | | let isbutton = true |
| | | |
| | | if (type === 'button' && item.OpenType === 'pop') { |
| | | _view = 'Modal' // 表单页面 |
| | | } else if (type === 'button' && (item.OpenType === 'tab' || item.OpenType === 'blank')) { |
| | | _view = item.tabTemplate // 新标签页模板 |
| | | } else if (type === 'button' && item.OpenType === 'popview') { |
| | | _view = item.tabType // 新弹窗标签模板 |
| | | uuid = item.linkTab |
| | | isbutton = false |
| | | } else if (type === 'tab') { |
| | | _view = item.type // 标签模板 |
| | | uuid = item.linkTab |
| | | isbutton = false |
| | | } |
| | | |
| | | let param = { |
| | | editMenu: _originMenu, |
| | | editTab: !isbutton ? item : '', |
| | | editAction: isbutton ? item : '', |
| | | subConfig: '', |
| | | tabview: _view |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) |
| | | try { |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam && param.tabview === 'Modal' && _LongParam.type === 'Modal') { |
| | | param.subConfig = _LongParam |
| | | } else if (_LongParam && param.tabview === 'FormTab' && _LongParam.type === 'FormTab') { |
| | | param.subConfig = _LongParam |
| | | } else if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') { |
| | | param.subConfig = _LongParam |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }, () => { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单基本信息已修改,请保存!', |
| | | message: this.state.dict['header.menu.config.update'], |
| | | duration: 10 |
| | | }) |
| | | }) |
| | |
| | | } |
| | | Api.getSystemConfig(_param) |
| | | }) |
| | | this.props.handleConfig('') |
| | | this.props.handleView() |
| | | } |
| | | |
| | | render () { |
| | |
| | | class CommonTableBaseData { |
| | | baseConfig = { |
| | | type: 'system', |
| | | Template: 'CommonTable', |
| | | enabled: false, |
| | | setting: { |
| | | actionfixed: false, |
| | |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | editTab: PropTypes.any, |
| | | btnParam: PropTypes.object, |
| | | subConfig: PropTypes.any, |
| | | editAction: PropTypes.object, |
| | | handleConfig: PropTypes.func |
| | | handleView: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | * 4、设置按钮基本信息 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const {menu, editAction, editTab, btnParam} = this.props |
| | | const {menu, editAction, editTab, subConfig} = this.props |
| | | |
| | | let _config = '' |
| | | let _menu = { |
| | | let _menu = { // 上级菜单是三级菜单或标签页 |
| | | type: editTab ? editTab.Template : menu.type, |
| | | tables: editTab ? editTab.tables : menu.LongParam.tables, |
| | | MenuID: editTab ? editTab.uuid : menu.MenuID, |
| | |
| | | MenuName: editTab ? editTab.tabName : menu.MenuName |
| | | } |
| | | |
| | | if (btnParam) { |
| | | _config = btnParam |
| | | if (subConfig) { |
| | | _config = subConfig |
| | | } else { |
| | | _config = JSON.parse(JSON.stringify((Source.baseConfig))) |
| | | } |
| | |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = (state, callback) => { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | // 页面返回 |
| | | handleViewBack = () => { |
| | | const {menu, editTab} = this.props |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: editTab, |
| | | editAction: '', |
| | | subConfig: '', |
| | | tabview: editTab ? editTab.Template : menu.LongParam.Template |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | cancelConfig = () => { |
| | | const { menu, config, originConfig } = this.state |
| | | const { config, originConfig } = this.state |
| | | let _this = this |
| | | |
| | | let isOrigin = config.fields.filter(item => item.origin).length > 0 |
| | |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.props.handleConfig(menu.type) |
| | | _this.handleViewBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleConfig(menu.type) |
| | | this.handleViewBack() |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { menu, config } = this.state |
| | | const { config } = this.state |
| | | |
| | | return ( |
| | | <div className="modal-form-board"> |
| | |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | | <Button key="save" className="mk-btn mk-green" loading={this.state.closeloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig(menu.type)}}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | |
| | | |
| | | class SubTableConfig extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, |
| | | menu: PropTypes.any, |
| | | handleConfig: PropTypes.func, |
| | | editTab: PropTypes.any, |
| | | config: PropTypes.any, |
| | | handleSubConfig: PropTypes.func, |
| | | supMenuList: PropTypes.array |
| | | } |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | const { config, editTab } = this.props |
| | | |
| | | let _config = null |
| | | |
| | | if (!config || config.create) { |
| | | if (!config) { |
| | | _config = JSON.parse(JSON.stringify(Source.baseConfig)) |
| | | if (config.uuid) { |
| | | _config.uuid = config.uuid |
| | | _config.tabName = config.label |
| | | } |
| | | _config.uuid = editTab.linkTab |
| | | _config.tabName = editTab.label |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = JSON.parse(JSON.stringify(config)) |
| | | } |
| | | |
| | | let _oriActions = [] |
| | | |
| | | if (_config.type === 'user') { |
| | | _config.action = _config.action.map(item => { |
| | | let uuid = Utils.getuuid() |
| | | |
| | | if (item.OpenType === 'pop') { // 含有子配置项的按钮 |
| | | _oriActions.push({ |
| | | prebtn: JSON.parse(JSON.stringify(item)), |
| | |
| | | } |
| | | |
| | | item.uuid = uuid |
| | | |
| | | return item |
| | | }) |
| | | } |
| | |
| | | this.setState = (state, callback) => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | // 页面返回 |
| | | handleViewBack = () => { |
| | | const {menu} = this.props |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: '', |
| | | editAction: '', |
| | | subConfig: '', |
| | | tabview: menu ? menu.LongParam.Template : '' |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | } |
| | | |
| | | // changeTemplate = () => { |
| | | // this.props.handleConfig('template') |
| | | // } |
| | | |
| | | /** |
| | | * @description 标签页保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { delActions } = this.state |
| | | const { delActions, originConfig } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | |
| | | if (config.search[0] && config.search[0].origin) { |
| | | config.search = config.search.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.columns[0] && config.columns[0].origin) { |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | if (originConfig.isAdd) { |
| | | if (config.search[0] && config.search[0].origin) { |
| | | config.search = config.search.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.columns[0] && config.columns[0].origin) { |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | } |
| | | } |
| | | |
| | | let _LongParam = '' |
| | |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | |
| | | |
| | | let btnParam = { |
| | | func: 'sPC_Button_AddUpt', |
| | | Type: 40, |
| | | ParentID: _config.uuid, |
| | | MenuNo: res.tabNo, |
| | | Template: 'SubTable', |
| | |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | let view = this.props.menu ? this.props.menu.type : '' |
| | | this.props.handleConfig(view) |
| | | this.handleViewBack() |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | const { config, originConfig } = this.state |
| | | |
| | | let _this = this |
| | | let isAdd = false |
| | | |
| | | if ( |
| | | (config.search[0] && config.search[0].origin) || |
| | | (config.action[0] && config.action[0].origin) || |
| | | (config.columns[0] && config.columns[0].origin) |
| | | ) { |
| | | isAdd = true |
| | | } |
| | | |
| | | if (isAdd) { |
| | | if (originConfig.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let view = _this.props.menu ? _this.props.menu.type : '' |
| | | _this.props.handleConfig(view) |
| | | _this.handleViewBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | let view = this.props.menu ? this.props.menu.type : '' |
| | | this.props.handleConfig(view) |
| | | this.handleViewBack() |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | dontsave = () => { |
| | | let view = this.props.menu ? this.props.menu.type : '' |
| | | this.props.handleConfig(view) |
| | | } |
| | | |
| | | render () { |
| | | const { modaltype } = this.state |
| | | const configAction = this.state.config.action.filter(_action => |
| | |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | | <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={this.dontsave}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button> |
| | | ]} |
| | | destroyOnClose |