From a8736e84e62cae98c05b1cc6ac6992e4b31e7cf2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 13 一月 2020 00:48:31 +0800 Subject: [PATCH] 2020-01-13 --- src/templates/formtabconfig/dragelement/index.jsx | 181 ++++++ src/templates/formtabconfig/dragelement/source.jsx | 13 src/templates/formtabconfig/source.jsx | 142 ++-- src/templates/formtabconfig/dragelement/card.jsx | 132 ++++ src/templates/formtabconfig/dragelement/index.scss | 15 src/templates/formtabconfig/dragelement/itemtypes.js | 8 src/templates/formtabconfig/index.jsx | 836 ++++++--------------------- src/templates/formtabconfig/index.scss | 244 +++----- src/templates/formtabconfig/actionform/index.jsx | 213 ------ 9 files changed, 715 insertions(+), 1,069 deletions(-) diff --git a/src/templates/formtabconfig/actionform/index.jsx b/src/templates/formtabconfig/actionform/index.jsx index 94154e2..f768035 100644 --- a/src/templates/formtabconfig/actionform/index.jsx +++ b/src/templates/formtabconfig/actionform/index.jsx @@ -53,100 +53,34 @@ }, { value: 'update', text: this.props.dict['header.form.action.update'] - }], - deleteOptions: [{ - value: '', - text: this.props.dict['header.form.empty'] - }, { - value: 'LogicDelete', - text: this.props.dict['header.form.action.LogicDelete'] - }, { - value: 'delete', - text: this.props.dict['header.form.action.delete'] }] } UNSAFE_componentWillMount () { - let _opentype = '' let _intertype = '' - let _position = '' - let _tabType = '' - let _linkTab = '' let _options = null this.props.formlist.forEach(form => { - if (form.key === 'OpenType') { - _opentype = form.initVal - } else if (form.key === 'intertype') { + if (form.key === 'intertype') { _intertype = form.initVal - } else if (form.key === 'position') { - _position = form.initVal - } else if (form.key === 'tabType') { - _tabType = form.initVal - } else if (form.key === 'linkTab') { - _linkTab = form.initVal } }) - let _tabs = this.props.tabs.filter(tab => tab.type === _tabType) - let initTab = _tabs.filter(tab => tab.uuid === _linkTab)[0] - - if (_opentype === 'innerpage') { // 鏂伴〉闈紙鍐呴儴锛夛紝鍙�夋ā鏉� - _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] - } else if (_opentype === 'outerpage') { // 鏂伴〉闈紙澶栭儴锛夛紝闇�瑕侀〉闈㈠湴鍧� - _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position'] - } else if (_opentype === 'blank' || _opentype === 'tab') { // 鏂版爣绛炬垨褰撳墠椤甸潰鏇挎崲 - _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position'] - } else if (_opentype === 'popview') { // 妯℃�佹鏍囩椤� - _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] - } else if (_opentype === 'excelIn' || _opentype === 'excelOut') { // 瀵煎叆瀵煎嚭 - if (_intertype === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] - } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] - } + if (_intertype === 'outer') { + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'method'] } else { - if (_intertype === 'outer') { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method'] - } else { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] - } + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] } + this.setState({ - openType: _opentype, - interType: _intertype, - position: _position, formlist: this.props.formlist.map(item => { if (item.key === 'class') { item.options = btnClasses } else if (item.key === 'icon') { item.options = btnIcons - } else if (item.key === 'Ot') { - if (_opentype === 'innerpage' || _position === 'grid') { - item.options = this.state.reqOptionSgl - } else if (['outerpage', 'blank', 'tab', 'popview'].includes(_opentype)) { - item.options = this.state.reqOptions - } else { - item.options = this.state.reqOptionsMutil - } } else if (item.key === 'sqlType') { - if (['prompt', 'exec'].includes(_opentype)) { - item.options = this.state.deleteOptions - } else { - item.options = this.state.insertUpdateOptions - } - } else if (item.key === 'linkTab') { - item.options = [ - { - value: '', - text: '鏂板缓' - }, - ..._tabs - ] - if (!initTab) { - item.initVal = '' - } + item.options = this.state.insertUpdateOptions } item.hidden = !_options.includes(item.key) return item @@ -167,144 +101,14 @@ } } - // 鎵撳紑鏂瑰紡鎴栨樉绀轰綅缃彉鍖� - openTypeChange = (key, value) => { - if (key === 'OpenType') { - let _options = null - if (value === 'innerpage') { - _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] - } else if (value === 'outerpage') { - _options = ['label', 'Ot', 'OpenType', 'url', 'icon', 'class', 'position'] - } else if (value === 'blank' || value === 'tab') { - _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position'] - } else if (value === 'popview') { - _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] - } else if (value === 'excelIn' || value === 'excelOut') { - if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] - } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] - } - } else { - if (this.state.interType === 'inner') { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] - } else { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] - } - } - this.setState({ - openType: value, - formlist: this.state.formlist.map(item => { - if (_options) { - item.hidden = !_options.includes(item.key) - if (item.key === 'intertype') { - item.initVal = this.state.interType - } - } - if (item.key === 'Ot') { - if (value === 'innerpage' || this.state.position === 'grid') { - item.options = this.state.reqOptionSgl - item.initVal = 'requiredSgl' - } else if (['outerpage', 'blank', 'tab', 'popview'].includes(value)) { - item.options = this.state.reqOptions - item.initVal = 'requiredSgl' - } else { - item.options = this.state.reqOptionsMutil - } - item.hidden = true - } else if (item.key === 'sqlType') { - if (['prompt', 'exec'].includes(value)) { - item.options = this.state.deleteOptions - } else { - item.options = this.state.insertUpdateOptions - } - item.initVal = '' - item.hidden = true - } - return item - }) - }, () => { - if (['excelIn', 'excelOut'].includes(value)) return - - this.setState({ - formlist: this.state.formlist.map(item => { - if (item.key === 'Ot') { - item.hidden = false - } else if (item.key === 'sqlType' && ['prompt', 'exec', 'pop'].includes(value)) { - item.hidden = false - } - return item - }) - }) - }) - } else if (key === 'position') { - this.setState({ - position: value, - formlist: this.state.formlist.map(item => { - if (item.key === 'Ot') { - if (this.state.openType === 'innerpage' || value === 'grid') { - item.options = this.state.reqOptionSgl - item.initVal = 'requiredSgl' - item.hidden = true - } else if (['outerpage', 'blank', 'tab', 'popview'].includes(this.state.openType)) { - item.options = this.state.reqOptions - item.initVal = 'requiredSgl' - item.hidden = true - } else { - item.options = this.state.reqOptionsMutil - } - } - return item - }) - }, () => { - this.setState({ - formlist: this.state.formlist.map(item => { - if (item.key === 'Ot') { - item.hidden = false - } - return item - }) - }) - }) - } else if (key === 'tabType') { - let _tabs = this.props.tabs.filter(tab => tab.type === value) - - this.setState({ - formlist: this.state.formlist.map(item => { - if (item.key === 'linkTab') { - item.options = [ - { - value: '', - text: '鏂板缓' - }, - ..._tabs - ] - item.initVal = '' - item.hidden = true - } - return item - }) - }, () => { - this.setState({ - formlist: this.state.formlist.map(item => { - if (item.key === 'linkTab') { - item.hidden = false - } - return item - }) - }) - }) - } - } - onChange = (e, key) => { let value = e.target.value if (key === 'intertype') { let _options = null if (value === 'inner') { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] } else { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'method'] } this.setState({ interType: value, @@ -406,7 +210,6 @@ <Select showSearch filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} - onChange={(value) => {this.openTypeChange(item.key, value)}} getPopupContainer={() => document.getElementById('winter')} > {item.options.map((option, index) => diff --git a/src/templates/formtabconfig/dragelement/card.jsx b/src/templates/formtabconfig/dragelement/card.jsx new file mode 100644 index 0000000..09159fd --- /dev/null +++ b/src/templates/formtabconfig/dragelement/card.jsx @@ -0,0 +1,132 @@ +import React from 'react' +import { useDrag, useDrop } from 'react-dnd' +import { Icon, Button, Select, DatePicker, Input } from 'antd' +import moment from 'moment' +import ItemTypes from './itemtypes' +import './index.scss' + +const { MonthPicker, WeekPicker, RangePicker } = DatePicker + +const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop }) => { + const originalIndex = findCard(id).index + const [{ isDragging }, drag] = useDrag({ + item: { type: ItemTypes[type], id, originalIndex }, + collect: monitor => ({ + isDragging: monitor.isDragging(), + }), + }) + const [, drop] = useDrop({ + accept: ItemTypes[type], + canDrop: () => true, + drop: (item) => { + if (!item.hasOwnProperty('originalIndex')) { + hasDrop(card) + } + }, + hover({ id: draggedId }) { + if (!draggedId) return + if (draggedId !== id) { + const { index: overIndex } = findCard(id) + moveCard(draggedId, overIndex) + } + }, + }) + const opacity = isDragging ? 0 : 1 + + const edit = () => { + editCard(id) + } + + const del = () => { + delCard(id) + } + + const copy = () => { + copyCard(id) + } + + const profile = () => { + profileCard(id) + } + + let _defaultValue = '' // 涓嬫媺鎼滅储銆佹椂闂磋寖鍥寸被鍨嬶紝鍒濆鍊奸渶瑕侀澶勭悊 + + if (type === 'search' && (card.type === 'multiselect' || card.type === 'select' || card.type === 'link')) { + if (card.initval) { + let _option = card.options.filter(option => option.Value === card.initval)[0] + if (_option) { + _defaultValue = _option.Text || '' + } else { + _defaultValue = '' + } + } else if (card.setAll === 'true') { + _defaultValue = '鍏ㄩ儴' + } + } else if (type === 'search' && card.type === 'daterange') { + _defaultValue = [null, null] + if (card.initval) { + try { + let _initval = JSON.parse(card.initval) + _defaultValue = [moment().subtract(_initval[0], 'days'), moment().subtract(_initval[1], 'days')] + } catch { + _defaultValue = [null, null] + } + } + } + + return ( + <div className="page-card" style={{ opacity: opacity}}> + <div ref={node => drag(drop(node))}> + {type === 'search' ? + <div className="ant-row ant-form-item"> + <div className="ant-col ant-form-item-label ant-col-xs-24 ant-col-sm-8"> + <label title={card.label}>{card.label}</label> + </div> + <div className="ant-col ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-16"> + {card.type === 'text' ? + <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> : null + } + {(card.type === 'multiselect' || card.type === 'select' || card.type === 'link') ? + <Select defaultValue={_defaultValue}></Select> : null + } + {card.type === 'date' ? + <DatePicker defaultValue={card.initval ? moment().subtract(card.initval, 'days') : null} /> : null + } + {card.type === 'dateweek' ? + <WeekPicker defaultValue={card.initval ? moment().subtract(card.initval * 7, 'days') : null} /> : null + } + {card.type === 'datemonth' ? + <MonthPicker defaultValue={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null + } + {card.type === 'daterange' ? + <RangePicker + className="data-range" + placeholder={['寮�濮嬫棩鏈�', '缁撴潫鏃ユ湡']} + renderExtraFooter={() => 'extra footer'} + defaultValue={_defaultValue} + /> : null + } + <div className="input-mask"></div> + </div> + </div> : null + } + {type === 'action' ? + <Button + className={'mk-btn mk-' + card.class} + icon={card.icon} + key={card.uuid} + > + {card.label}{card.position === 'grid' && <Icon type="table" />} + </Button> : null + } + </div> + <Icon className="edit" title="缂栬緫" type="edit" onClick={edit} /> + <Icon className="edit close" title="鍒犻櫎" type="close" onClick={del} /> + {type === 'action' ? <Icon className="edit copy" title="澶嶅埗" type="copy" onClick={copy} /> : null} + {type === 'action' && ['pop', 'prompt', 'exec'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc ? + <Icon className="edit profile" title="鏍¢獙瑙勫垯" type="profile" onClick={profile} /> : null + } + </div> + ) +} +export default Card diff --git a/src/templates/formtabconfig/dragelement/index.jsx b/src/templates/formtabconfig/dragelement/index.jsx new file mode 100644 index 0000000..530e296 --- /dev/null +++ b/src/templates/formtabconfig/dragelement/index.jsx @@ -0,0 +1,181 @@ +import React, { useState } from 'react' +import { useDrop } from 'react-dnd' +import update from 'immutability-helper' +import { Col } from 'antd' +import Utils from '@/utils/utils.js' +import Card from './card' +import ItemTypes from './itemtypes' +import './index.scss' + +const Container = ({list, type, groupId, setting, placeholder, handleList, handleMenu, deleteMenu, copyElement, profileMenu }) => { + let target = null + const [cards, setCards] = useState(list) + const moveCard = (id, atIndex) => { + const { card, index } = findCard(id) + const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] }) + setCards(_cards) + if (type === 'action') { + handleList(type, _cards) + } else { + handleList(type, _cards, null, groupId) + } + } + + const findCard = id => { + const card = cards.filter(c => `${c.uuid}` === id)[0] + return { + card, + index: cards.indexOf(card), + } + } + + const editCard = id => { + const { card } = findCard(id) + handleMenu(card) + } + + const profileCard = id => { + const { card } = findCard(id) + profileMenu(card) + } + + const delCard = id => { + const { card } = findCard(id) + deleteMenu({card: card, type: type}) + } + + const copyCard = id => { + const { card } = findCard(id) + let copycard = JSON.parse(JSON.stringify(card)) + copycard.uuid = Utils.getuuid() + copycard.origin = false + copycard.label = copycard.label + '(copy)' + + copycard.originCard = card + + copyElement(copycard) + } + + const hasDrop = (item) => { + target = item + } + + const [, drop] = useDrop({ + accept: ItemTypes[type], + drop(item) { + if (item.hasOwnProperty('originalIndex')) { + return + } + + let newcard = {} + newcard.uuid = Utils.getuuid() + newcard.focus = true + + if (item.type === 'search') { + let _match = 'like' + if (item.subType === 'select' || item.subType === 'link') { + _match = '=' + } else if (item.subType === 'date' || item.subType === 'datemonth') { + _match = '>=' + } else if (item.subType === 'dateweek' || item.subType === 'daterange') { + _match = 'between' + } + + newcard.label = 'label' + newcard.field = '' + newcard.initval = '' + newcard.type = item.subType + newcard.resourceType = '0' + newcard.options = [] + newcard.dataSource = '' + newcard.setAll = 'false' + newcard.linkField = '' + newcard.valueField = '' + newcard.valueText = '' + newcard.orderBy = '' + newcard.orderType = 'asc' + newcard.match = _match + newcard.display = 'dropdown' + } else if (item.type === 'action') { + newcard.label = 'button' + newcard.innerFunc = '' + newcard.outerFunc = '' + newcard.sql = '' + newcard.sqlType = '' + newcard.Ot = 'requiredSgl' + newcard.OpenType = item.subType + newcard.tabType = 'SubTable' + newcard.linkTab = '' + newcard.icon = '' + newcard.class = 'default' + newcard.intertype = 'inner' + newcard.interface = '' + newcard.method = 'POST' + newcard.position = 'toolbar' + newcard.execSuccess = 'grid' + newcard.execError = 'never' + newcard.popClose = 'never' + newcard.errorTime = 15 + newcard.callbackFunc = '' + newcard.pageTemplate = '' + newcard.url = '' + newcard.verify = null + } + + let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 + if (target) { + targetId = target.uuid + } + + const { index: overIndex } = findCard(`${targetId}`) + let targetIndex = overIndex + + targetIndex++ + + const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) + setCards(_cards) + handleList(type, _cards, newcard) + target = null + } + }) + + return ( + <div ref={drop} className="ant-row"> + {type === 'action' && cards.map(card => ( + <Card + key={card.uuid} + id={`${card.uuid}`} + type={type} + card={card} + moveCard={moveCard} + editCard={editCard} + delCard={delCard} + copyCard={copyCard} + profileCard={profileCard} + findCard={findCard} + hasDrop={hasDrop} + /> + ))} + {type === 'search' && cards.map(card => ( + <Col key={card.uuid} span={24 / setting.cols}> + <Card + id={`${card.uuid}`} + type={type} + card={card} + moveCard={moveCard} + editCard={editCard} + delCard={delCard} + findCard={findCard} + hasDrop={hasDrop} + /> + </Col> + ))} + {cards.length === 0 && + <div className="common-drawarea-placeholder"> + {placeholder} + </div> + } + </div> + ) +} +export default Container diff --git a/src/templates/formtabconfig/dragelement/index.scss b/src/templates/formtabconfig/dragelement/index.scss new file mode 100644 index 0000000..38776f9 --- /dev/null +++ b/src/templates/formtabconfig/dragelement/index.scss @@ -0,0 +1,15 @@ +.common-source-item { + display: block; + box-shadow: 0px 0px 2px #bcbcbc; + padding: 0.4rem 0.7rem; + background-color: white; + margin: 0px 0px 10px; + cursor: move; + border-radius: 4px; +} +.common-drawarea-placeholder { + width: 100%; + line-height: 65px; + text-align: center; + color: #bcbcbc; +} \ No newline at end of file diff --git a/src/templates/formtabconfig/dragelement/itemtypes.js b/src/templates/formtabconfig/dragelement/itemtypes.js new file mode 100644 index 0000000..9ea1f2c --- /dev/null +++ b/src/templates/formtabconfig/dragelement/itemtypes.js @@ -0,0 +1,8 @@ +export default { + CARD: 'card', + form: 'form', + search: 'search', + action: 'action', + columns: 'columns', + tab: 'tab' +} diff --git a/src/templates/formtabconfig/dragelement/source.jsx b/src/templates/formtabconfig/dragelement/source.jsx new file mode 100644 index 0000000..ab22158 --- /dev/null +++ b/src/templates/formtabconfig/dragelement/source.jsx @@ -0,0 +1,13 @@ +import React from 'react' +import { useDrag } from 'react-dnd' +import './index.scss' + +const SourceElement = ({content}) => { + const [, drag] = useDrag({ item: content }) + return ( + <div ref={drag} className="common-source-item"> + {content.label} + </div> + ) +} +export default SourceElement \ No newline at end of file diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index 365fc19..c8e43f2 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -12,10 +12,7 @@ import TabDragElement from './tabdragelement' import Api from '@/api' import SearchForm from '@/templates/tableshare/searchform' -import ColumnForm from '@/templates/tableshare/columnform' -import DragElement from '@/templates/tableshare/dragelement' -import ColspanForm from '@/templates/tableshare/colspanform' -import GridBtnForm from '@/templates/tableshare/gridbtnform' +import DragElement from './dragelement' import EditCard from '@/templates/tableshare/editcard' import VerifyCard from '@/templates/tableshare/verifycard' import MenuForm from '@/templates/tableshare/menuform' @@ -67,7 +64,6 @@ originMenu: null, // 鍘熷鑿滃崟 delActions: [], // 鍒犻櫎鎸夐挳鍒楄〃 funcLoading: false, // 瀛樺偍杩囩▼鍒涘缓涓� - showColumnName: false, // 鏄剧ず鍒楀瓧娈靛悕鎺у埗 tabviews: [], // 鎵�鏈夋爣绛鹃〉 profileVisible: false // 楠岃瘉淇℃伅妯℃�佹 } @@ -244,7 +240,7 @@ } } - handleList = (type, list, card) => { + handleList = (type, list, card, groupId) => { const { config } = this.state if (type === 'tabs') { // 鏍囩椤佃皟鏁撮『搴忔垨娣诲姞鍏冪礌 @@ -264,31 +260,23 @@ } else { this.setState({config: {...config, [card.groupId]: list}}) } - } else { - if (list.length > config[type].length) { + } else if (type === 'action') { + if (list.length > config.action.length) { list = list.filter(item => !item.origin) this.setState({ - [type + 'loading']: true, - config: {...config, [type]: list } + actionloading: true, + config: {...config, action: list } }, () => { // 鍒锋柊瀵瑰簲鐨勯厤缃俊鎭� this.setState({ - [type + 'loading']: false + actionloading: false }) - if (type === 'search') { - this.handleSearch(card) - } else if (type === 'action') { - this.handleAction(card) - } else if (type === 'columns') { - this.handleColumn(card) - } else if (type === 'tabs') { - this.handleTab(card) - } + this.handleAction(card) }) } else { - this.setState({config: {...config, [type]: list}}) + this.setState({config: {...config, action: list}}) } } } @@ -509,69 +497,12 @@ initVal: card.OpenType, required: true, options: [{ - value: 'pop', - text: this.state.dict['header.form.popform'] - }, { value: 'prompt', text: this.state.dict['header.form.prompt'] }, { value: 'exec', text: this.state.dict['header.form.exec'] - }, { - value: 'excelIn', - text: this.state.dict['header.form.excelIn'] - }, { - value: 'excelOut', - text: this.state.dict['header.form.excelOut'] - }, { - value: 'popview', - text: this.state.dict['header.form.popview'] - }, { - value: 'tab', - text: this.state.dict['header.form.tab'] - }, { - value: 'blank', - text: this.state.dict['header.form.blank'] - }, { - value: 'innerpage', - text: this.state.dict['header.form.newpage.inner'] - }, { - value: 'outerpage', - text: this.state.dict['header.form.newpage.outer'] }] - }, { - type: 'select', - key: 'tabType', - label: this.state.dict['header.form.tabType'], - initVal: card.tabType || 'SubTable', - required: true, - options: [{ - value: 'SubTable', - text: this.state.dict['header.menu.tab.subtable'] - }] - }, - { - type: 'select', - key: 'linkTab', - label: '鍏宠仈鏍囩', - initVal: card.linkTab || '', - required: false, - options: [] - }, - { - type: 'select', - key: 'pageTemplate', - label: this.state.dict['header.form.pageTemplate'], - initVal: card.pageTemplate, - required: true, - options: [] - }, - { - type: 'text', - key: 'url', - label: this.state.dict['header.form.newpage.url'], - initVal: card.url || '', - required: true }, { type: 'radio', @@ -602,12 +533,18 @@ readonly: false }, { - type: 'text', - key: 'interface', - label: this.state.dict['header.form.interface'], - initVal: card.interface, + type: 'radio', + key: 'sysInterface', + label: this.state.dict['header.form.sysInterface'], + initVal: card.sysInterface || 'false', required: true, - readonly: false + options: [{ + value: 'true', + text: this.state.dict['header.form.true'] + }, { + value: 'false', + text: this.state.dict['header.form.false'] + }] }, { type: 'text', @@ -619,33 +556,19 @@ }, { type: 'text', + key: 'interface', + label: this.state.dict['header.form.interface'], + initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : card.interface, + required: true, + readonly: card.sysInterface === 'true' + }, + { + type: 'text', key: 'callbackFunc', label: this.state.dict['header.form.callbackFunc'], initVal: card.callbackFunc, required: false, readonly: false - }, - { - type: 'select', - key: 'position', - label: this.state.dict['header.form.position'], - initVal: card.position || 'toolbar', - required: true, - options: [{ - value: 'toolbar', - text: this.state.dict['header.form.toolbar'] - }, { - value: 'grid', - text: this.state.dict['header.form.grid'] - }] - }, - { - type: 'select', - key: 'Ot', - label: this.state.dict['header.form.isRequired'], - initVal: card.Ot || 'requiredSgl', - required: true, - options: [] }, { type: 'select', @@ -733,221 +656,6 @@ } ] }) - } - - handleColumn = (card) => { - if (card.type !== 'colspan') { - this.setState({ - visible: true, - formtemp: 'columns', - modalTitle: '缂栬緫-鏄剧ず鍒�', - card: card, - formlist: [ - { - type: 'text', - key: 'label', - label: this.state.dict['header.form.name'], - initVal: card.label, - required: true - }, - { - type: 'text', - key: 'field', - label: this.state.dict['header.form.field'], - initVal: card.field, - required: true, - readonly: false - }, - { - type: 'select', - key: 'type', - label: this.state.dict['header.form.type'], - initVal: card.type, - required: true, - options: [{ - value: 'text', - text: this.state.dict['header.form.text'] - }, { - value: 'number', - text: this.state.dict['header.form.number'] - }, { - value: 'picture', - text: this.state.dict['header.form.picture'] - }, { - value: 'textarea', - text: this.state.dict['header.form.textarea'] - }] - }, - { - type: 'select', - key: 'Align', - label: this.state.dict['header.form.align'], - initVal: card.Align, - required: true, - options: [{ - value: 'left', - text: this.state.dict['header.form.alignLeft'] - }, { - value: 'right', - text: this.state.dict['header.form.alignRight'] - }, { - value: 'center', - text: this.state.dict['header.form.alignCenter'] - }] - }, - { - type: 'radio', - key: 'Hide', - label: this.state.dict['header.form.Hide'], - initVal: card.Hide, - required: true, - options: [{ - value: 'true', - text: this.state.dict['header.form.true'] - }, { - value: 'false', - text: this.state.dict['header.form.false'] - }] - }, - { - type: 'radio', - key: 'IsSort', - label: this.state.dict['header.form.IsSort'], - initVal: card.IsSort, - required: true, - options: [{ - value: 'true', - text: this.state.dict['header.form.true'] - }, { - value: 'false', - text: this.state.dict['header.form.false'] - }] - }, - { - type: 'number', - key: 'Width', - min: 1, - max: 1000, - decimal: 0, - label: this.state.dict['header.form.columnWidth'], - initVal: card.Width, - required: true - }, - { - type: 'number', - key: 'decimal', - min: 0, - max: 18, - decimal: 0, - label: this.state.dict['header.form.decimal'], - initVal: card.decimal, - required: false - }, - { - type: 'select', - key: 'format', - label: this.state.dict['header.form.format'], - initVal: card.format || '', - options: [{ - value: '', - text: this.state.dict['header.form.empty'] - }, { - value: 'thdSeparator', - text: this.state.dict['header.form.thdSeparator'] - }], - required: false - }, - { - type: 'text', - key: 'prefix', - label: this.state.dict['header.form.prefix'], - initVal: card.prefix || '', - required: false, - readonly: false - }, - { - type: 'text', - key: 'postfix', - label: this.state.dict['header.form.postfix'], - initVal: card.postfix || '', - // tooltip: '鍚庣紑鍊艰缃负"\\n",琛ㄧず鎹㈣', - tooltipClass: 'middle', - required: false, - readonly: false - }, - { - type: 'select', - key: 'match', - label: this.state.dict['header.form.match'], - initVal: card.match || '', - options: [{ - value: '', - text: this.state.dict['header.form.empty'] - }, { - value: '>', - text: '>' - }, { - value: '<', - text: '<' - }, { - value: '>=', - text: '>=' - }, { - value: '<=', - text: '<=' - }], - required: false - }, - { - type: 'text', - key: 'matchVal', - min: -Infinity, - max: Infinity, - decimal: 0, - label: this.state.dict['header.form.matchVal'], - initVal: card.matchVal || '', - required: false, - readonly: false - }, - { - type: 'select', - key: 'color', - label: this.state.dict['header.form.color'], - initVal: card.color || '', - options: [{ - value: '', - text: this.state.dict['header.form.empty'] - }, { - value: 'red', - text: '绾㈣壊锛堝唴瀹癸級' - }, { - value: 'redbg', - text: '绾㈣壊锛堣儗鏅級' - }, { - value: 'orange', - text: '姗欒壊锛堝唴瀹癸級' - }, { - value: 'orangebg', - text: '姗欒壊锛堣儗鏅級' - }, { - value: 'green', - text: '缁胯壊锛堝唴瀹癸級' - }, { - value: 'greenbg', - text: '缁胯壊锛堣儗鏅級' - }], - required: false - } - ] - }) - } else { - this.setState({ - visible: true, - formtemp: 'columns', - modalTitle: '缂栬緫-鍚堝苟鍒�', - card: card - }) - } } handleTab = (card) => { @@ -1058,14 +766,6 @@ }) } - handleGridBtn = () => { - this.setState({ - visible: true, - formtemp: 'gridbtn', - modalTitle: '缂栬緫-鎿嶄綔鍒�', - }) - } - /** * @description 鎼滅储銆佹寜閽�佹樉绀哄垪淇敼鍚庢彁浜や繚瀛� * 1銆佹悳绱㈡潯浠朵繚瀛橈紝褰撶被鍨嬩负涓嬫媺妗嗕笖瀛樺湪鏁版嵁婧愭椂锛屽皢鏌ヨ鏉′欢鎷兼帴涓簊ql锛屽苟鐢╞ase64杞爜 @@ -1077,121 +777,84 @@ const { card } = this.state let _config = JSON.parse(JSON.stringify(this.state.config)) - if (this.state.formtemp !== 'gridbtn') { - this.formRef.handleConfirm().then(res => { - let isupdate = false + this.formRef.handleConfirm().then(res => { + let isupdate = false - if (res.type === 'action' && card.originCard && res.values.OpenType === 'pop') { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: card.originCard.uuid - }).then(result => { - if (result.status && result.LongParam) { - let param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: menu.MenuID, - MenuID: res.values.uuid, - MenuNo: menu.MenuNo, - Template: 'Modal', - MenuName: res.values.label, - PageParam: JSON.stringify({Template: 'Modal'}), - LongParam: result.LongParam + if (res.type === 'action' && card.originCard && res.values.OpenType === 'pop') { + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: card.originCard.uuid + }).then(result => { + if (result.status && result.LongParam) { + let param = { + func: 'sPC_ButtonParam_AddUpt', + ParentID: menu.MenuID, + MenuID: res.values.uuid, + MenuNo: menu.MenuNo, + Template: 'Modal', + MenuName: res.values.label, + PageParam: JSON.stringify({Template: 'Modal'}), + LongParam: result.LongParam + } + Api.getSystemConfig(param).then(response => { + if (!response.status) { + notification.warning({ + top: 92, + message: response.message, + duration: 10 + }) } - Api.getSystemConfig(param).then(response => { - if (!response.status) { - notification.warning({ - top: 92, - message: response.message, - duration: 10 - }) - } - }) - } - }) - } - - if (res.type !== 'tabs') { - _config[res.type] = _config[res.type].map(item => { - if (item.uuid === res.values.uuid) { - isupdate = true - return res.values - } else { - return item - } - }) - _config[res.type] = _config[res.type].filter(item => !item.origin) - - if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃 - _config[res.type].push(res.values) + }) } - } else { // 鏍囩椤电殑娣诲姞涓庝慨鏀� - _config[res.values.groupId] = _config[res.values.groupId].map(item => { - if (item.uuid === res.values.uuid) { - isupdate = true - return res.values - } else { - return item - } - }) - _config[res.values.groupId] = _config[res.values.groupId].filter(item => !item.origin) - - if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃 - _config[res.values.groupId].push(res.values) - } - } - - - if (res.type === 'action') { - let gridbtn = _config.action.filter(act => act.position === 'grid') - let _display = false - - if (gridbtn.length > 0) { - _display = true - } - - if (_config.gridBtn) { - _config.gridBtn.display = _display + }) + } + + if (res.type !== 'tabs') { + _config[res.type] = _config[res.type].map(item => { + if (item.uuid === res.values.uuid) { + isupdate = true + return res.values } else { - _config.gridBtn = { - display: _display, - Align: 'center', - IsSort: 'false', - uuid: Utils.getuuid(), - label: this.state.dict['header.form.column.action'], - type: 'action', - style: 'button', - show: 'horizontal', - Width: 120 - } + return item } + }) + _config[res.type] = _config[res.type].filter(item => !item.origin) + + if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃 + _config[res.type].push(res.values) } + } else { // 鏍囩椤电殑娣诲姞涓庝慨鏀� + _config[res.values.groupId] = _config[res.values.groupId].map(item => { + if (item.uuid === res.values.uuid) { + isupdate = true + return res.values + } else { + return item + } + }) + _config[res.values.groupId] = _config[res.values.groupId].filter(item => !item.origin) + + if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃 + _config[res.values.groupId].push(res.values) + } + } + this.setState({ + config: _config, + searchloading: true, + actionloading: true, + columnsloading: true, + tabloading: true, + visible: false + }, () => { this.setState({ - config: _config, - searchloading: true, - actionloading: true, - columnsloading: true, - tabloading: true, - visible: false - }, () => { - this.setState({ - searchloading: false, - actionloading: false, - columnsloading: false, - tabloading: false - }) + searchloading: false, + actionloading: false, + columnsloading: false, + tabloading: false }) }) - } else { - this.formRef.handleConfirm().then(res => { - _config.gridBtn = res - - this.setState({ - config: _config, - visible: false - }) - }) - } + }) } /** @@ -1466,29 +1129,6 @@ if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃 _config.action.push(btn) - } - - let gridbtn = _config.action.filter(act => act.position === 'grid') - let _display = false - - if (gridbtn.length > 0) { - _display = true - } - - if (_config.gridBtn) { - _config.gridBtn.display = _display - } else { - _config.gridBtn = { - display: _display, - Align: 'center', - IsSort: 'false', - uuid: Utils.getuuid(), - label: this.state.dict['header.form.column.action'], - type: 'action', - style: 'button', - show: 'horizontal', - Width: 120 - } } this.setState({ @@ -1811,13 +1451,6 @@ } /** - * @description 涓夌骇鑿滃崟鍒囨崲妯℃澘 - */ - changeTemplate = () => { - this.props.handleConfig('template') - } - - /** * @description 涓夌骇鑿滃崟淇濆瓨 */ submitConfig = () => { @@ -1833,9 +1466,6 @@ } if (config.action[0] && config.action[0].origin) { config.action = config.action.filter(item => !item.origin) - } - if (config.columns[0] && config.columns[0].origin) { - config.columns = config.columns.filter(item => !item.origin) } if (config.tabs[0] && config.tabs[0].origin) { config.tabs = config.tabs.filter(item => !item.origin) @@ -2077,7 +1707,6 @@ if ( (config.search[0] && config.search[0].origin) || (config.action[0] && config.action[0].origin) || - (config.columns[0] && config.columns[0].origin) || (config.tabs[0] && config.tabs[0].origin) ) { isAdd = true @@ -2149,14 +1778,6 @@ columns.set(item.field, {...item, selected: true, datatype: _datatype}) } }) - } else if (type === 'columns') { - // 娣诲姞鏄剧ず鍒楋紝瀛楁闆嗕腑瀛樺湪鏄剧ず鍒楀瓧娈碉紝浣跨敤鏄剧ず鍒楀璞℃浛鎹㈠瓧娈甸泦锛岃缃暟鎹被鍨� - config.columns.forEach(item => { - if (columns.has(item.field)) { - let _datatype = columns.get(item.field).datatype - columns.set(item.field, {...item, selected: true, datatype: _datatype}) - } - }) } // 鏄剧ず瀛楁闆嗗脊绐� @@ -2204,106 +1825,72 @@ }) let items = [] - if (addType === 'search') { - config.search.forEach(item => { - if (columnsMap.has(item.field)) { - let cell = columnsMap.get(item.field) + config.search.forEach(item => { + if (columnsMap.has(item.field)) { + let cell = columnsMap.get(item.field) - if (cell.selected && cell.type === item.type) { // 鏁版嵁鏈慨鏀� - items.push(item) - } else if (cell.selected) { // 鏁版嵁绫诲瀷淇敼 - if (cell.type === 'text') { - item.match = textmatch[cell.datatype] - } else if (cell.type === 'select') { - item.match = selectmatch[cell.datatype] - } else if (cell.type === 'daterange') { - item.match = datematch[cell.datatype] - } else { - cell.type = 'text' - item.match = textmatch[cell.datatype] - } - - item.type = cell.type - item.initval = '' - items.push(item) - } - columnsMap.delete(item.field) - } else if (!item.origin) { + if (cell.selected && cell.type === item.type) { // 鏁版嵁鏈慨鏀� items.push(item) - } - }) - - let _columns = [...columnsMap.values()] - - _columns.forEach(item => { - if (item.selected) { - let _match = '' - if (item.type === 'text') { - _match = textmatch[item.datatype] - } else if (item.type === 'select') { - _match = selectmatch[item.datatype] - } else if (item.type === 'daterange') { - _match = datematch[item.datatype] + } else if (cell.selected) { // 鏁版嵁绫诲瀷淇敼 + if (cell.type === 'text') { + item.match = textmatch[cell.datatype] + } else if (cell.type === 'select') { + item.match = selectmatch[cell.datatype] + } else if (cell.type === 'daterange') { + item.match = datematch[cell.datatype] } else { - item.type = 'text' - _match = textmatch[item.datatype] + cell.type = 'text' + item.match = textmatch[cell.datatype] } - - let newcard = { - uuid: Utils.getuuid(), - label: item.label, - field: item.field, - initval: '', - type: item.type, - resourceType: '0', - setAll: 'false', - options: [], - dataSource: '', - linkField: '', - valueField: '', - valueText: '', - orderBy: '', - orderType: 'asc', - match: _match, - display: 'dropdown' - } - - items.push(newcard) - } - }) - } else { - config.columns.forEach(item => { - if (columnsMap.has(item.field)) { - let cell = columnsMap.get(item.field) - - if (cell.selected) { - items.push(item) - } - columnsMap.delete(item.field) - } else if (!item.origin) { + + item.type = cell.type + item.initval = '' items.push(item) } - }) + columnsMap.delete(item.field) + } else if (!item.origin) { + items.push(item) + } + }) - let _columns = [...columnsMap.values()] + let _columns = [...columnsMap.values()] - _columns.forEach(item => { - if (item.selected) { - let newcard = { - uuid: Utils.getuuid(), - Align: 'left', - label: item.label, - field: item.field, - Hide: 'false', - IsSort: item.type === 'picture' ? 'false' : 'true', - type: item.type, - Width: 120 - } - - items.push(newcard) + _columns.forEach(item => { + if (item.selected) { + let _match = '' + if (item.type === 'text') { + _match = textmatch[item.datatype] + } else if (item.type === 'select') { + _match = selectmatch[item.datatype] + } else if (item.type === 'daterange') { + _match = datematch[item.datatype] + } else { + item.type = 'text' + _match = textmatch[item.datatype] } - }) - } + + let newcard = { + uuid: Utils.getuuid(), + label: item.label, + field: item.field, + initval: '', + type: item.type, + resourceType: '0', + setAll: 'false', + options: [], + dataSource: '', + linkField: '', + valueField: '', + valueText: '', + orderBy: '', + orderType: 'asc', + match: _match, + display: 'dropdown' + } + + items.push(newcard) + } + }) this.setState({ [addType + 'loading']: true, @@ -2440,7 +2027,6 @@ if ( (config.search[0] && config.search[0].origin) || (config.action[0] && config.action[0].origin) || - (config.columns[0] && config.columns[0].origin) || (config.tabs[0] && config.tabs[0].origin) ) { isAdd = true @@ -2568,14 +2154,6 @@ } } - onColumnNameChange = () => { - const { showColumnName } = this.state - - this.setState({ - showColumnName: !showColumnName - }) - } - addTabGroup = () => { let _this = this let _config = JSON.parse(JSON.stringify(this.state.config)) @@ -2630,13 +2208,16 @@ } render () { + const { config } = this.state + let _length = config.groups.length + let configTabs = [] this.state.config.tabgroups.forEach(group => { configTabs.push(...this.state.config[group]) }) return ( - <div className="common-table-board"> + <div className="form-tab-board"> <DndProvider backend={HTML5Backend}> {/* 宸ュ叿鏍� */} <div className="tools"> @@ -2738,27 +2319,54 @@ <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={ <div> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> - <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button> </div> } style={{ width: '100%' }}> <Icon type="setting" onClick={this.changeSetting} /> - <div className="search-list"> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃悳绱€�嬩腑锛岄�夋嫨瀵瑰簲鎼滅储妗嗘嫋鑷虫澶勬坊鍔狅紱鎴栫偣鍑绘寜閽�婃坊鍔犳悳绱㈡潯浠躲�嬫壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ��"> - <Icon type="question-circle" /> - </Tooltip> - {!this.state.searchloading ? - <DragElement - type="search" - list={this.state.config.search} - handleList={this.handleList} - handleMenu={this.handleSearch} - deleteMenu={this.deleteElement} - placeholder={this.state.dict['header.form.search.placeholder']} - /> : null - } - </div> + <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃悳绱€�嬩腑锛岄�夋嫨瀵瑰簲鎼滅储妗嗘嫋鑷虫澶勬坊鍔狅紱鎴栫偣鍑绘寜閽�婃坊鍔犳悳绱㈡潯浠躲�嬫壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ��"> + <Icon type="question-circle" /> + </Tooltip> + <Collapse + activeKey={config.groups.map(group => group.uuid)} + expandIconPosition={'right'} + > + {!this.state.searchloading && config.groups.map((group, index) => ( + <Panel showArrow={false} header={group.label} key={group.uuid} extra={( + <span> + {index === _length - 1 ? <Icon + type="plus" + onClick={event => { + event.stopPropagation() + }} + /> : null} + {_length > 1 && index !== _length - 1 ? <Icon + type="delete" + onClick={event => { + event.stopPropagation() + }} + /> : null} + <Icon + type="edit" + onClick={event => { + event.stopPropagation() + }} + /> + </span> + )}> + <DragElement + type="search" + groupId={group.uuid} + list={group.sublist} + handleList={this.handleList} + setting={config.setting} + handleMenu={this.handleSearch} + deleteMenu={this.deleteElement} + placeholder={this.state.dict['header.form.search.placeholder']} + /> + </Panel> + ))} + </Collapse> <div className="action-list"> <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�"> <Icon type="question-circle" /> @@ -2773,27 +2381,6 @@ deleteMenu={this.deleteElement} profileMenu={this.profileAction} placeholder={this.state.dict['header.form.action.placeholder']} - /> : null - } - </div> - {/* 鏄剧ず鍒� */} - <div className="column-list"> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃樉绀哄垪銆嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬樉绀哄垪鎷栬嚦姝ゅ娣诲姞锛涙垨鐐瑰嚮銆婃坊鍔犳樉绀哄垪銆嬫寜閽壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ�傛敞锛氭坊鍔犲悎骞跺垪鏃讹紝闇�璁剧疆鍙�夊垪銆�"> - <Icon type="question-circle" /> - </Tooltip> - <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showColumnName} onChange={this.onColumnNameChange} /> - {!this.state.columnsloading ? - <DragElement - type="columns" - list={this.state.config.columns} - setting={this.state.config.setting} - gridBtn={this.state.config.gridBtn} - handleList={this.handleList} - handleMenu={this.handleColumn} - deleteMenu={this.deleteElement} - handleGridBtn={this.handleGridBtn} - showfield={this.state.showColumnName} - placeholder={this.state.dict['header.form.column.placeholder']} /> : null } </div> @@ -2848,29 +2435,6 @@ card={this.state.card} tabs={this.state.tabviews} formlist={this.state.formlist} - wrappedComponentRef={(inst) => this.formRef = inst} - /> : null - } - {this.state.formtemp === 'columns' && this.state.card.type !== 'colspan' ? - <ColumnForm - dict={this.state.dict} - card={this.state.card} - formlist={this.state.formlist} - wrappedComponentRef={(inst) => this.formRef = inst} - /> : null - } - {this.state.formtemp === 'columns' && this.state.card.type === 'colspan' ? - <ColspanForm - dict={this.state.dict} - card={this.state.card} - columns={this.state.config.columns} - wrappedComponentRef={(inst) => this.formRef = inst} - /> : null - } - {this.state.formtemp === 'gridbtn' ? - <GridBtnForm - dict={this.state.dict} - card={this.state.config.gridBtn} wrappedComponentRef={(inst) => this.formRef = inst} /> : null } diff --git a/src/templates/formtabconfig/index.scss b/src/templates/formtabconfig/index.scss index d1e5eea..f43082a 100644 --- a/src/templates/formtabconfig/index.scss +++ b/src/templates/formtabconfig/index.scss @@ -1,4 +1,4 @@ -.common-table-board { +.form-tab-board { position: fixed; z-index: 1070; padding-top: 48px; @@ -129,7 +129,6 @@ position: relative; width: calc(100vw - 235px); height: 100%; - // overflow-y: hidden; background: #ffffff; .ant-switch.big { min-width: 60px; @@ -160,88 +159,109 @@ .ant-card-body { position: relative; padding: 0 0 40px; - - .search-list { - padding: 1px 24px 20px; - min-height: 87px; - border-bottom: 1px solid #d9d9d9; - > .ant-row { - min-height: 65px; + >.anticon-question-circle { + position: relative; + left: 5px; + top: 20px; + } + >.ant-collapse { + border-radius: 0; + border: 0; + margin-top: 30px; + .ant-collapse-header { + cursor: default; + border-radius: 0; + background: #1890ff; + color: #ffffff; + .anticon { + font-size: 16px; + } + .ant-collapse-extra { + .anticon-edit { + position: absolute; + right: 15px; + } + } } - .ant-row .ant-col-6 { - padding: 0 12px!important; + .ant-collapse-item:last-child { + border-radius: 0; + .ant-collapse-content { + border-radius: 0; + } } - .ant-row.ant-form-item .ant-col { - padding: 0; - } - .page-card { - position: relative; - background: #ffffff; - border-radius: 2px; - padding-top: 15px; - .ant-form-item { - cursor: move; - display: flex; - margin-bottom: 0px; - .ant-form-item-label { - width: 100px; - height: 40px; - label { - width: 100%; + .ant-collapse-content-box { + padding: 16px 30px; + > .ant-row { + min-height: 90px; + padding-bottom: 30px; + .page-card { + position: relative; + background: #ffffff; + border-radius: 2px; + padding-top: 15px; + .ant-form-item { cursor: move; - overflow: hidden; - display: inline-block; - text-overflow: ellipsis; - white-space: nowrap; + display: flex; + margin-bottom: 0px; + .ant-form-item-label { + label { + width: 100%; + cursor: move; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + } + } + .ant-form-item-control-wrapper { + .ant-select { + width: 100%; + margin-top: 4px; + } + .ant-calendar-picker { + margin-top: 4px; + } + .input-mask { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + opacity: 0; + z-index: 2; + } + .data-range .ant-calendar-picker-input { + padding: 4px 20px 4px 5px; + font-size: 13px; + } + } } - } - .ant-form-item-control-wrapper { - flex: 1 1; - .ant-select { - width: 100%; - margin-top: 4px; - } - .ant-calendar-picker { - margin-top: 4px; - } - .input-mask { + .edit { position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - opacity: 0; - z-index: 2; + left: 15px; + top: 5px; + color: #1890ff; + cursor: pointer; + display: none; } - .data-range .ant-calendar-picker-input { - padding: 4px 20px 4px 5px; - font-size: 13px; + .edit.close { + left: 40px; + color: #ff4d4f; } } + .page-card:hover { + .edit { + display: inline-block; + } + } + .ant-calendar-picker { + min-width: 100px!important; + width: 100%; + } } - .edit { - position: absolute; - left: 0; - top: 5px; - color: #1890ff; - cursor: pointer; - display: none; - } - .edit.close { - left: 20px; - color: #ff4d4f; - } - } - .page-card:hover { - .edit { - display: inline-block; - } - } - .ant-calendar-picker { - min-width: 100px!important; - width: 100%; } } + .action-list { padding: 0px 20px 15px; min-height: 82px; @@ -290,84 +310,6 @@ .page-card:hover { .edit { display: inline-block; - } - } - } - .column-list { - position: relative; - padding: 0px 20px; - .ant-switch { - position: absolute; - right: 20px; - top: -10px; - } - > .ant-row { - background: #fafafa; - border-radius: 4px; - min-height: 47px; - border: 1px solid #e8e8e8; - .column-box { - display: flex; - } - .column-box:not(:first-child) { - border-top: 1px solid #e8e8e8; - } - .page-card { - position: relative; - padding: 0px; - min-height: 45px; - > div { - padding: 12px 0px 0px; - cursor: move; - height: 100%; - .ant-table-column-sorters { - padding: 0px 8px 12px; - } - .ant-table-column-fields { - padding: 0px 8px 5px; - } - } - .ant-table-column-sorter { - position: relative; - display: inline-block; - width: 24px; - font-size: 12px; - color: #bfbfbf; - .anticon-caret-up { - position: relative; - left: 10px; - top: -3px; - } - .anticon-caret-down { - position: relative; - left: -2px; - top: 3px; - } - } - .edit { - position: absolute; - left: 0; - top: 0px; - color: #1890ff; - cursor: pointer; - display: none; - } - .edit.close { - left: 20px; - color: #ff4d4f; - } - .ant-checkbox-inner { - margin-top: 14px; - margin-left: calc(50% - 8px); - } - } - .page-card:hover { - .edit { - display: inline-block; - } - } - .page-card:not(:last-child) { - border-right: 1px solid #e8e8e8; } } } diff --git a/src/templates/formtabconfig/source.jsx b/src/templates/formtabconfig/source.jsx index aba4f91..267165c 100644 --- a/src/templates/formtabconfig/source.jsx +++ b/src/templates/formtabconfig/source.jsx @@ -16,9 +16,71 @@ innerFunc: '', interface: '', outerFunc: '', + cols: 2, subtabs: [] }, tables: [], + groups: [ + { + isDefault: true, + uuid: Utils.getuuid(), + label: 'label', + sublist: [ + { + origin: true, + uuid: Utils.getuuid(), + label: 'label', + field: '', + initval: '', + type: 'text', + resourceType: '0', + setAll: 'false', + options: [], + dataSource: '', + linkField: '', + valueField: '', + valueText: '', + orderBy: '', + orderType: 'asc', + match: 'like' + }, { + origin: true, + uuid: Utils.getuuid(), + label: 'label', + field: '', + initval: '', + type: 'select', + resourceType: '0', + setAll: 'false', + options: [], + dataSource: '', + linkField: '', + valueField: '', + valueText: '', + orderBy: '', + orderType: 'asc', + match: 'equal' + }, { + origin: true, + uuid: Utils.getuuid(), + label: 'label', + field: '', + initval: '', + type: 'date', + resourceType: '0', + setAll: 'false', + options: [], + dataSource: '', + linkField: '', + valueField: '', + valueText: '', + orderBy: '', + orderType: 'asc', + match: 'greater' + } + ] + } + ], search: [ { origin: true, @@ -36,8 +98,7 @@ valueText: '', orderBy: '', orderType: 'asc', - match: 'like', - display: 'dropdown' + match: 'like' }, { origin: true, uuid: Utils.getuuid(), @@ -54,8 +115,7 @@ valueText: '', orderBy: '', orderType: 'asc', - match: 'equal', - display: 'dropdown' + match: 'equal' }, { origin: true, uuid: Utils.getuuid(), @@ -72,8 +132,7 @@ valueText: '', orderBy: '', orderType: 'asc', - match: 'greater', - display: 'dropdown' + match: 'greater' } ], action: [ @@ -122,29 +181,6 @@ url: '', icon: 'form', class: 'purple', - verify: null - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'delete', - intertype: 'inner', - innerFunc: '', - interface: '', - method: 'POST', - outerFunc: '', - sql: '', - sqlType: '', - callbackFunc: '', - Ot: 'required', - position: 'toolbar', - execSuccess: 'grid', - execError: 'never', - errorTime: 15, - OpenType: 'prompt', - pageTemplate: '', - url: '', - icon: 'delete', - class: 'red', verify: null } ], @@ -217,12 +253,6 @@ actionItems = [ { type: 'action', - label: CommonDict['header.form.popform'], - subType: 'pop', - url: '' - }, - { - type: 'action', label: CommonDict['header.form.prompt'], subType: 'prompt', url: '' @@ -231,48 +261,6 @@ type: 'action', label: CommonDict['header.form.exec'], subType: 'exec', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.excelIn'], - subType: 'excelIn', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.excelOut'], - subType: 'excelOut', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.popview'], - subType: 'popview', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.tab'], - subType: 'tab', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.blank'], - subType: 'blank', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.newpage.inner'], - subType: 'innerpage', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.newpage.outer'], - subType: 'outerpage', url: '' } ] -- Gitblit v1.8.0