From 66cc7818cf5e13c44f4372e7d47fb72df7d2f752 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 16 九月 2022 10:30:14 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/components/card/table-card/index.jsx | 2 src/utils/utils-custom.js | 11 src/menu/components/card/cardcellcomponent/dragaction/action.jsx | 8 src/menu/components/share/actioncomponent/dragaction/index.jsx | 39 + src/menu/components/share/searchcomponent/dragsearch/card.jsx | 22 src/menu/components/chart/antv-scatter/index.jsx | 2 src/views/billprint/index.jsx | 4 src/views/mobdesign/index.jsx | 4 src/views/interface/history/index.jsx | 16 src/views/menudesign/index.jsx | 4 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 6 src/menu/components/table/edit-table/index.scss | 10 src/tabviews/custom/components/card/cardcellList/index.jsx | 25 + src/menu/components/share/searchcomponent/dragsearch/index.jsx | 51 ++ src/menu/components/card/cardcellcomponent/index.jsx | 95 ++-- src/components/editor/index.jsx | 9 src/menu/components/share/actioncomponent/formconfig.jsx | 49 +- src/menu/components/search/main-search/dragsearch/card.jsx | 18 src/menu/components/card/cardcomponent/index.jsx | 18 src/menu/components/card/data-card/index.jsx | 2 src/components/breadview/index.jsx | 10 src/views/popdesign/index.jsx | 4 src/menu/components/table/edit-table/columns/index.scss | 6 src/tabviews/custom/index.jsx | 66 --- src/menu/components/table/base-table/columns/index.jsx | 7 src/views/appmanage/index.jsx | 9 src/menu/components/table/normal-table/columns/index.jsx | 32 + src/menu/components/table/edit-table/columns/index.jsx | 37 + src/components/tabview/index.jsx | 10 src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 10 src/menu/modulecell/dragsource/index.scss | 0 src/menu/components/card/cardcellcomponent/dragaction/index.scss | 8 src/views/appcheck/index.jsx | 9 src/menu/components/card/cardcellcomponent/dragaction/index.jsx | 53 ++ src/menu/components/card/cardcellcomponent/dragaction/card.jsx | 30 src/menu/components/chart/antv-bar/index.jsx | 1 src/menu/components/table/normal-table/index.scss | 10 src/api/index.js | 10 src/templates/modalconfig/dragelement/index.jsx | 8 src/menu/components/table/normal-table/columns/index.scss | 5 src/menu/components/table/edit-table/index.jsx | 2 src/utils/utils.js | 11 src/index.js | 2 src/menu/components/card/balcony/index.jsx | 8 src/menu/components/search/main-search/dragsearch/index.jsx | 51 ++ src/menu/stylecontroller/index.jsx | 4 src/views/pcdesign/index.jsx | 4 src/templates/zshare/formconfig.jsx | 49 +- src/mob/components/formdragelement/index.jsx | 1 src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx | 8 src/menu/components/share/actioncomponent/index.jsx | 19 src/menu/modulecell/index.jsx | 152 +++++++ src/menu/components/card/cardsimplecomponent/index.jsx | 6 src/menu/components/search/main-search/index.jsx | 2 src/menu/modulecell/index.scss | 42 ++ src/menu/components/card/cardcellcomponent/formconfig.jsx | 2 src/menu/modulecell/dragsource/index.jsx | 14 src/menu/stylecombcontrolbutton/index.jsx | 10 src/tabviews/custom/components/card/cardcellList/index.scss | 13 src/tabviews/zshare/fileupload/index.jsx | 11 src/tabviews/zshare/fileupload-pice/index.jsx | 11 61 files changed, 758 insertions(+), 384 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index afec16a..d726b02 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -81,11 +81,7 @@ class Api { constructor() { - if (process.env.NODE_ENV === 'production') { - axios.defaults.baseURL = document.location.origin + '/' + window.GLOB.service - } else { - axios.defaults.baseURL = window.GLOB.location + '/' + window.GLOB.service - } + axios.defaults.baseURL = window.GLOB.baseurl } /** @@ -106,7 +102,7 @@ * @description 寰俊涓氬姟璇锋眰 */ wxAccessToken () { - let _url = document.location.origin + '/' + window.GLOB.service + 'wxpay/getaccesstoken' + let _url = window.GLOB.baseurl + 'wxpay/getaccesstoken' if (process.env.NODE_ENV !== 'production') { _url = document.location.origin + '/wxpay/getaccesstoken' } @@ -958,7 +954,7 @@ * @description 鑾峰彇寰俊鏀粯浜岀淮鐮� */ getWxNativePay (param) { - let _url = document.location.origin + '/' + window.GLOB.service + 'wxpay/wxNativePay' + let _url = window.GLOB.baseurl + 'wxpay/wxNativePay' if (process.env.NODE_ENV !== 'production') { _url = document.location.origin + '/wxpay/wxNativePay' } diff --git a/src/components/breadview/index.jsx b/src/components/breadview/index.jsx index bd3d3cd..4e4e3e6 100644 --- a/src/components/breadview/index.jsx +++ b/src/components/breadview/index.jsx @@ -23,14 +23,6 @@ const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) const FormTab = asyncComponent(() => import('@/tabviews/formtab')) -let service = '' - -if (process.env.NODE_ENV === 'production') { - service = document.location.origin + '/' + window.GLOB.service + 'zh-CN/' -} else { - service = window.GLOB.location + '/' + window.GLOB.service + 'zh-CN/' -} - class BreadView extends Component { state = { tabview: null, // 鏍囩 @@ -108,7 +100,7 @@ } else if (view.type === 'FormTab') { return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'iframe') { - return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) + return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={window.GLOB.baseurl + 'zh-CN/' + view.LinkUrl}/>) } else { return (<NotFount key={view.MenuID} />) } diff --git a/src/components/editor/index.jsx b/src/components/editor/index.jsx index dae66f6..fb02a69 100644 --- a/src/components/editor/index.jsx +++ b/src/components/editor/index.jsx @@ -14,13 +14,6 @@ BraftEditor.use(Table()) -let service = '' -if (process.env.NODE_ENV === 'production') { - service = document.location.origin + '/' + window.GLOB.service -} else { - service = window.GLOB.location + '/' + window.GLOB.service -} - class NormalEditor extends Component { static propTpyes = { config: PropTypes.object, @@ -87,7 +80,7 @@ form.append('file', _param.binary) form.append('fileMd5', params.file.fileMd5) form.append('shardingMd5', _param.chunkMd5) - form.append('baseDomain', service) + form.append('baseDomain', window.GLOB.baseurl) form.append('rootPath', 'Content/images/upload/') form.append('fileName', params.file.fileName) form.append('fileExt', params.file.fileType) diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index ad4fec5..82043c0 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -26,14 +26,6 @@ const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) const FormTab = asyncComponent(() => import('@/tabviews/formtab')) -let service = '' - -if (process.env.NODE_ENV === 'production') { - service = document.location.origin + '/' + window.GLOB.service + 'zh-CN/' -} else { - service = window.GLOB.location + '/' + window.GLOB.service + 'zh-CN/' -} - class TabViews extends Component { static propTpyes = { collapse: PropTypes.bool @@ -215,7 +207,7 @@ } else if (view.type === 'FormTab') { return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'iframe') { - return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) + return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={window.GLOB.baseurl + 'zh-CN/' + view.LinkUrl}/>) } else { return (<NotFount key={view.MenuID} />) } diff --git a/src/index.js b/src/index.js index 3abe53d..0528488 100644 --- a/src/index.js +++ b/src/index.js @@ -210,11 +210,13 @@ } GLOB.service = _service ? _service + '/' : '' GLOB.host = window.location.host + (_service ? '_' + _service : '') + GLOB.baseurl = document.location.origin + '/' + GLOB.service } else { GLOB.linkurl = '' GLOB.location = config.host GLOB.service = config.service GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '') + GLOB.baseurl = GLOB.location + '/' + GLOB.service } let mark = sessionStorage.getItem('system_mark') diff --git a/src/menu/components/card/balcony/index.jsx b/src/menu/components/card/balcony/index.jsx index 263b648..6cec481 100644 --- a/src/menu/components/card/balcony/index.jsx +++ b/src/menu/components/card/balcony/index.jsx @@ -209,7 +209,7 @@ newcard.height = 1 // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [card.uuid, card.uuid], newcard) + MKEmitter.emit('cardAddElement', card.uuid, newcard) } addButton = () => { @@ -220,7 +220,7 @@ newcard.focus = true // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [card.uuid, card.uuid], newcard) + MKEmitter.emit('cardAddElement', card.uuid, newcard) } pasteComponent = (res, resolve) => { @@ -233,10 +233,10 @@ res.focus = true if (type === 'customCardElement') { - MKEmitter.emit('cardAddElement', [card.uuid, card.uuid], res) + MKEmitter.emit('cardAddElement', card.uuid, res) } else { res.eleType = 'button' - MKEmitter.emit('cardAddElement', [card.uuid, card.uuid], res) + MKEmitter.emit('cardAddElement', card.uuid, res) } resolve({status: true}) } diff --git a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx index 816abe9..baf28f1 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx @@ -18,7 +18,13 @@ const [, drop] = useDrop({ accept: 'action', canDrop: () => true, - drop({ id: draggedId }) { + drop(item) { + const { id: draggedId } = item + + if (item.$init) { + item.overIndex = id + } + if (!draggedId || draggedId === id) return const { index: originIndex } = findCard(draggedId) diff --git a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx index b5f393b..e0c82a5 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx @@ -40,7 +40,13 @@ const [, drop] = useDrop({ accept: 'action', canDrop: () => true, - drop({ id: draggedId }) { + drop(item) { + const { id: draggedId } = item + + if (item.$init) { + item.overIndex = id + } + if (!draggedId || draggedId === id) return const { index: originIndex } = findCard(draggedId) @@ -71,7 +77,7 @@ const getContent = () => { if (card.eleType === 'sequence') { return ( - <div className={'ant-mk-text'}>1</div> + <div style={{height: card.innerHeight || 'auto'}} className="ant-mk-text">1</div> ) } else if (card.eleType === 'text' || card.eleType === 'number') { let val = `${card.prefix || ''}${card.datatype === 'static' ? (card.value || '') : (card.field || '')}${card.postfix || ''}` @@ -83,18 +89,7 @@ <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div> ) } else if (card.eleType === 'icon') { - let fontSize = 14 - let lineHeight = 1.5 - - if (card.style.fontSize) { - fontSize = parseInt(card.style.fontSize) - } - if (card.style.lineHeight) { - lineHeight = parseFloat(card.style.lineHeight) - } - - let innerHeight = fontSize * lineHeight - return (<MkIcon style={{height: innerHeight}} className="ant-mk-icon" type={card.icon}/>) + return (<MkIcon style={{height: card.innerHeight || 'auto'}} className="ant-mk-icon" type={card.icon}/>) } else if (card.eleType === 'slider') { let val = card.value ? (card.value / card.maxValue) * 100 : 30 return <MkProgress value={val} config={card}/> @@ -165,7 +160,7 @@ val = <><span style={_s}>{card.prefix || ''}</span>{moment().format(card.dateFormat)}<span style={_s}>{card.postfix || ''}</span></> } return ( - <div className="ant-mk-date"> + <div className="ant-mk-text line1" style={{height: card.innerHeight || 'auto'}}> {val} </div> ) @@ -176,7 +171,7 @@ val = <><span style={_s}>{card.prefix || ''}</span>{card.formula}<span style={_s}>{card.postfix || ''}</span></> } return ( - <div className="ant-mk-date"> + <div className="ant-mk-text" style={{height: card.innerHeight || 'auto'}}> {val} </div> ) @@ -191,8 +186,7 @@ } let able = true - if ((appType === 'mob' || appType === 'pc') && parent && (parent.setting.click === 'menu' || parent.setting.click === 'menus')) { - // if ((appType === 'mob' || appType === 'pc') && parent && parent.setting.click === 'menu') { + if ((appType === 'mob' || appType === 'pc') && (parent.setting.click === 'menu' || parent.setting.click === 'menus')) { able = false } diff --git a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx index f6cdeac..683cd5f 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx @@ -112,6 +112,58 @@ const [, drop] = useDrop({ accept: 'action', drop(item) { + if (item.$init) { // 鎷栨嫿娣诲姞 + let newcard = {} + newcard.uuid = Utils.getuuid() + newcard.focus = true + + // 鏄剧ず鍒楄繃婊� + if (parent.type === 'custom' && item.class !== 'element') { + delete item.overIndex + return + } else if (parent.type === 'action' && item.class === 'element') { + delete item.overIndex + return + } + + if (item.class === 'element') { + newcard.eleType = item.value + newcard.datatype = 'dynamic' + newcard.height = 1 + } else { + newcard.eleType = 'button' + newcard.label = 'button' + newcard.verify = null + newcard.show = 'link' + newcard.Ot = 'requiredSgl' + newcard.OpenType = item.value + newcard.class = 'primary' + + if (newcard.OpenType === 'excelIn') { + newcard.label = item.text + newcard.class = 'dgreen' + newcard.Ot = 'notRequired' + } else if (item.subType === 'excelOut') { + newcard.label = item.text + newcard.execSuccess = 'never' + newcard.class = 'dgreen' + } + } + + if (item.overIndex) { + const { index } = findCard(item.overIndex) + const _cards = update(cards, { $splice: [[index + 1, 0, newcard]] }) + handleList(_cards) + } else { + handleList([...cards, newcard]) + } + + handleMenu(newcard) + + delete item.overIndex + return + } + const { index } = findCard(item.id) if (index > -1) return dropButton(item.id) @@ -127,7 +179,6 @@ id={card.uuid} key={card.uuid} card={card} - parent={parent} copyCard={copyCard} moveCard={moveCard} editCard={editCard} diff --git a/src/menu/components/card/cardcellcomponent/dragaction/index.scss b/src/menu/components/card/cardcellcomponent/dragaction/index.scss index c7c3f27..3683516 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/index.scss +++ b/src/menu/components/card/cardcellcomponent/dragaction/index.scss @@ -93,14 +93,6 @@ border-left: 0; border-right: 0; } - .ant-mk-date { - white-space: nowrap; - overflow: hidden; - word-break: break-word; - text-overflow: ellipsis; - font-weight: inherit; - font-style: inherit; - } .ant-mk-check { white-space: nowrap; overflow: hidden; diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 1529d90..ab7b202 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -25,6 +25,8 @@ if (type === 'table' || (type === 'card' && subtype === 'datacard')) { _options.push({value: 'sequence', text: '搴忓彿'}) + } else if (card.eleType === 'sequence') { // 鎷栨嫿娣诲姞绫诲瀷杞崲 + card.eleType = 'text' } let appMenus = [] diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index b2d12a3..20e37de 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -68,19 +68,16 @@ componentDidMount () { MKEmitter.addListener('submitModal', this.handleSave) MKEmitter.addListener('cardAddElement', this.cardAddElement) + MKEmitter.addListener('cardDelElement', this.cardDelElement) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props.cards), fromJS(nextProps.cards)) || !is(fromJS(this.state), fromJS(nextState)) + return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props.cards), fromJS(nextProps.cards)) } UNSAFE_componentWillReceiveProps(nextProps) { if (this.props.side !== nextProps.side) { - this.setState({ - elements: fromJS(nextProps.elements).toJS() - }) - } else if (!is(fromJS(this.props.elements), fromJS(nextProps.elements)) && nextProps.elements.length !== this.state.elements.length) { this.setState({ elements: fromJS(nextProps.elements).toJS() }) @@ -96,13 +93,14 @@ } MKEmitter.removeListener('submitModal', this.handleSave) MKEmitter.removeListener('cardAddElement', this.cardAddElement) + MKEmitter.removeListener('cardDelElement', this.cardDelElement) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } updateComponentStyle = (parentId, keys, style) => { const { cardCell } = this.props - if (!cardCell || cardCell.uuid !== parentId) return + if (cardCell.uuid !== parentId) return const { elements } = this.state @@ -120,10 +118,18 @@ }) } - cardAddElement = (ids, element) => { - const { cards, cardCell } = this.props + cardDelElement = (id, eleId) => { + const { cardCell } = this.props - if (!ids || ids.length !== 2 || ids[0] !== cards.uuid || ids[1] !== cardCell.uuid) return + if (id !== cardCell.uuid) return + + this.setState({elements: this.state.elements.filter(item => item.uuid !== eleId)}) + } + + cardAddElement = (id, element) => { + const { cardCell } = this.props + + if (id !== cardCell.uuid) return if (window.GLOB.$lock) return window.GLOB.$lock = true @@ -193,35 +199,30 @@ resetCardStyle = (card, style) => { let _card = fromJS(card).toJS() - - if (['text', 'number', 'formula'].includes(_card.eleType)) { - _card.style = style - let fontSize = 14 - let lineHeight = 1.5 + if (['text', 'number', 'formula', 'currentDate', 'sequence', 'icon'].includes(_card.eleType)) { + _card.style = style let line = _card.height || null - if (_card.style.fontSize) { - fontSize = parseInt(_card.style.fontSize) - } - if (_card.style.lineHeight) { - lineHeight = parseFloat(_card.style.lineHeight) + if (['currentDate', 'sequence', 'icon'].includes(_card.eleType)) { + line = 1 } if (line) { + let fontSize = 14 + let lineHeight = 1.5 + + if (_card.style.fontSize) { + fontSize = parseInt(_card.style.fontSize) + } + if (_card.style.lineHeight) { + lineHeight = parseFloat(_card.style.lineHeight) + } + _card.innerHeight = fontSize * lineHeight * line + } else { + _card.innerHeight = 'auto' } - } else if (_card.eleType === 'sequence') { - _card.style = style - - let fontSize = 14 - let lineHeight = 1.5 - - if (_card.style.fontSize) { - fontSize = parseInt(_card.style.fontSize) - } - - _card.innerHeight = fontSize * lineHeight } else if (_card.eleType === 'barcode') { _card.style = style @@ -323,7 +324,7 @@ this.setState({ actvisible: true, card: card, - formlist: getActionForm(card, functip, cards, usefulFields, 'card', menulist, modules, anchors) + formlist: getActionForm(card, functip, cards, usefulFields, menulist, modules, anchors) }) } @@ -364,23 +365,30 @@ let _elements = elements.map(cell => { if (cell.uuid === res.uuid) { res.style = cell.style || {} - if (res.eleType === 'splitline' && cell.eleType !== 'splitline') { + if (res.eleType === 'splitline' && (cell.eleType !== 'splitline' || cell.focus)) { res.style.paddingTop = '5px' res.style.paddingBottom = '5px' - } else if (['text', 'number', 'formula'].includes(res.eleType)) { - let fontSize = 14 - let lineHeight = 1.5 + } else if (['text', 'number', 'formula', 'currentDate', 'sequence', 'icon'].includes(res.eleType)) { let line = res.height || null - - if (res.style && res.style.fontSize) { - fontSize = parseInt(res.style.fontSize) - } - if (res.style && res.style.lineHeight) { - lineHeight = parseFloat(res.style.lineHeight) + + if (['currentDate', 'sequence', 'icon'].includes(res.eleType)) { + line = 1 } if (line) { + let fontSize = 14 + let lineHeight = 1.5 + + if (res.style && res.style.fontSize) { + fontSize = parseInt(res.style.fontSize) + } + if (res.style && res.style.lineHeight) { + lineHeight = parseFloat(res.style.lineHeight) + } + res.innerHeight = fontSize * lineHeight * line + } else { + res.innerHeight = 'auto' } if (res.eleType === 'text' && res.link && !res.style.color) { @@ -605,9 +613,10 @@ } dropButton = (id) => { - const { cards } = this.props + const { cards, cardCell } = this.props if (!cards.action) return + if (cardCell.type === 'custom') return let index = cards.action.findIndex(item => item.uuid === id) @@ -690,7 +699,7 @@ <div className="model-menu-card-cell-list"> <DragElement list={elements} - parent={{...cardCell, components: elements}} + parent={cardCell} fields={cards.columns} updateMarks={this.updateMarks} handleList={this.handleList} diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index 624eb32..0ead6f4 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -119,7 +119,6 @@ } addElement = () => { - const { cards } = this.props const { card } = this.state let newcard = {} @@ -131,11 +130,10 @@ newcard.height = 1 // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) + MKEmitter.emit('cardAddElement', card.uuid, newcard) } addButton = () => { - const { cards } = this.props const { card } = this.state let newcard = {eleType: 'button', label: 'button', verify: null, show: 'link', sqlType: '', Ot: 'requiredSgl', OpenType: 'prompt', icon: '', class: 'primary', intertype: 'system', execSuccess: 'grid', execError: 'never', popClose: 'never'} @@ -143,7 +141,7 @@ newcard.focus = true // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) + MKEmitter.emit('cardAddElement', card.uuid, newcard) } changeStyle = () => { @@ -235,7 +233,6 @@ } paste = (element, resolve) => { - const { cards } = this.props const { card } = this.state let _uuid = Utils.getuuid() @@ -256,14 +253,7 @@ resolve({status: true}) // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], element) - } - - clickComponent = (e) => { - if ((sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'propcard') && this.props.cards.subtype === 'propcard') { - e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card, this.props.cards, 'propcard') - } + MKEmitter.emit('cardAddElement', card.uuid, element) } doubleClickCard = () => { @@ -329,7 +319,7 @@ return ( <Col span={card.setting.width || 6}> - <div className={'card-item ' + (card.setting.btnControl || '')} style={_style} onClick={this.clickComponent} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> + <div className={'card-item ' + (card.setting.btnControl || '')} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> <CardCellComponent cards={cards} cardCell={card} side={side} elements={elements} updateElement={this.updateCard}/> <div className="card-control" onDoubleClick={(e) => e.stopPropagation()}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ diff --git a/src/menu/components/card/cardsimplecomponent/index.jsx b/src/menu/components/card/cardsimplecomponent/index.jsx index 54f44b0..67e71fb 100644 --- a/src/menu/components/card/cardsimplecomponent/index.jsx +++ b/src/menu/components/card/cardsimplecomponent/index.jsx @@ -82,7 +82,6 @@ } addElement = () => { - const { cards } = this.props const { card } = this.state let newcard = {} @@ -98,11 +97,10 @@ window.GLOB.$lock = false // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) + MKEmitter.emit('cardAddElement', card.uuid, newcard) } addButton = () => { - const { cards } = this.props const { card } = this.state let newcard = {eleType: 'button', label: 'button', verify: null, show: 'link', sqlType: '', Ot: 'requiredSgl', OpenType: 'prompt', icon: '', class: 'primary', intertype: 'system', execSuccess: 'grid', execError: 'never', popClose: 'never'} @@ -111,7 +109,7 @@ // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) + MKEmitter.emit('cardAddElement', card.uuid, newcard) } changeStyle = () => { diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index c3dfe4e..b44b03d 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -786,7 +786,7 @@ } trigger="hover"> <ToolOutlined /> </Popover> - <ActionComponent config={card} type="datacard" setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> + <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> <div className={'float-' + (card.wrap.cardFloat || 'left') + ' select-' + card.wrap.selStyle}> {card.subcards.map((subcard, index) => (<CardComponent key={subcard.uuid} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} </div> diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 1c498ad..db3f76b 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -596,7 +596,7 @@ } trigger="hover"> <ToolOutlined /> </Popover> - <ActionComponent config={card} type="datacard" setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> + <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> <div style={{minHeight: 'calc(100% - 90px)'}}> {card.subcards.map(subcard => (<CardSimpleComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} move={this.move} deleteElement={this.deleteCard}/>))} </div> diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 90c340e..acd5cc0 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -1402,7 +1402,6 @@ <NormalHeader config={card} updateComponent={this.updateComponent}/> <div className="canvas" id={card.uuid + 'canvas'} ref={ref => this.wrap = ref}></div> {appType !== 'mob' ? <ActionComponent - type="chart" config={card} updateaction={this.updateComponent} /> : null} diff --git a/src/menu/components/chart/antv-scatter/index.jsx b/src/menu/components/chart/antv-scatter/index.jsx index 5b5d93a..e5b1dfa 100644 --- a/src/menu/components/chart/antv-scatter/index.jsx +++ b/src/menu/components/chart/antv-scatter/index.jsx @@ -419,7 +419,7 @@ </Popover> <NormalHeader config={card} updateComponent={this.updateComponent}/> <div className="canvas" id={card.uuid + 'canvas'} ref={ref => this.wrap = ref}></div> - {appType !== 'mob' ? <ActionComponent type="chart" config={card} updateaction={this.updateComponent}/> : null} + {appType !== 'mob' ? <ActionComponent config={card} updateaction={this.updateComponent}/> : null} <div className="component-name"> <div className="center"> <div className="title">{card.name}</div> diff --git a/src/menu/components/search/main-search/dragsearch/card.jsx b/src/menu/components/search/main-search/dragsearch/card.jsx index e9d558a..4e36738 100644 --- a/src/menu/components/search/main-search/dragsearch/card.jsx +++ b/src/menu/components/search/main-search/dragsearch/card.jsx @@ -23,13 +23,19 @@ const [, drop] = useDrop({ accept: 'search', canDrop: () => true, - drop: ({ id: draggedId }) => { - if (!draggedId || draggedId === id) return - const { index: originIndex } = findCard(draggedId) - if (originIndex === -1) return + drop: (item) => { + const { id: draggedId, originalIndex } = item + + if (originalIndex === undefined) { + item.dropTargetId = id + } else { + if (!draggedId || draggedId === id) return + const { index: originIndex } = findCard(draggedId) + if (originIndex === -1) return - const { index: overIndex } = findCard(id) - moveCard(draggedId, overIndex) + const { index: overIndex } = findCard(id) + moveCard(draggedId, overIndex) + } }, }) const opacity = isDragging ? 0.5 : 1 diff --git a/src/menu/components/search/main-search/dragsearch/index.jsx b/src/menu/components/search/main-search/dragsearch/index.jsx index a3cfd27..5da648f 100644 --- a/src/menu/components/search/main-search/dragsearch/index.jsx +++ b/src/menu/components/search/main-search/dragsearch/index.jsx @@ -81,7 +81,56 @@ const [, drop] = useDrop({ accept: 'search', - drop() {} + drop(item) { + if (item.hasOwnProperty('originalIndex')) { + return + } + + let newcard = {} + newcard.uuid = Utils.getuuid() + newcard.focus = true + + newcard.label = 'label' + newcard.initval = '' + newcard.type = item.subType + newcard.resourceType = '0' + newcard.options = [] + newcard.orderType = 'asc' + + let _match = 'like' + if (item.subType === 'select' || item.subType === 'link' || item.subType === 'checkcard') { + _match = '=' + } else if (item.subType === 'date' || item.subType === 'datemonth') { + _match = '>=' + } else if (item.subType === 'dateweek' || item.subType === 'daterange') { + _match = 'between' + } else if (item.subType === 'group') { + _match = 'between' + newcard.items = ['day', 'week', 'month', 'quarter', 'year', 'customized'] + } + + newcard.match = _match + + let targetId = '' + + if (item.dropTargetId) { + targetId = item.dropTargetId + delete item.dropTargetId + } else if (cards.length > 0) { + targetId = cards[cards.length - 1].uuid + } + + const { index: overIndex, card } = findCard(`${targetId}`) + + if (card) { + newcard.ratio = card.ratio || 6 + newcard.labelwidth = card.labelwidth || 33.3 + } + + const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) + + handleList(_cards, newcard) + } }) let labelwidth = setting.searchLwidth !== undefined ? setting.searchLwidth : 33.3 diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index 379f56b..fc79218 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -162,7 +162,7 @@ let linkableFields = [] card.search.forEach(item => { - if (item.uuid === card.uuid) return + if (item.uuid === cell.uuid) return if (!['select', 'link', 'checkcard'].includes(item.type)) return if (item.type === 'checkcard' && item.multiple === 'true') return diff --git a/src/menu/components/share/actioncomponent/dragaction/index.jsx b/src/menu/components/share/actioncomponent/dragaction/index.jsx index 77e72fe..4ea521d 100644 --- a/src/menu/components/share/actioncomponent/dragaction/index.jsx +++ b/src/menu/components/share/actioncomponent/dragaction/index.jsx @@ -104,6 +104,45 @@ const [, drop] = useDrop({ accept: 'action', drop(item) { + if (item.$init) { // 鎷栨嫿娣诲姞 + let newcard = {} + newcard.uuid = Utils.getuuid() + newcard.focus = true + + if (item.class === 'element') { + delete item.overIndex + return + } else { + newcard.label = 'button' + newcard.verify = null + newcard.show = 'link' + newcard.Ot = 'requiredSgl' + newcard.OpenType = item.value + newcard.class = 'primary' + + if (newcard.OpenType === 'excelIn') { + newcard.label = item.text + newcard.class = 'dgreen' + newcard.Ot = 'notRequired' + } else if (item.subType === 'excelOut') { + newcard.label = item.text + newcard.execSuccess = 'never' + newcard.class = 'dgreen' + } + } + + if (item.overIndex) { + const { index } = findCard(item.overIndex) + const _cards = update(cards, { $splice: [[index + 1, 0, newcard]] }) + handleList(_cards, newcard) + } else { + handleList([...cards, newcard], newcard) + } + + delete item.overIndex + return + } + const { index } = findCard(item.id) if (index > -1) return dropButton(item.id) diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 789803c..157db98 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -12,7 +12,7 @@ * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ -export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = [], anchors = []) { +export function getActionForm (card, functip, config, usefulFields, menulist = [], modules = [], anchors = []) { let appType = sessionStorage.getItem('appType') let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview let printTemps = sessionStorage.getItem('printTemps') @@ -20,34 +20,44 @@ let setting = config.setting || {} let columns = config.columns || [] let appMenus = [] + let type = '' + + if (card.eleType === 'button') { + type = 'card' + } else if (config.subtype === 'datacard' || config.subtype === 'tablecard') { + type = 'datacard' + } else if (config.type === 'line' || config.type === 'bar' || config.type === 'scatter') { + type = 'chart' + } + let opentypes = [ { value: 'pop', - text: Formdict['model.form.popform'] + text: '寮圭獥锛堣〃鍗曪級' }, { value: 'prompt', - text: Formdict['model.form.prompt'] + text: '鎻愮ず妗�' }, { value: 'exec', - text: Formdict['model.form.exec'] + text: '鐩存帴鎵ц' }, { value: 'excelIn', - text: Formdict['model.form.excelIn'] + text: '瀵煎叆Excel' }, { value: 'excelOut', - text: Formdict['model.form.excelOut'] + text: '瀵煎嚭Excel' }, { value: 'popview', - text: Formdict['model.form.popview'] + text: '寮圭獥锛堟爣绛撅級' }, { value: 'tab', - text: Formdict['model.form.tab'] + text: '鏍囩椤�' }, { value: 'innerpage', - text: Formdict['model.form.newpage'] + text: '鏂伴〉闈�' }, { value: 'funcbutton', - text: Formdict['model.form.funcbutton'] + text: '鍔熻兘鎸夐挳' } ] @@ -76,17 +86,6 @@ return _list } - // if (type === 'editable') { - // opentypes = [ - // { - // value: 'excelIn', - // text: Formdict['model.form.excelIn'] - // }, { - // value: 'excelOut', - // text: Formdict['model.form.excelOut'] - // } - // ] - // } let tabs = getTabs(JSON.parse(JSON.stringify(window.GLOB.customMenu.components))) let pageTemps = [ @@ -152,6 +151,10 @@ if (type === 'chart' && appType !== 'mob') { opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut') + + if (card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut') { // 鎷栨嫿娣诲姞绫诲瀷杞崲 + card.OpenType = 'excelOut' + } } let refresh = [] @@ -172,6 +175,8 @@ value: 'form', text: '琛ㄥ崟锛堝紑鍏虫垨鍕鹃�夋锛�' }) + } else if (card.OpenType === 'form') { // 鎷栨嫿娣诲姞绫诲瀷杞崲 + card.OpenType = 'pop' } if (!card.control && card.controlField) { @@ -309,7 +314,7 @@ { type: 'text', key: 'sql', - label: Formdict['model.form.tablename'], + label: '琛ㄥ悕', initVal: card.sql || setting.tableName || '', required: true }, diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index 937d2f3..550fc4f 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -25,7 +25,6 @@ class ActionComponent extends Component { static propTpyes = { - type: PropTypes.string, // 鑿滃崟绫诲瀷锛屼富琛ㄦ垨瀛愯〃 config: PropTypes.object, // 鑿滃崟閰嶇疆淇℃伅 setSubConfig: PropTypes.func, // 璁剧疆瀛愰厤缃俊鎭� updateaction: PropTypes.func // 鑿滃崟閰嶇疆鏇存柊 @@ -199,7 +198,7 @@ this.setState({ visible: true, card: card, - formlist: getActionForm(card, functip, config, usefulFields, this.props.type, menulist, modules, anchors) + formlist: getActionForm(card, functip, config, usefulFields, menulist, modules, anchors) }) } @@ -246,9 +245,8 @@ if (item.uuid === btn.uuid) { btn.style = item.style || {} - - if (btn.class !== item.class || btn.show !== item.show || !btn.style.color) { - if (btn.show === 'link' || btn.show === 'icon') { + if (btn.class !== item.class || btn.show !== item.show || !btn.style.color || item.focus) { + if (btn.show === 'icon') { btn.style.color = color[btn.class] btn.style.backgroundColor = 'transparent' } else { @@ -436,13 +434,15 @@ let config = fromJS(this.props.config).toJS() let btn = null - if (config.subtype === 'normaltable') { + let _col = null + if (config.subtype === 'normaltable' || config.subtype === 'editable') { config.cols.forEach(col => { if (col.type !== 'action') return col.elements = col.elements.filter(item => { if (item.uuid === id) { btn = item + _col = col } return item.uuid !== id }) @@ -451,8 +451,9 @@ if (!btn) return - btn.Ot = 'requiredSgl' config.action.push(btn) + + MKEmitter.emit('cardDelElement', _col.uuid, btn.uuid) this.setState({ actionlist: config.action @@ -507,14 +508,14 @@ } render() { - const { config, type } = this.props + const { config } = this.props const { actionlist, visible, appType, card, dict, profVisible, record } = this.state return ( <div className={'model-menu-action-list length' + actionlist.length}> <DragElement list={actionlist} - type={appType === 'mob' ? (type || '') : ''} + type={appType === 'mob' ? config.subtype : ''} handleList={this.handleList} dropButton={this.dropButton} handleMenu={this.handleAction} diff --git a/src/menu/components/share/searchcomponent/dragsearch/card.jsx b/src/menu/components/share/searchcomponent/dragsearch/card.jsx index 7961d92..2b6bbe1 100644 --- a/src/menu/components/share/searchcomponent/dragsearch/card.jsx +++ b/src/menu/components/share/searchcomponent/dragsearch/card.jsx @@ -21,14 +21,20 @@ const [, drop] = useDrop({ accept: 'search', canDrop: () => true, - drop: ({ id: draggedId }) => { - if (!draggedId || draggedId === id) return - - const { index: originIndex } = findCard(draggedId) - if (originIndex === -1) return - - const { index: overIndex } = findCard(id) - moveCard(draggedId, overIndex) + drop: (item) => { + const { id: draggedId, originalIndex } = item + + if (originalIndex === undefined) { + item.dropTargetId = id + } else { + if (!draggedId || draggedId === id) return + + const { index: originIndex } = findCard(draggedId) + if (originIndex === -1) return + + const { index: overIndex } = findCard(id) + moveCard(draggedId, overIndex) + } } }) const opacity = isDragging ? 0.5 : 1 diff --git a/src/menu/components/share/searchcomponent/dragsearch/index.jsx b/src/menu/components/share/searchcomponent/dragsearch/index.jsx index a5013eb..8a063a7 100644 --- a/src/menu/components/share/searchcomponent/dragsearch/index.jsx +++ b/src/menu/components/share/searchcomponent/dragsearch/index.jsx @@ -81,7 +81,56 @@ const [, drop] = useDrop({ accept: 'search', - drop() {} + drop(item) { + if (item.hasOwnProperty('originalIndex')) { + return + } + + let newcard = {} + newcard.uuid = Utils.getuuid() + newcard.focus = true + + newcard.label = 'label' + newcard.initval = '' + newcard.type = item.subType + newcard.resourceType = '0' + newcard.options = [] + newcard.orderType = 'asc' + + let _match = 'like' + if (item.subType === 'select' || item.subType === 'link' || item.subType === 'checkcard') { + _match = '=' + } else if (item.subType === 'date' || item.subType === 'datemonth') { + _match = '>=' + } else if (item.subType === 'dateweek' || item.subType === 'daterange') { + _match = 'between' + } else if (item.subType === 'group') { + _match = 'between' + newcard.items = ['day', 'week', 'month', 'quarter', 'year', 'customized'] + } + + newcard.match = _match + + let targetId = '' + + if (item.dropTargetId) { + targetId = item.dropTargetId + delete item.dropTargetId + } else if (cards.length > 0) { + targetId = cards[cards.length - 1].uuid + } + + const { index: overIndex, card } = findCard(`${targetId}`) + + if (card) { + newcard.ratio = card.ratio || 6 + newcard.labelwidth = card.labelwidth || 33.3 + } + + const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) + + handleList(_cards, newcard) + } }) return ( diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx index 44be56a..f68b463 100644 --- a/src/menu/components/table/base-table/columns/index.jsx +++ b/src/menu/components/table/base-table/columns/index.jsx @@ -313,11 +313,10 @@ cell.uuid = Utils.getuuid() cell.focus = true - MKEmitter.emit('cardAddElement', [this.props.config.uuid, col.uuid], cell) + MKEmitter.emit('cardAddElement', col.uuid, cell) } addElement = (col) => { - const { config } = this.props let column = fromJS(col).toJS() if (column.type === 'colspan') { @@ -333,7 +332,7 @@ let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + MKEmitter.emit('cardAddElement', column.uuid, newcard) } else if (column.type === 'action') { let newcard = { uuid: Utils.getuuid(), @@ -349,7 +348,7 @@ } // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + MKEmitter.emit('cardAddElement', column.uuid, newcard) } } diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index 06fefad..c830e47 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -25,13 +25,13 @@ let options = [{ value: 'text', - text: Formdict['model.form.text'] + text: '鏂囨湰' }, { value: 'number', - text: Formdict['model.form.number'] + text: '鏁板瓧' }, { value: 'textarea', - text: Formdict['model.form.textarea'] + text: '澶氳鏂囨湰' }, { value: 'custom', text: '鑷畾涔夊垪' diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index 50c3486..a13f19a 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -53,7 +53,7 @@ } render() { - const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props + const { connectDragSource, connectDropTarget, moveCol, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props if (!column) return ( <th {...restProps} index={index}> @@ -93,10 +93,14 @@ const ColTarget = { drop(props, monitor) { - const dragIndex = monitor.getItem().index + const item = monitor.getItem() + const dragIndex = item.index const hoverIndex = props.index - if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { + if (item.$init) { + props.dropCol(item, hoverIndex) + return + } else if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { return } @@ -259,6 +263,25 @@ }) } + dropCol = (item, hoverIndex) => { + let _columns = fromJS(this.state.columns).toJS() + let type = item.subType + + if (item.subType === 'link' || item.subType === 'colspan' || item.subType === 'picture') { + type = 'text' + } + + let col = { focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: type, elements: [] } + + _columns.splice(hoverIndex, 0, col) + + this.setState({ + columns: _columns + }, () => { + this.editColumn(col) + }) + } + updateCol = (col, btn) => { let _columns = fromJS(this.state.columns).toJS() _columns = _columns.map(column => { @@ -293,18 +316,17 @@ cell.uuid = Utils.getuuid() cell.focus = true - MKEmitter.emit('cardAddElement', [this.props.config.uuid, col.uuid], cell) + MKEmitter.emit('cardAddElement', col.uuid, cell) } addElement = (col) => { - const { config } = this.props let column = fromJS(col).toJS() if (column.type === 'custom') { let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + MKEmitter.emit('cardAddElement', column.uuid, newcard) } else if (column.type === 'action') { let newcard = { uuid: Utils.getuuid(), @@ -320,7 +342,7 @@ } // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + MKEmitter.emit('cardAddElement', column.uuid, newcard) } } @@ -563,6 +585,7 @@ fields: fields, align: col.Align, moveCol: this.moveCol, + dropCol: this.dropCol, updateCol: this.updateCol, addElement: this.addElement, editColumn: this.editColumn, diff --git a/src/menu/components/table/edit-table/columns/index.scss b/src/menu/components/table/edit-table/columns/index.scss index 6ca33c7..3426cb2 100644 --- a/src/menu/components/table/edit-table/columns/index.scss +++ b/src/menu/components/table/edit-table/columns/index.scss @@ -75,6 +75,12 @@ } } + .model-menu-card-cell-list { + .card-detail-row { + min-height: 21px; + } + } + .ant-table-thead { th { position: relative; diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx index 26803be..f1c9345 100644 --- a/src/menu/components/table/edit-table/index.jsx +++ b/src/menu/components/table/edit-table/index.jsx @@ -423,7 +423,7 @@ <ToolOutlined /> </Popover> <SearchComponent config={card} updatesearch={this.updateComponent}/> - <ActionComponent type="editable" config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> + <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> <ColumnComponent config={card} updatecolumn={this.updateComponent}/> <div className="component-name"> <div className="center"> diff --git a/src/menu/components/table/edit-table/index.scss b/src/menu/components/table/edit-table/index.scss index 0991fb4..227900c 100644 --- a/src/menu/components/table/edit-table/index.scss +++ b/src/menu/components/table/edit-table/index.scss @@ -39,7 +39,15 @@ bottom: 0; } >.ant-row { - display: none; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + min-height: 10px; + .common-drawarea-placeholder { + display: none; + } } >.ant-switch { display: none; diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index 937165d..1c53e2e 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -40,19 +40,19 @@ let options = [{ value: 'text', - text: Formdict['model.form.text'] + text: '鏂囨湰' }, { value: 'number', - text: Formdict['model.form.number'] + text: '鏁板瓧' }, { value: 'picture', - text: Formdict['model.form.picture'] + text: '鍥剧墖' }, { value: 'link', - text: Formdict['model.form.href'] + text: '閾炬帴' }, { value: 'textarea', - text: Formdict['model.form.textarea'] + text: '澶氳鏂囨湰' }, { value: 'custom', text: '鑷畾涔夊垪' diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index 4240b49..aa68104 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -53,7 +53,7 @@ } render() { - const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props + const { connectDragSource, connectDropTarget, moveCol, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props if (index !== undefined) { return connectDragSource( @@ -109,10 +109,14 @@ const ColTarget = { drop(props, monitor) { - const dragIndex = monitor.getItem().index + const item = monitor.getItem() + const dragIndex = item.index const hoverIndex = props.index - if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { + if (item.$init) { + props.dropCol(item, hoverIndex) + return + } else if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { return } @@ -274,6 +278,20 @@ }) } + dropCol = (item, hoverIndex) => { + let _columns = fromJS(this.state.columns).toJS() + + let col = { focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: item.subType, elements: [] } + + _columns.splice(hoverIndex, 0, col) + + this.setState({ + columns: _columns + }, () => { + this.editColumn(col) + }) + } + loopCol = (columns, col) => { return columns.map(column => { if (column.type === 'colspan') { @@ -315,11 +333,10 @@ cell.uuid = Utils.getuuid() cell.focus = true - MKEmitter.emit('cardAddElement', [this.props.config.uuid, col.uuid], cell) + MKEmitter.emit('cardAddElement', col.uuid, cell) } addElement = (col) => { - const { config } = this.props let column = fromJS(col).toJS() if (column.type === 'colspan') { @@ -335,7 +352,7 @@ let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + MKEmitter.emit('cardAddElement', column.uuid, newcard) } else if (column.type === 'action') { let newcard = { uuid: Utils.getuuid(), @@ -351,7 +368,7 @@ } // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + MKEmitter.emit('cardAddElement', column.uuid, newcard) } } @@ -492,6 +509,7 @@ fields: fields, align: col.Align, moveCol: this.moveCol, + dropCol: this.dropCol, updateCol: this.updateCol, addElement: this.addElement, editColumn: this.editColumn, diff --git a/src/menu/components/table/normal-table/columns/index.scss b/src/menu/components/table/normal-table/columns/index.scss index db07412..9e88629 100644 --- a/src/menu/components/table/normal-table/columns/index.scss +++ b/src/menu/components/table/normal-table/columns/index.scss @@ -65,6 +65,11 @@ background: #ffffff!important; } } + .model-menu-card-cell-list { + .card-detail-row { + min-height: 21px; + } + } .ant-table-thead { th { diff --git a/src/menu/components/table/normal-table/index.scss b/src/menu/components/table/normal-table/index.scss index b558c2a..7db4e8e 100644 --- a/src/menu/components/table/normal-table/index.scss +++ b/src/menu/components/table/normal-table/index.scss @@ -39,7 +39,15 @@ bottom: 0; } >.ant-row { - display: none; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + min-height: 10px; + .common-drawarea-placeholder { + display: none; + } } >.ant-switch { display: none; diff --git a/src/menu/modulecell/dragsource/index.jsx b/src/menu/modulecell/dragsource/index.jsx new file mode 100644 index 0000000..11b7e42 --- /dev/null +++ b/src/menu/modulecell/dragsource/index.jsx @@ -0,0 +1,14 @@ +import React from 'react' +import { useDrag } from 'react-dnd' +// import './index.scss' + +const SourceCell = ({item}) => { + const [, drag] = useDrag({ item }) + + return ( + <div className="element-source-item"> + <div ref={drag} className="property"><span>{item.text}</span></div> + </div> + ) +} +export default SourceCell \ No newline at end of file diff --git a/src/menu/modulecell/dragsource/index.scss b/src/menu/modulecell/dragsource/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/menu/modulecell/dragsource/index.scss diff --git a/src/menu/modulecell/index.jsx b/src/menu/modulecell/index.jsx new file mode 100644 index 0000000..135b1e9 --- /dev/null +++ b/src/menu/modulecell/index.jsx @@ -0,0 +1,152 @@ +import React, {Component} from 'react' +import { is, fromJS } from 'immutable' + +import SourceWrap from './dragsource' +import './index.scss' + +class ElementSource extends Component { + state = { + options: [ + { + title: '鍗$墖鍏冪礌', + span: 8, + children: [ + { value: 'text', text: '鏂囨湰', type: 'action', class: 'element', $init: true}, + { value: 'number', text: '鏁板��', type: 'action', class: 'element', $init: true}, + { value: 'picture', text: '鍥剧墖', type: 'action', class: 'element', $init: true}, + { value: 'video', text: '瑙嗛', type: 'action', class: 'element', $init: true}, + { value: 'icon', text: '鍥炬爣', type: 'action', class: 'element', $init: true}, + { value: 'slider', text: '杩涘害鏉�', type: 'action', class: 'element', $init: true}, + { value: 'splitline', text: '鍒嗗壊绾�', type: 'action', class: 'element', $init: true}, + { value: 'barcode', text: '鏉″舰鐮�', type: 'action', class: 'element', $init: true}, + { value: 'qrcode', text: '浜岀淮鐮�', type: 'action', class: 'element', $init: true}, + { value: 'currentDate', text: '褰撳墠鏃堕棿', type: 'action', class: 'element', $init: true}, + { value: 'formula', text: '鍏紡', type: 'action', class: 'element', $init: true}, + { value: 'sequence', text: '搴忓彿', type: 'action', class: 'element', $init: true } + ] + }, + { + title: '鎸夐挳鍏冪礌', + span: 12, + children: [ + { value: 'pop', text: '寮圭獥(琛ㄥ崟)', type: 'action', class: 'button', $init: true }, + { value: 'prompt', text: '鎻愮ず妗�', type: 'action', class: 'button', $init: true }, + { value: 'exec', text: '鐩存帴鎵ц', type: 'action', class: 'button', $init: true }, + { value: 'excelIn', text: '瀵煎叆Excel', type: 'action', class: 'button', $init: true }, + { value: 'excelOut', text: '瀵煎嚭Excel', type: 'action', class: 'button', $init: true }, + { value: 'popview', text: '寮圭獥(鏍囩)', type: 'action', class: 'button', $init: true }, + { value: 'tab', text: '鏍囩椤�', type: 'action', class: 'button', $init: true }, + { value: 'innerpage', text: '鏂伴〉闈�', type: 'action', class: 'button', $init: true }, + { value: 'funcbutton', text: '鍔熻兘鎸夐挳', type: 'action', class: 'button', $init: true }, + { value: 'form', text: '琛ㄥ崟(寮�鍏�)', type: 'action', class: 'button', $init: true } + ] + }, + { + title: '琛ㄥ崟鍏冪礌', + span: 12, + children: [ + { subType: 'text', text: '鏂囨湰', type: 'form' }, + { subType: 'number', text: '鏁板瓧', type: 'form' }, + { subType: 'select', text: '涓嬫媺閫夋嫨', type: 'form' }, + { subType: 'textarea', text: '澶氳鏂囨湰', type: 'form' }, + { subType: 'multiselect', text: '涓嬫媺澶氶��', type: 'form' }, + { subType: 'link', text: '鑱斿姩鑿滃崟', type: 'form' }, + { subType: 'switch', text: '寮�鍏�', type: 'form' }, + { subType: 'checkbox', text: '澶氶�夋', type: 'form' }, + { subType: 'radio', text: '鍗曢�夋', type: 'form' }, + { subType: 'checkcard', text: '閫夐」鍗�', type: 'form' }, + { subType: 'fileupload', text: '鏂囦欢涓婁紶', type: 'form' }, + { subType: 'date', text: '鏃ユ湡锛堝ぉ锛�', type: 'form' }, + { subType: 'datemonth', text: '鏃ユ湡锛堟湀锛�', type: 'form' }, + { subType: 'cascader', text: '绾ц仈鑿滃崟', type: 'form' }, + { subType: 'rate', text: '璇勫垎', type: 'form' }, + { subType: 'color', text: '棰滆壊', type: 'form' }, + { subType: 'brafteditor', text: '瀵屾枃鏈�', type: 'form' }, + { subType: 'funcvar', text: '鍑芥暟鍙橀噺', type: 'form' }, + { subType: 'hint', text: '鎻愮ず', type: 'form' }, + { subType: 'split', text: '鍒嗛殧绾�', type: 'form' }, + { subType: 'linkMain', text: '鍏宠仈涓昏〃', type: 'form' }, + { subType: 'formula', text: '鍏紡', type: 'form' } + ] + }, + { + title: '鎼滅储鍏冪礌', + span: 12, + children: [ + { subType: 'text', text: '鏂囨湰', type: 'search' }, + { subType: 'select', text: '涓嬫媺閫夋嫨', type: 'search' }, + { subType: 'multiselect', text: '涓嬫媺澶氶��', type: 'search' }, + { subType: 'link', text: '鑱斿姩鑿滃崟', type: 'search' }, + { subType: 'checkcard', text: '閫夐」鍗�', type: 'search' }, + { subType: 'date', text: '鏃ユ湡锛堝ぉ锛�', type: 'search' }, + { subType: 'dateweek', text: '鏃ユ湡锛堝懆锛�', type: 'search' }, + { subType: 'datemonth', text: '鏃ユ湡锛堟湀锛�', type: 'search' }, + { subType: 'daterange', text: '鏃ユ湡锛堝尯闂达級', type: 'search' }, + { subType: 'group', text: '鏃ユ湡锛堢粍鍚堬級', type: 'search' } + ] + }, + { + title: '鏄剧ず鍒楀厓绱�', + span: 12, + children: [ + { subType: 'text', text: '鏂囨湰', type: 'col', $init: true }, + { subType: 'number', text: '鏁板瓧', type: 'col', $init: true }, + { subType: 'picture', text: '鍥剧墖', type: 'col', $init: true }, + { subType: 'link', text: '閾炬帴', type: 'col', $init: true }, + { subType: 'textarea', text: '澶氳鏂囨湰', type: 'col', $init: true }, + { subType: 'custom', text: '鑷畾涔夊垪', type: 'col', $init: true }, + { subType: 'colspan', text: '鍚堝苟鍒�', type: 'col', $init: true }, + { subType: 'formula', text: '鍏紡', type: 'col', $init: true }, + { subType: 'index', text: '搴忓彿', type: 'col', $init: true }, + { subType: 'action', text: '鎿嶄綔', type: 'col', $init: true } + ] + } + ] + } + + UNSAFE_componentWillMount() { + let appType = sessionStorage.getItem('appType') + let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview + let options = fromJS(this.state.options).toJS() + + if (appType === 'mob') { + options[1].children = options[1].children.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value)) + options[2].children = options[2].children.filter(item => { + if (item.subType === 'select') { + item.text = '閫夋嫨鍣�' + } + + return item.subType !== 'brafteditor' && item.subType !== 'multiselect' + }) + options = options.filter(option => option.title !== '鎼滅储鍏冪礌') + } else if (appType === 'pc') { + options[1].children = options[1].children.filter(item => item.value !== 'tab') + } + + if (viewType === 'popview') { // 寮圭獥鏍囩 + options[1].children = options[1].children.filter(item => item.value !== 'popview' && item.value !== 'funcbutton') + } + + this.setState({options}) + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + render() { + const { options } = this.state + + return ( + <div className="mk-source-box"> + <div className="tip">娉細褰撴嫋鍔ㄧ被鍨嬩笉鍙楁敮鎸佹椂浼氳閲嶇疆銆�</div> + {options.map((item, index) => (<div className="mk-class" span={item.span} key={index}> + <div className="title">{item.title}</div> + {item.children.map(cell => <SourceWrap key={cell.value || cell.subType} item={cell}/>)} + </div>))} + </div> + ) + } +} + +export default ElementSource \ No newline at end of file diff --git a/src/menu/modulecell/index.scss b/src/menu/modulecell/index.scss new file mode 100644 index 0000000..bd9e40b --- /dev/null +++ b/src/menu/modulecell/index.scss @@ -0,0 +1,42 @@ +.mk-source-box { + .tip { + height: 10px; + font-size: 12px; + color: rgba(0, 0, 0, 0.45); + } + .mk-class { + margin-left: -5px; + margin-right: -5px; + padding-top: 10px; + .title { + color: #1890ff; + font-size: 15px; + padding: 5px 0px; + border-bottom: 1px solid #e9e9e9; + margin-bottom: 10px; + } + .element-source-item { + display: inline-block; + + .property { + padding: 3px; + margin: 5px; + border: 1px solid #d9d9d9; + border-radius: 5px; + text-align: center; + cursor: move; + white-space: nowrap; + } + } + } + .mk-class[span="8"] { + .element-source-item { + width: 33.33%; + } + } + .mk-class[span="12"] { + .element-source-item { + width: 50%; + } + } +} \ No newline at end of file diff --git a/src/menu/stylecombcontrolbutton/index.jsx b/src/menu/stylecombcontrolbutton/index.jsx index 3beaaf4..6041a8d 100644 --- a/src/menu/stylecombcontrolbutton/index.jsx +++ b/src/menu/stylecombcontrolbutton/index.jsx @@ -58,10 +58,7 @@ if (!parent) { let _parent = null - if (_type === 'propcard') { - _parent = _p - MKEmitter.emit('changeCombineStyle', ['margin', 'padding', 'border', 'background', 'shadow']) - } else if (_type === 'cardcell') { + if (_type === 'cardcell') { _parent = _p MKEmitter.emit('changeCombineStyle', ['margin', 'padding', 'border', 'background', 'font']) } else { @@ -105,10 +102,7 @@ if (components.findIndex(cell => cell.uuid === card.uuid) > -1) { components = components.filter(cell => cell.uuid !== card.uuid) document.getElementById(card.uuid).classList.remove('selected-control-element') - } else if (type !== 'propcard' && parent.components.findIndex(cell => cell.uuid === card.uuid) > -1) { - components.push(card) - document.getElementById(card.uuid).classList.add('selected-control-element') - } else if (type === 'propcard' && parent.subcards.findIndex(cell => cell.uuid === card.uuid) > -1) { + } else if (type === 'cardcell' && parent.elements.findIndex(cell => cell.uuid === card.uuid) > -1) { components.push(card) document.getElementById(card.uuid).classList.add('selected-control-element') } diff --git a/src/menu/stylecontroller/index.jsx b/src/menu/stylecontroller/index.jsx index 8d96cee..02ffba0 100644 --- a/src/menu/stylecontroller/index.jsx +++ b/src/menu/stylecontroller/index.jsx @@ -298,7 +298,7 @@ * @description 淇敼鑳屾櫙浣嶇疆 */ changeBackgroundPositon= (val) => { - this.updateStyle({backgroundPositon: val}) + this.updateStyle({backgroundPosition: val}) } /** @@ -659,7 +659,7 @@ label="浣嶇疆" labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } > - <Select defaultValue={card.backgroundPositon || 'center'} onChange={this.changeBackgroundPositon}> + <Select defaultValue={card.backgroundPosition || 'center'} onChange={this.changeBackgroundPositon}> <Option value="center">center</Option> <Option value="top">top</Option> <Option value="bottom">bottom</Option> diff --git a/src/mob/components/formdragelement/index.jsx b/src/mob/components/formdragelement/index.jsx index 2494505..4ab72c5 100644 --- a/src/mob/components/formdragelement/index.jsx +++ b/src/mob/components/formdragelement/index.jsx @@ -99,6 +99,7 @@ newcard.options = [] newcard.readonly = 'false' newcard.required = 'true' + newcard.span = 24 newcard.focus = true let targetId = '' diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 5f7c2a3..34153e6 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -243,7 +243,7 @@ contents.push( <Col key={card.uuid} span={card.width}> <div style={card.style}> - <div className="ant-mk-text"><span className="sequence-wrap" style={_style}>{data.$Index || ''}</span></div> + <div className="ant-mk-text line1" style={{height: card.innerHeight || 'auto'}}><span className="sequence-wrap" style={_style}>{data.$Index || ''}</span></div> </div> </Col> ) @@ -454,6 +454,21 @@ ) } else if (card.eleType === 'icon') { let val = '' + let height = card.innerHeight + + if (!height) { // 鍏煎 + let fontSize = 14 + let lineHeight = 1.5 + + if (card.style.fontSize) { + fontSize = parseInt(card.style.fontSize) + } + if (card.style.lineHeight) { + lineHeight = parseFloat(card.style.lineHeight) + } + + height = fontSize * lineHeight + } if (card.datatype === 'static') { val = card.tooltip @@ -465,8 +480,8 @@ <Col key={card.uuid} span={card.width}> <div style={card.style}> {val ? <Tooltip title={val}> - <MkIcon className="ant-mk-icon" style={{height: card.innerHeight || 'auto'}} type={card.icon}/> - </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight || 'auto'}} type={card.icon}/>} + <MkIcon className="ant-mk-icon" style={{height: height}} type={card.icon}/> + </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: height}} type={card.icon}/>} </div> </Col> ) @@ -660,8 +675,8 @@ contents.push( <Col key={card.uuid} span={card.width}> - <div className="ant-mk-date" style={card.style}> - {val} + <div style={card.style}> + <div className="ant-mk-text line1" style={{height: card.innerHeight || 'auto'}}>{val}</div> </div> </Col> ) diff --git a/src/tabviews/custom/components/card/cardcellList/index.scss b/src/tabviews/custom/components/card/cardcellList/index.scss index b584f3d..eb77a1e 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.scss +++ b/src/tabviews/custom/components/card/cardcellList/index.scss @@ -23,12 +23,13 @@ text-decoration: inherit; .sequence-wrap { display: inline-block; - width: 22px; - height: 22px; - line-height: 22px; + width: 21px; + height: 21px; + line-height: 21px; white-space: nowrap; border-radius: 50%; overflow: visible; + text-align: center; } span { text-indent: 0px; @@ -133,12 +134,6 @@ border-bottom: 0; border-left: 0; border-right: 0; - } - .ant-mk-date { - white-space: nowrap; - overflow: hidden; - word-break: break-word; - text-overflow: ellipsis; } .ant-mk-check { white-space: nowrap; diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index abe3ac2..ceea329 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -86,7 +86,9 @@ let shortcuts = [] try { // 閰嶇疆淇℃伅瑙f瀽 - config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + config = window.decodeURIComponent(window.atob(result.LongParam)) + config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl) + config = JSON.parse(config) } catch (e) { console.warn('Parse Failure') config = '' @@ -608,18 +610,6 @@ cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 } } - } else if (cell.eleType === 'icon') { - let fontSize = 14 - let lineHeight = 1.5 - - if (cell.style.fontSize) { - fontSize = parseInt(cell.style.fontSize) - } - if (cell.style.lineHeight) { - lineHeight = parseFloat(cell.style.lineHeight) - } - - cell.innerHeight = fontSize * lineHeight } return cell }) @@ -728,18 +718,6 @@ cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 } } - } else if (cell.eleType === 'icon') { - let fontSize = 14 - let lineHeight = 1.5 - - if (cell.style.fontSize) { - fontSize = parseInt(cell.style.fontSize) - } - if (cell.style.lineHeight) { - lineHeight = parseFloat(cell.style.lineHeight) - } - - cell.innerHeight = fontSize * lineHeight } return cell.eleType !== 'button' || skip || permAction[cell.uuid] @@ -778,20 +756,8 @@ cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 } } - } else if (cell.eleType === 'icon') { - let fontSize = 14 - let lineHeight = 1.5 - - if (cell.style.fontSize) { - fontSize = parseInt(cell.style.fontSize) - } - if (cell.style.lineHeight) { - lineHeight = parseFloat(cell.style.lineHeight) - } - - cell.innerHeight = fontSize * lineHeight } - + return cell.eleType !== 'button' || skip || permAction[cell.uuid] }) }) @@ -832,18 +798,6 @@ cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 } } - } else if (cell.eleType === 'icon') { - let fontSize = 14 - let lineHeight = 1.5 - - if (cell.style.fontSize) { - fontSize = parseInt(cell.style.fontSize) - } - if (cell.style.lineHeight) { - lineHeight = parseFloat(cell.style.lineHeight) - } - - cell.innerHeight = fontSize * lineHeight } return cell.eleType !== 'button' || skip || permAction[cell.uuid] @@ -884,18 +838,6 @@ cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 } } - } else if (cell.eleType === 'icon') { - let fontSize = 14 - let lineHeight = 1.5 - - if (cell.style.fontSize) { - fontSize = parseInt(cell.style.fontSize) - } - if (cell.style.lineHeight) { - lineHeight = parseFloat(cell.style.lineHeight) - } - - cell.innerHeight = fontSize * lineHeight } return cell.eleType !== 'button' || skip || permAction[cell.uuid] }) diff --git a/src/tabviews/zshare/fileupload-pice/index.jsx b/src/tabviews/zshare/fileupload-pice/index.jsx index 5148154..fc6b969 100644 --- a/src/tabviews/zshare/fileupload-pice/index.jsx +++ b/src/tabviews/zshare/fileupload-pice/index.jsx @@ -8,13 +8,6 @@ import Api from '@/api' import './index.scss' -let service = '' -if (process.env.NODE_ENV === 'production') { - service = document.location.origin + '/' + window.GLOB.service -} else { - service = window.GLOB.location + '/' + window.GLOB.service -} - class FileUpload extends Component { static propTpyes = { config: PropTypes.object, // 琛ㄥ崟淇℃伅 @@ -184,7 +177,7 @@ form.append('file', param.binary) form.append('fileMd5', params.file.fileMd5) form.append('shardingMd5', param.chunkMd5) - form.append('baseDomain', service) + form.append('baseDomain', window.GLOB.baseurl) form.append('rootPath', 'Content/images/upload/') form.append('fileName', params.file.fileName) form.append('fileExt', params.file.fileType) @@ -315,7 +308,7 @@ Api.fileuploadbase64(param).then(result => { if (result.status && result.Images) { - let url = service + result.Images + let url = window.GLOB.baseurl + result.Images if (rduri) { url = rduri.replace(/webapi(.*)$/, '') + result.Images diff --git a/src/tabviews/zshare/fileupload/index.jsx b/src/tabviews/zshare/fileupload/index.jsx index 20d0e56..54d9727 100644 --- a/src/tabviews/zshare/fileupload/index.jsx +++ b/src/tabviews/zshare/fileupload/index.jsx @@ -8,13 +8,6 @@ import Api from '@/api' import './index.scss' -let service = '' -if (process.env.NODE_ENV === 'production') { - service = document.location.origin + '/' + window.GLOB.service -} else { - service = window.GLOB.location + '/' + window.GLOB.service -} - class FileUpload extends Component { static propTpyes = { config: PropTypes.object, // 琛ㄥ崟淇℃伅 @@ -182,7 +175,7 @@ form.append('file', param.binary) form.append('fileMd5', param.fileMd5) form.append('shardingMd5', param.fileMd5) - form.append('baseDomain', service) + form.append('baseDomain', window.GLOB.baseurl) form.append('rootPath', 'Content/images/upload/') form.append('fileName', param.fileName) form.append('fileExt', param.fileType) @@ -306,7 +299,7 @@ Api.fileuploadbase64(param).then(result => { if (result.status && result.Images) { - let url = service + result.Images + let url = window.GLOB.baseurl + result.Images if (rduri) { url = rduri.replace(/webapi(.*)$/, '') + result.Images diff --git a/src/templates/modalconfig/dragelement/index.jsx b/src/templates/modalconfig/dragelement/index.jsx index 4db46b0..996ca14 100644 --- a/src/templates/modalconfig/dragelement/index.jsx +++ b/src/templates/modalconfig/dragelement/index.jsx @@ -114,7 +114,13 @@ targetId = cards[cards.length - 1].uuid } - const { index: overIndex } = findCard(`${targetId}`) // cards涓虹┖鏃� overIndex 涓� -1 + const { index: overIndex, card } = findCard(`${targetId}`) // cards涓虹┖鏃� overIndex 涓� -1 + + if (card) { + newcard.span = card.span || 12 + newcard.labelwidth = card.labelwidth || 33.3 + } + const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) setCards(_cards) diff --git a/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx b/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx index f144c82..9f92dd0 100644 --- a/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx @@ -123,7 +123,13 @@ targetId = cards[cards.length - 1].uuid } - const { index: overIndex } = findCard(`${targetId}`) + const { index: overIndex, card } = findCard(`${targetId}`) + + if (card) { + newcard.ratio = card.ratio || 6 + newcard.labelwidth = card.labelwidth || 33.3 + } + const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) handleList(_cards, newcard) diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index ef844cd..6ec8e3d 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -333,16 +333,16 @@ } else { typeOptions = [{ value: 'text', - text: Formdict['model.form.text'] + text: '鏂囨湰' }, { value: 'select', - text: Formdict['model.form.select'] + text: '涓嬫媺閫夋嫨' }, { value: 'multiselect', - text: Formdict['model.form.multiselect'] + text: '涓嬫媺澶氶��' }, { value: 'link', - text: Formdict['model.form.link'] + text: '鑱斿姩鑿滃崟' }, { value: 'checkcard', text: '閫夐」鍗�' @@ -354,13 +354,13 @@ text: '鏃ユ湡锛堝懆锛�' }, { value: 'datemonth', - text: Formdict['model.form.datemonth'] + text: '鏃ユ湡锛堟湀锛�' }, { value: 'daterange', - text: Formdict['model.form.daterange'] + text: '鏃ユ湡锛堝尯闂达級' }, { value: 'group', - text: Formdict['model.form.dategroup'] + text: '鏃ユ湡锛堢粍鍚堬級' }] } @@ -2423,22 +2423,22 @@ let _openType = [{ value: 'text', - text: Formdict['model.form.text'] + text: '鏂囨湰' }, { value: 'number', - text: Formdict['model.form.number'] + text: '鏁板瓧' }, { value: 'select', - text: Formdict['model.form.select'] + text: '涓嬫媺閫夋嫨' }, { value: 'textarea', text: '澶氳鏂囨湰' }, { value: 'multiselect', - text: Formdict['model.form.multiselect'] + text: '涓嬫媺澶氶��' }, { value: 'link', - text: Formdict['model.form.link'] + text: '鑱斿姩鑿滃崟' }, { value: 'switch', text: '寮�鍏�' @@ -2459,7 +2459,7 @@ text: '鏃ユ湡锛堝ぉ锛�' }, { value: 'datemonth', - text: Formdict['model.form.datemonth'] + text: '鏃ユ湡锛堟湀锛�' // }, { // value: 'datetime', // text: '鏃ユ湡锛堝垎/绉掞級' @@ -2471,13 +2471,13 @@ text: '璇勫垎' }, { value: 'color', - text: Formdict['model.form.color'] + text: '棰滆壊' }, { value: 'brafteditor', text: '瀵屾枃鏈�' }, { value: 'funcvar', - text: Formdict['header.form.funcvar'] + text: '鍑芥暟鍙橀噺' }, { value: 'hint', text: '鎻愮ず' @@ -2497,16 +2497,19 @@ if (appType === 'mob') { _openType = [{ value: 'text', - text: Formdict['model.form.text'] + text: '鏂囨湰' }, { value: 'number', - text: Formdict['model.form.number'] + text: '鏁板瓧' }, { value: 'select', text: '閫夋嫨鍣�' }, { value: 'link', - text: Formdict['model.form.link'] + text: '鑱斿姩鑿滃崟' + }, { + value: 'textarea', + text: '澶氳鏂囨湰' }, { value: 'switch', text: '寮�鍏�' @@ -2527,13 +2530,7 @@ text: '鏃ユ湡锛堝ぉ锛�' }, { value: 'datemonth', - text: Formdict['model.form.datemonth'] - // }, { - // value: 'datetime', - // text: '鏃ユ湡锛堝垎/绉掞級' - }, { - value: 'textarea', - text: Formdict['model.form.textarea'] + text: '鏃ユ湡锛堟湀锛�' }, { value: 'cascader', text: '绾ц仈鑿滃崟' @@ -2542,7 +2539,7 @@ text: '璇勫垎' }, { value: 'funcvar', - text: Formdict['header.form.funcvar'] + text: '鍑芥暟鍙橀噺' }, { value: 'hint', text: '鎻愮ず' diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 630ecc0..eca6187 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -954,9 +954,11 @@ */ export function resetStyle (style) { if (!style) return {} - if (sessionStorage.getItem('appType') === 'mob') { - let _style = JSON.stringify(style) + let _style = JSON.stringify(style) + _style = _style.replace(/@mywebsite@\//ig, window.GLOB.baseurl) + + if (sessionStorage.getItem('appType') === 'mob') { // scaleview _style = _style.replace(/\d+vw/ig, (word) => { return parseFloat(word) * (window.GLOB.winWidth || 420) / 100 + 'px' @@ -965,8 +967,7 @@ return parseFloat(word) * (window.GLOB.winHeight || 738) / 100 + 'px' // return parseFloat(word) * 615 / 100 + 'px' }) - - return JSON.parse(_style) } - return JSON.parse(JSON.stringify(style)) + + return JSON.parse(_style) } \ No newline at end of file diff --git a/src/utils/utils.js b/src/utils/utils.js index b97fbde..82fedc6 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -730,14 +730,7 @@ static getrealurl (url) { if (!url) return '' - let baseurl = '' - if (process.env.NODE_ENV === 'production') { - baseurl = document.location.origin + '/' + window.GLOB.service - } else { - baseurl = window.GLOB.location + '/' + window.GLOB.service - } - - let realurl = url.match(/^http/) || url.match(/^\/\//) ? url : baseurl + url + let realurl = url.match(/^http/) || url.match(/^\/\//) ? url : window.GLOB.baseurl + url return realurl } @@ -753,7 +746,7 @@ if (options.cloudServiceApi) { baseurl = options.cloudServiceApi.replace(/webapi(.*)$/, '') } else { - baseurl = document.location.origin + '/' + window.GLOB.service + baseurl = window.GLOB.baseurl } return url.match(/^http/) || url.match(/^\/\//) ? url : baseurl + url diff --git a/src/views/appcheck/index.jsx b/src/views/appcheck/index.jsx index 1023652..8736e78 100644 --- a/src/views/appcheck/index.jsx +++ b/src/views/appcheck/index.jsx @@ -13,13 +13,6 @@ const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS const Header = asyncComponent(() => import('./header')) -let base_url = '' -if (process.env.NODE_ENV === 'production') { - base_url = document.location.origin + '/' + window.GLOB.service -} else { - base_url = window.GLOB.location + '/' + window.GLOB.service -} - const skinStyle = { bg_black_style_blue: {name: '钃濊壊', color: '#1890ff'}, bg_black_style_red: {name: '绾㈣壊', color: '#f5222d'}, @@ -247,7 +240,7 @@ </Col> </Row> <div className="action"> - <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${base_url}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph> + <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph> </div> </div> ) diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx index a39380c..e66512e 100644 --- a/src/views/appmanage/index.jsx +++ b/src/views/appmanage/index.jsx @@ -23,13 +23,6 @@ const ScriptForm = asyncComponent(() => import('./scriptform')) const SubMutilForm = asyncComponent(() => import('./submutilform')) -let base_url = '' -if (process.env.NODE_ENV === 'production') { - base_url = document.location.origin + '/' + window.GLOB.service -} else { - base_url = window.GLOB.location + '/' + window.GLOB.service -} - sessionStorage.setItem('isEditState', 'true') const skinStyle = { @@ -1188,7 +1181,7 @@ <Button type="link" onClick={() => this.setState({ selectSubApp: item, subVisible: 'edit' })} style={{color: '#8E44AD'}}>淇敼</Button> <Button type="link" onClick={() => this.deleteSubApp(item)} style={{color: '#ff4d4f'}}>鍒犻櫎</Button> <Button type="link" onClick={() => this.jumpApp(item)}>缂栬緫搴旂敤</Button> - <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${base_url}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph> + <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph> </div> </div> ) diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 3b63525..881335d 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -155,7 +155,9 @@ let config = '' try { - config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + config = window.decodeURIComponent(window.atob(result.LongParam)) + config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl) + config = JSON.parse(config) } catch (e) { console.warn('Parse Failure') config = '' diff --git a/src/views/interface/history/index.jsx b/src/views/interface/history/index.jsx index a8d4321..5e882c2 100644 --- a/src/views/interface/history/index.jsx +++ b/src/views/interface/history/index.jsx @@ -195,18 +195,12 @@ } uselogon = () => { - let baseurl = '' - if (process.env.NODE_ENV === 'production') { - baseurl = document.location.origin + '/' + window.GLOB.service - } else { - baseurl = window.GLOB.location + '/' + window.GLOB.service - } let m = { active: 'raw', createDate: '', formData: [], headers: [], - interface: baseurl + 'webapi/logon', + interface: window.GLOB.baseurl + 'webapi/logon', method: 'POST', params: [], raw: "{\n \"UserName\":\"******\",\n \"Password\":\"******\",\n \"systemType\":\"local\",\n \"Type\":\"鍏挜\",\n \"privatekey\":\"绉侀挜\",\n \"timestamp\":\"" + moment().format('YYYY-MM-DD HH:mm:ss') + "\",\n \"appkey\":\"" + window.GLOB.appkey + "\"\n}", @@ -216,18 +210,12 @@ } usedostars = () => { - let baseurl = '' - if (process.env.NODE_ENV === 'production') { - baseurl = document.location.origin + '/' + window.GLOB.service - } else { - baseurl = window.GLOB.location + '/' + window.GLOB.service - } let m = { active: 'raw', createDate: '', formData: [], headers: [], - interface: baseurl + 'webapi/dostars', + interface: window.GLOB.baseurl + 'webapi/dostars', method: 'POST', params: [], raw: "{\n \"func\":\"******\",\n \"LoginUID\":\"******\",\n \"UserID\":\"******\",\n \"nonc\":\"" + Utils.getguid() + "\",\n \"t\":" + parseInt(new Date().getTime() / 1000) + "\n}", diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index f46edb4..063842e 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -33,6 +33,7 @@ const MenuShell = asyncComponent(() => import('@/menu/menushell')) const PrintMenuForm = asyncComponent(() => import('./printmenuform')) const SourceWrap = asyncComponent(() => import('@/menu/modulesource')) +const Modulecell = asyncComponent(() => import('@/menu/modulecell')) const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) @@ -1117,6 +1118,9 @@ <Panel header="缁勪欢" key="component"> <SourceWrap MenuType={MenuType} /> </Panel> + <Panel header="鍏冪礌" key="element"> + <Modulecell /> + </Panel> {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" key="cuscomponent"> <SourceWrap components={customComponents} MenuType={MenuType} /> </Panel> : null} diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 8f7e805..24bc3ef 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -32,6 +32,7 @@ const Versions = asyncComponent(() => import('@/menu/versions')) const ViewNodes = asyncComponent(() => import('@/menu/viewnodes')) const SourceWrap = asyncComponent(() => import('@/mob/modulesource')) +const Modulecell = asyncComponent(() => import('@/menu/modulecell')) const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) const SysInterface = asyncComponent(() => import('@/menu/sysinterface')) @@ -1954,6 +1955,9 @@ <Panel header={dict['mob.component']} className="component" key="component"> <SourceWrap /> </Panel> + <Panel header="鍏冪礌" key="element"> + <Modulecell /> + </Panel> {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" className="cuscomponent" key="cuscomponent"> <SourceWrap components={customComponents} /> </Panel> : null} diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 5210249..06198dc 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -30,6 +30,7 @@ const MenuShell = asyncComponent(() => import('@/pc/menushell')) const ViewNodes = asyncComponent(() => import('@/menu/viewnodes')) const SourceWrap = asyncComponent(() => import('@/pc/modulesource')) +const Modulecell = asyncComponent(() => import('@/menu/modulecell')) const CreateView = asyncComponent(() => import('@/pc/createview')) const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const Quotecomponent = asyncComponent(() => import('@/pc/quotecomponent')) @@ -1861,6 +1862,9 @@ <Panel header={dict['mob.component']} key="component"> <SourceWrap /> </Panel> + <Panel header="鍏冪礌" key="element"> + <Modulecell /> + </Panel> {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" key="cuscomponent"> <SourceWrap components={customComponents} /> </Panel> : null} diff --git a/src/views/popdesign/index.jsx b/src/views/popdesign/index.jsx index 9f5d0a7..d804815 100644 --- a/src/views/popdesign/index.jsx +++ b/src/views/popdesign/index.jsx @@ -24,6 +24,7 @@ const Versions = asyncComponent(() => import('@/menu/versions')) const Header = asyncComponent(() => import('@/menu/header')) const SourceWrap = asyncComponent(() => import('@/menu/modulesource')) +const Modulecell = asyncComponent(() => import('@/menu/modulecell')) const MenuShell = asyncComponent(() => import('@/menu/menushell')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) const BgController = asyncComponent(() => import('@/pc/bgcontroller')) @@ -710,6 +711,9 @@ <Panel header="缁勪欢" key="component"> <SourceWrap MenuType="" /> </Panel> + <Panel header="鍏冪礌" key="element"> + <Modulecell /> + </Panel> {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" key="cuscomponent"> <SourceWrap components={customComponents} MenuType="" /> </Panel> : null} -- Gitblit v1.8.0