2 文件已重命名
22个文件已修改
16个文件已删除
3个文件已添加
| | |
| | | 'model.form.afterSuccess': 'Success', |
| | | 'model.form.afterError': 'Failure', |
| | | 'header.form.messageTip': 'Message', |
| | | 'header.form.errorTime': 'Residence time', |
| | | 'header.form.refresh': 'Refresh', |
| | | 'header.form.refresh.never': 'Don\'t refresh', |
| | | 'header.form.refresh.grid': 'Refresh the table', |
| | |
| | | 'model.form.afterSuccess': '成功后', |
| | | 'model.form.afterError': '失败后', |
| | | 'header.form.messageTip': '信息提示', |
| | | 'header.form.errorTime': '停留时间', |
| | | 'header.form.refresh': '刷新', |
| | | 'header.form.refresh.never': '不刷新', |
| | | 'header.form.refresh.grid': '刷新表格', |
| | |
| | | addButton = () => { |
| | | const { card } = this.state |
| | | |
| | | let newcard = {} |
| | | let newcard = {eleType: 'button', label: 'button', verify: null, show: 'link', sqlType: '', Ot: 'requiredSgl', OpenType: 'prompt', icon: '', class: 'primary', intertype: 'system', execSuccess: 'grid', execError: 'never', popClose: 'never'} |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | | newcard.eleType = 'button' |
| | | newcard.label = 'button' |
| | | newcard.sqlType = '' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = 'prompt' |
| | | newcard.icon = '' |
| | | newcard.class = 'primary' |
| | | newcard.intertype = 'system' |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.popClose = 'never' |
| | | newcard.errorTime = 10 |
| | | newcard.verify = null |
| | | newcard.show = 'link' |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', [card.uuid, card.uuid], newcard) |
| | |
| | | type: 'radio', |
| | | field: 'supControl', |
| | | label: '显示控制', |
| | | tooltip: '当前组件在主表选中行时显示,还是始终显示。', |
| | | initval: wrap.supControl || 'show', |
| | | tooltip: '当前组件在主表选中行时显示,还是始终显示。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'hidden', label: '选行'}, |
| | |
| | | type: 'multiselect', |
| | | field: 'blacklist', |
| | | label: '黑名单', |
| | | initval: wrap.blacklist || '', |
| | | initval: wrap.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | }, |
| | |
| | | * @description 取消保存,如果元素为新添元素,则从序列中删除 |
| | | */ |
| | | editModalCancel = () => { |
| | | const { card, elements } = this.state |
| | | const { card, elements, appType } = this.state |
| | | let _elements = null |
| | | |
| | | if (card.focus) { |
| | | _elements = elements.filter(item => item.uuid !== card.uuid) |
| | | |
| | | if (card.OpenType === 'popview' && appType !== 'mob') { // 弹窗标签按钮,从复制列表中删除 |
| | | MKEmitter.emit('delButtons', [card.uuid]) |
| | | } |
| | | } else { |
| | | _elements = elements |
| | | } |
| | |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardCellComponent = asyncComponent(() => import('../cardcellcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('./pastecomponent')) |
| | | const PasteController = asyncIconComponent(() => import('@/components/paste')) |
| | | |
| | | class CardBoxComponent extends Component { |
| | | static propTpyes = { |
| | |
| | | this.props.updateElement(_card) |
| | | } |
| | | |
| | | updateCard = (elements, type) => { |
| | | updateCard = (elements) => { |
| | | const { card, side } = this.state |
| | | |
| | | let _card = {} |
| | |
| | | _card = {...card, elements: elements} |
| | | } |
| | | |
| | | if (type === 'paste') { |
| | | this.setState({ |
| | | card: _card, |
| | | elements: fromJS(elements).toJS() |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | card: _card |
| | | }) |
| | | } |
| | | |
| | | this.props.updateElement(_card) |
| | | } |
| | |
| | | const { cards } = this.props |
| | | const { card } = this.state |
| | | |
| | | let newcard = {} |
| | | let newcard = {eleType: 'button', label: 'button', verify: null, show: 'link', sqlType: '', Ot: 'requiredSgl', OpenType: 'prompt', icon: '', class: 'primary', intertype: 'system', execSuccess: 'grid', execError: 'never', popClose: 'never'} |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | | newcard.eleType = 'button' |
| | | newcard.label = 'button' |
| | | newcard.sqlType = '' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = 'prompt' |
| | | newcard.icon = '' |
| | | newcard.class = 'primary' |
| | | newcard.intertype = 'system' |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.popClose = 'never' |
| | | newcard.errorTime = 10 |
| | | newcard.verify = null |
| | | newcard.show = 'link' |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) |
| | |
| | | |
| | | if (res.appmenu) { |
| | | res.menu = res.appmenu |
| | | delete res.appmenu |
| | | } |
| | | delete res.appmenu |
| | | |
| | | this.setState({ |
| | | card: {...card, setting: res} |
| | |
| | | } |
| | | |
| | | this.props.updateElement({...card, setting: res}) |
| | | } |
| | | |
| | | paste = (element, resolve) => { |
| | | const { cards } = this.props |
| | | const { card } = this.state |
| | | |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | if (element.copyType === 'action' && element.OpenType === 'popview') { // 弹窗标签复制 |
| | | let _cell = fromJS(element).toJS() |
| | | _cell.$originUuid = element.uuid |
| | | _cell.uuid = _uuid |
| | | MKEmitter.emit('copyButtons', [_cell]) |
| | | } |
| | | |
| | | element.uuid = _uuid |
| | | element.focus = true |
| | | |
| | | resolve({status: true}) |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], element) |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | |
| | | <Icon type="edit" className="edit" title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="cardcell" card={card}/> |
| | | <PasteComponent elements={elements} options={['action', 'customCardElement']} updateConfig={(list) => this.updateCard(list, 'paste')} /> |
| | | <PasteController options={['action', 'customCardElement']} updateConfig={this.paste} /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
File was renamed from src/menu/components/card/table-card/cardcomponent/index.jsx |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, Popover, Icon } from 'antd' |
| | | import { Popover, Icon } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import SettingForm from './settingform' |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import { getTableSetting, getCarouselSetting } from './options' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const CardCellComponent = asyncComponent(() => import('../../cardcellcomponent')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardCellComponent = asyncComponent(() => import('../cardcellcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | |
| | | class CardBoxComponent extends Component { |
| | | static propTpyes = { |
| | | cards: PropTypes.object, // 卡片行配置信息 |
| | | card: PropTypes.object, // 卡片配置信息 |
| | | move: PropTypes.func, // 卡片移动 |
| | | deleteElement: PropTypes.func, // 卡片删除 |
| | | updateElement: PropTypes.func // 菜单配置更新 |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | card: null, // 卡片信息,包括正反面 |
| | | card: null, // 卡片信息 |
| | | formlist: null, // 设置表单信息 |
| | | elements: null, // 编辑组 |
| | | visible: false, // 模态框控制 |
| | | settingVisible: false, |
| | | } |
| | | |
| | | /** |
| | |
| | | const { card } = this.props |
| | | |
| | | this.setState({ |
| | | card: fromJS(card).toJS(), |
| | | elements: fromJS(card.elements).toJS(), |
| | | card: fromJS(card).toJS() |
| | | }) |
| | | } |
| | | |
| | |
| | | const { cards } = this.props |
| | | const { card } = this.state |
| | | |
| | | let newcard = {} |
| | | let newcard = {eleType: 'button', label: 'button', verify: null, show: 'link', sqlType: '', Ot: 'requiredSgl', OpenType: 'prompt', icon: '', class: 'primary', intertype: 'system', execSuccess: 'grid', execError: 'never', popClose: 'never'} |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | | newcard.eleType = 'button' |
| | | newcard.label = 'button' |
| | | newcard.sqlType = '' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = 'prompt' |
| | | newcard.icon = '' |
| | | newcard.class = 'primary' |
| | | newcard.intertype = 'system' |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.popClose = 'never' |
| | | newcard.errorTime = 10 |
| | | newcard.verify = null |
| | | newcard.show = 'link' |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) |
| | |
| | | const { card } = this.state |
| | | |
| | | let _style = null |
| | | let options = ['height', 'background', 'border', 'padding', 'margin'] |
| | | let options = ['height', 'background', 'border', 'padding', 'margin', 'shadow'] |
| | | _style = card.style ? fromJS(card.style).toJS() : {} |
| | | |
| | | if (cards.type === 'carousel') { |
| | | options = ['background', 'border', 'padding', 'margin', 'shadow'] |
| | | } |
| | | |
| | | MKEmitter.emit('changeStyle', [cards.uuid, card.uuid], options, _style) |
| | | } |
| | | |
| | | settingSubmit = () => { |
| | | getSettingForms = () => { |
| | | const { cards } = this.props |
| | | const { setting } = this.state.card |
| | | |
| | | if (cards.type !== 'carousel') { |
| | | return getTableSetting(setting, cards.columns) |
| | | } else { |
| | | return getCarouselSetting(setting, cards.subtype === 'propcard') |
| | | } |
| | | } |
| | | |
| | | updateSetting = (res) => { |
| | | const { card } = this.state |
| | | |
| | | this.settingRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | settingVisible: false, |
| | | card: {...card, setting: res} |
| | | }) |
| | | if (res.appmenu) { |
| | | res.menu = res.appmenu |
| | | } |
| | | delete res.appmenu |
| | | |
| | | this.props.updateElement({...card, setting: res}) |
| | | }) |
| | | let _card = {...card, setting: res} |
| | | |
| | | this.setState({ card: _card }) |
| | | this.props.updateElement(_card) |
| | | } |
| | | |
| | | render() { |
| | | const { cards } = this.props |
| | | const { card, elements, settingVisible, dict } = this.state |
| | | let _style = resetStyle(card.style) |
| | | const { card } = this.state |
| | | |
| | | let _style = {...card.style} |
| | | |
| | | if (cards.type === 'carousel') { |
| | | _style.height = cards.style.height |
| | | } |
| | | |
| | | _style = resetStyle(_style) |
| | | |
| | | return ( |
| | | <div className="ant-col ant-col-24"> |
| | | <div className="card-item" style={_style}> |
| | | <CardCellComponent cards={cards} cardCell={card} elements={elements} updateElement={this.updateCard}/> |
| | | <CardCellComponent cards={cards} cardCell={card} elements={card.elements} updateElement={this.updateCard}/> |
| | | <div className="card-control"> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="plus" title="添加元素" onClick={this.addElement} type="plus" /> |
| | | <Icon className="plus" title="添加按钮" onClick={this.addButton} type="plus-square" /> |
| | | <Icon className="edit" title="编辑" type="edit" onClick={() => this.setState({settingVisible: true})} /> |
| | | <NormalForm title="卡片设置" width={700} update={this.updateSetting} getForms={this.getSettingForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="cardcell" card={card}/> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | {cards.subtype !== 'datacard' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="plus" title="前移" type="arrow-left" onClick={() => this.props.move(card, 'left')} /> |
| | | <Icon className="close" title="后移" type="arrow-right" onClick={() => this.props.move(card, 'right')} /> |
| | | </div> |
| | | } trigger="hover" getPopupContainer={() => document.getElementById(card.uuid + 'swap')}> |
| | | <Icon type="swap" id={card.uuid + 'swap'}/> |
| | | </Popover> |
| | | <Icon className="close" title="删除卡片" type="delete" onClick={() => this.props.deleteElement(card)} /> |
| | | </Popover> : null} |
| | | {cards.subtype !== 'datacard' ? <Icon className="close" title="删除卡片" type="delete" onClick={() => this.props.deleteElement(card)} /> : null} |
| | | </div> |
| | | } trigger="hover"> |
| | | <Icon type="tool" /> |
| | | </Popover> |
| | | </div> |
| | | </div> |
| | | <Modal |
| | | wrapClassName="popview-modal" |
| | | title={'行设置'} |
| | | visible={settingVisible} |
| | | width={700} |
| | | maskClosable={false} |
| | | okText={dict['model.submit']} |
| | | onOk={this.settingSubmit} |
| | | onCancel={() => { this.setState({ settingVisible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | <SettingForm |
| | | dict={dict} |
| | | cards={cards} |
| | | setting={card.setting} |
| | | inputSubmit={this.settingSubmit} |
| | | wrappedComponentRef={(inst) => this.settingRef = inst} |
| | | /> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |
New file |
| | |
| | | /** |
| | | * @description tablecard setting表单配置信息 |
| | | */ |
| | | export function getTableSetting (setting, columns) { |
| | | let _columns = columns.map(item => ({value: item.field, label: item.label})) |
| | | _columns.push({value: '$Index', label: '序号(前端)'}) |
| | | |
| | | const settingForm = [ |
| | | { |
| | | type: 'radio', |
| | | field: 'condition', |
| | | label: '显示条件', |
| | | initval: setting.condition || 'false', |
| | | tooltip: '当选择“有”时,只有符合条件的数据才会展示。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '有'}, |
| | | {value: 'false', label: '无'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'controlField', values: ['true']}, |
| | | {field: 'controlType', values: ['true']}, |
| | | {field: 'controlValue', values: ['true']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'controlField', |
| | | label: '控制字段', |
| | | initval: setting.controlField || '', |
| | | required: true, |
| | | options: _columns |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'controlType', |
| | | label: '对比方式', |
| | | initval: setting.controlType || '=', |
| | | required: true, |
| | | options: [ |
| | | {value: '=', label: '='}, |
| | | {value: '!=', label: '!='}, |
| | | {value: '>', label: '>'}, |
| | | {value: '<', label: '<'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'controlValue', |
| | | label: '对比值', |
| | | initval: setting.controlValue || '', |
| | | required: false |
| | | } |
| | | ] |
| | | |
| | | return settingForm |
| | | } |
| | | |
| | | /** |
| | | * @description carousel setting表单配置信息 |
| | | */ |
| | | export function getCarouselSetting (setting, hasPrimaryKey) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | |
| | | let menulist = [] |
| | | let appmenulist = [] |
| | | |
| | | if (appType) { |
| | | appmenulist = sessionStorage.getItem('appMenus') |
| | | if (appmenulist) { |
| | | try { |
| | | appmenulist = JSON.parse(appmenulist) |
| | | } catch { |
| | | appmenulist = [] |
| | | } |
| | | } else { |
| | | appmenulist = [] |
| | | } |
| | | } else { |
| | | menulist = sessionStorage.getItem('fstMenuList') |
| | | if (menulist) { |
| | | try { |
| | | menulist = JSON.parse(menulist) |
| | | } catch { |
| | | menulist = [] |
| | | } |
| | | } else { |
| | | menulist = [] |
| | | } |
| | | } |
| | | |
| | | const cardSettingForm = [ |
| | | { |
| | | type: 'text', |
| | | field: 'primaryId', |
| | | label: '主键值', |
| | | initval: setting.primaryId || '', |
| | | tooltip: '卡片点击时,向其他组件传递的ID值。', |
| | | required: false, |
| | | forbid: !hasPrimaryKey |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'click', |
| | | label: '点击事件', |
| | | initval: setting.click || '', |
| | | required: false, |
| | | options: [ |
| | | {value: '', label: '无'}, |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'link', label: '链接'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'menu', values: ['menu']}, |
| | | {field: 'appmenu', values: ['menu']}, |
| | | {field: 'linkurl', values: ['link']}, |
| | | {field: 'open', values: ['menu', 'link']}, |
| | | {field: 'joint', values: ['menu', 'link']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | field: 'menu', |
| | | label: '菜单', |
| | | initval: setting.menu || [], |
| | | required: true, |
| | | options: menulist, |
| | | forbid: !!appType |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'appmenu', |
| | | label: '关联菜单', |
| | | initval: setting.menu || '', |
| | | required: true, |
| | | options: appmenulist, |
| | | forbid: !appType |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | field: 'linkurl', |
| | | label: '链接', |
| | | initval: setting.linkurl || '', |
| | | required: true, |
| | | options: [], |
| | | span: 24 |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'open', |
| | | label: '打开方式', |
| | | initval: setting.open || 'blank', |
| | | required: false, |
| | | options: [ |
| | | {value: 'blank', label: '新窗口'}, |
| | | {value: 'self', label: '当前窗口'}, |
| | | ], |
| | | forbid: appType !== 'pc' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'joint', |
| | | label: '参数拼接', |
| | | initval: setting.joint || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | }, |
| | | ] |
| | | |
| | | return cardSettingForm |
| | | } |
| | |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import getWrapForm from './options' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const WrapComponent = asyncIconComponent(() => import('./wrapsetting')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardComponent = asyncComponent(() => import('../cardcomponent')) |
| | | const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) |
| | | const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/components/paste')) |
| | | const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) |
| | | const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) |
| | | |
| | |
| | | this.props.updateConfig(_card) |
| | | } |
| | | |
| | | addSearch = () => { |
| | | addSearch = (copy) => { |
| | | const { card } = this.state |
| | | |
| | | let newcard = {} |
| | | |
| | | if (copy) { |
| | | newcard = copy |
| | | newcard.focus = true |
| | | } else { |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | |
| | | newcard.orderType = 'asc' |
| | | newcard.display = 'dropdown' |
| | | newcard.match = '=' |
| | | } |
| | | |
| | | // 注册事件-添加搜索 |
| | | MKEmitter.emit('addSearch', card.uuid, newcard) |
| | | } |
| | | |
| | | addButton = () => { |
| | | addButton = (copy) => { |
| | | const { card } = this.state |
| | | |
| | | let newcard = {} |
| | | |
| | | if (copy) { |
| | | newcard = copy |
| | | newcard.focus = true |
| | | } else { |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | |
| | | newcard.verify = null |
| | | newcard.show = 'button' |
| | | newcard.style = {marginRight: '15px'} |
| | | } |
| | | |
| | | // 注册事件-添加按钮 |
| | | MKEmitter.emit('addButton', card.uuid, newcard) |
| | |
| | | } |
| | | } |
| | | |
| | | addCard = () => { |
| | | addCard = (copy) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let newcard = {} |
| | | |
| | | if (copy) { // 粘贴 |
| | | newcard = copy |
| | | } else { |
| | | let height = card.subcards[0].style.height |
| | | if (height === 'auto') { |
| | | height = '100px' |
| | | } |
| | | |
| | | let newcard = { |
| | | newcard = { |
| | | uuid: Utils.getuuid(), |
| | | $cardType: 'extendCard', |
| | | setting: { width: 6, type: 'simple', click: 'button'}, |
| | |
| | | backStyle: {}, |
| | | elements: [], |
| | | backElements: [] |
| | | } |
| | | } |
| | | |
| | | card.subcards.push(newcard) |
| | |
| | | |
| | | this.setState({card}) |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | getWrapForms = () => { |
| | | const { card } = this.state |
| | | |
| | | return getWrapForm(card.wrap, card.subtype) |
| | | } |
| | | |
| | | updateWrap = (res) => { |
| | | this.updateComponent({...this.state.card, wrap: res}) |
| | | } |
| | | |
| | | pasteComponent = (res, resolve) => { |
| | | const { card, appType } = this.state |
| | | |
| | | let type = res.copyType |
| | | delete res.copyType |
| | | |
| | | if (type === 'cardcell') { |
| | | res.uuid = Utils.getuuid() |
| | | res.setting = res.setting || {} |
| | | res.$cardType = 'extendCard' |
| | | res.setting.width = res.setting.width || 6 |
| | | |
| | | let copyBtns = [] |
| | | let mobtypes = ['pop', 'prompt', 'exec', 'innerpage'] |
| | | |
| | | let elements = [] |
| | | res.elements && res.elements.forEach(cell => { |
| | | if (cell.datatype === 'dynamic') { |
| | | cell.datatype = 'static' |
| | | } |
| | | |
| | | if (cell.eleType !== 'button') { |
| | | cell.uuid = Utils.getuuid() |
| | | elements.push(cell) |
| | | } else if (appType === 'mob' && !mobtypes.includes(cell.OpenType)) { |
| | | return |
| | | } else { |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.push(_cell) |
| | | } |
| | | |
| | | cell.uuid = _uuid |
| | | elements.push(cell) |
| | | } |
| | | }) |
| | | |
| | | res.elements = elements |
| | | |
| | | let backElements = [] |
| | | |
| | | if (appType !== 'mob') { |
| | | res.backElements && res.backElements.forEach(cell => { |
| | | if (cell.datatype === 'dynamic') { |
| | | cell.datatype = 'static' |
| | | } |
| | | |
| | | if (cell.eleType !== 'button') { |
| | | cell.uuid = Utils.getuuid() |
| | | backElements.push(cell) |
| | | } else if (appType === 'mob' && !mobtypes.includes(cell.OpenType)) { |
| | | return |
| | | } else { |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.push(_cell) |
| | | } |
| | | |
| | | cell.uuid = _uuid |
| | | backElements.push(cell) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | res.backElements = backElements |
| | | |
| | | if (copyBtns.length > 0) { |
| | | MKEmitter.emit('copyButtons', copyBtns) |
| | | } |
| | | |
| | | resolve({status: true}) |
| | | |
| | | this.addCard(res) |
| | | } else if (type === 'search' || type === 'form') { |
| | | if (appType === 'mob') { |
| | | resolve({status: false, message: '移动端数据卡不支持添加搜索条件。'}) |
| | | } else { |
| | | res.uuid = Utils.getuuid() |
| | | let keys = card.search.map(item => item.field.toLowerCase()) |
| | | |
| | | if (type === 'form') { |
| | | if (['number', 'switch', 'textarea', 'fileupload', 'hint', 'color', 'funcvar'].includes(res.type)) { |
| | | res.type = 'text' |
| | | } else if (res.type === 'radio') { |
| | | res.type = 'select' |
| | | } else if (res.type === 'checkbox') { |
| | | res.type = 'multiselect' |
| | | } else if (res.type === 'datetime') { |
| | | res.type = 'date' |
| | | } |
| | | } |
| | | |
| | | if (res.field && keys.includes(res.field.toLowerCase())) { |
| | | resolve({status: false, message: '搜索字段已存在!'}) |
| | | return |
| | | } |
| | | |
| | | resolve({status: true}) |
| | | |
| | | this.addSearch(res) |
| | | } |
| | | } else if (type === 'action') { |
| | | if (appType === 'mob' && !['pop', 'prompt', 'exec', 'innerpage'].includes(res.OpenType)) { |
| | | resolve({status: false, message: '移动端不支持此类型的按钮。'}) |
| | | } else { |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | if (res.OpenType === 'popview') { |
| | | let _cell = fromJS(res).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | |
| | | MKEmitter.emit('copyButtons', [_cell]) |
| | | } |
| | | |
| | | resolve({status: true}) |
| | | |
| | | res.uuid = _uuid |
| | | this.addButton(res) |
| | | } |
| | | } |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | |
| | | <NormalHeader defaultshow="hidden" config={card} updateComponent={this.updateComponent}/> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="plus" title="添加卡片" onClick={this.addCard} type="plus" /> |
| | | {appType !== 'mob' ? <Icon className="plus" title="添加搜索" onClick={this.addSearch} type="plus-circle" /> : null} |
| | | <Icon className="plus" title="添加按钮" onClick={this.addButton} type="plus-square" /> |
| | | <WrapComponent config={card} updateConfig={this.updateComponent} /> |
| | | <Icon className="plus" title="添加卡片" onClick={() => this.addCard()} type="plus" /> |
| | | {appType !== 'mob' ? <Icon className="plus" title="添加搜索" onClick={() => this.addSearch()} type="plus-circle" /> : null} |
| | | <Icon className="plus" title="添加按钮" onClick={() => this.addButton()} type="plus-square" /> |
| | | <NormalForm title="数据卡设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="datacard" card={card}/> |
| | | <PasteComponent config={card} options={['action', 'search', 'form', 'cardcell']} updateConfig={this.updateComponent} /> |
| | | <PasteComponent options={['action', 'search', 'form', 'cardcell']} updateConfig={this.pasteComponent} /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> |
| | | <UserComponent config={card}/> |
New file |
| | |
| | | /** |
| | | * @description Wrap表单配置信息 |
| | | */ |
| | | export default function (wrap, subtype) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let MenuType = '' |
| | | |
| | | if (window.GLOB.customMenu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | | } |
| | | |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | const cardWrapForm = [ |
| | | { |
| | | type: 'text', |
| | | field: 'title', |
| | | label: '标题', |
| | | initval: wrap.title || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'name', |
| | | label: '组件名称', |
| | | initval: wrap.name || '', |
| | | tooltip: '用于组件间的区分。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'width', |
| | | label: '宽度', |
| | | initval: wrap.width || 24, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'datatype', |
| | | label: '数据来源', |
| | | initval: wrap.datatype || 'dynamic', |
| | | tooltip: '选择静态值,无需配置数据源。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'dynamic', label: '动态'}, |
| | | {value: 'static', label: '静态'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'pagestyle', |
| | | label: '分页风格', |
| | | initval: wrap.pagestyle || 'page', |
| | | tooltip: '数据源选择分页时有效。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'page', label: '页码'}, |
| | | {value: 'switch', label: '左右切换', forbid: appType === 'mob'}, |
| | | {value: 'slide', label: '滑动加载', forbid: appType !== 'mob'}, |
| | | ], |
| | | forbid: !(subtype === 'datacard' || (subtype === 'tablecard' && appType === 'mob')) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'cardType', |
| | | label: '数据选择', |
| | | initval: wrap.cardType || '', |
| | | required: false, |
| | | options: [ |
| | | {value: '', label: '不可选'}, |
| | | {value: 'radio', label: '单选'}, |
| | | {value: 'checkbox', label: '多选', forbid: subtype === 'propcard'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'checkAll', values: ['checkbox']} |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'checkAll', |
| | | label: '全选', |
| | | initval: wrap.checkAll || 'hidden', |
| | | required: false, |
| | | options: [ |
| | | {value: 'hidden', label: '隐藏'}, |
| | | {value: 'show', label: '显示'}, |
| | | ], |
| | | forbid: subtype !== 'datacard' || appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'cardFloat', |
| | | label: '对齐方式', |
| | | initval: wrap.cardFloat || 'left', |
| | | tooltip: '设置为居中对齐或右对齐,只在卡片为1行时有效。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'left', label: '左对齐'}, |
| | | {value: 'center', label: '居中'}, |
| | | {value: 'right', label: '右对齐'}, |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'scale', |
| | | label: '放大效果', |
| | | initval: wrap.scale || 'false', |
| | | tooltip: '鼠标悬浮于卡片上方时,卡片放大1.05倍。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | forbid: subtype === 'tablecard' || appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'printType', |
| | | label: '组件类型', |
| | | initval: wrap.printType || 'content', |
| | | tooltip: '选择类型为《页眉/页脚》时,打印的每页里都会带有该组件。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'content', label: '内容'}, |
| | | {value: 'headerOrfooter', label: '页眉/页脚'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' || MenuType !== 'billPrint' |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | field: 'blacklist', |
| | | label: '黑名单', |
| | | initval: wrap.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | }, |
| | | ] |
| | | |
| | | return cardWrapForm.map(item => { |
| | | if (['pagestyle', 'cardType'].includes(item.field)) { |
| | | item.options = item.options.filter(option => !option.forbid) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import getWrapForm from '../data-card/options' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const WrapComponent = asyncIconComponent(() => import('../data-card/wrapsetting')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardComponent = asyncComponent(() => import('../cardcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/components/paste')) |
| | | const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) |
| | |
| | | this.props.updateConfig(_card) |
| | | } |
| | | |
| | | addCard = () => { |
| | | addCard = (copy) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let newcard = {} |
| | | |
| | | let newcard = { |
| | | if (copy) { // 粘贴 |
| | | newcard = copy |
| | | } else { |
| | | newcard = { |
| | | uuid: Utils.getuuid(), |
| | | setting: { width: 6, type: 'simple'}, |
| | | style: { |
| | |
| | | elem.uuid = Utils.getuuid() |
| | | return elem |
| | | }) |
| | | } |
| | | } |
| | | |
| | | card.subcards.push(newcard) |
| | |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | pasteComponent = (res, resolve) => { |
| | | const { appType } = this.state |
| | | |
| | | delete res.copyType |
| | | delete res.$cardType |
| | | |
| | | res.uuid = Utils.getuuid() |
| | | res.setting = res.setting || {} |
| | | res.setting.width = res.setting.width || 6 |
| | | |
| | | let copyBtns = [] |
| | | let mobtypes = ['pop', 'prompt', 'exec', 'innerpage'] |
| | | |
| | | let elements = [] |
| | | res.elements && res.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') { |
| | | cell.uuid = Utils.getuuid() |
| | | elements.push(cell) |
| | | } else if (appType === 'mob' && !mobtypes.includes(cell.OpenType)) { |
| | | return |
| | | } else { |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.push(_cell) |
| | | } |
| | | |
| | | cell.uuid = _uuid |
| | | elements.push(cell) |
| | | } |
| | | }) |
| | | |
| | | res.elements = elements |
| | | |
| | | let backElements = [] |
| | | |
| | | if (appType !== 'mob') { |
| | | res.backElements && res.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') { |
| | | cell.uuid = Utils.getuuid() |
| | | backElements.push(cell) |
| | | } else if (appType === 'mob' && !mobtypes.includes(cell.OpenType)) { |
| | | return |
| | | } else { |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.push(_cell) |
| | | } |
| | | |
| | | cell.uuid = _uuid |
| | | backElements.push(cell) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | res.backElements = backElements |
| | | |
| | | if (copyBtns.length > 0) { |
| | | MKEmitter.emit('copyButtons', copyBtns) |
| | | } |
| | | |
| | | resolve({status: true}) |
| | | |
| | | this.addCard(res) |
| | | } |
| | | |
| | | getWrapForms = () => { |
| | | const { card } = this.state |
| | | |
| | | return getWrapForm(card.wrap, card.subtype) |
| | | } |
| | | |
| | | updateWrap = (res) => { |
| | | this.updateComponent({...this.state.card, wrap: res}) |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | |
| | | <NormalHeader defaultshow="hidden" config={card} updateComponent={this.updateComponent}/> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="plus" title="添加卡片" onClick={this.addCard} type="plus" /> |
| | | <WrapComponent config={card} updateConfig={this.updateComponent} /> |
| | | <Icon className="plus" title="添加卡片" onClick={() => this.addCard()} type="plus" /> |
| | | <NormalForm title="属性卡设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="propcard" card={card}/> |
| | | <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} /> |
| | | <PasteComponent options={['cardcell']} updateConfig={this.pasteComponent} /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import getWrapForm from '../data-card/options' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const WrapComponent = asyncIconComponent(() => import('../data-card/wrapsetting')) |
| | | const CardComponent = asyncComponent(() => import('./cardcomponent')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardSimpleComponent = asyncComponent(() => import('../cardsimplecomponent')) |
| | | const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/components/paste')) |
| | | const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) |
| | |
| | | this.props.updateConfig(_card) |
| | | } |
| | | |
| | | addCard = () => { |
| | | addCard = (copy) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let newcard = {} |
| | | |
| | | let newcard = { |
| | | if (copy) { // 粘贴 |
| | | newcard = copy |
| | | } else { |
| | | newcard = { |
| | | uuid: Utils.getuuid(), |
| | | setting: { width: 6, type: 'simple'}, |
| | | style: { |
| | |
| | | return elem |
| | | }) |
| | | } |
| | | } |
| | | |
| | | card.subcards.push(newcard) |
| | | |
| | |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | addSearch = () => { |
| | | addSearch = (copy) => { |
| | | const { card } = this.state |
| | | |
| | | let newcard = {} |
| | | |
| | | if (copy) { |
| | | newcard = copy |
| | | newcard.focus = true |
| | | } else { |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | |
| | | newcard.orderType = 'asc' |
| | | newcard.display = 'dropdown' |
| | | newcard.match = '=' |
| | | } |
| | | |
| | | // 注册事件-添加搜索 |
| | | MKEmitter.emit('addSearch', card.uuid, newcard) |
| | |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | getWrapForms = () => { |
| | | const { card } = this.state |
| | | |
| | | return getWrapForm(card.wrap, card.subtype) |
| | | } |
| | | |
| | | updateWrap = (res) => { |
| | | this.updateComponent({...this.state.card, wrap: res}) |
| | | } |
| | | |
| | | pasteComponent = (res, resolve) => { |
| | | const { card, appType } = this.state |
| | | |
| | | let type = res.copyType |
| | | delete res.copyType |
| | | |
| | | if (type === 'cardcell') { |
| | | res.uuid = Utils.getuuid() |
| | | res.setting = res.setting || {} |
| | | res.setting.width = res.setting.width || 6 |
| | | |
| | | let copyBtns = [] |
| | | let mobtypes = ['pop', 'prompt', 'exec', 'innerpage'] |
| | | |
| | | let elements = [] |
| | | res.elements && res.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') { |
| | | cell.uuid = Utils.getuuid() |
| | | elements.push(cell) |
| | | } else if (appType === 'mob' && !mobtypes.includes(cell.OpenType)) { |
| | | return |
| | | } else { |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.push(_cell) |
| | | } |
| | | |
| | | cell.uuid = _uuid |
| | | elements.push(cell) |
| | | } |
| | | }) |
| | | |
| | | res.elements = elements |
| | | |
| | | delete res.$cardType |
| | | delete res.backElements |
| | | |
| | | if (copyBtns.length > 0) { |
| | | MKEmitter.emit('copyButtons', copyBtns) |
| | | } |
| | | |
| | | resolve({status: true}) |
| | | |
| | | this.addCard(res) |
| | | } else if (type === 'search' || type === 'form') { |
| | | if (appType === 'mob') { |
| | | resolve({status: false, message: '移动端数据卡不支持添加搜索条件。'}) |
| | | } else { |
| | | res.uuid = Utils.getuuid() |
| | | let keys = card.search.map(item => item.field.toLowerCase()) |
| | | |
| | | if (type === 'form') { |
| | | if (['number', 'switch', 'textarea', 'fileupload', 'hint', 'color', 'funcvar'].includes(res.type)) { |
| | | res.type = 'text' |
| | | } else if (res.type === 'radio') { |
| | | res.type = 'select' |
| | | } else if (res.type === 'checkbox') { |
| | | res.type = 'multiselect' |
| | | } else if (res.type === 'datetime') { |
| | | res.type = 'date' |
| | | } |
| | | } |
| | | |
| | | if (res.field && keys.includes(res.field.toLowerCase())) { |
| | | resolve({status: false, message: '搜索字段已存在!'}) |
| | | return |
| | | } |
| | | |
| | | resolve({status: true}) |
| | | |
| | | this.addSearch(res) |
| | | } |
| | | } |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | |
| | | <NormalHeader config={card} updateComponent={this.updateComponent}/> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="plus" title="添加卡片" onClick={this.addCard} type="plus" /> |
| | | {appType !== 'mob' ? <Icon className="plus" title="添加搜索" onClick={this.addSearch} type="plus-circle" /> : null} |
| | | <WrapComponent config={card} updateConfig={this.updateComponent} /> |
| | | <Icon className="plus" title="添加卡片" onClick={() => this.addCard()} type="plus" /> |
| | | {appType !== 'mob' ? <Icon className="plus" title="添加搜索" onClick={() => this.addSearch()} type="plus-circle" /> : null} |
| | | <NormalForm title="表格设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="tablecard" card={card}/> |
| | | <PasteComponent config={card} options={['cardcell', 'search', 'form']} updateConfig={this.updateComponent} /> |
| | | <PasteComponent options={['cardcell', 'search', 'form']} updateConfig={this.pasteComponent} /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> |
| | | <UserComponent config={card}/> |
| | |
| | | <Icon type="tool" /> |
| | | </Popover> |
| | | <div style={{minHeight: 'calc(100% - 90px)'}}> |
| | | {card.subcards.map(subcard => (<CardComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} move={this.move} deleteElement={this.deleteCard}/>))} |
| | | {card.subcards.map(subcard => (<CardSimpleComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} move={this.move} deleteElement={this.deleteCard}/>))} |
| | | </div> |
| | | {card.setting.laypage === 'true' && card.wrap.pagestyle !== 'slide' && appType !== 'mob' ? <Pagination size="small" total={50} /> : null} |
| | | {card.setting.laypage === 'true' && card.wrap.pagestyle !== 'slide' && appType === 'mob' ? <MobPagination /> : null} |
| | |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import getWrapForm from './options' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const WrapComponent = asyncIconComponent(() => import('./wrapsetting')) |
| | | const CardComponent = asyncComponent(() => import('../cardcomponent')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) |
| | | const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | |
| | | } |
| | | } |
| | | |
| | | getWrapForms = () => { |
| | | const { card } = this.state |
| | | |
| | | return getWrapForm(card.wrap, card.subtype) |
| | | } |
| | | |
| | | updateWrap = (res) => { |
| | | this.updateComponent({...this.state.card, wrap: res}) |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | |
| | | <div className="menu-data-carousel-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <WrapComponent config={card} updateConfig={this.updateComponent}/> |
| | | <NormalForm title="轮播-动态数据" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="datacard" card={card}/> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors"/> |
| | | <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog}/> |
| | |
| | | } trigger="hover"> |
| | | <Icon type="tool"/> |
| | | </Popover> |
| | | <CardComponent cards={card} card={card.subcards[0]} updateElement={this.updateCard} deleteElement={this.deleteCard}/> |
| | | <CardSimpleComponent cards={card} card={card.subcards[0]} updateElement={this.updateCard} deleteElement={this.deleteCard}/> |
| | | </div> |
| | | ) |
| | | } |
New file |
| | |
| | | /** |
| | | * @description Wrap表单配置信息 |
| | | */ |
| | | export default function (wrap, subtype) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | const cardWrapForm = [ |
| | | { |
| | | type: 'text', |
| | | field: 'name', |
| | | label: '组件名称', |
| | | initval: wrap.name || '', |
| | | tooltip: '用于组件间的区分。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'width', |
| | | label: '宽度', |
| | | initval: wrap.width || 24, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'datatype', |
| | | label: '数据来源', |
| | | initval: wrap.datatype || 'dynamic', |
| | | tooltip: '选择静态值,无需配置数据源。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'dynamic', label: '动态'}, |
| | | {value: 'static', label: '静态'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'autoplay', |
| | | label: '自动切换', |
| | | initval: wrap.autoplay || 'false', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '否'}, |
| | | {value: 'true', label: '是'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'speed', |
| | | label: '时间间隔', |
| | | initval: wrap.speed || 3, |
| | | tooltip: '使用自动切换时有效,默认为3秒', |
| | | min: 1, |
| | | max: 100, |
| | | precision: 0, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'dots', |
| | | label: '指示点', |
| | | initval: wrap.dots || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '显示'}, |
| | | {value: 'false', label: '隐藏'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'vertical', |
| | | label: '垂直显示', |
| | | initval: wrap.vertical || 'false', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | forbid: appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'dotPosition', |
| | | label: '指示点位置', |
| | | initval: wrap.dotPosition || 'bottom', |
| | | required: false, |
| | | options: [ |
| | | {value: 'top', label: '上'}, |
| | | {value: 'bottom', label: '下'}, |
| | | {value: 'left', label: '左'}, |
| | | {value: 'right', label: '右'}, |
| | | ], |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'effect', |
| | | label: '动画效果', |
| | | initval: wrap.effect || 'scrollx', |
| | | required: false, |
| | | options: [ |
| | | {value: 'scrollx', label: '切换'}, |
| | | {value: 'fade', label: '渐显'}, |
| | | ], |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | field: 'blacklist', |
| | | label: '黑名单', |
| | | initval: wrap.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | }, |
| | | ] |
| | | |
| | | return cardWrapForm |
| | | } |
| | |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import getWrapForm from '../data-card/options' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const WrapComponent = asyncIconComponent(() => import('../data-card/wrapsetting')) |
| | | const CardComponent = asyncComponent(() => import('../cardcomponent')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) |
| | | const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | getWrapForms = () => { |
| | | const { card } = this.state |
| | | |
| | | return getWrapForm(card.wrap, card.subtype) |
| | | } |
| | | |
| | | updateWrap = (res) => { |
| | | this.updateComponent({...this.state.card, wrap: res}) |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="plus" title="添加卡片" onClick={this.addCard} type="plus" /> |
| | | <WrapComponent config={card} updateConfig={this.updateComponent} /> |
| | | <NormalForm title="轮播-静态数据" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="propcard" card={card}/> |
| | | <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | |
| | | <Icon type="tool" /> |
| | | </Popover> |
| | | {card.subcards.length > 0 ? <Carousel dotPosition={card.wrap.dotPosition || 'bottom'} effect={card.wrap.effect || 'scrollx'}> |
| | | {card.subcards.map((subcard) => (<CardComponent key={subcard.uuid} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | {card.subcards.map((subcard) => (<CardSimpleComponent key={subcard.uuid} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | </Carousel> : null} |
| | | </div> |
| | | ) |
| | |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.popClose = 'never' |
| | | newcard.errorTime = 10 |
| | | newcard.verify = null |
| | | newcard.show = 'icon' |
| | | |
| | |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.popClose = 'never' |
| | | newcard.errorTime = 10 |
| | | newcard.verify = null |
| | | newcard.show = 'icon' |
| | | |
| | |
| | | newcard.interface = card.setting.interface || '' |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.errorTime = 10 |
| | | newcard.verify = null |
| | | newcard.show = 'button' |
| | | newcard.style = {marginRight: '15px'} |
| | |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.errorTime || 10 |
| | | duration: 10 |
| | | }) |
| | | } else if (res.ErrCode === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.errorTime || 10 |
| | | duration: 10 |
| | | }) |
| | | } else if (res.ErrCode === 'NM') { |
| | | message.error(res.message || res.ErrMesg) |
| | |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | icon: 'plus', |
| | | class: 'green', |
| | |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | icon: 'form', |
| | | class: 'purple', |
| | |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'prompt', |
| | | icon: 'delete', |
| | | class: 'red', |
| | |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.popClose = 'never' |
| | | newcard.errorTime = 15 |
| | | newcard.verify = null |
| | | } |
| | | |
| | |
| | | Ot: 'notRequired', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'exec', |
| | | icon: '', |
| | | class: 'border-primary', |
| | |
| | | label: '关闭', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'exec', |
| | | pageTemplate: '', |
| | | url: '', |
| | |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.popClose = 'never' |
| | | newcard.errorTime = 10 |
| | | newcard.verify = null |
| | | |
| | | if (item.subType === 'excelIn') { |
| | |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | icon: 'plus', |
| | | class: 'green', |
| | |
| | | position: 'grid', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | icon: 'form', |
| | | class: 'purple', |
| | |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'prompt', |
| | | icon: 'delete', |
| | | class: 'red', |
| | |
| | | } |
| | | |
| | | delButtons = (items) => { |
| | | const { copyButtons } = this.state |
| | | |
| | | this.setState({ |
| | | delButtons: [...this.state.delButtons, ...items], |
| | | copyButtons: copyButtons.filter(item => !items.includes(item.uuid)) |
| | | }) |
| | | this.setState({ delButtons: [...this.state.delButtons, ...items] }) |
| | | } |
| | | |
| | | copyButtons = (items) => { |
| | |
| | | } |
| | | |
| | | delButtons = (items) => { |
| | | const { copyButtons, delButtons } = this.state |
| | | |
| | | this.setState({ |
| | | delButtons: [...delButtons, ...items], |
| | | copyButtons: copyButtons.filter(item => !items.includes(item.uuid)) |
| | | }) |
| | | this.setState({ delButtons: [...this.state.delButtons, ...items] }) |
| | | } |
| | | |
| | | copyButtons = (items) => { |