| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form } from 'antd' |
| | | import { Form, Icon } from 'antd' |
| | | |
| | | import zhCN from '@/locales/zh-CN/mob.js' |
| | | import enUS from '@/locales/en-US/mob.js' |
| | |
| | | import './index.scss' |
| | | |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const StyleInput = asyncComponent(() => import('@/menu/stylecontroller/styleInput')) |
| | | const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent')) |
| | | |
| | | class MobController extends Component { |
| | |
| | | this.props.updateConfig(config) |
| | | } |
| | | |
| | | /** |
| | | * @description 修改背景颜色 ,颜色控件 |
| | | */ |
| | | changePadding = (val, type) => { |
| | | let config = fromJS(this.props.config).toJS() |
| | | |
| | | config.style[type] = val |
| | | this.props.updateConfig(config) |
| | | } |
| | | |
| | | |
| | | imgChange = (val) => { |
| | | this.setState({ |
| | | backgroundImage: val |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { config } = this.props |
| | | const { backgroundColor, backgroundImage } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 4 } |
| | | sm: { span: 5 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 20 } |
| | | sm: { span: 19 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div className="menu-background-controller"> |
| | | <div className="pc-style-controller"> |
| | | <Form {...formItemLayout}> |
| | | <Form.Item className="color-control" colon={false} label="颜色"> |
| | | <Form.Item |
| | | colon={false} |
| | | label="宽度" |
| | | > |
| | | <StyleInput defaultValue={config.style.width || '100%'} options={['px', '%', 'vw']} onChange={(val) => this.changePadding(val, 'width')}/> |
| | | </Form.Item> |
| | | <Form.Item className="color-control" colon={false} label="背景色"> |
| | | <ColorSketch value={backgroundColor} onChange={this.changeBackgroundColor} /> |
| | | </Form.Item> |
| | | <Form.Item colon={false} label="图片"> |
| | | <Form.Item colon={false} label="背景图"> |
| | | <SourceComponent value={backgroundImage} type="" placement="right" onChange={this.imgChange}/> |
| | | </Form.Item> |
| | | <p style={{borderBottom: '1px solid #eaeaea', color: '#40a9ff'}}>内边距</p> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<Icon title="上边距" type="arrow-up"/>} |
| | | > |
| | | <StyleInput defaultValue={config.style.paddingTop || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'paddingTop')}/> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<Icon title="下边距" type="arrow-down"/>} |
| | | > |
| | | <StyleInput defaultValue={config.style.paddingBottom || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'paddingBottom')}/> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<Icon title="左边距" type="arrow-left"/>} |
| | | > |
| | | <StyleInput defaultValue={config.style.paddingLeft || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'paddingLeft')}/> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<Icon title="右边距" type="arrow-right"/>} |
| | | > |
| | | <StyleInput defaultValue={config.style.paddingRight || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'paddingRight')}/> |
| | | </Form.Item> |
| | | <p style={{borderBottom: '1px solid #eaeaea', color: '#40a9ff'}}>外边距</p> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<Icon title="上边距" type="arrow-up"/>} |
| | | > |
| | | <StyleInput defaultValue={config.style.marginTop || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'marginTop')}/> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<Icon title="下边距" type="arrow-down"/>} |
| | | > |
| | | <StyleInput defaultValue={config.style.marginBottom || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'marginBottom')}/> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<Icon title="左边距" type="arrow-left"/>} |
| | | > |
| | | <StyleInput defaultValue={config.style.marginLeft || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'marginLeft')}/> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<Icon title="右边距" type="arrow-right"/>} |
| | | > |
| | | <StyleInput defaultValue={config.style.marginRight || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'marginRight')}/> |
| | | </Form.Item> |
| | | </Form> |
| | | </div> |
| | | ) |
| | |
| | | .menu-background-controller { |
| | | .pc-style-controller { |
| | | width: 100%; |
| | | height: 100%; |
| | | overflow: hidden; |
| | |
| | | top: 5px; |
| | | } |
| | | } |
| | | .ant-form-item label > .anticon { |
| | | font-size: 16px; |
| | | vertical-align: middle; |
| | | } |
| | | } |
| | | |
| | | .margin-popover { |
| | | padding-top: 0px; |
| | | .ant-popover-inner-content { |
| | | width: 90px; |
| | | padding: 0px 5px; |
| | | .ant-menu-root.ant-menu-vertical { |
| | | border: 0; |
| | | .ant-menu-item { |
| | | height: 30px; |
| | | cursor: pointer; |
| | | line-height: 30px; |
| | | } |
| | | .ant-menu-item:not(:last-child) { |
| | | margin-bottom: 0px; |
| | | } |
| | | .ant-menu-item:first-child { |
| | | margin-top: 10px; |
| | | } |
| | | .ant-menu-item:last-child { |
| | | margin-bottom: 10px; |
| | | } |
| | | } |
| | | } |
| | | .ant-popover-arrow { |
| | | display: none; |
| | | } |
| | | } |
| | |
| | | this.props.updateConfig(component) |
| | | } |
| | | |
| | | /** |
| | | * @description 单个卡片信息更新 |
| | | */ |
| | | updateCard = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | |
| | | card.subcards = card.subcards.map(item => { |
| | | if (item.uuid === cell.uuid) return cell |
| | | return item |
| | | }) |
| | | |
| | | this.setState({card}) |
| | | |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | getStyle = (comIds, style) => { |
| | | const { card } = this.state |
| | | |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={22}> |
| | | <Form.Item label="菜单参数"> |
| | | {getFieldDecorator('MenuNo', { |
| | | initialValue: menu.MenuNo || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入菜单参数!' |
| | | } |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={22}> |
| | | <Form.Item label="菜单属性"> |
| | | {getFieldDecorator('property', { |
| | | initialValue: menu.property || 'menu' |
| | |
| | | |
| | | import MenuForm from '../menuform' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | |
| | | editMenu: null, |
| | | columns: [ |
| | | { title: '菜单名称', dataIndex: 'name', key: 'name' }, |
| | | { title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo' }, |
| | | { title: '菜单属性', dataIndex: 'property', key: 'property', render: text => { |
| | | const trans = {menu: '菜单', link: '链接', linkmenu: '关联菜单', classify: '分类'} |
| | | |
| | |
| | | const trans = {blank: '新窗口', self: '当前窗口'} |
| | | |
| | | return trans[text] |
| | | }}, |
| | | { title: '是否隐藏', dataIndex: 'hidden', key: 'hidden', render: (text, record) => { |
| | | const trans = {'true': '是', 'false': '否'} |
| | | return trans[text] || '否' |
| | | }}, |
| | | { title: '操作', key: 'operation', align: 'center', width: '190px', render: (text, record) => |
| | | (<div> |
| | |
| | | let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID) |
| | | _this.setState({data: _data}) |
| | | _this.props.menuUpdate({...menu, sublist: _data}) |
| | | MKEmitter.emit('delButtons', [record.MenuID]) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | editMenu: null, |
| | | columns: [ |
| | | { title: '菜单名称', dataIndex: 'name', key: 'name' }, |
| | | { title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo' }, |
| | | { title: '菜单属性', dataIndex: 'property', key: 'property', render: text => { |
| | | const trans = {menu: '菜单', link: '链接', linkmenu: '关联菜单', classify: '分类'} |
| | | |
| | |
| | | const trans = {blank: '新窗口', self: '当前窗口'} |
| | | |
| | | return trans[text] |
| | | }}, |
| | | { title: '是否隐藏', dataIndex: 'hidden', key: 'hidden', render: (text, record) => { |
| | | const trans = {'true': '是', 'false': '否'} |
| | | return trans[text] || '否' |
| | | }}, |
| | | { title: '操作', key: 'operation', align: 'center', width: '190px', render: (text, record) => |
| | | (<div> |
| | |
| | | let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID) |
| | | _this.setState({data: _data}) |
| | | _this.props.menuUpdate({...menu, sublist: _data}) |
| | | |
| | | let uuids = [record.MenuID] |
| | | record.sublist && record.sublist.forEach(item => { |
| | | uuids.push(item.MenuID) |
| | | }) |
| | | MKEmitter.emit('delButtons', uuids) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | editMenu: null, |
| | | columns: [ |
| | | { title: '菜单名称', dataIndex: 'name', key: 'name' }, |
| | | { title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo' }, |
| | | { title: '菜单属性', dataIndex: 'property', key: 'property', render: text => { |
| | | const trans = {menu: '菜单', link: '链接', linkmenu: '关联菜单', classify: '分类'} |
| | | |
| | |
| | | const trans = {blank: '新窗口', self: '当前窗口'} |
| | | |
| | | return trans[text] |
| | | }}, |
| | | { title: '是否隐藏', dataIndex: 'hidden', key: 'hidden', render: (text, record) => { |
| | | const trans = {'true': '是', 'false': '否'} |
| | | return trans[text] || '否' |
| | | }}, |
| | | { title: '操作', key: 'operation', align: 'center', width: '190px', render: (text, record) => |
| | | (<div> |
| | |
| | | content: '', |
| | | onOk() { |
| | | _this.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) |
| | | |
| | | let uuids = [record.MenuID] |
| | | record.sublist && record.sublist.forEach(item => { |
| | | uuids.push(item.MenuID) |
| | | |
| | | item.sublist && item.sublist.forEach(cell => { |
| | | uuids.push(cell.MenuID) |
| | | }) |
| | | }) |
| | | MKEmitter.emit('delButtons', uuids) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | tr:not(.classify) + .ant-table-expanded-row { |
| | | display: none; |
| | | } |
| | | td[colspan="4"] { |
| | | td[colspan="6"] { |
| | | padding: 5px 0px 5px 5px!important; |
| | | } |
| | | .ant-table-body { |
| | |
| | | let _openKeys = [] |
| | | // MenuID(菜单Id)、MenuName(菜单名称)、OnlySelf(值为true,表示三级菜单,增加-仅页面)、Type(菜单级别) |
| | | // ParentID(父级Id)、Selected(是否选中-已失效)、Tabs( 标签类型)、TypeCharOne 菜单类型PC或其他 |
| | | // result.data.forEach(item => { // 测试 |
| | | // if (item.ParentID === '0') { |
| | | // item.ParentID = item.TypeCharOne |
| | | // } |
| | | // }) |
| | | let _tree = this.getTree(fromJS(mainMenus).toJS(), result.data) |
| | | if (_tree[0]) { |
| | | if (_tree[0].key === 'PC' && _tree[0].children) { |
| | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.DateCount = Utils.formatOptions(DateCount) |
| | | |
| | | // exec_type: 'y' 解码字段:LText、LText1、LText2、custom_script、DateCount |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | |
| | | const BgController = asyncComponent(() => import('@/pc/bgcontroller')) |
| | | const Quotecomponent = asyncComponent(() => import('@/pc/quotecomponent')) |
| | | const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) |
| | | const PaddingController = asyncComponent(() => import('@/pc/padcontroller')) |
| | | const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) |
| | | const SysInterface = asyncComponent(() => import('@/menu/sysinterface')) |
| | | const PictureController = asyncComponent(() => import('@/menu/picturecontroller')) |
| | |
| | | } |
| | | |
| | | delButtons = (items) => { |
| | | const { copyButtons } = this.state |
| | | const { copyButtons, delButtons } = this.state |
| | | |
| | | this.setState({ |
| | | delButtons: [...this.state.delButtons, ...items], |
| | | delButtons: [...delButtons, ...items], |
| | | copyButtons: copyButtons.filter(item => !items.includes(item.uuid)) |
| | | }) |
| | | } |
| | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | _param.secretkey = Utils.encrypt('', _param.timestamp) |
| | | |
| | | Api.getSystemConfig(_param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | let appMenuParam = null |
| | | if (item.type === 'navbar') { |
| | | appMenuParam = { |
| | | func: 's_appmenus_addupt', |
| | | exec_type: 'y' |
| | | } |
| | | |
| | | appMenuParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | appMenuParam.secretkey = Utils.encrypt('', _param.timestamp) |
| | | |
| | | new_open_edition[item.uuid] = res.open_edition || '' |
| | | |
| | | resolve() |
| | | }) |
| | | let LText = [] |
| | | let app_param = [] |
| | | let kei_no = sessionStorage.getItem('kei_no') |
| | | let userid = sessionStorage.getItem('CloudUserID') || '' |
| | | |
| | | item.menus.forEach((fst, findex) => { |
| | | // LText.push(`select '${fst.MenuID}','${fst.name}','','0','${sessionStorage.getItem('appId')}','0','${(findex + 1) * 10}','10','','${userid}','${window.GLOB.appkey}','${fst.MenuNo || ''}','${kei_no}','pc'`) |
| | | LText.push(`select '${fst.MenuID}','${fst.name}','','0','0','0','${(findex + 1) * 10}','10','','${userid}','${window.GLOB.appkey}','${fst.MenuNo || ''}','${kei_no}','pc'`) |
| | | app_param.push(`select '${window.GLOB.appkey}','${fst.MenuID}','${userid}','${(findex + 1) * 10}','','${fst.name}','${fst.MenuNo || ''}','0','10','${kei_no}','pc'`) |
| | | if (fst.property === 'classify' && fst.sublist.length > 0) { |
| | | fst.sublist.forEach(scd => { |
| | | LText.push(`select '${scd.MenuID}','${scd.name}','','0','${fst.MenuID}','0','${(findex + 1) * 10}','20','','${userid}','${window.GLOB.appkey}','${scd.MenuNo || ''}','${kei_no}','pc'`) |
| | | app_param.push(`select '${window.GLOB.appkey}','${scd.MenuID}','${userid}','${(findex + 1) * 10}','','${scd.name}','${scd.MenuNo || ''}','${fst.MenuID}','20','${kei_no}','pc'`) |
| | | |
| | | if (scd.property === 'classify' && scd.sublist.length > 0) { |
| | | scd.sublist.forEach(thd => { |
| | | LText.push(`select '${thd.MenuID}','${thd.name}','','0','${scd.MenuID}','0','${(findex + 1) * 10}','20','','${userid}','${window.GLOB.appkey}','${thd.MenuNo || ''}','${kei_no}','pc'`) |
| | | app_param.push(`select '${window.GLOB.appkey}','${thd.MenuID}','${userid}','${(findex + 1) * 10}','','${thd.name}','${thd.MenuNo || ''}','${scd.MenuID}','20','${kei_no}','pc'`) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | appMenuParam.LText = Utils.formatOptions(LText.join(' union ')) |
| | | appMenuParam.LText1 = Utils.formatOptions(app_param.join(' union ')) |
| | | } |
| | | |
| | | if (appMenuParam) { |
| | | Api.getSystemConfig(appMenuParam).then(_res => { |
| | | if (!_res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: _res.message, |
| | | duration: 5 |
| | | }) |
| | | this.setState({ menuloading: false }) |
| | | return |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | this.setState({ menuloading: false }) |
| | | return |
| | | } |
| | | |
| | | new_open_edition[item.uuid] = res.open_edition || '' |
| | | |
| | | resolve() |
| | | }) |
| | | }) |
| | | } else { |
| | | Api.getSystemConfig(_param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | this.setState({ menuloading: false }) |
| | | return |
| | | } |
| | | |
| | | new_open_edition[item.uuid] = res.open_edition || '' |
| | | resolve() |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | Promise.all(deffers).then(() => { |
| | |
| | | appViewList = JSON.parse(appViewList) |
| | | let _length = appViewList.length |
| | | let appIndeList = appViewList.map(item => item.keys_id).join(',') |
| | | |
| | | |
| | | config.components = config.components.map(item => { |
| | | if (item.type === 'navbar') { |
| | |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | this.setState({ menuloading: false }) |
| | | } else { |
| | | sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) |
| | | resolve(true) |
| | |
| | | } |
| | | }) |
| | | } |
| | | }).then(res => { // 按钮删除 |
| | | }).then(res => { // 按钮或菜单删除 |
| | | if (!res) return |
| | | |
| | | if (delButtons.length === 0) { |
| | |
| | | {customComponents && customComponents.length ? <Panel header="自定义组件" key="cuscomponent"> |
| | | <SourceWrap components={customComponents} /> |
| | | </Panel> : null} |
| | | <Panel header={'页面背景'} key="background"> |
| | | <Panel header={'页面样式'} key="background"> |
| | | {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null} |
| | | </Panel> |
| | | <Panel header={'页面内边距'} key="padding"> |
| | | {config ? <PaddingController config={config} updateConfig={this.updateConfig} /> : null} |
| | | </Panel> |
| | | </Collapse> |
| | | </div> |
| | |
| | | overflow-y: auto; |
| | | .menu-shell-inner { |
| | | min-height: 100vh; |
| | | margin: 0 auto; |
| | | } |
| | | } |
| | | .menu-body.saving { |