From 57266ee8c62f0fddb42c18c705507fc0dc2416f6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 18 八月 2023 17:42:39 +0800 Subject: [PATCH] 2023-08-18 --- src/menu/picturecontroller/index.jsx | 69 +- src/menu/components/chart/antv-G6/index.jsx | 15 src/menu/components/share/sourcecomponent/inputform/index.jsx | 58 + src/menu/components/timeline/normal-timeline/index.jsx | 23 src/menu/components/card/table-card/index.jsx | 34 - src/mob/modulesource/dragsource/index.jsx | 5 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 3 src/menu/components/form/simple-form/index.jsx | 22 src/pc/modulesource/dragsource/index.jsx | 5 src/menu/components/chart/antv-bar/index.jsx | 23 src/menu/components/chart/antv-scatter/index.jsx | 24 src/menu/components/code/sandbox/index.jsx | 17 src/views/tabledesign/index.jsx | 45 - src/menu/modulesource/dragsource/index.jsx | 5 src/pc/modulesource/index.jsx | 53 -- src/menu/components/tree/antd-tree/index.jsx | 15 src/views/mobdesign/index.jsx | 61 -- src/menu/components/table/edit-table/index.jsx | 37 - src/menu/components/carousel/data-card/index.jsx | 23 src/views/menudesign/index.jsx | 147 ----- src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx | 2 src/menu/components/card/balcony/index.jsx | 19 src/menu/components/module/voucher/options.jsx | 2 src/mob/colorsketch/index.jsx | 56 + src/tabviews/custom/components/module/voucher/index.jsx | 31 src/menu/components/form/step-form/index.jsx | 22 src/menu/components/card/cardcellcomponent/index.jsx | 76 ++ src/views/pcdesign/index.jsx | 59 -- src/menu/components/form/tab-form/index.jsx | 22 src/menu/components/share/actioncomponent/formconfig.jsx | 6 src/mob/components/menubar/normal-menubar/index.jsx | 16 src/menu/components/carousel/prop-card/index.jsx | 23 src/menu/components/share/sourcecomponent/index.jsx | 2 src/menu/components/card/double-data-card/index.jsx | 36 - src/mob/modulesource/index.jsx | 53 -- src/components/mkIcon/index.jsx | 12 src/menu/components/card/data-card/index.jsx | 36 - src/menu/components/share/actioncomponent/index.jsx | 79 ++ src/menu/components/chart/antv-pie/index.jsx | 22 /dev/null | 0 src/menu/components/chart/antv-dashboard/index.jsx | 15 src/menu/components/editor/braft-editor/index.jsx | 16 src/menu/components/card/prop-card/index.jsx | 27 - src/templates/zshare/verifycard/baseform/index.jsx | 45 + src/views/imdesign/index.jsx | 41 - src/menu/components/table/normal-table/index.jsx | 43 - src/utils/option.js | 9 src/menu/modulesource/index.jsx | 53 -- 48 files changed, 333 insertions(+), 1,174 deletions(-) diff --git a/src/components/mkIcon/index.jsx b/src/components/mkIcon/index.jsx index 529f3a4..fd157d7 100644 --- a/src/components/mkIcon/index.jsx +++ b/src/components/mkIcon/index.jsx @@ -47,8 +47,8 @@ componentDidMount() { if (!window.GLOB.designView) { - if (sessionStorage.getItem('systemIcons')) { - this.setState({cusicons: JSON.parse(sessionStorage.getItem('systemIcons'))}) + if (window.GLOB.systemIcons) { + this.setState({cusicons: window.GLOB.systemIcons}) } else { this.getIcons() } @@ -72,18 +72,16 @@ message: res.message, duration: 5 }) - sessionStorage.setItem('systemIcons', JSON.stringify([])) - return - } else if (!res.data) { + window.GLOB.systemIcons = [] return } - let icons = res.data.map(item => { + let icons = (res.data || []).map(item => { item.icon_svg = window.decodeURIComponent(window.atob(item.icon_svg)) return item }) - sessionStorage.setItem('systemIcons', JSON.stringify(icons)) + window.GLOB.systemIcons = icons this.setState({cusicons: icons}) }) diff --git a/src/menu/components/card/balcony/index.jsx b/src/menu/components/card/balcony/index.jsx index 70ff681..756ffcc 100644 --- a/src/menu/components/card/balcony/index.jsx +++ b/src/menu/components/card/balcony/index.jsx @@ -17,7 +17,6 @@ const CardCellComponent = asyncComponent(() => import('../cardcellcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) class BalconyEditComponent extends Component { @@ -51,23 +50,6 @@ columns: [], scripts: [], elements: [], - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.elements = _card.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) } this.updateComponent(_card) @@ -305,7 +287,6 @@ <PasteComponent options={['action', 'customCardElement']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} /> {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} </div> diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index a5b33a8..3d140fc 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -561,10 +561,11 @@ </Col> ) } else if (item.type === 'file') { - let type = this.state.eleType + let type = this.record.eleType if (item.key === 'posterUrl') { type = 'picture' } + fields.push( <Col span={12} key={index}> <Form.Item label={item.tooltip ? diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index f052c14..5e871c2 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -1,13 +1,14 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Modal, Button } from 'antd' +import { Modal, Button, notification } from 'antd' import moment from 'moment' +import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' import { getCardCellForm } from './formconfig' +import { queryPrintSql } from '@/utils/option.js' import { getActionForm, getBaseTableActionForm } from '@/menu/components/share/actioncomponent/formconfig' - import Utils, { FuncUtils } from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import MenuUtils from '@/utils/utils-custom.js' @@ -315,21 +316,64 @@ let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid, supId) - if (cards.subtype === 'basetable') { - this.setState({ - actvisible: true, - card: card, - formlist: getBaseTableActionForm(card, functip, cards, usefulFields, modules) - }) - } else { - let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || [] + this.checkPrintTemp().then(() => { + if (cards.subtype === 'basetable') { + this.setState({ + actvisible: true, + card: card, + formlist: getBaseTableActionForm(card, functip, cards, usefulFields, modules) + }) + } else { + let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || [] + + this.setState({ + actvisible: true, + card: card, + formlist: getActionForm(card, functip, cards, usefulFields, modules, anchors, side) + }) + } + }) + } - this.setState({ - actvisible: true, - card: card, - formlist: getActionForm(card, functip, cards, usefulFields, modules, anchors, side) - }) - } + checkPrintTemp = () => { + return new Promise(resolve => { + if (!window.GLOB.printTemps) { + let param = { + func: 'sPC_Get_SelectedList', + LText: Utils.formatOptions(queryPrintSql), + obj_name: 'data', + arr_field: 'PN,ID,Images' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 + + Api.getCloudConfig(param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + + let temps = (res.data || []).map(temp => { + return { + value: temp.ID, + text: temp.PN + } + }) + window.GLOB.printTemps = temps + resolve() + }, () => { + resolve() + }) + } else { + resolve() + } + }) } /** diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 089dc95..5822912 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -17,7 +17,6 @@ const CardComponent = asyncComponent(() => import('../cardcomponent')) const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) @@ -78,40 +77,6 @@ backElements: [], menus: [] }] - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.elements = scard.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - scard.backElements = scard.backElements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) - _card.action = config.action.map(col => { - col.uuid = Utils.getuuid() - return col - }) - _card.search = config.search.map(col => { - col.uuid = Utils.getuuid() - return col - }) } this.updateComponent(_card) @@ -558,7 +523,6 @@ <PasteComponent options={['action', 'search', 'form', 'cardcell']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> </div> diff --git a/src/menu/components/card/double-data-card/index.jsx b/src/menu/components/card/double-data-card/index.jsx index 1374635..81cf755 100644 --- a/src/menu/components/card/double-data-card/index.jsx +++ b/src/menu/components/card/double-data-card/index.jsx @@ -18,7 +18,6 @@ const DoubleCardComponent = asyncComponent(() => import('../doublecardcomponent')) const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) @@ -92,40 +91,6 @@ value: '瀛愯〃鍖哄煙' }] }] - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.elements = scard.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - scard.backElements = scard.backElements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) - _card.action = config.action.map(col => { - col.uuid = Utils.getuuid() - return col - }) - _card.search = config.search.map(col => { - col.uuid = Utils.getuuid() - return col - }) } this.updateComponent(_card) @@ -540,7 +505,6 @@ <PasteComponent options={['action', 'search', 'form', 'cardcell']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> </div> diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx index 12c8c19..880a042 100644 --- a/src/menu/components/card/prop-card/index.jsx +++ b/src/menu/components/card/prop-card/index.jsx @@ -17,7 +17,6 @@ const CardComponent = asyncComponent(() => import('../cardcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) @@ -70,31 +69,6 @@ }], } - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.elements = scard.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - scard.backElements = scard.backElements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) - } this.updateComponent(_card) } else { this.setState({ @@ -416,7 +390,6 @@ <PasteComponent options={['cardcell']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} </div> diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 5eb5acd..dd96ddb 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -18,7 +18,6 @@ const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) @@ -67,38 +66,6 @@ elements: [] }], action: [], - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.elements = scard.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) - _card.search = config.search.map(col => { - col.uuid = Utils.getuuid() - return col - }) - if (config.action) { - _card.action = config.action.map(col => { - col.uuid = Utils.getuuid() - return col - }) - } } this.updateComponent(_card) @@ -456,7 +423,6 @@ <PasteComponent options={['cardcell', 'search', 'form']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} </div> diff --git a/src/menu/components/carousel/data-card/index.jsx b/src/menu/components/carousel/data-card/index.jsx index 5d84aea..7fd4050 100644 --- a/src/menu/components/carousel/data-card/index.jsx +++ b/src/menu/components/carousel/data-card/index.jsx @@ -18,7 +18,6 @@ const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const { confirm } = Modal @@ -60,27 +59,6 @@ }, elements: [] }] - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.elements = scard.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) } this.updateComponent(_card) @@ -232,7 +210,6 @@ <CopyComponent type="datacard" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)}/> <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> diff --git a/src/menu/components/carousel/prop-card/index.jsx b/src/menu/components/carousel/prop-card/index.jsx index 755b7e7..c9afca3 100644 --- a/src/menu/components/carousel/prop-card/index.jsx +++ b/src/menu/components/carousel/prop-card/index.jsx @@ -19,7 +19,6 @@ const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const { confirm } = Modal @@ -59,27 +58,6 @@ style: {}, elements: [], }] - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.elements = scard.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) } this.updateComponent(_card) @@ -279,7 +257,6 @@ <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} </div> diff --git a/src/menu/components/chart/antv-G6/index.jsx b/src/menu/components/chart/antv-G6/index.jsx index 2e9dbf7..658e69c 100644 --- a/src/menu/components/chart/antv-G6/index.jsx +++ b/src/menu/components/chart/antv-G6/index.jsx @@ -17,7 +17,6 @@ const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const MindData = [ 'Modeling Methods', @@ -987,19 +986,6 @@ plot: _plot, } - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.plot = config.plot - _card.plot.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - } - this.updateComponent(_card) } else { this.setState({ @@ -1411,7 +1397,6 @@ <ChartCompileForm config={card} plotchange={this.updateComponent}/> <CopyComponent type="antvG6" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)}/> <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 4000502..332e3ab 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -20,7 +20,6 @@ const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) class antvBarLineChart extends Component { @@ -84,27 +83,6 @@ search: [], action: [], plot: _plot, - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.plot = config.plot - _card.plot.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.action = config.action.map(col => { - col.uuid = Utils.getuuid() - return col - }) - _card.search = config.search.map(col => { - col.uuid = Utils.getuuid() - return col - }) } this.updateComponent(_card, true) @@ -1358,7 +1336,6 @@ <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> diff --git a/src/menu/components/chart/antv-dashboard/index.jsx b/src/menu/components/chart/antv-dashboard/index.jsx index f74d260..7ffc5c5 100644 --- a/src/menu/components/chart/antv-dashboard/index.jsx +++ b/src/menu/components/chart/antv-dashboard/index.jsx @@ -15,7 +15,6 @@ const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) registerShape('point', 'pointer', { @@ -127,19 +126,6 @@ search: [], action: [], plot: _plot, - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.plot = config.plot - _card.plot.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts } this.updateComponent(_card, true) @@ -530,7 +516,6 @@ <CopyComponent type="dashboard" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index 304484c..f5a70b1 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -17,7 +17,6 @@ const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) class antvBarLineChart extends Component { @@ -77,26 +76,6 @@ search: [], action: [], plot: _plot, - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.plot = config.plot - _card.plot.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - if (appType !== 'mob') { - _card.search = config.search.map(col => { - col.uuid = Utils.getuuid() - return col - }) - } } this.updateComponent(_card, true) @@ -704,7 +683,6 @@ <CopyComponent type="pie" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> diff --git a/src/menu/components/chart/antv-scatter/index.jsx b/src/menu/components/chart/antv-scatter/index.jsx index bf2a909..8c1a624 100644 --- a/src/menu/components/chart/antv-scatter/index.jsx +++ b/src/menu/components/chart/antv-scatter/index.jsx @@ -18,7 +18,6 @@ const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) class antvScatterChart extends Component { @@ -71,28 +70,6 @@ search: [], action: [], plot: _plot, - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.plot = config.plot - _card.plot.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.action = config.action.map(col => { - col.uuid = Utils.getuuid() - return col - }) - _card.search = config.search.map(col => { - col.uuid = Utils.getuuid() - return col - }) } this.updateComponent(_card, true) @@ -377,7 +354,6 @@ <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)}/> <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> diff --git a/src/menu/components/code/sandbox/index.jsx b/src/menu/components/code/sandbox/index.jsx index 1df42b8..62a1e35 100644 --- a/src/menu/components/code/sandbox/index.jsx +++ b/src/menu/components/code/sandbox/index.jsx @@ -15,7 +15,6 @@ const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const EditorCode = asyncIconComponent(() => import('./editorcode')) const CodeContent = asyncComponent(() => import('./codecontent')) @@ -52,21 +51,6 @@ html: '', css: '', js: '', - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.html = config.html - _card.css = config.css - _card.js = config.js - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts } this.updateComponent(_card) @@ -162,7 +146,6 @@ </NormalForm> <CopyComponent type="sandbox" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <EditorCode config={card} updateConfig={this.updateComponent}/> {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} diff --git a/src/menu/components/editor/braft-editor/index.jsx b/src/menu/components/editor/braft-editor/index.jsx index 3dfb6b3..6557e9c 100644 --- a/src/menu/components/editor/braft-editor/index.jsx +++ b/src/menu/components/editor/braft-editor/index.jsx @@ -16,7 +16,6 @@ const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const EditorContent = asyncIconComponent(() => import('./editorcontent')) const BraftContent = asyncComponent(() => import('@/tabviews/custom/components/share/braftContent')) @@ -52,20 +51,6 @@ columns: [], scripts: [], html: '' - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - _card.html = config.html - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts } this.updateComponent(_card) @@ -197,7 +182,6 @@ </NormalForm> <CopyComponent type="editor" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <EditorContent config={card} updateConfig={this.updateComponent}/> {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}} type="setting"/>} diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index 91474ce..bc66a55 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -24,7 +24,6 @@ const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteForms = asyncIconComponent(() => import('@/menu/components/share/pasteforms')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) const { confirm } = Modal @@ -76,26 +75,6 @@ }] } - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.fields = scard.fields.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) - } this.updateComponent(_card) } else { let _card = fromJS(card).toJS() @@ -621,7 +600,6 @@ <CopyComponent type="simpleform" card={card}/> <PasteForms config={card.subcards[0]} update={this.pasteForm} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx index 09ece7c..1d81503 100644 --- a/src/menu/components/form/step-form/index.jsx +++ b/src/menu/components/form/step-form/index.jsx @@ -24,7 +24,6 @@ const FormAction = asyncComponent(() => import('../formaction')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) const { confirm } = Modal @@ -79,26 +78,6 @@ }] } - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.fields = scard.fields.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) - } this.setState({ group: _card.subcards[0] || null }) @@ -735,7 +714,6 @@ <CopyComponent type="stepform" card={card}/> <PasteComponent config={card} options={['formgroup', 'simpleform']} updateConfig={this.pasteForm} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} diff --git a/src/menu/components/form/tab-form/index.jsx b/src/menu/components/form/tab-form/index.jsx index 7dfd611..18b4656 100644 --- a/src/menu/components/form/tab-form/index.jsx +++ b/src/menu/components/form/tab-form/index.jsx @@ -24,7 +24,6 @@ const FormAction = asyncComponent(() => import('../formaction')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) const { confirm } = Modal @@ -91,26 +90,6 @@ }] } - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.fields = scard.fields.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) - } this.setState({ group: _card.subcards[0] || null }) @@ -736,7 +715,6 @@ <CopyComponent type="tabform" card={card}/> <PasteComponent config={card} options={['formgroup', 'simpleform']} updateConfig={this.pasteForm} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} diff --git a/src/menu/components/module/voucher/options.jsx b/src/menu/components/module/voucher/options.jsx index 2d78725..bdc8eb0 100644 --- a/src/menu/components/module/voucher/options.jsx +++ b/src/menu/components/module/voucher/options.jsx @@ -150,7 +150,7 @@ field: 'linkmenu', label: '鍒锋柊鑿滃崟', initval: wrap.linkmenu || [], - tooltip: '鐐瑰嚮鍏抽棴鏃堕渶瑕佸埛鏂扮殑鑿滃崟銆�', + tooltip: '鐐瑰嚮淇濆瓨鏃堕渶瑕佸埛鏂扮殑鑿滃崟銆�', required: false, allowClear: true, options: menulist diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index bbc1515..c246b60 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -12,8 +12,7 @@ export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = [], side) { let appType = sessionStorage.getItem('appType') let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview - let printTemps = sessionStorage.getItem('printTemps') - printTemps = printTemps ? JSON.parse(printTemps) : [] + let printTemps = window.GLOB.printTemps || [] let setting = config.setting || {} let columns = side === 'sub' && config.subColumns ? config.subColumns : (config.columns || []) let appMenus = [] @@ -1283,8 +1282,7 @@ */ export function getBaseTableActionForm (card, functip, config, usefulFields, modules) { let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview - let printTemps = sessionStorage.getItem('printTemps') - printTemps = printTemps ? JSON.parse(printTemps) : [] + let printTemps = window.GLOB.printTemps || [] let setting = config.setting || {} let columns = config.columns || [] diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index fbe9e9e..8f601ee 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -4,10 +4,11 @@ import { Modal, notification, Button } from 'antd' import moment from 'moment' +import Api from '@/api' import Utils, { FuncUtils } from '@/utils/utils.js' +import { queryPrintSql } from '@/utils/option.js' import { getActionForm, getBaseTableActionForm } from './formconfig' import asyncSpinComponent from '@/utils/asyncSpinComponent' - import MKEmitter from '@/utils/events.js' import ActionForm from './actionform' import MenuUtils from '@/utils/utils-custom.js' @@ -210,23 +211,67 @@ let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId) - if (config.subtype === 'basetable') { - delete card.eleType // 鍖哄垎鎸夐挳浣嶇疆 - - this.setState({ - visible: true, - card: card, - formlist: getBaseTableActionForm(card, functip, config, usefulFields, modules) - }) - } else { - let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, config.uuid) || [] + this.checkPrintTemp().then(() => { + if (config.subtype === 'basetable') { + delete card.eleType // 鍖哄垎鎸夐挳浣嶇疆 - this.setState({ - visible: true, - card: card, - formlist: getActionForm(card, functip, config, usefulFields, modules, anchors) - }) - } + this.setState({ + visible: true, + card: card, + formlist: getBaseTableActionForm(card, functip, config, usefulFields, modules) + }) + } else { + let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, config.uuid) || [] + + this.setState({ + visible: true, + card: card, + formlist: getActionForm(card, functip, config, usefulFields, modules, anchors) + }) + } + }) + } + + checkPrintTemp = () => { + return new Promise(resolve => { + if (!window.GLOB.printTemps) { + let param = { + func: 'sPC_Get_SelectedList', + LText: Utils.formatOptions(queryPrintSql), + obj_name: 'data', + arr_field: 'PN,ID,Images' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 + + Api.getCloudConfig(param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + + let temps = (res.data || []).map(temp => { + return { + value: temp.ID, + text: temp.PN + } + }) + + window.GLOB.printTemps = temps + resolve() + }, () => { + resolve() + }) + } else { + resolve() + } + }) } /** diff --git a/src/menu/components/share/sourcecomponent/index.jsx b/src/menu/components/share/sourcecomponent/index.jsx index 2d197f7..bf42033 100644 --- a/src/menu/components/share/sourcecomponent/index.jsx +++ b/src/menu/components/share/sourcecomponent/index.jsx @@ -37,7 +37,7 @@ } shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) + return !is(fromJS(this.state), fromJS(nextState)) || nextProps.type !== this.props.type } deleteUrl = () => { diff --git a/src/menu/components/share/sourcecomponent/inputform/index.jsx b/src/menu/components/share/sourcecomponent/inputform/index.jsx index b1a4249..5f552ce 100644 --- a/src/menu/components/share/sourcecomponent/inputform/index.jsx +++ b/src/menu/components/share/sourcecomponent/inputform/index.jsx @@ -36,7 +36,7 @@ UNSAFE_componentWillMount () { if (this.props.keyword === 'system') { - this.init() + this.preInit() } } @@ -54,26 +54,40 @@ return !is(fromJS(this.state), fromJS(nextState)) } - init = () => { + preInit = () => { const { type } = this.props - let originlist = [] - if (type === 'video') { - let videos = sessionStorage.getItem('app_videos') - try { - originlist = JSON.parse(videos) - } catch (e) { - originlist = [] - } - } else { - let pictures = sessionStorage.getItem('app_pictures') - try { - originlist = JSON.parse(pictures) - } catch (e) { - originlist = [] - } - } + let _type = type === 'video' ? 'video' : 'image' + let _sname = type === 'video' ? 'app_videos' : 'app_pictures' + this.getSource(_type, _sname).then(res => { + this.init(res) + }) + } + + getSource = (type, sessionName) => { + return new Promise(resolve => { + if (window.GLOB[sessionName]) { + resolve(window.GLOB[sessionName]) + } else { + let param = { + func: 's_url_db_adduptdel', + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + type: 'search', + typecharone: type + } + Api.getCloudConfig(param).then(res => { + let data = res.data || [] + window.GLOB[sessionName] = data + + resolve(data) + }) + } + }) + } + + init = (originlist) => { let list = originlist let pagelist = list.filter((item, index) => index < this.state.pageSize) @@ -136,11 +150,11 @@ }).then(result => { if (result.status) { if (card.typecharone === 'image') { - sessionStorage.setItem('app_pictures', JSON.stringify(result.data || [])) - this.init() + window.GLOB.app_pictures = result.data || [] + this.init(result.data || []) } else { - sessionStorage.setItem('app_videos', JSON.stringify(result.data || [])) - this.init() + window.GLOB.app_videos = result.data || [] + this.init(result.data || []) } this.setState({editvisible: false}) } else { diff --git a/src/menu/components/share/usercomponent/index.jsx b/src/menu/components/share/usercomponent/index.jsx deleted file mode 100644 index 4f72b16..0000000 --- a/src/menu/components/share/usercomponent/index.jsx +++ /dev/null @@ -1,223 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Modal, notification } from 'antd' -import { UserOutlined } from '@ant-design/icons' -import html2canvas from 'html2canvas' - -import Api from '@/api' -import Utils from '@/utils/utils.js' -import UserForm from './settingform' -import MKEmitter from '@/utils/events.js' -import './index.scss' - -class UserComponent extends Component { - static propTpyes = { - config: PropTypes.object - } - - state = { - visible: false, - loading: false, - name: '', - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - trigger = () => { - const { config } = this.props - - this.setState({ - visible: true, - loading: false, - name: window.GLOB.UserComponentMap.get(config.uuid) || config.name || '' - }) - } - - getUserComponent = () => { - let config = fromJS(this.props.config).toJS() - let _config = {} - - _config.wrap = config.wrap || {} - _config.type = config.type || '' - _config.subtype = config.subtype || '' - _config.style = config.style || {} - _config.subcards = config.subcards || [] - _config.headerStyle = config.headerStyle || {} - _config.action = config.action || [] - _config.search = config.search || [] - _config.cols = config.cols || [] - _config.plot = config.plot || {} - _config.html = config.html || '' - _config.css = config.css || '' - _config.js = config.js || '' - - _config.width = _config.wrap.width || _config.plot.width || config.width || 24 - - _config.subcards = _config.subcards.map(card => { - if (card.elements) { - card.elements = card.elements.map(item => this.resetElement(item)) - } - if (card.backElements) { - card.backElements = card.backElements.map(item => this.resetElement(item)) - } - return card - }) - _config.action = _config.action.map(item => { - item.verify = null - return item - }) - _config.search = _config.search.map(item => { - if (item.resourceType === '1') { - item.resourceType = '0' - item.dataSource = '' - item.valueText = '' - item.valueText = '' - item.options = '' - } - item.blacklist = [] - return item - }) - - let loopCol = (cols) => { - return cols.map(col => { - col.uuid = Utils.getuuid() - col.marks = null - - if (col.type === 'colspan' && col.subcols) { - col.subcols = loopCol(col.subcols) - } else if (col.type === 'custom' && col.elements) { - col.elements = col.elements.map(cell => { - if (cell.eleType === 'button') { - cell.verify = null - } else { - cell = this.resetElement(cell) - } - return cell - }) - } - return col - }) - } - - _config.cols = loopCol(_config.cols) - - return _config - } - - resetElement = (item) => { - item.marks = null - item.verify = null - - if (item.datatype === 'dynamic') { - if (item.eleType === 'icon') { - item.tooltip = item.field - } else if (item.eleType === 'slider') { - item.value = 50 - } else { - item.value = item.field - } - - item.datatype = 'static' - item.field = '' - } - if (item.link === 'dynamic') { - item.link = 'static' - } - return item - } - - submit = () => { - const { config } = this.props - - this.verifyRef.handleConfirm().then(res => { - document.getElementsByClassName('menu-view')[0].classList.add('saving') - this.setState({loading: true}) - setTimeout(() => { - // let template = this.getUserComponent() - let template = fromJS(config).toJS() - html2canvas(document.getElementById(config.uuid)).then(canvas => { - let param = { - Base64Img: canvas.toDataURL('image/png') // 鑾峰彇鐢熸垚鐨勫浘鐗� - } - - if (window.GLOB.cloudServiceApi) { - param.rduri = window.GLOB.cloudServiceApi - param.userid = sessionStorage.getItem('CloudUserID') || '' - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } - - Api.fileuploadbase64(param).then(result => { - if (result.status) { - Api.getCloudConfig({ - func: 's_custom_components_adduptdel', - c_id: config.uuid, - images: Utils.getcloudurl(result.Images), - typename: sessionStorage.getItem('appType') || '', - c_name: res.name, - long_param: window.btoa(window.encodeURIComponent(JSON.stringify(template))), - del_type: '' - }).then(response => { - if (response.status) { - this.setState({loading: false, visible: false}) - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) - document.getElementsByClassName('menu-view')[0].classList.remove('saving') - MKEmitter.emit('updateCustomComponent') - } else { - this.setState({loading: false}) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) - } else { - this.setState({loading: false}) - notification.warning({ - top: 92, - message: result.ErrMesg, - duration: 5 - }) - } - }) - }) - }, 300) - }) - } - - cancel = () => { - this.setState({ visible: false }) - document.getElementsByClassName('menu-view')[0].classList.remove('saving') - } - - render () { - const { visible, loading, name } = this.state - - return ( - <div className="user-component-wrap"> - <UserOutlined title="鐢熸垚鑷畾涔夌粍浠�" onClick={this.trigger} /> - <Modal - title="鑷畾涔夌粍浠�" - visible={visible} - width={500} - maskClosable={false} - confirmLoading={loading} - onOk={this.submit} - onCancel={this.cancel} - destroyOnClose - > - <UserForm name={name} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/> - </Modal> - </div> - ) - } -} - -export default UserComponent \ No newline at end of file diff --git a/src/menu/components/share/usercomponent/index.scss b/src/menu/components/share/usercomponent/index.scss deleted file mode 100644 index cdfe23d..0000000 --- a/src/menu/components/share/usercomponent/index.scss +++ /dev/null @@ -1,7 +0,0 @@ -.user-component-wrap { - display: inline-block; - - >.anticon-user { - color: purple; - } -} \ No newline at end of file diff --git a/src/menu/components/share/usercomponent/settingform/index.jsx b/src/menu/components/share/usercomponent/settingform/index.jsx deleted file mode 100644 index cd66103..0000000 --- a/src/menu/components/share/usercomponent/settingform/index.jsx +++ /dev/null @@ -1,86 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Tooltip } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' - -// import './index.scss' - -class SettingForm extends Component { - static propTpyes = { - name: PropTypes.string, // 缁勪欢鍚嶇О - inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 - } - - state = {} - - UNSAFE_componentWillMount () { - - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - render() { - const { getFieldDecorator } = this.props.form - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <Form {...formItemLayout}> - <Row gutter={24}> - <Col span={22}> - <Form.Item label={ - <Tooltip placement="topLeft" title="鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�"> - <QuestionCircleOutlined className="mk-form-tip" /> - 缁勪欢鍚嶇О - </Tooltip> - }> - {getFieldDecorator('name', { - initialValue: this.props.name || '', - rules: [ - { - required: true, - message: '璇疯緭鍏ョ粍浠跺悕绉�!' - }, - { - max: 15, - message: '缁勪欢鍚嶇О鏈�澶�15涓瓧绗�!' - } - ] - })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit}/>)} - </Form.Item> - </Col> - </Row> - </Form> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/components/share/usercomponent/settingform/index.scss b/src/menu/components/share/usercomponent/settingform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/menu/components/share/usercomponent/settingform/index.scss +++ /dev/null diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx index 44c1fab..9aed6ca 100644 --- a/src/menu/components/table/edit-table/index.jsx +++ b/src/menu/components/table/edit-table/index.jsx @@ -19,7 +19,6 @@ const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const ColumnComponent = asyncComponent(() => import('./columns')) @@ -64,41 +63,6 @@ scripts: [], submit: {intertype: 'system', default: 'true', innerFunc: '', execSuccess: 'grid', execError: 'never', scripts: [], uniques: []}, isNew: true - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - let oriUids = {} - _card.action = config.action.map(item => { - let _uuid = Utils.getuuid() - oriUids[item.uuid] = _uuid - item.uuid = _uuid - return item - }) - _card.search = config.search.map(item => { - item.uuid = Utils.getuuid() - return item - }) - _card.cols = config.cols.map(col => { - col.uuid = Utils.getuuid() - if (col.type === 'custom' && col.elements) { - col.elements = col.elements.map(cell => { - cell.uuid = Utils.getuuid() - return cell - }) - } - return col - }) } this.updateComponent(_card) @@ -365,7 +329,6 @@ <CopyComponent type="editable" card={card}/> <PasteComponent config={card} options={['action', 'search', 'form', 'cols']} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> </div> diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx index d12dd02..613f54c 100644 --- a/src/menu/components/table/normal-table/index.jsx +++ b/src/menu/components/table/normal-table/index.jsx @@ -19,7 +19,6 @@ const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const ColumnComponent = asyncComponent(() => import('./columns')) @@ -72,47 +71,6 @@ ], scripts: [], isNew: true - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - let oriUids = {} - _card.action = config.action.map(item => { - let _uuid = Utils.getuuid() - oriUids[item.uuid] = _uuid - item.uuid = _uuid - return item - }) - _card.search = config.search.map(item => { - item.uuid = Utils.getuuid() - return item - }) - _card.cols = config.cols.map(col => { - col.uuid = Utils.getuuid() - if (col.type === 'colspan' && col.subcols) { - col = this.loopCol(col) - } else if (col.type === 'custom' && col.elements) { - col.elements = col.elements.map(cell => { - cell.uuid = Utils.getuuid() - return cell - }) - } - return col - }) - - if (_card.wrap.doubleClick) { - _card.wrap.doubleClick = oriUids[_card.wrap.doubleClick] || '' - } } if (appType === 'mob') { @@ -417,7 +375,6 @@ <PasteComponent config={card} options={options} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> </div> diff --git a/src/menu/components/timeline/normal-timeline/index.jsx b/src/menu/components/timeline/normal-timeline/index.jsx index cb58209..22d2344 100644 --- a/src/menu/components/timeline/normal-timeline/index.jsx +++ b/src/menu/components/timeline/normal-timeline/index.jsx @@ -17,7 +17,6 @@ const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) class NormalTimelineComponent extends Component { @@ -58,27 +57,6 @@ }], columns: [], scripts: [], - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.subcards = config.subcards.map(scard => { - scard.uuid = Utils.getuuid() - scard.elements = scard.elements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) - return scard - }) } this.updateComponent(_card) @@ -181,7 +159,6 @@ <CopyComponent type="timeline" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> </div> diff --git a/src/menu/components/tree/antd-tree/index.jsx b/src/menu/components/tree/antd-tree/index.jsx index c7afa92..b093ad7 100644 --- a/src/menu/components/tree/antd-tree/index.jsx +++ b/src/menu/components/tree/antd-tree/index.jsx @@ -17,7 +17,6 @@ const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) @@ -55,19 +54,6 @@ columns: [], scripts: [], action: [], - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts } this.updateComponent(_card) @@ -233,7 +219,6 @@ <CopyComponent type="tree" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> </div> diff --git a/src/menu/modulesource/dragsource/index.jsx b/src/menu/modulesource/dragsource/index.jsx index 7b5a6ea..290d9b2 100644 --- a/src/menu/modulesource/dragsource/index.jsx +++ b/src/menu/modulesource/dragsource/index.jsx @@ -1,13 +1,12 @@ import React from 'react' import { useDrag } from 'react-dnd' -import { CloseCircleOutlined } from '@ant-design/icons' import './index.scss' -const MobSourceElement = ({item, triggerDel}) => { +const MobSourceElement = ({item}) => { const [, drag] = useDrag({ item }) return ( <div className="menu-source-item"> - <div className="property"><span>{item.title}</span>{item.config ? <CloseCircleOutlined onClick={() => triggerDel(item)}/> : null}</div> + <div className="property"><span>{item.title}</span></div> <img ref={drag} src={item.url} alt=""/> </div> ) diff --git a/src/menu/modulesource/index.jsx b/src/menu/modulesource/index.jsx index e990025..a5e0a7e 100644 --- a/src/menu/modulesource/index.jsx +++ b/src/menu/modulesource/index.jsx @@ -1,14 +1,9 @@ import React, {Component} from 'react' import { is, fromJS } from 'immutable' -import { Modal, notification } from 'antd' -import Api from '@/api' import { menuOptions } from './option' import SourceWrap from './dragsource' -import MKEmitter from '@/utils/events.js' import './index.scss' - -const { confirm } = Modal class ModelSource extends Component { state = { @@ -32,54 +27,8 @@ }) } - UNSAFE_componentWillReceiveProps (nextProps) { - if (nextProps.components && !is(fromJS(this.props.components), fromJS(nextProps.components))) { - this.setState({ - menuOptions: fromJS(nextProps.components).toJS() - }) - } - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) - } - - triggerDel = (item) => { - confirm({ - title: `纭畾鍒犻櫎<${item.title}>鍚楋紵`, - content: '', - onOk() { - return new Promise(resolve => { - Api.getCloudConfig({ - func: 's_custom_components_adduptdel', - c_id: item.uuid, - images: '', - c_name: item.title, - typename: sessionStorage.getItem('appType') || '', - long_param: '', - del_type: 'Y' - }).then(result => { - if (result.status) { - notification.success({ - top: 92, - message: '鍒犻櫎鎴愬姛锛�', - duration: 5 - }) - - MKEmitter.emit('updateCustomComponent') - } else { - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - } - resolve() - }) - }) - }, - onCancel() {} - }) } render() { @@ -87,7 +36,7 @@ return ( <div className="mob-card-source-box"> - {menuOptions.map((item, index) => (<SourceWrap key={index} item={item} triggerDel={this.triggerDel} />))} + {menuOptions.map((item, index) => (<SourceWrap key={index} item={item}/>))} </div> ) } diff --git a/src/menu/picturecontroller/index.jsx b/src/menu/picturecontroller/index.jsx index 164b0a0..f91da59 100644 --- a/src/menu/picturecontroller/index.jsx +++ b/src/menu/picturecontroller/index.jsx @@ -18,7 +18,7 @@ const Video = asyncComponent(() => import('./video')) const Image = asyncComponent(() => import('@/components/Image')) -class PasteController extends Component { +class SourceController extends Component { state = { visible: false, editvisible: false, @@ -39,29 +39,42 @@ } trigger = () => { - let pictures = sessionStorage.getItem('app_pictures') - let videos = sessionStorage.getItem('app_videos') - let colorlist = sessionStorage.getItem('app_colors') + let deffers = [] - if (!pictures) { - notification.warning({ - top: 92, - message: '鏈幏鍙栧埌璧勬簮淇℃伅锛岃绋嶅悗鎴栧埛鏂伴噸璇曘��', - duration: 5 - }) - return - } + deffers.push(this.getSource('image', 'app_pictures', 0)) + deffers.push(this.getSource('video', 'app_videos', 50)) + deffers.push(this.getSource('color', 'app_colors', 100)) + + Promise.all(deffers).then(result => { + this.open(...result) + }) + } - try { - pictures = JSON.parse(pictures) - videos = JSON.parse(videos) - colorlist = JSON.parse(colorlist) - } catch (e) { - pictures = [] - videos = [] - colorlist = [] - } + getSource = (type, sessionName, delay) => { + return new Promise(resolve => { + if (window.GLOB[sessionName]) { + resolve(window.GLOB[sessionName]) + } else { + let param = { + func: 's_url_db_adduptdel', + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + type: 'search', + typecharone: type + } + setTimeout(() => { + Api.getCloudConfig(param).then(res => { + let data = res.data || [] + window.GLOB[sessionName] = data + + resolve(data) + }) + }, delay) + } + }) + } + open = (pictures, videos, colorlist) => { let filpictures = pictures let filvideos = videos @@ -112,13 +125,13 @@ }).then(result => { if (result.status) { if (card.typecharone === 'image') { - sessionStorage.setItem('app_pictures', JSON.stringify(result.data || [])) + window.GLOB.app_pictures = result.data || [] this.resetPicture(result.data || []) } else if (card.typecharone === 'video') { - sessionStorage.setItem('app_videos', JSON.stringify(result.data || [])) + window.GLOB.app_videos = result.data || [] this.resetVideo(result.data || []) } else if (card.typecharone === 'color') { - sessionStorage.setItem('app_colors', JSON.stringify(result.data || [])) + window.GLOB.app_colors = result.data || [] this.resetColor(result.data || []) } this.setState({editvisible: false}) @@ -166,13 +179,13 @@ }).then(res => { if (res.status) { if (item.typecharone === 'image') { - sessionStorage.setItem('app_pictures', JSON.stringify(res.data || [])) + window.GLOB.app_pictures = res.data || [] _this.resetPicture(res.data || []) } else if (item.typecharone === 'video') { - sessionStorage.setItem('app_videos', JSON.stringify(res.data || [])) + window.GLOB.app_videos = res.data || [] _this.resetVideo(res.data || []) } else if (item.typecharone === 'color') { - sessionStorage.setItem('app_colors', JSON.stringify(res.data || [])) + window.GLOB.app_colors = res.data || [] _this.resetColor(res.data || []) } } else { @@ -381,4 +394,4 @@ } } -export default PasteController \ No newline at end of file +export default SourceController \ No newline at end of file diff --git a/src/mob/colorsketch/index.jsx b/src/mob/colorsketch/index.jsx index 63abecf..35822cb 100644 --- a/src/mob/colorsketch/index.jsx +++ b/src/mob/colorsketch/index.jsx @@ -4,6 +4,7 @@ import { Popover } from 'antd' import { CloseCircleFilled } from '@ant-design/icons' +import Api from '@/api' import './index.scss' const presetColors = [ @@ -12,6 +13,7 @@ '#adc6ff', '#EBE9E9', '#d9d9d9', 'rgba(0, 0, 0, 0.65)', 'rgba(0, 0, 0, 0.85)', '#000000', '#ffffff', 'transparent' ] const _href = window.location.href.split('#')[0] +let loading = false class ColorSketch extends Component { static propTpyes = { @@ -38,7 +40,39 @@ initVal = value } - let _colors = sessionStorage.getItem('app_colors') + this.setState({color: initVal, initVal, allowClear: allowClear === true}, () => { + this.checkcolors() + }) + } + + checkcolors = () => { + let app_colors = window.GLOB.app_colors + + if (app_colors) { + this.getColors(app_colors) + } else { + if (loading) { + this.getColors([]) + } else { + loading = true + let param = { + func: 's_url_db_adduptdel', + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + typecharone: 'color', + type: 'search' + } + + Api.getCloudConfig(param).then(res => { + loading = false + window.GLOB.app_colors = res.data || [] + this.getColors(res.data || []) + }) + } + } + } + + getColors = (appColors) => { let colors = JSON.parse(JSON.stringify(presetColors)) let normal_colors = localStorage.getItem(_href + 'normal_colors') @@ -56,19 +90,11 @@ normal_colors = [] } - if (_colors) { - try { - _colors = JSON.parse(_colors) - } catch (e) { - _colors = [] - } + appColors.forEach(item => { + if (normal_colors.includes(item.linkurl)) return - _colors.forEach(item => { - if (normal_colors.includes(item.linkurl)) return - - colors.push({color: item.linkurl, title: '绯荤粺鑹诧細' + item.linkurl}) - }) - } + colors.push({color: item.linkurl, title: '绯荤粺鑹诧細' + item.linkurl}) + }) if (colors.length < 40) { for (let i = colors.length; i < 40; i++) { @@ -76,7 +102,7 @@ } } - this.setState({color: initVal, initVal, allowClear: allowClear === true, colors}) + this.setState({colors}) } handleChange = (color) => { @@ -126,8 +152,6 @@ localStorage.setItem(_href + 'normal_colors', JSON.stringify(normal_colors)) } } - - render() { const { color, allowClear, colors } = this.state diff --git a/src/mob/components/menubar/normal-menubar/index.jsx b/src/mob/components/menubar/normal-menubar/index.jsx index df95f23..016fd2f 100644 --- a/src/mob/components/menubar/normal-menubar/index.jsx +++ b/src/mob/components/menubar/normal-menubar/index.jsx @@ -16,7 +16,6 @@ const MenuComponent = asyncComponent(() => import('./menucomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) @@ -60,20 +59,6 @@ }] } - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.wrap = config.wrap - _card.wrap.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.subMenus = config.subMenus.map(item => { - item.uuid = Utils.getuuid() - - return item - }) - } this.setState({ card: _card }) @@ -298,7 +283,6 @@ <CopyComponent type="menubar" card={card}/> <PasteComponent config={card} options={['menucell']} updateConfig={this.filterComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} /> - <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} {card.wrap.datatype !== 'dynamic' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} diff --git a/src/mob/modulesource/dragsource/index.jsx b/src/mob/modulesource/dragsource/index.jsx index 5e00912..8e60670 100644 --- a/src/mob/modulesource/dragsource/index.jsx +++ b/src/mob/modulesource/dragsource/index.jsx @@ -1,13 +1,12 @@ import React from 'react' import { useDrag } from 'react-dnd' -import { CloseCircleOutlined } from '@ant-design/icons' import './index.scss' -const MobSourceElement = ({item, triggerDel}) => { +const MobSourceElement = ({item}) => { const [, drag] = useDrag({ item }) return ( <div className={'menu-source-item ' + item.component + '-' + item.subtype}> - <div className="property"><span>{item.title}</span>{item.config ? <CloseCircleOutlined onClick={() => triggerDel(item)}/> : null}</div> + <div className="property"><span>{item.title}</span></div> <img ref={drag} src={item.url} alt=""/> </div> ) diff --git a/src/mob/modulesource/index.jsx b/src/mob/modulesource/index.jsx index 69b9bac..3e9ecbc 100644 --- a/src/mob/modulesource/index.jsx +++ b/src/mob/modulesource/index.jsx @@ -1,14 +1,9 @@ import React, {Component} from 'react' import { is, fromJS } from 'immutable' -import { Modal, notification } from 'antd' -import Api from '@/api' import { menuOptions } from './option' import SourceWrap from './dragsource' -import MKEmitter from '@/utils/events.js' import './index.scss' - -const { confirm } = Modal class ModelSource extends Component { state = { @@ -38,54 +33,8 @@ }) } - UNSAFE_componentWillReceiveProps (nextProps) { - if (nextProps.components && !is(fromJS(this.props.components), fromJS(nextProps.components))) { - this.setState({ - menuOptions: fromJS(nextProps.components).toJS() - }) - } - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) - } - - triggerDel = (item) => { - confirm({ - title: `纭畾鍒犻櫎<${item.title}>鍚楋紵`, - content: '', - onOk() { - return new Promise(resolve => { - Api.getCloudConfig({ - func: 's_custom_components_adduptdel', - c_id: item.uuid, - images: '', - c_name: item.title, - typename: sessionStorage.getItem('appType') || '', - long_param: '', - del_type: 'Y' - }).then(result => { - if (result.status) { - notification.success({ - top: 92, - message: '鍒犻櫎鎴愬姛锛�', - duration: 5 - }) - - MKEmitter.emit('updateCustomComponent') - } else { - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - } - resolve() - }) - }) - }, - onCancel() {} - }) } render() { @@ -93,7 +42,7 @@ return ( <div className="mob-card-source-box"> - {menuOptions.map((item, index) => (<SourceWrap key={index} item={item} triggerDel={this.triggerDel} />))} + {menuOptions.map((item, index) => (<SourceWrap key={index} item={item}/>))} </div> ) } diff --git a/src/pc/modulesource/dragsource/index.jsx b/src/pc/modulesource/dragsource/index.jsx index 7b5a6ea..290d9b2 100644 --- a/src/pc/modulesource/dragsource/index.jsx +++ b/src/pc/modulesource/dragsource/index.jsx @@ -1,13 +1,12 @@ import React from 'react' import { useDrag } from 'react-dnd' -import { CloseCircleOutlined } from '@ant-design/icons' import './index.scss' -const MobSourceElement = ({item, triggerDel}) => { +const MobSourceElement = ({item}) => { const [, drag] = useDrag({ item }) return ( <div className="menu-source-item"> - <div className="property"><span>{item.title}</span>{item.config ? <CloseCircleOutlined onClick={() => triggerDel(item)}/> : null}</div> + <div className="property"><span>{item.title}</span></div> <img ref={drag} src={item.url} alt=""/> </div> ) diff --git a/src/pc/modulesource/index.jsx b/src/pc/modulesource/index.jsx index 619d3ae..feabed5 100644 --- a/src/pc/modulesource/index.jsx +++ b/src/pc/modulesource/index.jsx @@ -1,14 +1,9 @@ import React, {Component} from 'react' import { is, fromJS } from 'immutable' -import { Modal, notification } from 'antd' -import Api from '@/api' import { menuOptions } from './option' import SourceWrap from './dragsource' -import MKEmitter from '@/utils/events.js' import './index.scss' - -const { confirm } = Modal class ModelSource extends Component { state = { @@ -30,54 +25,8 @@ }) } - UNSAFE_componentWillReceiveProps (nextProps) { - if (nextProps.components && !is(fromJS(this.props.components), fromJS(nextProps.components))) { - this.setState({ - menuOptions: fromJS(nextProps.components).toJS() - }) - } - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) - } - - triggerDel = (item) => { - confirm({ - title: `纭畾鍒犻櫎<${item.title}>鍚楋紵`, - content: '', - onOk() { - return new Promise(resolve => { - Api.getCloudConfig({ - func: 's_custom_components_adduptdel', - c_id: item.uuid, - images: '', - c_name: item.title, - typename: sessionStorage.getItem('appType') || '', - long_param: '', - del_type: 'Y' - }).then(result => { - if (result.status) { - notification.success({ - top: 92, - message: '鍒犻櫎鎴愬姛锛�', - duration: 5 - }) - - MKEmitter.emit('updateCustomComponent') - } else { - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - } - resolve() - }) - }) - }, - onCancel() {} - }) } render() { @@ -85,7 +34,7 @@ return ( <div className="mob-card-source-box"> - {menuOptions.map((item, index) => (<SourceWrap key={index} item={item} triggerDel={this.triggerDel} />))} + {menuOptions.map((item, index) => (<SourceWrap key={index} item={item}/>))} </div> ) } diff --git a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx index de0e111..5893982 100644 --- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx +++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx @@ -4,7 +4,7 @@ import { Form, Row, Col, Input, Select, Radio, InputNumber, Modal } from 'antd' import { FormOutlined } from '@ant-design/icons' -import ColorSketch from '@/mob/colorsketch' +import ColorSketch from '@/tabviews/zshare/mutilform/mkColor' import NodeForm from './nodeform' import './index.scss' diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index f11d8c0..e42bad6 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -689,6 +689,15 @@ saved: true }) } + + let tabId = '' + if (config.wrap.linkmenu && config.wrap.linkmenu.length > 0) { + tabId = config.wrap.linkmenu[config.wrap.linkmenu.length - 1] + } + + if (tabId) { + MKEmitter.emit('reloadMenuView', tabId, 'table') + } }) } @@ -781,7 +790,7 @@ } voucherTempSave = (list, name, typeChar, typeName) => { - const { type, BID, data, book, title, orgcode, orgname, tempTypeClass, tempTypeName } = this.state + const { type, config, BID, data, book, title, orgcode, orgname, tempTypeClass, tempTypeName } = this.state if (!book) { notification.warning({ @@ -933,6 +942,15 @@ data: fromJS(list).toJS(), }) } + + let tabId = '' + if (config.wrap.linkmenu && config.wrap.linkmenu.length > 0) { + tabId = config.wrap.linkmenu[config.wrap.linkmenu.length - 1] + } + + if (tabId) { + MKEmitter.emit('reloadMenuView', tabId, 'table') + } }) } @@ -1048,27 +1066,16 @@ triggerclose = () => { const { config, status } = this.state - let tabId = '' - if (config.wrap.linkmenu && config.wrap.linkmenu.length > 0) { - tabId = config.wrap.linkmenu[config.wrap.linkmenu.length - 1] - } - if (status === 'change') { confirm({ content: '鍐呭宸插彉鏇达紝纭畾瑕佸叧闂悧锛�', onOk() { MKEmitter.emit('closeTabView', config.$pageId) - if (tabId) { - MKEmitter.emit('reloadMenuView', tabId, 'table') - } }, onCancel() {} }) } else { MKEmitter.emit('closeTabView', config.$pageId) - if (tabId) { - MKEmitter.emit('reloadMenuView', tabId, 'table') - } } } diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index 1395bea..b5d04f2 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -3,8 +3,11 @@ import { fromJS } from 'immutable' import { Form, Row, Col, Select, Radio, Tooltip, Input, notification } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' +import moment from 'moment' import Api from '@/api' +import Utils from '@/utils/utils.js' +import { queryPrintSql } from '@/utils/option.js' import './index.scss' const sysTempsIds = ['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'] @@ -79,10 +82,46 @@ this.resetTemps(wxTemps) } - let printTemps = sessionStorage.getItem('printTemps') - printTemps = printTemps ? JSON.parse(printTemps) : [] + this.checkPrintTemp() + } - this.setState({printTemps}) + checkPrintTemp = () => { + if (!window.GLOB.printTemps) { + let param = { + func: 'sPC_Get_SelectedList', + LText: Utils.formatOptions(queryPrintSql), + obj_name: 'data', + arr_field: 'PN,ID,Images' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 + + Api.getCloudConfig(param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + + let temps = (res.data || []).map(temp => { + return { + value: temp.ID, + text: temp.PN + } + }) + + window.GLOB.printTemps = temps + + this.setState({printTemps: temps}) + }) + } else { + this.setState({printTemps: window.GLOB.printTemps || []}) + } } resetTemps = (wxTemps) => { diff --git a/src/utils/option.js b/src/utils/option.js index f876513..1652359 100644 --- a/src/utils/option.js +++ b/src/utils/option.js @@ -905,3 +905,12 @@ } export const queryTableSql = 'select top 999999 TbName,Remark from (select TbName,Remark from sDataDictb where appkey= @appkey@ and Deleted=0 union select a.TbName,Remark from (select TbName,Remark from sDataDictb where appkey= \'\' and Deleted=0 ) a left join (select TbName from sDataDictb where appkey= @appkey@ and Deleted=0 ) b on a.TbName=b.TbName where b.TbName is null ) t order by TbName' + +export const queryPrintSql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate + where appkey= @appkey@ and Deleted=0 and typechartwo='web_print' + union select ID,Images,a.PrintTempNO+PrintTempName as PN + from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a + left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b + on a.PrintTempNO=b.PrintTempNO + left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c + on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` \ No newline at end of file diff --git a/src/views/imdesign/index.jsx b/src/views/imdesign/index.jsx index a250188..6bd3c0c 100644 --- a/src/views/imdesign/index.jsx +++ b/src/views/imdesign/index.jsx @@ -97,10 +97,6 @@ } componentDidMount () { - setTimeout(() => { - this.getAppPictures() - }, 1000) - document.onkeydown = (event) => { let e = event || window.event let keyCode = e.keyCode || e.which || e.charCode @@ -183,43 +179,6 @@ sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) this.props.history.replace('/imdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID, type: 'view'})))) window.location.reload() - }) - } - - getAppPictures = () => { - if (sessionStorage.getItem('app_pictures')) return - - let deffers = [] - let param = { - func: 's_url_db_adduptdel', - PageIndex: 0, // 0 浠h〃鍏ㄩ儴 - PageSize: 0, // 0 浠h〃鍏ㄩ儴 - type: 'search' - } - deffers = [new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'image'}).then(res => { - resolve(res.data) - }) - }, 500) - }), new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'video'}).then(res => { - resolve(res.data) - }) - }, 1000) - }), new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'color'}).then(res => { - resolve(res.data) - }) - }, 1500) - })] - - Promise.all(deffers).then(response => { - sessionStorage.setItem('app_pictures', JSON.stringify(response[0] || [])) - sessionStorage.setItem('app_videos', JSON.stringify(response[1] || [])) - sessionStorage.setItem('app_colors', JSON.stringify(response[2] || [])) }) } diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 6d94c54..0a95623 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -61,7 +61,6 @@ menuloading: false, oriConfig: null, config: null, - customComponents: [], comloading: false, settingshow: sessionStorage.getItem('settingshow') !== 'false', eyeopen: false, @@ -123,18 +122,7 @@ MKEmitter.addListener('changePopview', this.initPopview) MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) - MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) setTimeout(() => { - if (sessionStorage.getItem('app_custom_components')) { - let list = sessionStorage.getItem('app_custom_components') - list = JSON.parse(list) - - this.setCustomComponent(list) - } else { - this.updateCustomComponent() - } - this.getAppPictures() - this.getPrintTemp() this.getRoleFields() setGLOBFuncs() }, 1000) @@ -205,7 +193,6 @@ } MKEmitter.removeListener('changePopview', this.initPopview) MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave) - MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) } triggerMenuSave = () => { @@ -235,135 +222,6 @@ window.GLOB.customMenu = config this.setState({view: '', popConfig: null}) - } - - getPrintTemp = () => { - if (!sessionStorage.getItem('printTemps')) { - let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate - where appkey= @appkey@ and Deleted=0 and typechartwo='web_print' - union select ID,Images,a.PrintTempNO+PrintTempName as PN - from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a - left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b - on a.PrintTempNO=b.PrintTempNO - left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c - on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` - - let param = { - func: 'sPC_Get_SelectedList', - LText: Utils.formatOptions(_sql), - obj_name: 'data', - arr_field: 'PN,ID,Images' - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 - - Api.getCloudConfig(param).then(res => { - if (res.status) { - let temps = res.data.map(temp => { - return { - value: temp.ID, - text: temp.PN - } - }) - - sessionStorage.setItem('printTemps', JSON.stringify(temps)) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - } - - getAppPictures = () => { - if (sessionStorage.getItem('app_pictures')) return - - let deffers = [] - let param = { - func: 's_url_db_adduptdel', - PageIndex: 0, // 0 浠h〃鍏ㄩ儴 - PageSize: 0, // 0 浠h〃鍏ㄩ儴 - type: 'search' - } - deffers = [new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'image'}).then(res => { - resolve(res.data) - }) - }, 500) - }), new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'video'}).then(res => { - resolve(res.data) - }) - }, 1000) - }), new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'color'}).then(res => { - resolve(res.data) - }) - }, 1500) - })] - - Promise.all(deffers).then(response => { - sessionStorage.setItem('app_pictures', JSON.stringify(response[0] || [])) - sessionStorage.setItem('app_videos', JSON.stringify(response[1] || [])) - sessionStorage.setItem('app_colors', JSON.stringify(response[2] || [])) - }) - } - - updateCustomComponent = () => { - Api.getCloudConfig({ - func: 's_get_custom_components', - typename: '', - typecharone: '' - }).then(res => { - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } else if (res.cus_list) { - sessionStorage.setItem('app_custom_components', JSON.stringify(res.cus_list)) - this.setCustomComponent(res.cus_list) - } - }) - } - - setCustomComponent = (cus_list) => { - let coms = [] - - cus_list.forEach(item => { - let config = '' - - try { - config = JSON.parse(window.decodeURIComponent(window.atob(item.long_param))) - } catch (e) { - console.warn('Parse Failure') - config = '' - } - - if (!config || !item.c_name) return - - window.GLOB.UserComponentMap.set(item.c_id, item.c_name) - coms.push({ - uuid: item.c_id, - type: 'menu', - title: item.c_name, - url: item.images, - component: config.type, - subtype: config.subtype, - config - }) - }) - this.setState({customComponents: coms}) } initPopview = (card, btn) => { @@ -1242,7 +1100,7 @@ } render () { - const { view, comloading, MenuType, MenuId, config, settingshow, ParentId, menuloading, customComponents, eyeopen, needUpdate } = this.state + const { view, comloading, MenuType, MenuId, config, settingshow, ParentId, menuloading, eyeopen, needUpdate } = this.state return ( <ConfigProvider locale={_locale}> @@ -1290,9 +1148,6 @@ <Panel header="鍏冪礌" key="element"> <Modulecell /> </Panel> - {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" key="cuscomponent"> - <SourceWrap components={customComponents} MenuType={MenuType} /> - </Panel> : null} <Panel header="椤甸潰鏍峰紡" key="background"> {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null} </Panel> diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 21bf77f..9b01279 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -4,7 +4,7 @@ import { is, fromJS } from 'immutable' import HTML5Backend from 'react-dnd-html5-backend' import { ConfigProvider, notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, RedoOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' +import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' import moment from 'moment' import md5 from 'md5' @@ -165,7 +165,6 @@ MKEmitter.addListener('triggerMenuSave', this.submitConfig) MKEmitter.addListener('changeEditMenu', this.changeEditMenu) setTimeout(() => { - this.getAppPictures() this.getRoleFields() setGLOBFuncs() }, 1000) @@ -472,43 +471,6 @@ sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) this.props.history.replace('/mobdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID || homeId, type: 'view'})))) } - }) - } - - getAppPictures = () => { - if (sessionStorage.getItem('app_pictures')) return - - let deffers = [] - let param = { - func: 's_url_db_adduptdel', - PageIndex: 0, // 0 浠h〃鍏ㄩ儴 - PageSize: 0, // 0 浠h〃鍏ㄩ儴 - type: 'search' - } - deffers = [new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'image'}).then(res => { - resolve(res.data) - }) - }, 500) - }), new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'video'}).then(res => { - resolve(res.data) - }) - }, 1000) - }), new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'color'}).then(res => { - resolve(res.data) - }) - }, 1500) - })] - - Promise.all(deffers).then(response => { - sessionStorage.setItem('app_pictures', JSON.stringify(response[0] || [])) - sessionStorage.setItem('app_videos', JSON.stringify(response[1] || [])) - sessionStorage.setItem('app_colors', JSON.stringify(response[2] || [])) }) } @@ -1936,26 +1898,6 @@ }) } - refreshView = () => { - const { oriConfig, config } = this.state - - if (!is(fromJS(oriConfig || {}), fromJS(config || {}))) { - notification.warning({ - top: 92, - message: '閰嶇疆淇℃伅鏈繚瀛橈紒', - duration: 5 - }) - return - } - - sessionStorage.removeItem('sysRoles') - sessionStorage.removeItem('permFuncField') - sessionStorage.removeItem('app_videos') - sessionStorage.removeItem('app_pictures') - - window.location.reload() - } - setHomeView = () => { const { oriConfig, config } = this.state @@ -2185,7 +2127,6 @@ <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> <Transfer MenuID={MenuId} /> <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/> - <Button className="mk-border-danger" onClick={this.refreshView}><RedoOutlined /> 寮哄埗鍒锋柊</Button> <Button type="default" onClick={this.closeView}>鍏抽棴</Button> </div> </div> diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index ff5b5b3..79bb8c8 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -4,7 +4,7 @@ import { is, fromJS } from 'immutable' import HTML5Backend from 'react-dnd-html5-backend' import { ConfigProvider, notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, RedoOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' +import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' import moment from 'moment' import md5 from 'md5' @@ -146,7 +146,6 @@ MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) setTimeout(() => { - this.getAppPictures() this.getRoleFields() setGLOBFuncs() }, 1000) @@ -325,43 +324,6 @@ sessionStorage.setItem('appViewList', JSON.stringify(appViewList)) this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID || homeId, type: 'view'})))) } - }) - } - - getAppPictures = () => { - if (sessionStorage.getItem('app_pictures')) return - - let deffers = [] - let param = { - func: 's_url_db_adduptdel', - PageIndex: 0, // 0 浠h〃鍏ㄩ儴 - PageSize: 0, // 0 浠h〃鍏ㄩ儴 - type: 'search' - } - deffers = [new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'image'}).then(res => { - resolve(res.data) - }) - }, 500) - }), new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'video'}).then(res => { - resolve(res.data) - }) - }, 1000) - }), new Promise(resolve => { - setTimeout(() => { - Api.getCloudConfig({...param, typecharone: 'color'}).then(res => { - resolve(res.data) - }) - }, 1500) - })] - - Promise.all(deffers).then(response => { - sessionStorage.setItem('app_pictures', JSON.stringify(response[0] || [])) - sessionStorage.setItem('app_videos', JSON.stringify(response[1] || [])) - sessionStorage.setItem('app_colors', JSON.stringify(response[2] || [])) }) } @@ -1592,24 +1554,6 @@ }) } - refreshView = () => { - if (!is(fromJS(this.state.oriConfig || {}), fromJS(this.state.config || {}))) { - notification.warning({ - top: 92, - message: '閰嶇疆淇℃伅鏈繚瀛橈紒', - duration: 5 - }) - return - } - - sessionStorage.removeItem('sysRoles') - sessionStorage.removeItem('permFuncField') - sessionStorage.removeItem('app_videos') - sessionStorage.removeItem('app_pictures') - - window.location.reload() - } - setHomeView = () => { const { config } = this.state @@ -1795,7 +1739,6 @@ <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> <Transfer MenuID={MenuId} /> <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/> - <Button className="mk-border-danger" onClick={this.refreshView}><RedoOutlined /> 寮哄埗鍒锋柊</Button> <Button type="default" onClick={this.closeView}>鍏抽棴</Button> </div> </div> diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 936154b..4696876 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -114,7 +114,6 @@ MKEmitter.addListener('changePopview', this.initPopview) MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) setTimeout(() => { - this.getPrintTemp() this.getRoleFields() setGLOBFuncs() }, 1000) @@ -191,50 +190,6 @@ if (this.state.view === 'popview') return this.submitConfig() - } - - getPrintTemp = () => { - if (!sessionStorage.getItem('printTemps')) { - let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate - where appkey= @appkey@ and Deleted=0 and typechartwo='web_print' - union select ID,Images,a.PrintTempNO+PrintTempName as PN - from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a - left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b - on a.PrintTempNO=b.PrintTempNO - left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c - on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` - - let param = { - func: 'sPC_Get_SelectedList', - LText: Utils.formatOptions(_sql), - obj_name: 'data', - arr_field: 'PN,ID,Images' - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 - - Api.getCloudConfig(param).then(res => { - if (res.status) { - let temps = res.data.map(temp => { - return { - value: temp.ID, - text: temp.PN - } - }) - - sessionStorage.setItem('printTemps', JSON.stringify(temps)) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } } initPopview = (card, btn) => { -- Gitblit v1.8.0