| | |
| | | |
| | | const MenuForm = asyncComponent(() => import('./menuform')) |
| | | const Transfer = asyncComponent(() => import('@/pc/transfer')) |
| | | const PopviewController = asyncComponent(() => import('@/menu/popview')) |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | const MenuShell = asyncComponent(() => import('@/pc/menushell')) |
| | | const ViewNodes = asyncComponent(() => import('@/menu/viewnodes')) |
| | |
| | | const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) |
| | | |
| | | sessionStorage.setItem('isEditState', 'true') |
| | | sessionStorage.setItem('editMenuType', 'menu') // 编辑菜单类型 |
| | | |
| | | sessionStorage.setItem('appType', 'pc') // 应用类型 |
| | | sessionStorage.setItem('typename', 'pc') |
| | | document.body.className = '' |
| | | window.GLOB.UserComponentMap = new Map() // 缓存用户自定义组件 |
| | | window.GLOB.TabsMap = new Map() // 缓存用户操作的标签页 |
| | | window.GLOB.CacheIndependent = new Map() |
| | | window.GLOB.urlFields = [] // url变量 |
| | | window.GLOB.customMenu = null // 保存菜单信息 |
| | | |
| | | const memberLevel = Utils.getMemberLevel() |
| | | |
| | |
| | | MenuNo: '', |
| | | delButtons: [], |
| | | copyButtons: [], |
| | | thawButtons: [], |
| | | activeKey: 'basedata', |
| | | menuloading: false, |
| | | oriConfig: null, |
| | | config: null, |
| | | popBtn: null, // 弹窗标签页 |
| | | visible: false, |
| | | customComponents: [], |
| | | settingshow: sessionStorage.getItem('settingshow') !== 'false', |
| | | controlshow: sessionStorage.getItem('controlshow') !== 'false', |
| | |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | if (memberLevel < 30) return |
| | | |
| | | sessionStorage.setItem('editMenuType', 'menu') // 编辑菜单类型 |
| | | |
| | | window.GLOB.UserComponentMap = new Map() // 缓存用户自定义组件 |
| | | window.GLOB.TabsMap = new Map() // 缓存用户操作的标签页 |
| | | window.GLOB.CacheIndependent = new Map() |
| | | window.GLOB.urlFields = [] // url变量 |
| | | window.GLOB.customMenu = null // 保存菜单信息 |
| | | |
| | | try { |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | | |
| | |
| | | } |
| | | MKEmitter.addListener('delButtons', this.delButtons) |
| | | MKEmitter.addListener('modalStatus', this.modalStatus) |
| | | MKEmitter.addListener('thawButtons', this.thawButtons) |
| | | MKEmitter.addListener('copyButtons', this.copyButtons) |
| | | MKEmitter.addListener('changePopview', this.initPopview) |
| | | MKEmitter.addListener('changeEditMenu', this.changeEditMenu) |
| | |
| | | } |
| | | MKEmitter.removeListener('delButtons', this.delButtons) |
| | | MKEmitter.removeListener('modalStatus', this.modalStatus) |
| | | MKEmitter.removeListener('thawButtons', this.thawButtons) |
| | | MKEmitter.removeListener('copyButtons', this.copyButtons) |
| | | MKEmitter.removeListener('changePopview', this.initPopview) |
| | | MKEmitter.removeListener('changeEditMenu', this.changeEditMenu) |
| | |
| | | } |
| | | |
| | | triggerMenuSave = () => { |
| | | if (this.state.visible) return |
| | | |
| | | this.submitConfig() |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | handleBack = () => { |
| | | this.setState({popBtn: null, delButtons: [], copyButtons: [], thawButtons: []}, () => { |
| | | sessionStorage.setItem('editMenuType', 'menu') |
| | | window.GLOB.customMenu = this.state.config |
| | | this.setState({visible: false}) |
| | | }) |
| | | } |
| | | |
| | | updateComponentStyle = (parentId, keys, style) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | copyButtons = (items) => { |
| | | this.setState({copyButtons: [...this.state.copyButtons, ...items]}) |
| | | } |
| | | |
| | | thawButtons = (item) => { |
| | | this.setState({thawButtons: [...this.state.thawButtons, item]}) |
| | | } |
| | | |
| | | initPopview = (card, btn) => { |
| | | const { oriConfig, config } = this.state |
| | |
| | | return |
| | | } |
| | | |
| | | btn.config = fromJS(config).toJS() |
| | | btn.component = card |
| | | let _btn = fromJS(btn).toJS() |
| | | _btn.MenuName = config.MenuName + '-' + card.name + '-' + btn.label |
| | | _btn.ParentMenuID = config.uuid |
| | | |
| | | sessionStorage.setItem('editMenuType', 'popview') // 编辑弹窗标签 |
| | | |
| | | this.setState({popBtn: btn, visible: true}) |
| | | this.props.history.push('/popdesign/' + window.btoa(window.encodeURIComponent((JSON.stringify(_btn))))) |
| | | } |
| | | |
| | | closeView = () => { |
| | |
| | | item.action && item.action.forEach(btn => { |
| | | if (btn.hidden === 'true') return |
| | | |
| | | this.checkBtn(btn) |
| | | m.children.push({ |
| | | key: btn.uuid, |
| | | title: btn.label, |
| | |
| | | if (cell.eleType !== 'button') return |
| | | if (cell.hidden === 'true') return |
| | | |
| | | this.checkBtn(cell) |
| | | m.children.push({ |
| | | key: cell.uuid, |
| | | title: cell.label, |
| | |
| | | if (cell.eleType !== 'button') return |
| | | if (cell.hidden === 'true') return |
| | | |
| | | this.checkBtn(cell) |
| | | m.children.push({ |
| | | key: cell.uuid, |
| | | title: cell.label, |
| | |
| | | if (cell.eleType !== 'button') return |
| | | if (cell.hidden === 'true') return |
| | | |
| | | this.checkBtn(cell) |
| | | m.children.push({ |
| | | key: cell.uuid, |
| | | title: cell.label, |
| | |
| | | if (cell.eleType !== 'button') return |
| | | if (cell.hidden === 'true') return |
| | | |
| | | this.checkBtn(cell) |
| | | m.children.push({ |
| | | key: cell.uuid, |
| | | title: cell.label, |
| | |
| | | item.action && item.action.forEach(btn => { |
| | | if (btn.hidden === 'true') return |
| | | |
| | | this.checkBtn(btn) |
| | | m.children.push({ |
| | | key: btn.uuid, |
| | | title: btn.label, |
| | |
| | | col.elements.forEach(btn => { |
| | | if (btn.hidden === 'true') return |
| | | |
| | | this.checkBtn(btn) |
| | | m.children.push({ |
| | | key: btn.uuid, |
| | | title: btn.label, |
| | |
| | | } |
| | | |
| | | return nodes |
| | | } |
| | | |
| | | checkBtn = (btn) => { |
| | | if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) { |
| | | let hascheck = false |
| | | btn.verify.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | |
| | | if (/\$check@|@check\$/ig.test(item.sql)) { |
| | | hascheck = true |
| | | } |
| | | }) |
| | | if (hascheck) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: `可选择多行的按钮《${btn.label}》中 $check@ 或 @check$ 将不会生效!`, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | getSubMenus = () => { |
| | |
| | | } |
| | | |
| | | submitConfig = () => { |
| | | const { delButtons, copyButtons, thawButtons } = this.state |
| | | const { delButtons, copyButtons } = this.state |
| | | let config = fromJS(this.state.config).toJS() |
| | | |
| | | if (!config.MenuName || !config.MenuNo || (config.cacheUseful === 'true' && !config.cacheTime)) { |
| | |
| | | } |
| | | return Api.getSystemConfig(_param) |
| | | } |
| | | }).then(res => { // 按钮解除冻结 |
| | | if (!res) return |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (!res.nonexec) { // 执行删除后刷新菜单列表 |
| | | this.getAppMenus() |
| | | } |
| | | |
| | | if (thawButtons.length === 0) { |
| | | return { status: true } |
| | | } else { |
| | | return Api.getSystemConfig({ |
| | | func: 'sPC_MainMenu_ReDel', |
| | | MenuID: thawButtons.join(',') |
| | | }) |
| | | } |
| | | }).then(res => { // 页面保存 |
| | | if (!res) return |
| | | |
| | |
| | | this.setState({ |
| | | delButtons: [], |
| | | copyButtons: [], |
| | | thawButtons: [], |
| | | menuloading: false |
| | | }) |
| | | notification.success({ |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { localedict, loading, visible, popBtn, comloading, activeKey, settingshow, controlshow, dict, MenuId, config, menuloading, customComponents, eyeopen } = this.state |
| | | const { localedict, loading, comloading, activeKey, settingshow, controlshow, dict, MenuId, config, menuloading, customComponents, eyeopen } = this.state |
| | | |
| | | return ( |
| | | <ConfigProvider locale={localedict}> |
| | | <div className={'mk-pc-view '} id="mk-pc-design-view"> |
| | | {loading ? <Spin className="view-spin" size="large" /> : null} |
| | | {!popBtn && !visible ? <DndProvider backend={HTML5Backend}> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}> |
| | | <div className="draw"> |
| | | {settingshow ? <DoubleLeftOutlined onClick={() => {sessionStorage.setItem('settingshow', 'false'); this.setState({settingshow: false})}}/> : null} |
| | |
| | | <div className="pc-setting-tools"> |
| | | <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> |
| | | {/* 基本信息 */} |
| | | <Panel header={dict['mob.basemsg']} key="basedata"> |
| | | <Panel header="基本信息" key="basedata"> |
| | | {/* 菜单信息 */} |
| | | {config ? <MenuForm |
| | | dict={dict} |
| | |
| | | <div className={'menu-body menu-view' + (menuloading ? ' saving' : '') + (eyeopen ? ' eye-open' : '')}> |
| | | {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} |
| | | </div> |
| | | </DndProvider> : null} |
| | | {popBtn && visible ? <PopviewController btn={popBtn} handleBack={this.handleBack}/> : null} |
| | | </DndProvider> |
| | | <StyleController /> |
| | | <StyleCombController /> |
| | | <ModalController /> |