| | |
| | | }, { |
| | | 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 |
| | |
| | | } |
| | | } |
| | | |
| | | // 打开方式或显示位置变化 |
| | | 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, |
| | |
| | | <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) => |
New file |
| | |
| | | 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 |
New file |
| | |
| | | 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 |
New file |
| | |
| | | .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; |
| | | } |
New file |
| | |
| | | export default { |
| | | CARD: 'card', |
| | | form: 'form', |
| | | search: 'search', |
| | | action: 'action', |
| | | columns: 'columns', |
| | | tab: 'tab' |
| | | } |
New file |
| | |
| | | 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 |
| | |
| | | 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' |
| | |
| | | originMenu: null, // 原始菜单 |
| | | delActions: [], // 删除按钮列表 |
| | | funcLoading: false, // 存储过程创建中 |
| | | showColumnName: false, // 显示列字段名控制 |
| | | tabviews: [], // 所有标签页 |
| | | profileVisible: false // 验证信息模态框 |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | handleList = (type, list, card) => { |
| | | handleList = (type, list, card, groupId) => { |
| | | const { config } = this.state |
| | | |
| | | if (type === 'tabs') { // 标签页调整顺序或添加元素 |
| | |
| | | } 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}}) |
| | | } |
| | | } |
| | | } |
| | |
| | | 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', |
| | |
| | | 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', |
| | |
| | | }, |
| | | { |
| | | 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', |
| | |
| | | } |
| | | ] |
| | | }) |
| | | } |
| | | |
| | | 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) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | handleGridBtn = () => { |
| | | this.setState({ |
| | | visible: true, |
| | | formtemp: 'gridbtn', |
| | | modalTitle: '编辑-操作列', |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索、按钮、显示列修改后提交保存 |
| | | * 1、搜索条件保存,当类型为下拉框且存在数据源时,将查询条件拼接为sql,并用base64转码 |
| | |
| | | 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 |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | 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({ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 三级菜单切换模板 |
| | | */ |
| | | changeTemplate = () => { |
| | | this.props.handleConfig('template') |
| | | } |
| | | |
| | | /** |
| | | * @description 三级菜单保存 |
| | | */ |
| | | submitConfig = () => { |
| | |
| | | } |
| | | 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) |
| | |
| | | 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 |
| | |
| | | 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}) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 显示字段集弹窗 |
| | |
| | | }) |
| | | |
| | | 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, |
| | |
| | | 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 |
| | |
| | | } |
| | | } |
| | | |
| | | onColumnNameChange = () => { |
| | | const { showColumnName } = this.state |
| | | |
| | | this.setState({ |
| | | showColumnName: !showColumnName |
| | | }) |
| | | } |
| | | |
| | | addTabGroup = () => { |
| | | let _this = this |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | |
| | | } |
| | | |
| | | 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"> |
| | |
| | | <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" /> |
| | |
| | | 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> |
| | |
| | | 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 |
| | | } |
| | |
| | | .common-table-board { |
| | | .form-tab-board { |
| | | position: fixed; |
| | | z-index: 1070; |
| | | padding-top: 48px; |
| | |
| | | position: relative; |
| | | width: calc(100vw - 235px); |
| | | height: 100%; |
| | | // overflow-y: hidden; |
| | | background: #ffffff; |
| | | .ant-switch.big { |
| | | min-width: 60px; |
| | |
| | | .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; |
| | |
| | | .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; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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, |
| | |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | match: 'like', |
| | | display: 'dropdown' |
| | | match: 'like' |
| | | }, { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | match: 'equal', |
| | | display: 'dropdown' |
| | | match: 'equal' |
| | | }, { |
| | | origin: true, |
| | | uuid: Utils.getuuid(), |
| | |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | match: 'greater', |
| | | display: 'dropdown' |
| | | match: 'greater' |
| | | } |
| | | ], |
| | | action: [ |
| | |
| | | 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 |
| | | } |
| | | ], |
| | |
| | | actionItems = [ |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['header.form.popform'], |
| | | subType: 'pop', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'action', |
| | | label: CommonDict['header.form.prompt'], |
| | | subType: 'prompt', |
| | | url: '' |
| | |
| | | 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: '' |
| | | } |
| | | ] |