From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十一月 2022 16:11:55 +0800 Subject: [PATCH] 2022-11-21 --- src/menu/components/card/cardcellcomponent/index.jsx | 73 ++++++++++++++++-------------------- 1 files changed, 32 insertions(+), 41 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 8ab612e..d2529af 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -5,7 +5,7 @@ import asyncComponent from '@/utils/asyncComponent' import { getCardCellForm } from './formconfig' -import { getActionForm } from '@/menu/components/share/actioncomponent/formconfig' +import { getActionForm, getBaseTableActionForm } from '@/menu/components/share/actioncomponent/formconfig' import MKEmitter from '@/utils/events.js' import MenuUtils from '@/utils/utils-custom.js' @@ -162,6 +162,8 @@ options = ['padding', 'margin'] } + options.push('clear') + this.setState({ card: element }) @@ -260,12 +262,10 @@ if (card.eleType === 'button') { this.handleAction(card) } else { - let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || [] - this.setState({ visible: true, card: card, - formlist: getCardCellForm(card, cards.type, cards.subtype, cardCell, anchors) + formlist: getCardCellForm(card, cards, cardCell) }) } } @@ -303,29 +303,34 @@ } } - let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid, supId) || [] - let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || [] + let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid, supId) - this.setState({ - actvisible: true, - card: card, - formlist: getActionForm(card, functip, cards, usefulFields, modules, anchors) - }) + 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) + }) + } } /** * @description 鍙栨秷淇濆瓨锛屽鏋滃厓绱犱负鏂版坊鍏冪礌锛屽垯浠庡簭鍒椾腑鍒犻櫎 */ editModalCancel = () => { - const { card, elements, appType } = this.state + const { card, elements } = this.state let _elements = null if (card.focus) { _elements = elements.filter(item => item.uuid !== card.uuid) - - if (card.OpenType === 'popview' && appType !== 'mob') { // 寮圭獥鏍囩鎸夐挳锛屼粠澶嶅埗鍒楄〃涓垹闄� - MKEmitter.emit('delButtons', [card.uuid]) - } } else { _elements = elements } @@ -408,14 +413,15 @@ */ handleActionSubmit = () => { const { elements } = this.state - let color = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#666666' } + let color = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#666666', default: 'rgba(0, 0, 0, 0.65)' } this.actionFormRef.handleConfirm().then(res => { let _elements = elements.map(cell => { if (cell.uuid === res.uuid) { res.eleType = cell.eleType || null res.style = cell.style || null - res.modal = cell.modal || null + // res.modal = cell.modal || null + // res.config = cell.config || null res.wrapStyle = cell.wrapStyle || null // res = {...cell, ...res} @@ -431,13 +437,14 @@ res.style = {} } } else if (res.class !== cell.class || res.show !== cell.show || !res.style) { + let cl = res.class.replace('border-', '') let style = {} if (res.show === 'link' || res.show === 'icon') { - style.color = color[res.class] + style.color = color[cl] style.backgroundColor = 'transparent' } else { style.color = '#ffffff' - style.backgroundColor = color[res.class] + style.backgroundColor = color[cl] } res.style = {...res.style, ...style} } @@ -460,30 +467,19 @@ * @description 鎸夐挳鍒犻櫎 */ deleteElement = (card) => { - const { cardCell, side } = this.props - const { elements, appType } = this.state + const { elements } = this.state let _this = this confirm({ content: '纭畾鍒犻櫎鍏冪礌鍚楋紵', onOk() { let _elements = elements.filter(item => item.uuid !== card.uuid) - - if (card.OpenType === 'popview' || card.verify || card.modal) { - card.$parentId = cardCell.uuid - card.$side = side || '' - } _this.setState({ elements: _elements }, () => { _this.props.updateElement(_elements) }) - - if (card.eleType !== 'button') return - if (appType === 'mob' || (appType === 'pc' && card.OpenType !== 'popview')) return - - MKEmitter.emit('delButtons', [card.uuid]) }, onCancel() {} }) @@ -497,7 +493,6 @@ profVisible: true, card: element }) - MKEmitter.emit('modalStatus', '楠岃瘉淇℃伅') } /** @@ -521,8 +516,6 @@ }, () => { this.props.updateElement(_elements) }) - - MKEmitter.emit('modalStatus', false) }) } @@ -555,18 +548,18 @@ } } - handleSave = (_cards, btn, modal) => { + handleSave = (componentId, btnId, modal) => { const { cards } = this.props const { elements } = this.state - if (cards.uuid !== _cards.uuid) return + if (cards.uuid !== componentId) return - let _index = elements.findIndex(cell => cell.uuid === btn.uuid) + let _index = elements.findIndex(cell => cell.uuid === btnId) if (_index === -1) return let _elements = elements.map(cell => { - if (cell.uuid === btn.uuid) { + if (cell.uuid === btnId) { cell.modal = modal } @@ -743,11 +736,9 @@ if (this.verifyRef.handleCancel) { this.verifyRef.handleCancel().then(() => { this.setState({ profVisible: false }) - MKEmitter.emit('modalStatus', false) }) } else { this.setState({ profVisible: false }) - MKEmitter.emit('modalStatus', false) } }} destroyOnClose -- Gitblit v1.8.0