From e36eb1999794bd71e76482b92a0b0b20f49d0032 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 05 三月 2021 19:37:03 +0800 Subject: [PATCH] 2021-03-05 --- src/pc/components/navbar/normal-navbar/index.jsx | 59 + src/pc/components/navbar/normal-navbar/menusetting/menutable/index.scss | 54 + src/views/pcdesign/menuform/index.jsx | 23 src/templates/comtableconfig/index.jsx | 29 src/pc/components/navbar/normal-navbar/menusetting/index.jsx | 21 src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx | 462 +++++++++++++- src/tabviews/zshare/actionList/excelInbutton/index.jsx | 4 src/pc/quotecomponent/index.jsx | 123 ++++ src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx | 14 src/templates/sharecomponent/fieldscomponent/index.jsx | 7 src/templates/modalconfig/index.jsx | 16 src/pc/quotecomponent/settingform/index.scss | 11 src/templates/sharecomponent/tablecomponent/index.jsx | 16 src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx | 2 src/templates/sharecomponent/settingcalcomponent/index.jsx | 2 src/views/menudesign/index.jsx | 77 - src/menu/datasource/verifycard/index.jsx | 1 src/index.js | 2 src/views/pcdesign/index.jsx | 411 +++++++++++--- src/templates/zshare/formconfig.jsx | 2 src/pc/quotecomponent/settingform/index.jsx | 88 +++ src/templates/calendarconfig/index.jsx | 17 src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx | 109 ++ src/templates/subtableconfig/index.jsx | 30 src/pc/components/navbar/normal-navbar/wrapsetting/settingform/index.jsx | 56 + src/menu/modalconfig/index.jsx | 5 src/pc/components/navbar/normal-navbar/index.scss | 38 + src/pc/quotecomponent/index.scss | 6 package.json | 2 src/menu/popview/index.jsx | 47 - 30 files changed, 1,311 insertions(+), 423 deletions(-) diff --git a/package.json b/package.json index dc3fd68..ad7bc05 100644 --- a/package.json +++ b/package.json @@ -188,7 +188,7 @@ ] ] }, - "homepage": ".", + "homepage": "./build", "devDependencies": { "typescript": "^4.0.2" } diff --git a/src/index.js b/src/index.js index f53f790..4f87b72 100644 --- a/src/index.js +++ b/src/index.js @@ -60,7 +60,7 @@ // 娴嬭瘯绯荤粺鏂囦欢缃簬admin涓� // fetch(process.env.NODE_ENV === 'production' ? '../options.json' : './options.json') -fetch('../options.json') +fetch('./options.json') .then(response => response.json()) .catch(() => { document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">绯荤粺閰嶇疆淇℃伅鑾峰彇澶辫触锛岃鑱旂郴绠$悊鍛橈紒</div>' diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index 07dadb0..18aba05 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -655,7 +655,6 @@ <FieldsComponent config={{...config, columns}} type="fields" - tableFields={menu.tableFields} updatefield={this.updatefields} /> <EditTable actions={['edit', 'move', 'copy', 'del']} type="datasourcefield" data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 3aec940..155a031 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -405,10 +405,9 @@ * 3銆佹鏌ヨ〃鍗曚腑鐨勫凡閫夊瓧娈碉紝骞舵爣璁板凡閫� */ queryField = () => { - const { menu } = this.props const { config } = this.state - if (menu.tables.length === 0) { + if (window.GLOB.tableFields.length === 0) { notification.warning({ top: 92, message: '璇烽�夋嫨琛ㄥ悕锛�', @@ -418,7 +417,7 @@ } let columns = new Map() - menu.tableFields.forEach(table => { + window.GLOB.tableFields.forEach(table => { table.columns.forEach(column => { columns.set(column.field, column) }) diff --git a/src/menu/popview/index.jsx b/src/menu/popview/index.jsx index fbd6208..58cf8cb 100644 --- a/src/menu/popview/index.jsx +++ b/src/menu/popview/index.jsx @@ -42,12 +42,10 @@ MenuType: '', MenuId: '', MenuNo: '', - tableFields: [], delButtons: [], activeKey: 'basedata', menuloading: false, oriConfig: null, - openEdition: '', config: null, customComponents: [] } @@ -153,11 +151,9 @@ return } - let _config = fromJS(config).toJS() - delete _config.tableFields const _this = this - if (!is(fromJS(oriConfig), fromJS(_config))) { + if (!is(fromJS(oriConfig), fromJS(config))) { confirm({ title: '閰嶇疆宸蹭慨鏀癸紝鏀惧純淇濆瓨鍚楋紵', content: '', @@ -214,10 +210,11 @@ config.Template = 'CustomPage' } + config.open_edition = result.open_edition || '' + this.setState({ oriConfig: config, - config: fromJS(config).toJS(), - openEdition: result.open_edition || '', + config: fromJS(config).toJS() }) this.props.modifyCustomMenu(config) @@ -332,7 +329,7 @@ submitConfig = () => { const { btn } = this.props - const { openEdition, delButtons } = this.state + const { delButtons } = this.state let config = fromJS(this.state.config).toJS() if ((config.cacheUseful === 'true' && !config.cacheTime) || !config.MenuNo || !config.MenuName) { @@ -355,31 +352,25 @@ config.enabled = false } - let _config = fromJS(config).toJS() - delete _config.tableFields - let _name = (btn.component.name ? btn.component.name + '-' : '') + btn.label let param = { func: 'sPC_ButtonParam_AddUpt', ParentID: btn.config.uuid, - MenuID: _config.uuid, - MenuNo: _config.MenuNo || '', + MenuID: config.uuid, + MenuNo: config.MenuNo || '', Template: 'CustomPage', MenuName: _name, PageParam: JSON.stringify({Template: 'CustomPage'}), - LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } - - if (openEdition) { // 鐗堟湰绠$悊 - param.open_edition = openEdition + LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))), + open_edition: config.open_edition } let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 func: 'sPC_Button_AddUpt', Type: 60, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 - ParentID: _config.uuid, - MenuNo: _config.MenuNo, + ParentID: config.uuid, + MenuNo: config.MenuNo, Template: 'CustomPage', PageParam: '', LongParam: '', @@ -427,9 +418,10 @@ if (!res) return if (res.status) { + config.open_edition = res.open_edition || '' + this.setState({ - oriConfig: fromJS(_config).toJS(), - openEdition: res.open_edition || '' + oriConfig: fromJS(config).toJS() }) if (btnParam.LText) { @@ -540,15 +532,8 @@ /** * @description 鏇存柊甯哥敤琛ㄤ俊鎭紝蹇嵎娣诲姞鍚庢洿鏂伴厤缃俊鎭� */ - updatetable = (config, fields) => { - const { tableFields } = this.state - - config.tableFields = fields ? fields : tableFields - - this.setState({ - tableFields: fields ? fields : tableFields, - config - }) + updatetable = (config) => { + this.setState({ config }) this.props.modifyCustomMenu(config) } diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx index a67fe8e..35ef413 100644 --- a/src/pc/components/navbar/normal-navbar/index.jsx +++ b/src/pc/components/navbar/normal-navbar/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Icon, Popover } from 'antd' +import { Icon, Popover, Menu } from 'antd' import asyncIconComponent from '@/utils/asyncIconComponent' @@ -18,6 +18,7 @@ const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) // const { confirm } = Modal +const { SubMenu } = Menu class NormalNavbar extends Component { static propTpyes = { @@ -140,7 +141,7 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'shadow'], card.style) + MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'shadow'], card.style) } changeLogoStyle = () => { @@ -154,6 +155,18 @@ e.stopPropagation() MKEmitter.emit('clickComponent', this.state.card) } + } + + changeMenu = (menu) => { + MKEmitter.emit('changeEditMenu', menu) + } + + changeLogoMenu = () => { + const { card } = this.state + + if (!card.wrap.logolink) return + + MKEmitter.emit('changeEditMenu', {MenuID: card.wrap.logolink}) } render() { @@ -184,9 +197,47 @@ <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeLogoStyle} type="font-colors" /> </div> } trigger="hover"> - <div className="logo" style={card.logoStyle}><img src={card.wrap.logo} alt=""/></div> + <div className={'logo' + (card.wrap.logolink ? ' pointer' : '')} style={card.logoStyle} onDoubleClick={this.changeLogoMenu}><img src={card.wrap.logo} alt=""/></div> </Popover> : null} - <div className="menu">sdf</div> + <div className="menu"> + <Menu mode="horizontal"> + {card.menus.map(fst => { + if (fst.property === 'classify' && fst.sublist.length > 0) { + return ( + <SubMenu title={fst.name} key={fst.MenuID} popupClassName="normal-navbar-submenu"> + {fst.sublist.map(scd => { + if (scd.property === 'classify' && scd.sublist.length > 0) { + return ( + <Menu.ItemGroup key={scd.MenuID} title={scd.name}> + {scd.sublist.map(thd => { + return ( + <Menu.Item key={thd.MenuID} > + <span onClick={(e) => e.stopPropagation()} onDoubleClick={() => this.changeMenu(thd)}>{thd.name}</span> + </Menu.Item> + ) + })} + </Menu.ItemGroup> + ) + } else { + return ( + <Menu.Item key={scd.MenuID} onClick={(e) => e.stopPropagation()}> + <span onClick={(e) => e.stopPropagation()} onDoubleClick={() => this.changeMenu(scd)}>{scd.name}</span> + </Menu.Item> + ) + } + })} + </SubMenu> + ) + } else { + return ( + <Menu.Item key={fst.MenuID} onClick={(e) => e.stopPropagation()}> + <span onClick={(e) => e.stopPropagation()} onDoubleClick={() => this.changeMenu(fst)}>{fst.name}</span> + </Menu.Item> + ) + } + })} + </Menu> + </div> <div className="link">asdfds</div> </div> </div> diff --git a/src/pc/components/navbar/normal-navbar/index.scss b/src/pc/components/navbar/normal-navbar/index.scss index bdba21d..c141a87 100644 --- a/src/pc/components/navbar/normal-navbar/index.scss +++ b/src/pc/components/navbar/normal-navbar/index.scss @@ -14,6 +14,7 @@ .navbar-wrap { margin: 0 auto; display: flex; + max-width: 100%; .logo { display: inline-block; @@ -22,13 +23,31 @@ max-height: 100%; } } + .logo.pointer { + cursor: pointer; + } .menu { flex: 1; display: inline-block; + font-size: inherit; + color: inherit; + .ant-menu { + background: transparent; + line-height: inherit; + font-size: inherit; + color: inherit; + .ant-menu-item:hover, .ant-menu-item-active, .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open, .ant-menu-submenu-active, .ant-menu-submenu-title:hover { + color: unset; + } + } + .ant-menu-horizontal > .ant-menu-item:hover, .ant-menu-horizontal > .ant-menu-submenu:hover, .ant-menu-horizontal > .ant-menu-item-active, .ant-menu-horizontal > .ant-menu-submenu-active, .ant-menu-horizontal > .ant-menu-item-open, .ant-menu-horizontal > .ant-menu-submenu-open, .ant-menu-horizontal > .ant-menu-item-selected, .ant-menu-horizontal > .ant-menu-submenu-selected { + color: unset; + } } .link { flex: 1; display: inline-block; + text-align: right; } } .card-control { @@ -111,4 +130,23 @@ } .top-menu-popover { padding-top: 0!important; +} +.normal-navbar-submenu { + .ant-menu-item-group { + float: left; + } + .ant-menu-item { + height: 32px; + line-height: 32px; + span { + display: inline-block; + width: 100%; + height: 100%; + padding: 0 16px 0 28px; + } + padding: 0; + } + .ant-menu .ant-menu-item-selected { + background-color: #ffffff; + } } \ No newline at end of file diff --git a/src/pc/components/navbar/normal-navbar/menusetting/index.jsx b/src/pc/components/navbar/normal-navbar/menusetting/index.jsx index bb5070f..18f00b1 100644 --- a/src/pc/components/navbar/normal-navbar/menusetting/index.jsx +++ b/src/pc/components/navbar/normal-navbar/menusetting/index.jsx @@ -19,27 +19,16 @@ visible: false } - UNSAFE_componentWillMount () { - const { config } = this.props - - this.setState({menus: fromJS(config.menus).toJS()}) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) } verifySubmit = () => { - // const { config } = this.props + const { config } = this.props + let menus = this.mTable.state.data || [] - // this.verifyRef.handleConfirm().then(res => { - - // this.setState({ - // wrap: res, - // visible: false - // }) - // this.props.updateConfig({...config, wrap: res}) - // }) + this.props.updateConfig({...config, menus}) + this.setState({visible: false}) } render () { @@ -53,7 +42,7 @@ wrapClassName="popview-modal" title="鑿滃崟缂栬緫" visible={visible} - width={800} + width={950} maskClosable={false} okText={dict['model.submit']} onOk={this.verifySubmit} diff --git a/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx b/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx index bd7216a..a0411c6 100644 --- a/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx +++ b/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Radio, Tooltip, Icon } from 'antd' +import { Form, Row, Col, Input, Radio, Tooltip, Icon, Select } from 'antd' import './index.scss' @@ -13,11 +13,33 @@ } state = { - property: this.props.menu.property || 'menu' + property: this.props.menu.property || 'menu', + linkIntId: this.props.menu.linkIntId || '', + appMenus: [], } UNSAFE_componentWillMount () { - + let appMenus = sessionStorage.getItem('appMenus') + if (appMenus) { + try { + appMenus = JSON.parse(appMenus) + } catch { + appMenus = [] + } + } else { + appMenus = [] + } + + this.setState({appMenus}) + } + + componentDidMount() { + const { menu } = this.props + + if (!menu.MenuID) { + let _form = document.getElementById('name') + _form && _form.select() + } } handleConfirm = () => { @@ -25,6 +47,9 @@ return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { + if (values.linkmenuid) { + values.linkIntId = this.state.linkIntId || '' + } resolve(values) } else { reject(err) @@ -47,10 +72,14 @@ this.setState({property: val}) } + changeLinkMenu = (val, { props }) => { + this.setState({linkIntId: props.intid}) + } + render() { const { menu } = this.props const { getFieldDecorator } = this.props.form - const { property } = this.state + const { property, appMenus } = this.state const formItemLayout = { labelCol: { @@ -66,7 +95,7 @@ return ( <Form {...formItemLayout}> <Row gutter={24}> - <Col span={24}> + <Col span={22}> <Form.Item label="鑿滃崟鍚嶇О"> {getFieldDecorator('name', { initialValue: menu.name, @@ -79,48 +108,76 @@ })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} </Form.Item> </Col> - <Col span={24}> - <Form.Item label="灞炴��"> + <Col span={22}> + <Form.Item label="鑿滃崟灞炴��"> {getFieldDecorator('property', { initialValue: menu.property || 'menu' })( <Radio.Group onChange={this.changeProperty}> <Radio value="menu">鑿滃崟</Radio> <Radio value="link">閾炬帴</Radio> - <Radio value="classify">鍒嗙被</Radio> + {menu.level === 1 || menu.level === 2 ? <Radio value="classify">鍒嗙被</Radio> : null} + <Radio value="linkmenu">鍏宠仈鑿滃崟</Radio> </Radio.Group> )} </Form.Item> </Col> - {property === 'link' ? <Col span={24}> - <Form.Item label={ - <Tooltip placement="topLeft" title="閾炬帴鑷冲綋鍓嶇郴缁熺殑鑿滃崟鏃讹紝鍙互浣跨敤 $ + 鑿滃崟ID锛屼緥濡傦細$dsdffowejdsfi銆�"> - <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}}/> - 閾炬帴鍦板潃 - </Tooltip> - }> + {property === 'link' ? <Col span={22}> + <Form.Item label="閾炬帴鍦板潃"> {getFieldDecorator('link', { initialValue: menu.link || '', - rules: [ - { - required: true, - message: '璇疯緭鍏ラ摼鎺ュ湴鍧�!' - } - ] + rules: [{ + required: true, + message: '璇疯緭鍏ラ摼鎺ュ湴鍧�!' + }] })(<TextArea rows={2} />)} </Form.Item> </Col> : null} - {property === 'menu' ? <Col span={24}> + {property !== 'classify' ? <Col span={22}> + <Form.Item label="鎵撳紑鏂瑰紡"> + {getFieldDecorator('open', { + initialValue: menu.open || 'blank' + })( + <Radio.Group> + <Radio value="blank">鏂扮獥鍙�</Radio> + <Radio value="self">褰撳墠绐楀彛</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {property === 'linkmenu' ? <Col span={22}> <Form.Item label={ - <Tooltip placement="topLeft" title="澶嶅埗鍏朵粬鑿滃崟鏃讹紝璇峰~鍐欏搴旂殑鑿滃崟ID銆�"> + <Tooltip placement="topLeft" title="鍏宠仈褰撳墠app涓凡鏈夌殑鑿滃崟銆�"> + <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}}/> + 鍏宠仈鑿滃崟 + </Tooltip> + }> + {getFieldDecorator('linkMenuId', { + initialValue: menu.linkMenuId || '', + rules: [{ + required: true, + message: '璇烽�夋嫨鍏宠仈鑿滃崟!' + }] + })( + <Select onChange={this.changeLinkMenu}> + {appMenus.map(item => (<Select.Option key={item.MenuID} intid={item.menuid_int} value={item.MenuID}>{item.MenuName}</Select.Option>))} + </Select> + )} + </Form.Item> + </Col> : null} + {property === 'menu' ? <Col span={22}> + <Form.Item label={ + <Tooltip placement="topLeft" title="澶嶅埗鑿滃崟浠呭湪褰撳墠鑿滃崟涓嶅瓨鍦ㄦ椂鏈夋晥銆�"> <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}}/> 澶嶅埗鑿滃崟 </Tooltip> }> - {getFieldDecorator('copyMenu', { - initialValue: menu.copyMenu || '' + {getFieldDecorator('copyMenuId', { + initialValue: menu.copyMenuId || '' })( - <Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} /> + <Select> + {appMenus.map(item => (<Select.Option key={item.MenuID} value={item.MenuID}>{item.MenuName}</Select.Option>))} + </Select> )} </Form.Item> </Col> : null} diff --git a/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx b/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx index 6d38929..bd6a4ce 100644 --- a/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx +++ b/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx @@ -1,72 +1,346 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Table, Button, Modal } from 'antd' +import { Table, Button, Modal, Icon } from 'antd' import MenuForm from '../menuform' import Utils from '@/utils/utils.js' import './index.scss' -class SubTable extends Component { +const { confirm } = Modal + +class ThdTable extends Component { static propTpyes = { menus: PropTypes.object, // 鍗$墖琛屼俊鎭� + menuUpdate: PropTypes.func // 鍗$墖琛屼俊鎭� } state = { data: [], + editMenu: null, columns: [ - { title: 'Date', dataIndex: 'date', key: 'date' }, - { title: 'Name', dataIndex: 'name', key: 'name' }, - { - title: 'Status', - key: 'state', - render: () => ( - <span> - Finished - </span> - ), - }, - { title: 'Upgrade Status', dataIndex: 'upgradeNum', key: 'upgradeNum' }, - { - title: 'Action', - dataIndex: 'operation', - key: 'operation', - render: () => ( - <span className="table-operation"> - <a href>Pause</a> - <a href>Stop</a> - </span> - ), - }, + { title: '鑿滃崟鍚嶇О', dataIndex: 'name', key: 'name' }, + { title: '鑿滃崟灞炴��', dataIndex: 'property', key: 'property', render: text => { + const trans = {menu: '鑿滃崟', link: '閾炬帴', linkmenu: '鍏宠仈鑿滃崟', classify: '鍒嗙被'} + + return trans[text] + }}, + { title: '鎵撳紑鏂瑰紡', dataIndex: 'open', key: 'open', render: (text, record) => { + if (record.property === 'classify') return '' + + const trans = {blank: '鏂扮獥鍙�', self: '褰撳墠绐楀彛'} + + return trans[text] + }}, + { title: '鎿嶄綔', key: 'operation', align: 'center', width: '190px', render: (text, record) => + (<div> + <Button type="link" style={{padding: '0 5px', marginRight: '5px'}} onClick={() => this.editMenu(record)}>缂栬緫</Button> + <Button type="link" style={{color: '#ff4d4f', padding: '0 5px', marginRight: '5px'}} onClick={() => this.delMenu(record)}>鍒犻櫎</Button> + <Icon type="arrow-up" style={{color: '#26C281', cursor: 'pointer', padding: '0 5px', marginRight: '5px'}} onClick={() => this.moveUp(record)}/> + <Icon type="arrow-down" style={{color: '#ff4d4f', cursor: 'pointer', padding: '0 5px'}} onClick={() => this.moveDown(record)}/> + </div>) + } ] } UNSAFE_componentWillMount () { - // const { data } = this.props - + const { menu } = this.props + this.setState({data: menu.sublist ? fromJS(menu.sublist).toJS() : []}) } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } - handleSubmit = (e) => { - e.preventDefault() + moveUp = (record) => { + const { menu } = this.props + let data = fromJS(this.state.data).toJS() - if (this.props.inputSubmit) { - this.props.inputSubmit() + let dragIndex = data.findIndex(c => c.MenuID === record.MenuID) + let hoverIndex = dragIndex - 1 + + if (hoverIndex === -1) return + + data.splice(hoverIndex, 0, ...data.splice(dragIndex, 1)) + this.setState({data}) + this.props.menuUpdate({...menu, sublist: data}) + } + + moveDown = (record) => { + const { menu } = this.props + let data = fromJS(this.state.data).toJS() + + let dragIndex = data.findIndex(c => c.MenuID === record.MenuID) + let hoverIndex = dragIndex + 1 + + if (hoverIndex === data.length) return + + data.splice(hoverIndex, 0, ...data.splice(dragIndex, 1)) + this.setState({data}) + this.props.menuUpdate({...menu, sublist: data}) + } + + delMenu = (record) => { + const { menu } = this.props + const _this = this + + confirm({ + title: '纭畾鍒犻櫎鍚楋紵', + content: '', + onOk() { + let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID) + _this.setState({data: _data}) + _this.props.menuUpdate({...menu, sublist: _data}) + }, + onCancel() {} + }) + } + + editMenu = (record) => { + this.setState({editMenu: record, visible: true}) + } + + plusMenu = () => { + let _menu = { + name: '鑿滃崟', + property: 'menu', + level: 3, + sublist: [] } + + this.setState({editMenu: _menu, visible: true}) + } + + menuSubmit = () => { + const { menu } = this.props + const { editMenu } = this.state + + this.menuRef.handleConfirm().then(res => { + let _menu = {...editMenu, ...res} + let _data = this.state.data + if (!_menu.MenuID) { + _menu.MenuID = Utils.getuuid() + _data.push(_menu) + } else { + _data = _data.map(item => { + if (item.MenuID === _menu.MenuID) { + return _menu + } else { + return item + } + }) + } + this.setState({data: _data, editMenu: null, visible: false}) + this.props.menuUpdate({...menu, sublist: _data}) + }) } render() { - const { columns, data } = this.state + const { columns, data, visible, editMenu } = this.state return ( - <Table - className="components-table-demo-nested" - columns={columns} - dataSource={data} - /> + <div className="thdmenu-control-wrap"> + <Icon type="plus" style={{color: '#26C281', padding: '5px', fontSize: '16px'}} onClick={this.plusMenu}/> + <Table + rowKey="MenuID" + size="small" + columns={columns} + dataSource={data} + pagination={false} + /> + <Modal + title="缂栬緫" + visible={visible} + width={600} + maskClosable={false} + onOk={this.menuSubmit} + onCancel={() => { this.setState({ visible: false }) }} + destroyOnClose + > + <MenuForm + menu={editMenu} + inputSubmit={this.menuSubmit} + wrappedComponentRef={(inst) => this.menuRef = inst} + /> + </Modal> + </div> + ) + } +} + +class SubTable extends Component { + static propTpyes = { + menu: PropTypes.object, // 鍗$墖琛屼俊鎭� + menuUpdate: PropTypes.func // 鍗$墖琛屼俊鎭� + } + + state = { + data: [], + editMenu: null, + columns: [ + { title: '鑿滃崟鍚嶇О', dataIndex: 'name', key: 'name' }, + { title: '鑿滃崟灞炴��', dataIndex: 'property', key: 'property', render: text => { + const trans = {menu: '鑿滃崟', link: '閾炬帴', linkmenu: '鍏宠仈鑿滃崟', classify: '鍒嗙被'} + + return trans[text] + }}, + { title: '鎵撳紑鏂瑰紡', dataIndex: 'open', key: 'open', render: (text, record) => { + if (record.property === 'classify') return '' + + const trans = {blank: '鏂扮獥鍙�', self: '褰撳墠绐楀彛'} + + return trans[text] + }}, + { title: '鎿嶄綔', key: 'operation', align: 'center', width: '190px', render: (text, record) => + (<div> + <Button type="link" style={{padding: '0 5px', marginRight: '5px'}} onClick={() => this.editMenu(record)}>缂栬緫</Button> + <Button type="link" style={{color: '#ff4d4f', padding: '0 5px', marginRight: '5px'}} onClick={() => this.delMenu(record)}>鍒犻櫎</Button> + <Icon type="arrow-up" style={{color: '#26C281', cursor: 'pointer', padding: '0 5px', marginRight: '5px'}} onClick={() => this.moveUp(record)}/> + <Icon type="arrow-down" style={{color: '#ff4d4f', cursor: 'pointer', padding: '0 5px'}} onClick={() => this.moveDown(record)}/> + </div>) + } + ] + } + + UNSAFE_componentWillMount () { + const { menu } = this.props + + this.setState({data: menu.sublist ? fromJS(menu.sublist).toJS() : []}) + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + moveUp = (record) => { + const { menu } = this.props + let data = fromJS(this.state.data).toJS() + + let dragIndex = data.findIndex(c => c.MenuID === record.MenuID) + let hoverIndex = dragIndex - 1 + + if (hoverIndex === -1) return + + data.splice(hoverIndex, 0, ...data.splice(dragIndex, 1)) + this.setState({data}) + this.props.menuUpdate({...menu, sublist: data}) + } + + moveDown = (record) => { + const { menu } = this.props + let data = fromJS(this.state.data).toJS() + + let dragIndex = data.findIndex(c => c.MenuID === record.MenuID) + let hoverIndex = dragIndex + 1 + + if (hoverIndex === data.length) return + + data.splice(hoverIndex, 0, ...data.splice(dragIndex, 1)) + this.setState({data}) + this.props.menuUpdate({...menu, sublist: data}) + } + + delMenu = (record) => { + const { menu } = this.props + const _this = this + + confirm({ + title: (record.property === 'classify' && record.sublist.length > 0 ? '鑿滃崟涓嬪惈鏈夊瓙鑿滃崟锛�' : '') + '纭畾鍒犻櫎鍚楋紵', + content: '', + onOk() { + let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID) + _this.setState({data: _data}) + _this.props.menuUpdate({...menu, sublist: _data}) + }, + onCancel() {} + }) + } + + editMenu = (record) => { + this.setState({editMenu: record, visible: true}) + } + + plusMenu = () => { + let _menu = { + name: '鑿滃崟', + property: 'classify', + level: 2, + sublist: [] + } + + this.setState({editMenu: _menu, visible: true}) + } + + menuSubmit = () => { + const { menu } = this.props + const { editMenu } = this.state + + this.menuRef.handleConfirm().then(res => { + let _menu = {...editMenu, ...res} + let _data = this.state.data + if (!_menu.MenuID) { + _menu.MenuID = Utils.getuuid() + _data.push(_menu) + } else { + _data = _data.map(item => { + if (item.MenuID === _menu.MenuID) { + return _menu + } else { + return item + } + }) + } + this.setState({data: _data, editMenu: null, visible: false}) + this.props.menuUpdate({...menu, sublist: _data}) + }) + } + + menuUpdate = (res) => { + const { menu } = this.props + + let _data = this.state.data.map(item => { + if (item.MenuID === res.MenuID) { + return res + } else { + return item + } + }) + + this.setState({data: _data}) + this.props.menuUpdate({...menu, sublist: _data}) + } + + render() { + const { columns, data, visible, editMenu } = this.state + + return ( + <div className="submenu-control-wrap"> + <Icon type="plus" style={{color: '#26C281', padding: '5px', fontSize: '16px'}} onClick={this.plusMenu}/> + <Table + size="middle" + rowKey="MenuID" + columns={columns} + rowClassName={record => record.property} + expandedRowRender={record => <ThdTable menu={record} menuUpdate={this.menuUpdate} />} + dataSource={data} + pagination={false} + /> + <Modal + title="缂栬緫" + visible={visible} + width={600} + maskClosable={false} + onOk={this.menuSubmit} + onCancel={() => { this.setState({ visible: false }) }} + destroyOnClose + > + <MenuForm + menu={editMenu} + inputSubmit={this.menuSubmit} + wrappedComponentRef={(inst) => this.menuRef = inst} + /> + </Modal> + </div> ) } } @@ -81,14 +355,26 @@ editMenu: null, columns: [ { title: '鑿滃崟鍚嶇О', dataIndex: 'name', key: 'name' }, - { title: '灞炴��', dataIndex: 'property', key: 'property', render: text => { - if (text === 'menu') { - return '鑿滃崟' - } else { - return '鍒嗙被' - } + { title: '鑿滃崟灞炴��', dataIndex: 'property', key: 'property', render: text => { + const trans = {menu: '鑿滃崟', link: '閾炬帴', linkmenu: '鍏宠仈鑿滃崟', classify: '鍒嗙被'} + + return trans[text] }}, - { title: 'Action', key: 'operation', render: () => <a href="#d">Publish</a> }, + { title: '鎵撳紑鏂瑰紡', dataIndex: 'open', key: 'open', render: (text, record) => { + if (record.property === 'classify') return '' + + const trans = {blank: '鏂扮獥鍙�', self: '褰撳墠绐楀彛'} + + return trans[text] + }}, + { title: '鎿嶄綔', key: 'operation', align: 'center', width: '190px', render: (text, record) => + (<div> + <Button type="link" style={{padding: '0 5px', marginRight: '5px'}} onClick={() => this.editMenu(record)}>缂栬緫</Button> + <Button type="link" style={{color: '#ff4d4f', padding: '0 5px', marginRight: '5px'}} onClick={() => this.delMenu(record)}>鍒犻櫎</Button> + <Icon type="arrow-up" style={{color: '#26C281', cursor: 'pointer', padding: '0 5px', marginRight: '5px'}} onClick={() => this.moveUp(record)}/> + <Icon type="arrow-down" style={{color: '#ff4d4f', cursor: 'pointer', padding: '0 5px'}} onClick={() => this.moveDown(record)}/> + </div>) + } ] } @@ -102,12 +388,54 @@ return !is(fromJS(this.state), fromJS(nextState)) } + moveUp = (record) => { + let data = fromJS(this.state.data).toJS() + + let dragIndex = data.findIndex(c => c.MenuID === record.MenuID) + let hoverIndex = dragIndex - 1 + + if (hoverIndex === -1) return + + data.splice(hoverIndex, 0, ...data.splice(dragIndex, 1)) + this.setState({data}) + } + + moveDown = (record) => { + let data = fromJS(this.state.data).toJS() + + let dragIndex = data.findIndex(c => c.MenuID === record.MenuID) + let hoverIndex = dragIndex + 1 + + if (hoverIndex === data.length) return + + data.splice(hoverIndex, 0, ...data.splice(dragIndex, 1)) + this.setState({data}) + } + + delMenu = (record) => { + const { data } = this.state + const _this = this + + confirm({ + title: (record.property === 'classify' && record.sublist.length > 0 ? '鑿滃崟涓嬪惈鏈夊瓙鑿滃崟锛�' : '') + '纭畾鍒犻櫎鍚楋紵', + content: '', + onOk() { + _this.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) + }, + onCancel() {} + }) + } + + editMenu = (record) => { + this.setState({editMenu: record, visible: true}) + } + plusMenu = () => { let _menu = { name: '鑿滃崟', property: 'classify', level: 1, - children: [] + sublist: [] } this.setState({editMenu: _menu, visible: true}) @@ -118,18 +446,36 @@ this.menuRef.handleConfirm().then(res => { let _menu = {...editMenu, ...res} - if (!_menu.uuid) { - _menu.uuid = Utils.getuuid() - this.setState({data: [...data, _menu]}) + if (!_menu.MenuID) { + _menu.MenuID = Utils.getuuid() + this.setState({data: [...data, _menu], editMenu: null, visible: false}) } else { - this.setState({data: data.map(item => { - if (item.uuid === _menu.uuid) { - return _menu - } else { - return item - } - })}) + this.setState({ + editMenu: null, + visible: false, + data: data.map(item => { + if (item.MenuID === _menu.MenuID) { + return _menu + } else { + return item + } + }) + }) } + }) + } + + menuUpdate = (res) => { + const { data } = this.state + + this.setState({ + data: data.map(item => { + if (item.MenuID === res.MenuID) { + return res + } else { + return item + } + }) }) } @@ -140,10 +486,12 @@ <div className="menu-control-wrap"> <Button className="menu-plus mk-green" onClick={this.plusMenu}>娣诲姞</Button> <Table - className="components-table-demo-nested" + rowKey="MenuID" columns={columns} - expandedRowRender={<SubTable />} + rowClassName={record => record.property} + expandedRowRender={record => <SubTable menu={record} menuUpdate={this.menuUpdate} />} dataSource={data} + pagination={false} /> <Modal title="缂栬緫" diff --git a/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.scss b/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.scss index 1a060dd..16854bb 100644 --- a/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.scss +++ b/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.scss @@ -7,4 +7,58 @@ z-index: 1; margin-bottom: 5px; } + .ant-empty { + margin: 5px 0; + } + thead tr { + background: #fbfbfb; + } + tbody > tr:not(.ant-table-expanded-row) { + background: #ffffff; + } + tr:not(.classify) { + > td { + >.ant-table-row-expand-icon-cell { + div { + display: none; + } + } + >.ant-table-row-expand-icon { + display: none; + } + } + } + tr:not(.classify) + .ant-table-expanded-row { + display: none; + } + td[colspan="4"] { + padding: 5px 0px 5px 5px!important; + } + .ant-table-body { + margin: 0!important; + } + + .submenu-control-wrap { + position: relative; + + .anticon-plus { + position: absolute; + top: 8px; + right: 10px; + z-index: 1; + } + + .thdmenu-control-wrap { + position: relative; + .ant-table-row-indent { + display: none; + } + .ant-table-row-expand-icon { + display: none; + } + .ant-table-small { + border: 0; + } + } + } } \ No newline at end of file diff --git a/src/pc/components/navbar/normal-navbar/wrapsetting/settingform/index.jsx b/src/pc/components/navbar/normal-navbar/wrapsetting/settingform/index.jsx index 3a72098..e8a8e8f 100644 --- a/src/pc/components/navbar/normal-navbar/wrapsetting/settingform/index.jsx +++ b/src/pc/components/navbar/normal-navbar/wrapsetting/settingform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Tooltip, Icon, InputNumber } from 'antd' +import { Form, Row, Col, Input, Tooltip, Icon, InputNumber, Select } from 'antd' import asyncComponent from '@/utils/asyncComponent' import './index.scss' @@ -16,29 +16,37 @@ } state = { - roleList: [] + appMenus: [], + logointid: this.props.wrap.linkIntId || '' } UNSAFE_componentWillMount () { - let roleList = sessionStorage.getItem('sysRoles') - if (roleList) { + let appMenus = sessionStorage.getItem('appMenus') + if (appMenus) { try { - roleList = JSON.parse(roleList) + appMenus = JSON.parse(appMenus) } catch { - roleList = [] + appMenus = [] } } else { - roleList = [] + appMenus = [] } - this.setState({roleList}) + this.setState({appMenus}) } handleConfirm = () => { + const { logointid } = this.state // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { + values.linkIntId = '' + + if (values.logolink && logointid) { + values.linkIntId = logointid + } + resolve(values) } else { reject(err) @@ -58,6 +66,7 @@ render() { const { wrap } = this.props const { getFieldDecorator } = this.props.form + const { appMenus } = this.state const formItemLayout = { labelCol: { @@ -82,6 +91,19 @@ { required: true, message: this.props.dict['form.required.input'] + '瀵艰埅鏍忓悕绉�!' + } + ] + })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} + </Form.Item> + </Col> + <Col span={12}> + <Form.Item label="鑿滃崟鍙傛暟"> + {getFieldDecorator('MenuNo', { + initialValue: wrap.MenuNo, + rules: [ + { + required: true, + message: this.props.dict['form.required.input'] + '鑿滃崟鍙傛暟!' } ] })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} @@ -127,6 +149,24 @@ )} </Form.Item> </Col> + <Col span={12}> + <Form.Item label="logo閾炬帴"> + {getFieldDecorator('logolink', { + initialValue: wrap.logolink || '' + })( + <Select + showSearch + onChange={(val, { props }) => this.setState({logointid: props.intid})} + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + <Select.Option key="empty" intid={''} value={''}>鏃�</Select.Option> + {appMenus.map(option => + <Select.Option key={option.MenuID} intid={option.menuid_int} value={option.MenuID}>{option.MenuName}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> </Row> </Form> </div> diff --git a/src/pc/quotecomponent/index.jsx b/src/pc/quotecomponent/index.jsx new file mode 100644 index 0000000..11426ac --- /dev/null +++ b/src/pc/quotecomponent/index.jsx @@ -0,0 +1,123 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Button, Modal, notification } from 'antd' + +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' +import SettingForm from './settingform' +import Api from '@/api' +import './index.scss' + +class Quotecomponent extends Component { + static propTpyes = { + config: PropTypes.any, + updateConfig: PropTypes.func + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + visible: false, + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + verifySubmit = () => { + let config = fromJS(this.props.config).toJS() + + this.verifyRef.handleConfirm().then(res => { + let exit = false + config.components.forEach(item => { + if (item.type === res.keys_type) { + exit = true + } + }) + + if (exit) { + let msg = '' + if (res.keys_type === 'navbar') { + msg = '瀵艰埅鏍忓凡瀛樺湪锛�' + } + notification.warning({ + top: 92, + message: msg, + duration: 5 + }) + return + } + + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + TypeCharOne: sessionStorage.getItem('kei_no'), + typename: 'pc', + MenuID: res.keys_id + }).then(result => { + if (!result.status) { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + return + } + let _config = null + try { + _config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + } catch (e) { + console.warn('Parse Failure') + _config = null + } + + if (!_config) { + notification.warning({ + top: 92, + message: '鏈幏鍙栧埌閰嶇疆淇℃伅锛�', + duration: 5 + }) + return + } + + _config.open_edition = result.open_edition || '' + window.GLOB.CacheIndependent.set(_config.uuid, fromJS(_config).toJS()) + + config.components.unshift(_config) + + this.setState({ + visible: false + }) + this.props.updateConfig(config) + }) + }) + } + + render () { + const { config } = this.props + const { visible, dict } = this.state + + return ( + <div className="quote-wrap"> + <Button icon="appstore" onClick={() => {this.setState({visible: true})}}>缁勪欢寮曠敤</Button> + <Modal + title="缁勪欢寮曠敤" + visible={visible} + width={500} + maskClosable={false} + okText={dict['model.submit']} + onOk={this.verifySubmit} + onCancel={() => { this.setState({ visible: false }) }} + destroyOnClose + > + <SettingForm + dict={dict} + config={config} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> + </Modal> + </div> + ) + } +} + +export default Quotecomponent \ No newline at end of file diff --git a/src/pc/quotecomponent/index.scss b/src/pc/quotecomponent/index.scss new file mode 100644 index 0000000..161ee6e --- /dev/null +++ b/src/pc/quotecomponent/index.scss @@ -0,0 +1,6 @@ +.quote-wrap { + button { + border-color: #40a9ff; + color: #40a9ff; + } +} \ No newline at end of file diff --git a/src/pc/quotecomponent/settingform/index.jsx b/src/pc/quotecomponent/settingform/index.jsx new file mode 100644 index 0000000..afadc00 --- /dev/null +++ b/src/pc/quotecomponent/settingform/index.jsx @@ -0,0 +1,88 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Select } from 'antd' + +import './index.scss' + +class SettingForm extends Component { + static propTpyes = { + dict: PropTypes.object, // 瀛楀吀椤� + } + + state = { + appMenus: [] + } + + UNSAFE_componentWillMount () { + let appMenus = sessionStorage.getItem('appViewList') + if (appMenus) { + try { + appMenus = JSON.parse(appMenus) + appMenus = appMenus.filter(item => item.keys_type !== 'index') + } catch { + appMenus = [] + } + } else { + appMenus = [] + } + + this.setState({appMenus}) + } + + handleConfirm = () => { + const { appMenus } = this.state + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let item = appMenus.filter(_menu => _menu.keys_id === values.menu)[0] + resolve(item) + } else { + reject(err) + } + }) + }) + } + + render() { + const { getFieldDecorator } = this.props.form + const { appMenus } = this.state + + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout}> + <Row gutter={24}> + <Col span={20}> + <Form.Item label="鑿滃崟"> + {getFieldDecorator('menu', { + initialValue: '', + rules: [{ + required: true, + message: '璇烽�夋嫨鑿滃崟!' + }] + })( + <Select> + {appMenus.map(option => + <Select.Option key={option.keys_id} value={option.keys_id}>{option.remark}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + </Row> + </Form> + ) + } +} + +export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/pc/quotecomponent/settingform/index.scss b/src/pc/quotecomponent/settingform/index.scss new file mode 100644 index 0000000..159130b --- /dev/null +++ b/src/pc/quotecomponent/settingform/index.scss @@ -0,0 +1,11 @@ +.model-menu-setting-form { + position: relative; + + .anticon-question-circle { + color: #c49f47; + margin-right: 3px; + } + .ant-input-number { + width: 100%; + } +} \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx index b4481c0..b2c76db 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx @@ -43,6 +43,7 @@ let errors = null let sheetName = btn.verify.sheet + let errDetail = '' if (Object.keys(workbook.Sheets).length === 1) { sheetName = Object.keys(workbook.Sheets)[0] @@ -58,14 +59,15 @@ } else { let iserror = false btn.verify.columns.forEach(op => { - if (header[op.Column] !== op.Text) { + let _name = typeof(header[op.Column]) === 'string' ? header[op.Column].replace(/(^\s*|\s*$)/g, '') : header[op.Column] + let _text = op.Text ? op.Text.replace(/(^\s*|\s*$)/g, '') : op.Text + + if (_name !== _text && !iserror) { iserror = true + errors = 'headerError' + errDetail = `Excel涓紙${_name}锛変笌鎸夐挳鍒椾俊鎭紙${_text}锛変笉涓�鑷达紒` } }) - - if (iserror) { - errors = 'headerError' - } } } @@ -76,7 +78,7 @@ } // 鏈�缁堣幏鍙栧埌骞朵笖鏍煎紡鍖栧悗鐨� json 鏁版嵁 - this.props.returndata(data, errors, sheetName) + this.props.returndata(data, errors, sheetName, errDetail) this.setState({ excelId: '', }, () => { diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 1312e0d..0d53a35 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -194,7 +194,7 @@ /** * @description Excel 瀵煎叆 */ - getexceldata = (data, errors, sheetName) => { + getexceldata = (data, errors, sheetName, errDetail) => { const { btn } = this.props if (errors) { @@ -213,7 +213,7 @@ } else if (errors === 'headerError') { notification.warning({ top: 92, - message: '宸ヤ綔琛ㄣ��' + sheetName + '銆嬭〃澶磋缃敊璇紝璇锋鏌ヨ〃澶翠腑鐨勫悕绉板強椤哄簭锛屼笌鎸夐挳Excel鍒椾俊鎭槸鍚︿竴鑷达紒', + message: `宸ヤ綔琛ㄣ��${sheetName}銆嬭〃澶撮敊璇紝${errDetail}`, duration: 5 }) } diff --git a/src/templates/calendarconfig/index.jsx b/src/templates/calendarconfig/index.jsx index 4a349ed..55c923d 100644 --- a/src/templates/calendarconfig/index.jsx +++ b/src/templates/calendarconfig/index.jsx @@ -42,7 +42,6 @@ dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 瀛楀吀 config: null, // 椤甸潰閰嶇疆 visible: false, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪锛屾ā鎬佹鏄剧ず鎺у埗 - tableFields: [], // 宸查�夎〃瀛楁闆� fields: null, // 鎼滅储鏉′欢鍙婃樉绀哄垪锛屽彲閫夊瓧娈� formlist: null, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪琛ㄥ崟瀛楁 menuloading: false, // 鑿滃崟淇濆瓨涓� @@ -710,18 +709,6 @@ config: config }) } - - /** - * @description 鏇存柊甯哥敤琛ㄤ俊鎭紝蹇嵎娣诲姞鍚庢洿鏂伴厤缃俊鎭� - */ - updatetable = (config, fields) => { - const { tableFields } = this.state - - this.setState({ - config: config, - tableFields: fields ? fields : tableFields - }) - } // 骞村垏鎹㈡椂閲嶆柊鐢熸垚鏁版嵁 changeDate = (year) => { @@ -753,7 +740,7 @@ <TableComponent config={config} containerId="subtable-basedata" - updatetable={this.updatetable} + updatetable={this.updateconfig} /> </Panel> {/* 鎼滅储鏉′欢娣诲姞 */} @@ -766,7 +753,6 @@ <FieldsComponent config={config} type="search" - tableFields={this.state.tableFields} updatefield={this.updateconfig} /> </Panel> @@ -789,7 +775,6 @@ <SettingComponent config={config} MenuID={menu.MenuID} - tableFields={this.state.tableFields} updateConfig={this.updateconfig} /> <SearchComponent diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 5df380a..f944b3b 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -44,7 +44,6 @@ state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, config: null, // 椤甸潰閰嶇疆 - tableFields: [], // 宸查�夌殑甯哥敤琛� formlist: null, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪琛ㄥ崟瀛楁 menuloading: false, // 鑿滃崟淇濆瓨涓� menucloseloading: false, // 鑿滃崟鍏抽棴鏃讹紝閫夋嫨淇濆瓨 @@ -1074,28 +1073,6 @@ } /** - * @description 鏇存柊甯哥敤琛ㄤ俊鎭紝蹇嵎娣诲姞鍚庢洿鏂伴厤缃俊鎭� - */ - updatetable = (config, fields) => { - const { tableFields } = this.state - - this.setState({ - config: config, - tableFields: fields ? fields : tableFields - }) - } - - /** - * @description 鏇存柊鏍囩閰嶇疆淇℃伅 - */ - updatetabs = (config) => { - - this.setState({ - config: config - }) - } - - /** * @description 鏇存柊閰嶇疆淇℃伅 */ updateconfig = (config) => { @@ -1134,7 +1111,7 @@ <TableComponent config={config} containerId="main-basedata" - updatetable={this.updatetable} + updatetable={this.updateconfig} /> </Panel> {/* 鎼滅储鏉′欢娣诲姞 */} @@ -1145,7 +1122,6 @@ <FieldsComponent config={config} type="search" - tableFields={this.state.tableFields} updatefield={this.updateconfig} /> </Panel> @@ -1185,7 +1161,6 @@ <FieldsComponent config={config} type="columns" - tableFields={this.state.tableFields} updatefield={this.updateconfig} /> </Panel> @@ -1296,7 +1271,7 @@ config={config} tabs={this.state.tabviews} setSubConfig={(item) => this.setSubConfig(item, 'tab')} - updatetabs={this.updatetabs} + updatetabs={this.updateconfig} /> </Card> </div> diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 00de833..1db628e 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -47,7 +47,6 @@ state = { menu: null, // 涓婄骇鑿滃崟锛屼笁绾ц彍鍗曟垨鏍囩 dict: CommonDict, // 瀛楀吀 - tableFields: [], // 宸查�夌殑甯哥敤琛� config: null, // 椤甸潰閰嶇疆锛屽寘鎷ā鏉跨被鍨嬨�佹ā鎬佹璁剧疆銆佹坊鍔犺〃鍚嶃�佽〃鍗曞垪琛� visible: false, // 琛ㄥ崟缂栬緫妯℃�佹锛屾樉绀烘帶鍒� modalformlist: null, // 鍩烘湰淇℃伅琛ㄥ崟瀛楁 @@ -588,18 +587,6 @@ } /** - * @description 鏇存柊甯哥敤琛ㄤ俊鎭紝蹇嵎娣诲姞鍚庢洿鏂伴厤缃俊鎭� - */ - updatetable = (config, fields) => { - const { tableFields } = this.state - - this.setState({ - config: config, - tableFields: fields ? fields : tableFields - }) - } - - /** * @description 鍏ㄥ眬璁剧疆妯℃�佹 */ changeSetting = () => { @@ -782,7 +769,7 @@ <TableComponent config={config} containerId="modal-basedata" - updatetable={this.updatetable} + updatetable={this.updateconfig} /> </Panel> <Panel header={dict['header.menu.form']} key="1"> @@ -794,7 +781,6 @@ <FieldsComponent config={config} type="form" - tableFields={this.state.tableFields} updatefield={this.updateconfig} /> <Button type="primary" block onClick={() => this.handleGroup()}>{dict['header.menu.group.add']}</Button> diff --git a/src/templates/sharecomponent/fieldscomponent/index.jsx b/src/templates/sharecomponent/fieldscomponent/index.jsx index 178350f..a828bf7 100644 --- a/src/templates/sharecomponent/fieldscomponent/index.jsx +++ b/src/templates/sharecomponent/fieldscomponent/index.jsx @@ -14,7 +14,6 @@ static propTpyes = { type: PropTypes.string, // 鎼滅储鏉′欢娣诲姞銆佹樉绀哄垪娣诲姞 config: PropTypes.object, // 瀹瑰櫒Id - tableFields: PropTypes.string, // 宸查�夎〃瀛楁闆� updatefield: PropTypes.func } @@ -25,9 +24,9 @@ } queryField = () => { - const { type, config, tableFields } = this.props + const { type, config } = this.props // 鍒ゆ柇鏄惁宸查�夋嫨琛ㄥ悕 - if (!tableFields || tableFields.length === 0) { + if (!window.GLOB.tableFields || window.GLOB.tableFields.length === 0) { notification.warning({ top: 92, message: '璇烽�夋嫨琛ㄥ悕锛�', @@ -38,7 +37,7 @@ // 琛ㄥ瓧娈甸泦杞负map鏁版嵁 let columns = new Map() - tableFields.forEach(table => { + window.GLOB.tableFields.forEach(table => { table.columns.forEach(column => { columns.set(column.field.toLowerCase(), column) }) diff --git a/src/templates/sharecomponent/settingcalcomponent/index.jsx b/src/templates/sharecomponent/settingcalcomponent/index.jsx index e3a64e3..683b4a0 100644 --- a/src/templates/sharecomponent/settingcalcomponent/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/index.jsx @@ -12,7 +12,6 @@ static propTpyes = { config: PropTypes.any, MenuID: PropTypes.string, - tableFields: PropTypes.any, updateConfig: PropTypes.func } @@ -76,7 +75,6 @@ <VerifyCard dict={dict} config={config} - tableFields={this.props.tableFields} menuId={this.props.config.uuid} searches={config.search} wrappedComponentRef={(inst) => this.verifyRef = inst} diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx index cd2600a..bd0e767 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx @@ -21,7 +21,6 @@ class VerifyCard extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� - tableFields: PropTypes.any, // 鏁版嵁婧愪俊鎭� config: PropTypes.object, // 鏁版嵁婧愪俊鎭� menuId: PropTypes.string, // 鑿滃崟Id searches: PropTypes.array, // 鎼滅储鏉′欢 @@ -353,7 +352,6 @@ <FieldsComponent config={{...this.props.config, columns}} type="fields" - tableFields={this.props.tableFields} updatefield={this.updatefields} /> <Table diff --git a/src/templates/sharecomponent/tablecomponent/index.jsx b/src/templates/sharecomponent/tablecomponent/index.jsx index d44cc6f..4558e82 100644 --- a/src/templates/sharecomponent/tablecomponent/index.jsx +++ b/src/templates/sharecomponent/tablecomponent/index.jsx @@ -153,8 +153,7 @@ this.setState({ tableFields: _columns }) - - this.props.updatetable(this.props.config, _columns) + window.GLOB.tableFields = _columns }) } @@ -209,11 +208,16 @@ } }) } + + let _columns = [...tableFields, tabmsg] + this.setState({ - tableFields: [...tableFields, tabmsg] + tableFields: _columns }) - this.props.updatetable(_config, [...tableFields, tabmsg]) + window.GLOB.tableFields = _columns + + this.props.updatetable(_config) } else { notification.warning({ top: 92, @@ -240,7 +244,9 @@ tableFields: _fields }) - this.props.updatetable({...config, tables: _tables}, _fields) + window.GLOB.tableFields = _fields + + this.props.updatetable({...config, tables: _tables}) } /** diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 931505d..d3bda26 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -50,7 +50,6 @@ dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 瀛楀吀 config: null, // 椤甸潰閰嶇疆 visible: false, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪锛屾ā鎬佹鏄剧ず鎺у埗 - tableFields: [], // 宸查�夎〃瀛楁闆� menuloading: false, // 鑿滃崟淇濆瓨涓� menucloseloading: false, // 鑿滃崟鍏抽棴鏃讹紝閫夋嫨淇濆瓨 loading: false, // 鍔犺浇涓紝椤甸潰spin @@ -916,27 +915,6 @@ chartview: _chartview }) } - - /** - * @description 鏇存柊甯哥敤琛ㄤ俊鎭紝蹇嵎娣诲姞鍚庢洿鏂伴厤缃俊鎭� - */ - updatetable = (config, fields) => { - const { tableFields } = this.state - - this.setState({ - config: config, - tableFields: fields ? fields : tableFields - }) - } - - /** - * @description 鎵归噺娣诲姞锛屾洿鏂伴厤缃俊鎭� - */ - updatefield = (config) => { - this.setState({ - config: config - }) - } render () { const { activeKey, config, chartview } = this.state @@ -961,7 +939,7 @@ <TableComponent config={config} containerId="subtable-basedata" - updatetable={this.updatetable} + updatetable={this.updateconfig} /> </Panel> {/* 鎼滅储鏉′欢娣诲姞 */} @@ -974,8 +952,7 @@ <FieldsComponent config={config} type="search" - tableFields={this.state.tableFields} - updatefield={this.updatefield} + updatefield={this.updateconfig} /> </Panel> {/* 鎸夐挳娣诲姞 */} @@ -1018,8 +995,7 @@ <FieldsComponent config={config} type="columns" - tableFields={this.state.tableFields} - updatefield={this.updatefield} + updatefield={this.updateconfig} /> </Panel> </Collapse> diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index b6e4456..b9da890 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -2407,7 +2407,7 @@ { type: 'radio', key: 'interception', - label: '鎴彇', + label: '鎴彇绌烘牸', initVal: card.interception || 'false', tooltip: '鎻愪氦鏃讹紝鏄惁鎴彇棣栧熬鐨勭┖鐧藉瓧绗︺��', options: [{ diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 5a23018..f227a6a 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -56,14 +56,12 @@ ParentId: '', MenuName: '', MenuNo: '', - tableFields: [], delButtons: [], copyButtons: [], thawButtons: [], activeKey: 'basedata', menuloading: false, oriConfig: null, - openEdition: '', config: null, popBtn: null, // 寮圭獥鏍囩椤� visible: false, @@ -228,10 +226,7 @@ initPopview = (card, btn) => { const { oriConfig, config } = this.state - let _config = fromJS(config).toJS() - delete _config.tableFields - - if (!is(fromJS(oriConfig), fromJS(_config))) { + if (!is(fromJS(oriConfig), fromJS(config))) { notification.warning({ top: 92, message: '閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', @@ -240,7 +235,7 @@ return } - btn.config = _config + btn.config = fromJS(config).toJS() btn.component = card sessionStorage.setItem('editMenuType', 'popview') // 缂栬緫寮圭獥鏍囩 @@ -264,10 +259,7 @@ return } - let _config = fromJS(config).toJS() - delete _config.tableFields - - if (!is(fromJS(oriConfig), fromJS(_config))) { + if (!is(fromJS(oriConfig), fromJS(config))) { confirm({ title: '閰嶇疆宸蹭慨鏀癸紝鏀惧純淇濆瓨鍚楋紵', content: '', @@ -341,10 +333,11 @@ config.lastCount = config.lastCount || '' } + config.open_edition = result.open_edition || '' + this.setState({ oriConfig: config, - config: fromJS(config).toJS(), - openEdition: result.open_edition || '', + config: fromJS(config).toJS() }) this.props.modifyCustomMenu(config) @@ -458,7 +451,7 @@ } submitConfig = () => { - const { openEdition, MenuType, delButtons, copyButtons, thawButtons } = this.state + const { MenuType, delButtons, copyButtons, thawButtons } = this.state let config = fromJS(this.state.config).toJS() if (MenuType === 'billPrint' && (!config.firstCount || !config.everyPCount)) { @@ -495,21 +488,19 @@ config.enabled = false } - let _config = fromJS(config).toJS() - delete _config.tableFields - let param = { func: 'sPC_TrdMenu_AddUpt', - FstID: _config.fstMenuId || '', - SndID: _config.parentId, - ParentID: _config.parentId, - MenuID: _config.uuid, - MenuNo: _config.MenuNo || '', - EasyCode: _config.easyCode || '', + FstID: config.fstMenuId || '', + SndID: config.parentId, + ParentID: config.parentId, + MenuID: config.uuid, + MenuNo: config.MenuNo || '', + EasyCode: config.easyCode || '', Template: 'CustomPage', - MenuName: _config.MenuName || '', - PageParam: JSON.stringify({Template: 'CustomPage', OpenType: _config.OpenType || 'newtab'}), - LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config))), + MenuName: config.MenuName || '', + PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab'}), + LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))), + open_edition: config.open_edition, LText: '', LTexttb: '' } @@ -518,15 +509,11 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) - if (openEdition) { // 鐗堟湰绠$悊 - param.open_edition = openEdition - } - let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 func: 'sPC_Button_AddUpt', Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 - ParentID: _config.uuid, - MenuNo: _config.MenuNo, + ParentID: config.uuid, + MenuNo: config.MenuNo, Template: 'CustomPage', PageParam: '', LongParam: '', @@ -564,7 +551,7 @@ if (result.status) { Api.getSystemConfig({ func: 's_PrintTemplateMSub', - ID: _config.uuid, + ID: config.uuid, Images: Utils.getcloudurl(result.Images), Remark: '', temp_type: 'billprint', @@ -646,9 +633,9 @@ if (!res) return if (res.status) { + config.open_edition = res.open_edition || '' this.setState({ - oriConfig: fromJS(_config).toJS(), - openEdition: res.open_edition || '' + oriConfig: fromJS(config).toJS() }) if (btnParam.LText) { @@ -720,7 +707,7 @@ let _param = { func: 'sPC_ButtonParam_AddUpt', - ParentID: _config.uuid, + ParentID: config.uuid, MenuID: item.uuid, MenuNo: '', Template: 'CustomPage', @@ -882,22 +869,6 @@ this.props.modifyCustomMenu(config) } - /** - * @description 鏇存柊甯哥敤琛ㄤ俊鎭紝蹇嵎娣诲姞鍚庢洿鏂伴厤缃俊鎭� - */ - updatetable = (config, fields) => { - const { tableFields } = this.state - - config.tableFields = fields ? fields : tableFields - - this.setState({ - tableFields: fields ? fields : tableFields, - config - }) - - this.props.modifyCustomMenu(config) - } - render () { const { activeKey, MenuType, popBtn, visible, dict, MenuId, config, ParentId, MenuName, MenuNo, menuloading, customComponents } = this.state @@ -932,7 +903,7 @@ updateConfig={this.updateConfig} /> : null} {/* 琛ㄥ悕娣诲姞 */} - {config ? <TableComponent config={config} updatetable={this.updatetable}/> : null} + {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null} </Panel> {/* 缁勪欢娣诲姞 */} <Panel header={dict['mob.component']} key="component"> diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 959975f..f270f84 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -26,6 +26,7 @@ const MenuShell = asyncComponent(() => import('@/pc/menushell')) const SourceWrap = asyncComponent(() => import('@/pc/modulesource')) 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')) @@ -41,6 +42,7 @@ sessionStorage.setItem('appType', 'pc') // 搴旂敤绫诲瀷 document.body.className = '' window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� +window.GLOB.CacheIndependent = new Map() class MenuDesign extends Component { state = { @@ -49,20 +51,18 @@ MenuId: '', MenuName: '', MenuNo: '', - tableFields: [], delButtons: [], copyButtons: [], thawButtons: [], activeKey: 'basedata', menuloading: false, oriConfig: null, - openEdition: '', config: null, popBtn: null, // 寮圭獥鏍囩椤� visible: false, customComponents: [], - settingshow: true, - controlshow: true, + settingshow: sessionStorage.getItem('settingshow') !== 'false', + controlshow: sessionStorage.getItem('controlshow') !== 'false', } UNSAFE_componentWillMount() { @@ -105,6 +105,7 @@ MKEmitter.addListener('thawButtons', this.thawButtons) MKEmitter.addListener('copyButtons', this.copyButtons) MKEmitter.addListener('changePopview', this.initPopview) + MKEmitter.addListener('changeEditMenu', this.changeEditMenu) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) setTimeout(() => { @@ -124,8 +125,25 @@ MKEmitter.removeListener('thawButtons', this.thawButtons) MKEmitter.removeListener('copyButtons', this.copyButtons) MKEmitter.removeListener('changePopview', this.initPopview) + MKEmitter.removeListener('changeEditMenu', this.changeEditMenu) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) + } + + changeEditMenu = (menu) => { + const { oriConfig, config } = this.state + + if (!is(fromJS(oriConfig), fromJS(config))) { + notification.warning({ + top: 92, + message: '閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', + duration: 5 + }) + return + } + + this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: menu.MenuID, type: 'view'})))) + window.location.reload() } getAppMessage = () => { @@ -133,7 +151,7 @@ func: 's_get_keyids', bid: sessionStorage.getItem('appId') }).then(res => { - if (!res) { + if (!res.status) { notification.warning({ top: 92, message: res.message, @@ -144,7 +162,11 @@ let homeId = '' if (this.state.MenuId) { + let appViewList = res.data && res.data.length > 0 ? res.data : [] + homeId = this.state.MenuId + + sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) } else { let appViewList = [] if (res.data && res.data.length > 0) { @@ -204,6 +226,8 @@ } getAppPictures = () => { + if (sessionStorage.getItem('app_videos') || sessionStorage.getItem('app_pictures')) return + Api.getSystemConfig({ func: 's_url_db_adduptdel', PageIndex: 0, // 0 浠h〃鍏ㄩ儴 @@ -305,26 +329,23 @@ } initPopview = (card, btn) => { - // const { oriConfig, config } = this.state + const { oriConfig, config } = this.state - // let _config = fromJS(config).toJS() - // delete _config.tableFields + if (!is(fromJS(oriConfig), fromJS(config))) { + notification.warning({ + top: 92, + message: '閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', + duration: 5 + }) + return + } - // if (!is(fromJS(oriConfig), fromJS(_config))) { - // notification.warning({ - // top: 92, - // message: '閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', - // duration: 5 - // }) - // return - // } + btn.config = fromJS(config).toJS() + btn.component = card - // btn.config = _config - // btn.component = card + sessionStorage.setItem('editMenuType', 'popview') // 缂栬緫寮圭獥鏍囩 - // sessionStorage.setItem('editMenuType', 'popview') // 缂栬緫寮圭獥鏍囩 - - // this.setState({popBtn: btn, visible: true}) + this.setState({popBtn: btn, visible: true}) } closeView = () => { @@ -335,10 +356,7 @@ return } - let _config = fromJS(config).toJS() - delete _config.tableFields - - if (!is(fromJS(oriConfig), fromJS(_config))) { + if (!is(fromJS(oriConfig), fromJS(config))) { confirm({ title: '閰嶇疆宸蹭慨鏀癸紝鏀惧純淇濆瓨鍚楋紵', content: '', @@ -379,7 +397,6 @@ uuid: MenuId, MenuID: MenuId, Template: 'webPage', - easyCode: '', enabled: false, MenuName: '', MenuNo: '', @@ -394,14 +411,25 @@ config.uuid = MenuId config.MenuID = MenuId + config.open_edition = result.open_edition || '' - this.setState({ - oriConfig: config, - config: fromJS(config).toJS(), - openEdition: result.open_edition || '', + let indeComs = [] + config.components.forEach(item => { + if (item.type === 'navbar') { + indeComs.push(fromJS(item).toJS()) + } }) - this.props.modifyCustomMenu(config) + if (indeComs.length === 0) { + this.setState({ + oriConfig: config, + config: fromJS(config).toJS(), + }) + + this.props.modifyCustomMenu(config) + } else { + this.jointComponents(config, indeComs) + } } else { notification.warning({ top: 92, @@ -409,6 +437,107 @@ duration: 5 }) } + }) + + let _param = { + func: 's_get_app_menus', + TypeCharOne: sessionStorage.getItem('kei_no'), + typename: 'pc', + LText: `select '${window.GLOB.appkey}'`, + timestamp: moment().format('YYYY-MM-DD HH:mm:ss') + } + + _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) + + Api.getSystemConfig(_param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return + } + + let appIndeList = sessionStorage.getItem('appViewList') + appIndeList = JSON.parse(appIndeList) + appIndeList = appIndeList.map(item => (item.keys_type !== 'index' ? item.keys_id : '')).join(',') + + let menus = res.menus.filter(item => appIndeList.indexOf(item.MenuID) === -1) + sessionStorage.setItem('appMenus', JSON.stringify(menus)) + }) + } + + jointComponents = (config, indeComs) => { + let deffers = indeComs.map(item => { + return new Promise(resolve => { + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + TypeCharOne: sessionStorage.getItem('kei_no'), + typename: 'pc', + MenuID: item.uuid + }).then(res => { + res.uuid = item.uuid + + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return + } + + resolve(res) + }) + }) + }) + Promise.all(deffers).then(result => { + let _conf = {} + result.forEach(res => { + let _config = null + try { + _config = res.LongParam ? JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) : null + } catch (e) { + console.warn('Parse Failure') + _config = null + } + + if (_config) { + _config.open_edition = res.open_edition || '' + _conf[res.uuid] = _config + window.GLOB.CacheIndependent.set(res.uuid, fromJS(_config).toJS()) + } + }) + + let _length = config.components.length + config.components = config.components.map(item => { + if (item.type === 'navbar') { + if (_conf[item.uuid]) { + item = _conf[item.uuid] + } else { + item = null + } + } + return item + }) + + config.components = config.components.filter(Boolean) + + if (_length > config.components.length) { + notification.warning({ + top: 92, + message: '閮ㄥ垎缁勪欢宸插垹闄わ紒', + duration: 5 + }) + } + + this.setState({ + oriConfig: fromJS(config).toJS(), + config: config + }) + + this.props.modifyCustomMenu(config) }) } @@ -512,7 +641,7 @@ } submitConfig = () => { - const { openEdition, delButtons, copyButtons, thawButtons } = this.state + const { delButtons, copyButtons, thawButtons } = this.state let config = fromJS(this.state.config).toJS() if (!config.MenuName || !config.MenuNo || (config.cacheUseful === 'true' && !config.cacheTime)) { @@ -535,41 +664,33 @@ config.enabled = false } - let _config = fromJS(config).toJS() - delete _config.tableFields - - let parMenuId = 'pc' + sessionStorage.getItem('kei_no') + sessionStorage.getItem('lang') + let parMenuId = sessionStorage.getItem('kei_no') + 'pc' + sessionStorage.getItem('lang') let param = { func: 'sPC_TrdMenu_AddUpt', FstID: parMenuId, SndID: parMenuId, ParentID: parMenuId, - MenuID: _config.uuid, - MenuNo: _config.MenuNo || '', - EasyCode: _config.easyCode || '', + MenuID: config.uuid, + MenuNo: config.MenuNo || '', + EasyCode: '', Template: 'webPage', TypeCharOne: sessionStorage.getItem('kei_no'), Typename: 'pc', - MenuName: _config.MenuName || '', + MenuName: config.MenuName || '', PageParam: JSON.stringify({Template: 'webPage'}), - LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config))), + open_edition: config.open_edition, LText: '', LTexttb: '' } - param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - if (!openEdition) { // 鐗堟湰绠$悊 - param.open_edition = openEdition - } + param.secretkey = Utils.encrypt('', param.timestamp) let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 func: 'sPC_Button_AddUpt', Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 - ParentID: _config.uuid, - MenuNo: _config.MenuNo, + ParentID: config.uuid, + MenuNo: config.MenuNo, Template: 'webPage', PageParam: '', LongParam: '', @@ -586,31 +707,129 @@ btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) new Promise(resolve => { - // html2canvas(document.getElementById('menu-shell-inner')).then(canvas => { - // let _param = { - // Base64Img: canvas.toDataURL('image/png') // 鑾峰彇鐢熸垚鐨勫浘鐗� - // } + let _config = fromJS(config).toJS() + let indeComs = [] + _config.components = _config.components.map(item => { + if (item.type === 'navbar') { + indeComs.push(item) + return { + type: 'navbar', + uuid: item.uuid + } + } + return item + }) - // _param.rduri = options.cloudServiceApi - // _param.userid = sessionStorage.getItem('CloudUserID') || '' - // _param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' + param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - // Api.fileuploadbase64(_param).then(result => { - // if (result.status) { - // let Images = Utils.getcloudurl(result.Images) - // param.PageParam = JSON.stringify({Template: 'webPage', Images}) - // resolve(true) - // } else { - // notification.warning({ - // top: 92, - // message: result.ErrMesg, - // duration: 5 - // }) - // resolve(false) - // } - // }) - // }) - resolve(true) + if (indeComs.length === 0) { + resolve(true) + } else { + let new_open_edition = {} + let deffers = indeComs.map(item => { + return new Promise(resolve => { + let _item = window.GLOB.CacheIndependent.get(item.uuid) + if (_item && is(fromJS(_item), fromJS(item))) { + new_open_edition[item.uuid] = item.open_edition || '' + resolve() + return + } + + let _param = { + func: 'sPC_TrdMenu_AddUpt', + FstID: parMenuId, + SndID: parMenuId, + ParentID: parMenuId, + MenuID: item.uuid, + MenuNo: item.wrap.MenuNo || '', + EasyCode: '', + Template: item.type, + TypeCharOne: sessionStorage.getItem('kei_no'), + Typename: 'pc', + MenuName: item.name || '', + PageParam: JSON.stringify({Template: item.type}), + open_edition: item.open_edition || '', + LText: '', + LTexttb: '' + } + + _param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(item))) + _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 + } + + new_open_edition[item.uuid] = res.open_edition || '' + + resolve() + }) + }) + }) + Promise.all(deffers).then(() => { + let appViewList = sessionStorage.getItem('appViewList') + 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') { + item.open_edition = new_open_edition[item.uuid] || '' + window.GLOB.CacheIndependent.set(item.uuid, fromJS(item).toJS()) + + if (appIndeList.indexOf(item.uuid) === -1) { + appViewList.unshift({ + appkey: window.GLOB.appkey || '', + bid: sessionStorage.getItem('appId') || '', + kei_no: sessionStorage.getItem('kei_no') || '', + keys_id: item.uuid, + keys_type: 'navbar', + remark: item.name + }) + } + } + return item + }) + + if (appViewList.length > _length) { + let param = { + func: 's_kei_link_keyids_addupt', + BID: sessionStorage.getItem('appId'), + exec_type: 'y', + LText: '' + } + + param.LText = appViewList.map(item => `select '${item.keys_id}','${item.keys_type}','${item.kei_no}','${item.appkey}','${item.bid}','${sessionStorage.getItem('CloudUserID')}','${item.remark}'`) + param.LText = param.LText.join(' union all ') + param.LText = Utils.formatOptions(param.LText) + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt('', param.timestamp) + + Api.getSystemConfig(param).then(result => { + if (!result.status) { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } else { + sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) + resolve(true) + } + }) + } else { + resolve(true) + } + }) + } }).then(res => { // 鎸夐挳鍒犻櫎 if (!res) return @@ -664,9 +883,10 @@ if (!res) return if (res.status) { + config.open_edition = res.open_edition || '' + this.setState({ - oriConfig: fromJS(_config).toJS(), - openEdition: res.open_edition || '' + oriConfig: fromJS(config).toJS(), }) if (btnParam.LText) { @@ -738,7 +958,7 @@ let _param = { func: 'sPC_ButtonParam_AddUpt', - ParentID: _config.uuid, + ParentID: config.uuid, MenuID: item.uuid, MenuNo: '', Template: 'webPage', @@ -805,6 +1025,7 @@ } getRoleFields = () => { + if (sessionStorage.getItem('sysRoles') || sessionStorage.getItem('permFuncField')) return Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { if (res.status) { let _permFuncField = [] @@ -900,20 +1121,24 @@ this.props.modifyCustomMenu(config) } - /** - * @description 鏇存柊甯哥敤琛ㄤ俊鎭紝蹇嵎娣诲姞鍚庢洿鏂伴厤缃俊鎭� - */ - updatetable = (config, fields) => { - const { tableFields } = this.state + refreshView = () => { + const { oriConfig, config } = this.state - config.tableFields = fields ? fields : tableFields + if (!is(fromJS(oriConfig), fromJS(config))) { + notification.warning({ + top: 92, + message: '閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', + duration: 5 + }) + return + } - this.setState({ - tableFields: fields ? fields : tableFields, - config - }) - - this.props.modifyCustomMenu(config) + sessionStorage.removeItem('sysRoles') + sessionStorage.removeItem('permFuncField') + sessionStorage.removeItem('app_videos') + sessionStorage.removeItem('app_pictures') + + window.location.reload() } render () { @@ -925,8 +1150,8 @@ <DndProvider backend={HTML5Backend}> <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}> <div className="draw"> - {settingshow ? <Icon onClick={() => this.setState({settingshow: false})} type="double-left" /> : null} - {!settingshow ? <Icon onClick={() => this.setState({settingshow: true})} type="double-right" /> : null} + {settingshow ? <Icon onClick={() => {sessionStorage.setItem('settingshow', 'false'); this.setState({settingshow: false})}} type="double-left" /> : null} + {!settingshow ? <Icon onClick={() => {sessionStorage.setItem('settingshow', 'true'); this.setState({settingshow: true})}} type="double-right" /> : null} </div> <div className="pc-setting-tools"> <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> @@ -940,7 +1165,7 @@ updateConfig={this.updateConfig} /> : null} {/* 琛ㄥ悕娣诲姞 */} - {config ? <TableComponent config={config} updatetable={this.updatetable}/> : null} + {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null} </Panel> {/* 缁勪欢娣诲姞 */} <Panel header={dict['mob.component']} key="component"> @@ -960,8 +1185,8 @@ </div> <div className={'menu-control ' + (!controlshow ? 'hidden' : '')}> <div className="draw"> - {controlshow ? <Icon onClick={() => this.setState({controlshow: false})} type="double-right" /> : null} - {!controlshow ? <Icon onClick={() => this.setState({controlshow: true})} type="double-left" /> : null} + {controlshow ? <Icon onClick={() => {sessionStorage.setItem('controlshow', 'false'); this.setState({controlshow: false})}} type="double-right" /> : null} + {!controlshow ? <Icon onClick={() => {sessionStorage.setItem('controlshow', 'true'); this.setState({controlshow: true})}} type="double-left" /> : null} </div> <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button> <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config && config.enabled} onChange={this.onEnabledChange} /> @@ -969,6 +1194,8 @@ <StyleCombControlButton menu={config} /> <SysInterface config={config} updateConfig={this.updateConfig}/> <PictureController/> + <Quotecomponent config={config} updateConfig={this.updateConfig}/> + <Button className="mk-border-danger" icon="redo" onClick={this.refreshView}>寮哄埗鍒锋柊</Button> <Button type="default" onClick={this.closeView}>{dict['mob.return']}</Button> </div> <div className={'menu-body ' + (menuloading ? 'saving' : '')}> diff --git a/src/views/pcdesign/menuform/index.jsx b/src/views/pcdesign/menuform/index.jsx index 13163ce..cedb3a5 100644 --- a/src/views/pcdesign/menuform/index.jsx +++ b/src/views/pcdesign/menuform/index.jsx @@ -14,17 +14,6 @@ state = {} - UNSAFE_componentWillMount () { - - } - - UNSAFE_componentWillReceiveProps(nextProps) { - const { config } = this.props - if (!config && nextProps.config) { - this.props.form.setFieldsValue({easyCode: nextProps.config.easyCode}) - } - } - // 涓�浜岀骇鑿滃崟鍒囨崲 selectChange = (key, value) => { const { config } = this.props @@ -44,11 +33,6 @@ // 鑿滃崟鍙傛暟 changeNo = (e) => { this.props.updateConfig({...this.props.config, MenuNo: e.target.value}) - } - - // 鍔╄鐮� - changeEasyCode = (e) => { - this.props.updateConfig({...this.props.config, easyCode: e.target.value}) } changeCacheDay = (val) => { @@ -145,13 +129,6 @@ )} </Form.Item> </Col> : null} - <Col span={24}> - <Form.Item label={dict['mob.menu.easycode']}> - {getFieldDecorator('easyCode', { - initialValue: config.easyCode - })(<Input placeholder="" autoComplete="off" onChange={this.changeEasyCode}/>)} - </Form.Item> - </Col> </Row> </Form> ) -- Gitblit v1.8.0