| | |
| | | }) |
| | | } |
| | | |
| | | cancel = () => { |
| | | this.setState({ visible: false }) |
| | | |
| | | this.props.cancel && this.props.cancel() |
| | | } |
| | | |
| | | render () { |
| | | const { title, width, children } = this.props |
| | | const { visible, dict, formlist } = this.state |
| | |
| | | maskClosable={false} |
| | | okText={dict['model.confirm']} |
| | | onOk={this.submit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | onCancel={this.cancel} |
| | | destroyOnClose |
| | | > |
| | | <ModalForm |
| | |
| | | const StyleInput = asyncComponent(() => import('./styleInput')) |
| | | const MKFileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload')) |
| | | const MKColor = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkColor')) |
| | | const MkIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent')) |
| | | |
| | | class ModalForm extends Component { |
| | | static propTpyes = { |
| | |
| | | content = (<Cascader options={item.options} expandTrigger="hover" placeholder="" />) |
| | | } else if (item.type === 'textarea') { |
| | | content = (<TextArea rows={item.rows || 2} placeholder=""/>) |
| | | } else if (item.type === 'mkicon') { |
| | | content = (<MkIcon />) |
| | | } else if (item.type === 'source') { |
| | | content = (<SourceComponent type="" placement="right"/>) |
| | | } |
| | | |
| | | if (!content) return |
| | |
| | | overflow: hidden; |
| | | .color-sketch-block-box { |
| | | min-width: 100px; |
| | | .color-sketch-block-inner { |
| | | box-shadow: 0 0 0 1px rgba(0, 0, 0, .1) inset; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import getWrapForm from './options' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | const WrapComponent = asyncIconComponent(() => import('./wrapsetting')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const MenuComponent = asyncComponent(() => import('./menucomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) |
| | |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | getWrapForms = () => { |
| | | const { card } = this.state |
| | | |
| | | return getWrapForm(card.wrap) |
| | | } |
| | | |
| | | updateWrap = (res) => { |
| | | this.updateComponent({...this.state.card, wrap: res}) |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="plus" title="添加菜单" onClick={this.addMenu} type="plus" /> |
| | | <WrapComponent config={card} updateConfig={this.updateComponent} /> |
| | | <NormalForm title="菜单设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="menubar" card={card}/> |
| | | <PasteComponent config={card} options={['menucell']} updateConfig={this.updateComponent} /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | |
| | | import { Modal, Popover, Icon, Col } from 'antd' |
| | | |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import SettingForm from './settingform' |
| | | import getSettingForm from './options' |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | |
| | | class MenuBoxComponent extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | card: null, |
| | | formlist: null, |
| | | visible: false |
| | | card: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { card } = this.props |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | |
| | | if (card.isnew) { |
| | | this.setState({ |
| | | visible: true |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | const { cards } = this.props |
| | | |
| | | return !is(fromJS(cards.wrap), fromJS(nextProps.cards.wrap)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | /** |
| | |
| | | MKEmitter.emit('changeStyle', [cards.uuid, card.uuid], options, _style) |
| | | } |
| | | |
| | | settingSubmit = () => { |
| | | const { card } = this.state |
| | | |
| | | this.settingRef.handleConfirm().then(res => { |
| | | let _card = {...card, setting: res} |
| | | |
| | | if (!card.isnew && card.setting.type === 'menu' && _card.setting.type !== 'menu') { |
| | | const _this = this |
| | | confirm({ |
| | | content: '菜单将被重置,确定修改吗?', |
| | | onOk() { |
| | | _card.oriuuid = _card.uuid |
| | | _card.uuid = Utils.getuuid() |
| | | _this.setState({ visible: false, card: _card }) |
| | | _this.props.updateElement(_card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | delete _card.isnew |
| | | this.setState({ visible: false, card: _card }) |
| | | this.props.updateElement(_card) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | cancel = () => { |
| | | const { card } = this.state |
| | | |
| | | |
| | | if (card.isnew) { |
| | | let _card = fromJS(card).toJS() |
| | | delete _card.isnew |
| | | |
| | | this.setState({ visible: false, card: _card }) |
| | | this.setState({ card: _card }) |
| | | this.props.updateElement(_card) |
| | | } |
| | | } |
| | | |
| | | getSettingForms = () => { |
| | | const { card } = this.state |
| | | |
| | | return getSettingForm(card.setting) |
| | | } |
| | | |
| | | updateSetting = (res, resolve) => { |
| | | const { card } = this.state |
| | | let _card = {...card, setting: res} |
| | | |
| | | if (!card.isnew && card.setting.type === 'menu' && _card.setting.type !== 'menu') { |
| | | const _this = this |
| | | confirm({ |
| | | content: '菜单将被重置,确定修改吗?', |
| | | onOk() { |
| | | _card.oriuuid = _card.uuid |
| | | _card.uuid = Utils.getuuid() |
| | | _this.setState({ card: _card }) |
| | | _this.props.updateElement(_card) |
| | | resolve() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.setState({ visible: false }) |
| | | delete _card.isnew |
| | | this.setState({ card: _card }) |
| | | this.props.updateElement(_card) |
| | | resolve() |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { cards, offset } = this.props |
| | | const { card, visible, dict } = this.state |
| | | const { offset } = this.props |
| | | const { card } = this.state |
| | | |
| | | let _style = {...card.style} |
| | | |
| | |
| | | <Col span={card.setting.width || 6} offset={offset || 0}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="编辑" type="edit" onClick={() => this.setState({visible: true})} /> |
| | | <NormalForm title="菜单编辑" width={900} check update={this.updateSetting} getForms={this.getSettingForms} cancel={this.cancel}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="menucell" card={card}/> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | |
| | | <div className="menu-name">{card.setting.name}</div> |
| | | </div> |
| | | </Popover> |
| | | <Modal |
| | | wrapClassName="popview-modal" |
| | | title={'菜单设置'} |
| | | visible={visible} |
| | | width={900} |
| | | maskClosable={false} |
| | | okText={dict['model.submit']} |
| | | onOk={this.settingSubmit} |
| | | onCancel={this.cancel} |
| | | destroyOnClose |
| | | > |
| | | <SettingForm |
| | | dict={dict} |
| | | cards={cards} |
| | | setting={card.setting} |
| | | inputSubmit={this.settingSubmit} |
| | | wrappedComponentRef={(inst) => this.settingRef = inst} |
| | | /> |
| | | </Modal> |
| | | </Col> |
| | | ) |
| | | } |
New file |
| | |
| | | /** |
| | | * @description Setting表单配置信息 |
| | | */ |
| | | export default function (setting) { |
| | | let menulist = sessionStorage.getItem('appMenus') |
| | | |
| | | if (menulist) { |
| | | try { |
| | | menulist = JSON.parse(menulist) |
| | | } catch { |
| | | menulist = [] |
| | | } |
| | | } else { |
| | | menulist = [] |
| | | } |
| | | |
| | | const menuWrapForm = [ |
| | | { |
| | | type: 'text', |
| | | field: 'name', |
| | | label: '菜单名称', |
| | | initval: setting.name || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'MenuNo', |
| | | label: '菜单参数', |
| | | initval: setting.MenuNo || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'width', |
| | | label: '宽度', |
| | | initval: setting.width || 24, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'type', |
| | | label: '菜单属性', |
| | | initval: setting.type || 'menu', |
| | | required: true, |
| | | options: [ |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'linkmenu', label: '关联菜单'}, |
| | | {value: 'sysmenu', label: '系统页'}, |
| | | {value: 'link', label: '链接'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'sysmenu', values: ['sysmenu']}, |
| | | {field: 'copyMenuId', values: ['menu']}, |
| | | {field: 'linkMenuId', values: ['linkmenu']}, |
| | | {field: 'linkurl', values: ['link']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'sysmenu', |
| | | label: '系统页面', |
| | | initval: setting.sysmenu || '', |
| | | required: true, |
| | | options: [ |
| | | {value: 'AIService', label: '智能客服'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'copyMenuId', |
| | | label: '复制菜单', |
| | | initval: setting.copyMenuId || '', |
| | | tooltip: '复制菜单仅在当前菜单初始化时有效。', |
| | | required: false, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'linkMenuId', |
| | | label: '关联菜单', |
| | | initval: setting.linkMenuId || '', |
| | | required: true, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | field: 'linkurl', |
| | | label: '链接', |
| | | initval: setting.linkurl || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'sign', |
| | | label: '标志', |
| | | initval: setting.sign || 'icon', |
| | | required: true, |
| | | options: [ |
| | | {value: 'icon', label: '图标'}, |
| | | {value: 'image', label: '图片'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'icon', values: ['icon']}, |
| | | {field: 'iconFont', values: ['icon']}, |
| | | {field: 'padding', values: ['icon']}, |
| | | {field: 'color', values: ['icon']}, |
| | | {field: 'background', values: ['icon']}, |
| | | {field: 'url', values: ['image']}, |
| | | {field: 'imgWidth', values: ['image']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'mkicon', |
| | | field: 'icon', |
| | | label: '图标', |
| | | initval: setting.icon || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'iconFont', |
| | | label: '字体大小', |
| | | initval: setting.iconFont || 20, |
| | | min: 12, |
| | | max: 200, |
| | | precision: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'padding', |
| | | label: '内边距', |
| | | initval: setting.padding || 12, |
| | | min: 0, |
| | | max: 200, |
| | | precision: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'color', |
| | | label: '字体颜色', |
| | | initval: setting.color || '#ffffff', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'background', |
| | | label: '背景色', |
| | | initval: setting.background || '#1890ff', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'source', |
| | | field: 'url', |
| | | label: '图片地址', |
| | | initval: setting.url || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'imgWidth', |
| | | label: '图片宽度', |
| | | initval: setting.imgWidth || 36, |
| | | tooltip: '图片宽度与高度相当,使用的图片比例应为1:1。', |
| | | min: 10, |
| | | max: 500, |
| | | precision: 0, |
| | | required: false |
| | | }, |
| | | ] |
| | | |
| | | return menuWrapForm |
| | | } |
New file |
| | |
| | | /** |
| | | * @description Wrap表单配置信息 |
| | | */ |
| | | export default function (wrap) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | const menuWrapForm = [ |
| | | { |
| | | type: 'text', |
| | | field: 'title', |
| | | label: '标题', |
| | | initval: wrap.title || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'name', |
| | | label: '组件名称', |
| | | initval: wrap.name || '', |
| | | tooltip: '用于组件间的区分。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'width', |
| | | label: '宽度', |
| | | initval: wrap.width || 24, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | field: 'blacklist', |
| | | label: '黑名单', |
| | | initval: wrap.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | }, |
| | | ] |
| | | |
| | | return menuWrapForm |
| | | } |
| | |
| | | // }) |
| | | const _addressUrl = window.location.href.split('#')[0] + 'queryAddress' |
| | | |
| | | if (_addressUrl === 'false') { |
| | | if (_addressUrl !== 'true') { |
| | | sessionStorage.setItem('city', '') |
| | | sessionStorage.setItem('ipAddress', '') |
| | | } else { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (res.query_address === 'false') { |
| | | if (res.query_address !== 'true') { |
| | | localStorage.setItem(_addressUrl, 'false') |
| | | } else { |
| | | localStorage.setItem(_addressUrl, 'true') |