| | |
| | | 'use strict'; |
| | | // 'use strict'; |
| | | |
| | | const fs = require('fs'); |
| | | const isWsl = require('is-wsl'); |
| | |
| | | const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin'); |
| | | const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin'); |
| | | const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); |
| | | const eslint = require('eslint'); |
| | | // const eslint = require('eslint'); |
| | | |
| | | const postcssNormalize = require('postcss-normalize'); |
| | | |
| | |
| | | "dependencies": { |
| | | "immutable": { |
| | | "version": "3.7.6", |
| | | "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.7.6.tgz", |
| | | "resolved": "http://registry.npm.taobao.org/immutable/download/immutable-3.7.6.tgz", |
| | | "integrity": "sha1-E7TTyxK++hVIKib+Gy665kAHHks=" |
| | | } |
| | | } |
| | |
| | | } |
| | | }, |
| | | "caniuse-lite": { |
| | | "version": "1.0.30001102", |
| | | "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001102.tgz", |
| | | "integrity": "sha512-fOjqRmHjRXv1H1YD6QVLb96iKqnu17TjcLSaX64TwhGYed0P1E1CCWZ9OujbbK4Z/7zax7zAzvQidzdtjx8RcA==" |
| | | "version": "1.0.30001191", |
| | | "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001191.tgz", |
| | | "integrity": "sha512-xJJqzyd+7GCJXkcoBiQ1GuxEiOBCLQ0aVW9HMekifZsAVGdj5eJ4mFB9fEhSHipq9IOk/QXFJUiIr9lZT+EsGw==" |
| | | }, |
| | | "capture-exit": { |
| | | "version": "2.0.0", |
| | |
| | | "braft-extensions": "^0.1.1", |
| | | "browserslist": "^4.13.0", |
| | | "camelcase": "^5.2.0", |
| | | "caniuse-lite": "^1.0.30001102", |
| | | "case-sensitive-paths-webpack-plugin": "2.2.0", |
| | | "codemirror": "^5.52.2", |
| | | "css-loader": "2.1.1", |
| | |
| | | .ant-table-thead > tr > th .ant-table-column-sorter .ant-table-column-sorter-inner .ant-table-column-sorter-up.on, .ant-table-thead > tr > th .ant-table-column-sorter .ant-table-column-sorter-inner .ant-table-column-sorter-down.on { |
| | | color: $color6; |
| | | } |
| | | .mk-water-mark { |
| | | color: $color4; |
| | | } |
| | | } |
| | | |
| | | body.hidden-split-line #root { // 去除登录页分割线 |
| | |
| | | import { modifyTabview, toggleIsiframe } from '@/store/action' |
| | | import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import NotFount from '@/components/404' |
| | | import options from '@/store/options.js' |
| | | import mzhCN from '@/locales/zh-CN/main.js' |
| | | import menUS from '@/locales/en-US/main.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | </div> |
| | | </div> |
| | | </BackTop> |
| | | {options.sysType === 'local' && window.GLOB.systemType !== 'production' ? <div className="mk-water-mark">测试系统</div> : null} |
| | | </Tabs.TabPane> |
| | | ) |
| | | })} |
| | |
| | | bottom: 20px; |
| | | right: 30px; |
| | | } |
| | | .mk-water-mark { |
| | | position: absolute; |
| | | top: 47px; |
| | | left: 5px; |
| | | font-size: 13px; |
| | | font-style: italic; |
| | | } |
| | | } |
| | | .mk-tabview-wrap.collapsed { |
| | | max-width: calc(100% - 80px); |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { connect } from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Popover, Modal, Pagination, notification } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Utils from '@/utils/utils.js' |
| | | 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 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 NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) |
| | | const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) |
| | | |
| | | const { confirm } = Modal |
| | | |
| | | class DataCardEditComponent extends Component { |
| | | static propTpyes = { |
| | | card: PropTypes.object, |
| | | deletecomponent: PropTypes.func, |
| | | updateConfig: PropTypes.func, |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | card: null, |
| | | back: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { card } = this.props |
| | | |
| | | if (card.isNew) { |
| | | let _card = { |
| | | uuid: card.uuid, |
| | | type: card.type, |
| | | floor: card.floor, |
| | | tabId: card.tabId || '', |
| | | parentId: card.parentId || '', |
| | | format: 'array', // 组件属性 - 数据格式 |
| | | pageable: true, // 组件属性 - 是否可分页 |
| | | switchable: true, // 组件属性 - 数据是否可切换 |
| | | dataName: card.dataName || '', |
| | | width: card.width || 24, |
| | | name: card.name, |
| | | subtype: card.subtype, |
| | | setting: { interType: 'system' }, |
| | | wrap: { name: card.name, width: card.width || 24, title: '', pagestyle: 'page', switch: 'false' }, |
| | | style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' }, |
| | | headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' }, |
| | | columns: [], |
| | | scripts: [], |
| | | action: [], |
| | | search: [], |
| | | btnlog: [], |
| | | subcards: [{ |
| | | uuid: Utils.getuuid(), |
| | | setting: { width: 6, type: 'simple'}, |
| | | style: { |
| | | borderWidth: '1px', borderColor: '#e8e8e8', |
| | | paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px', |
| | | marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' |
| | | }, |
| | | backStyle: {}, |
| | | elements: [], |
| | | backElements: [] |
| | | }] |
| | | } |
| | | |
| | | if (card.config) { |
| | | let config = fromJS(card.config).toJS() |
| | | |
| | | _card.wrap = config.wrap |
| | | _card.wrap.name = card.name |
| | | _card.style = config.style |
| | | _card.headerStyle = config.headerStyle |
| | | |
| | | _card.subcards = config.subcards.map(scard => { |
| | | scard.uuid = Utils.getuuid() |
| | | scard.elements = scard.elements.map(elem => { |
| | | elem.uuid = Utils.getuuid() |
| | | return elem |
| | | }) |
| | | scard.backElements = scard.backElements.map(elem => { |
| | | elem.uuid = Utils.getuuid() |
| | | return elem |
| | | }) |
| | | return scard |
| | | }) |
| | | _card.action = config.action.map(col => { |
| | | col.uuid = Utils.getuuid() |
| | | return col |
| | | }) |
| | | _card.search = config.search.map(col => { |
| | | col.uuid = Utils.getuuid() |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | card: _card |
| | | }) |
| | | this.props.updateConfig(_card) |
| | | } else { |
| | | card.action = card.action || [] // 兼容 |
| | | card.search = card.search || [] // 兼容 |
| | | |
| | | this.setState({ |
| | | card: fromJS(card).toJS() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('submitModal', this.handleSave) |
| | | MKEmitter.addListener('logButton', this.logButton) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) || (!this.props.menu && nextProps.menu) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | MKEmitter.removeListener('submitModal', this.handleSave) |
| | | MKEmitter.removeListener('logButton', this.logButton) |
| | | } |
| | | |
| | | logButton = (id, item) => { |
| | | const { card } = this.state |
| | | |
| | | if (id !== card.uuid) return |
| | | |
| | | let btnlog = card.btnlog || [] |
| | | btnlog.push(item) |
| | | |
| | | this.setState({ |
| | | card: {...card, btnlog} |
| | | }) |
| | | this.props.updateConfig({...card, btnlog}) |
| | | } |
| | | |
| | | /** |
| | | * @description 卡片行外层信息更新(数据源,样式等) |
| | | */ |
| | | updateComponent = (component) => { |
| | | this.setState({ |
| | | card: component |
| | | }) |
| | | |
| | | component.width = component.wrap.width |
| | | component.name = component.wrap.name |
| | | |
| | | this.props.updateConfig(component) |
| | | } |
| | | |
| | | /** |
| | | * @description 单个卡片信息更新 |
| | | */ |
| | | updateCard = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | |
| | | card.subcards = card.subcards.map(item => { |
| | | if (item.uuid === cell.uuid) return cell |
| | | return item |
| | | }) |
| | | |
| | | this.setState({card}) |
| | | |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | /** |
| | | * @description 单个卡片信息更新 |
| | | */ |
| | | deleteCard = (cell) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | let _this = this |
| | | |
| | | confirm({ |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | let uuids = [] |
| | | cell.elements && cell.elements.forEach(c => { |
| | | if (c.eleType === 'button') { |
| | | uuids.push(c.uuid) |
| | | } |
| | | }) |
| | | cell.backElements && cell.backElements.forEach(c => { |
| | | if (c.eleType === 'button') { |
| | | uuids.push(c.uuid) |
| | | } |
| | | }) |
| | | MKEmitter.emit('delButtons', uuids) |
| | | |
| | | if (card.btnlog) { |
| | | card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) |
| | | } |
| | | |
| | | _this.setState({card}) |
| | | _this.props.updateConfig(card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin'], card.style) |
| | | } |
| | | |
| | | getStyle = (comIds, style) => { |
| | | const { card } = this.state |
| | | |
| | | if (comIds.length !== 1 || comIds[0] !== card.uuid) return |
| | | |
| | | let _card = {...card, style} |
| | | |
| | | this.setState({ |
| | | card: _card |
| | | }) |
| | | |
| | | this.props.updateConfig(_card) |
| | | } |
| | | |
| | | addSearch = () => { |
| | | const { card } = this.state |
| | | |
| | | let newcard = {} |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | | newcard.label = 'label' |
| | | newcard.type = 'select' |
| | | newcard.resourceType = '0' |
| | | newcard.options = [] |
| | | newcard.setAll = 'false' |
| | | newcard.orderType = 'asc' |
| | | newcard.display = 'dropdown' |
| | | newcard.match = '=' |
| | | |
| | | // 注册事件-添加搜索 |
| | | MKEmitter.emit('addSearch', card.uuid, newcard) |
| | | } |
| | | |
| | | addButton = () => { |
| | | const { card } = this.state |
| | | |
| | | let newcard = {} |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | | newcard.label = 'label' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = 'pop' |
| | | newcard.icon = '' |
| | | newcard.class = 'green' |
| | | newcard.intertype = card.setting.interType || 'system' |
| | | newcard.innerFunc = card.setting.innerFunc || '' |
| | | newcard.sysInterface = card.setting.sysInterface || '' |
| | | newcard.outerFunc = card.setting.outerFunc || '' |
| | | newcard.interface = card.setting.interface || '' |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.verify = null |
| | | newcard.show = 'button' |
| | | newcard.btnstyle = {marginRight: '15px'} |
| | | |
| | | // 注册事件-添加按钮 |
| | | MKEmitter.emit('addButton', card.uuid, newcard) |
| | | } |
| | | |
| | | setSubConfig = (item) => { |
| | | const { card } = this.state |
| | | let btn = fromJS(item).toJS() |
| | | |
| | | if (btn.OpenType === 'pop') { |
| | | if (!btn.modal) { |
| | | btn.modal = { |
| | | setting: { title: btn.label, width: 60, cols: '2', container: 'view', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' }, |
| | | tables: [], |
| | | groups: [], |
| | | fields: [] |
| | | } |
| | | } |
| | | MKEmitter.emit('changeModal', card, btn) |
| | | } else if (btn.OpenType === 'popview') { |
| | | MKEmitter.emit('changePopview', card, btn) |
| | | } |
| | | } |
| | | |
| | | handleSave = (_cards, btn, modal) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | |
| | | if (card.uuid !== _cards.uuid) return |
| | | |
| | | let _index = card.action.findIndex(cell => cell.uuid === btn.uuid) |
| | | |
| | | if (_index === -1) return |
| | | |
| | | card.action = card.action.map(cell => { |
| | | if (cell.uuid === btn.uuid) { |
| | | cell.modal = modal |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | |
| | | this.setState({card}) |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | handleLog = (type, logs, item) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | |
| | | if (type === 'revert') { |
| | | let done = false |
| | | if (item.$parentId) { |
| | | card.subcards.forEach(col => { |
| | | if (item.$parentId === col.uuid) { |
| | | if (item.$side !== 'back') { |
| | | col.elements = col.elements ? [...col.elements, item] : [item] |
| | | } else { |
| | | col.backElements = col.backElements ? [...col.backElements, item] : [item] |
| | | } |
| | | done = true |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (!done) { |
| | | card.action = card.action ? [...card.action, item] : [item] |
| | | } |
| | | |
| | | card.btnlog = logs |
| | | |
| | | this.setState({ card }) |
| | | this.props.updateConfig(card) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '恢复成功!', |
| | | duration: 2 |
| | | }) |
| | | } else { |
| | | card.btnlog = logs |
| | | this.setState({ card }) |
| | | this.props.updateConfig(card) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '清除成功!', |
| | | duration: 2 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | | MKEmitter.emit('clickComponent', this.state.card) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { card } = this.state |
| | | |
| | | let offset = 0 |
| | | if (card.wrap.cardFloat && card.wrap.cardFloat !== 'left') { |
| | | let _width = 0 |
| | | card.subcards.forEach(card => { |
| | | _width += card.setting.width |
| | | }) |
| | | offset = _width < 24 ? 24 - _width : 0 |
| | | if (card.wrap.cardFloat === 'center') { |
| | | offset = Math.floor(offset / 2) |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div className="menu-data-card-edit-box" style={{...card.style}} onClick={this.clickComponent} id={card.uuid}> |
| | | <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.addSearch} type="plus-circle" /> |
| | | <Icon className="plus" title="添加按钮" onClick={this.addButton} type="plus-square" /> |
| | | <WrapComponent config={card} updateConfig={this.updateComponent} /> |
| | | <CopyComponent type="datacard" card={card}/> |
| | | <PasteComponent config={card} options={['action', 'search', 'form']} updateConfig={this.updateComponent} /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> |
| | | <UserComponent config={card}/> |
| | | <Icon className="close" title="删除组件" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | | <SettingComponent config={card} updateConfig={this.updateComponent} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <Icon type="tool" /> |
| | | </Popover> |
| | | <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> |
| | | {card.subcards.map((subcard, index) => (<CardComponent key={subcard.uuid} offset={!index ? offset : 0} cards={card} card={subcard} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | <div style={{clear: 'both'}}></div> |
| | | {card.wrap.pagestyle !== 'switch' && card.setting.laypage === 'true' ? <Pagination total={85} size="small" showTotal={total => `共 ${total} 条`} pageSize={20} defaultCurrent={1}/> : null} |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | menu: state.customMenu |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(DataCardEditComponent) |
New file |
| | |
| | | .menu-data-card-edit-box { |
| | | position: relative; |
| | | box-sizing: border-box; |
| | | background: #ffffff; |
| | | background-position: center center; |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | min-height: 20px; |
| | | |
| | | .card-control { |
| | | position: absolute; |
| | | top: 0px; |
| | | left: 0px; |
| | | .anticon-tool { |
| | | right: auto; |
| | | left: 1px; |
| | | padding: 1px; |
| | | } |
| | | } |
| | | .anticon-tool { |
| | | position: absolute; |
| | | z-index: 2; |
| | | font-size: 16px; |
| | | right: 1px; |
| | | top: 1px; |
| | | cursor: pointer; |
| | | padding: 5px; |
| | | background: rgba(255, 255, 255, 0.55); |
| | | } |
| | | |
| | | .card-item { |
| | | overflow: hidden; |
| | | position: relative; |
| | | background-color: #ffffff; |
| | | background-position: center center; |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | min-height: 20px; |
| | | } |
| | | |
| | | .card-item:hover { |
| | | box-shadow: 0px 0px 2px #1890ff; |
| | | } |
| | | |
| | | .model-menu-card-cell-list .card-detail-row > .anticon-plus { |
| | | position: absolute; |
| | | right: -30px; |
| | | font-size: 16px; |
| | | } |
| | | .model-menu-action-list { |
| | | line-height: 40px; |
| | | .ant-row > .anticon-plus { |
| | | position: absolute; |
| | | right: -30px; |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | .card-add-button { |
| | | text-align: right; |
| | | clear: left; |
| | | .anticon-plus { |
| | | font-size: 20px; |
| | | color: #26C281; |
| | | padding: 5px; |
| | | margin-right: 10px; |
| | | } |
| | | } |
| | | .ant-pagination { |
| | | float: right; |
| | | margin: 10px; |
| | | } |
| | | |
| | | .model-menu-action-list { |
| | | .page-card { |
| | | line-height: 55px; |
| | | } |
| | | } |
| | | } |
| | | .menu-data-card-edit-box::after { |
| | | display: block; |
| | | content: ' '; |
| | | clear: both; |
| | | } |
| | | .menu-data-card-edit-box:hover { |
| | | z-index: 1; |
| | | box-shadow: 0px 0px 4px #1890ff; |
| | | } |
New file |
| | |
| | | import React from 'react' |
| | | import { useDrag } from 'react-dnd' |
| | | import { Icon } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const MobSourceElement = ({item, triggerDel}) => { |
| | | const [, drag] = useDrag({ item }) |
| | | return ( |
| | | <div className="menu-source-item"> |
| | | <div className="property"><span>{item.title}</span>{item.config ? <Icon onClick={() => triggerDel(item)} type="close-circle" /> : null}</div> |
| | | <img ref={drag} src={item.url} alt=""/> |
| | | </div> |
| | | ) |
| | | } |
| | | export default MobSourceElement |
New file |
| | |
| | | .menu-source-item { |
| | | display: inline-block; |
| | | width: 100%; |
| | | margin-bottom: 15px; |
| | | height: auto; |
| | | min-height: 70px; |
| | | |
| | | .property { |
| | | font-size: 14px; |
| | | color: rgba(0, 0, 0, 0.65); |
| | | margin-bottom: 2px; |
| | | |
| | | .anticon-close-circle { |
| | | opacity: 0; |
| | | cursor: pointer; |
| | | padding: 0 3px; |
| | | color: #ff4d4f; |
| | | transition: all 0.3s; |
| | | } |
| | | } |
| | | |
| | | img { |
| | | width: 100%; |
| | | cursor: move; |
| | | box-shadow: 0px 0px 1px #1890ff; |
| | | } |
| | | |
| | | .tooltip-block { |
| | | width: 100%; |
| | | height: 100%; |
| | | background: transparent; |
| | | } |
| | | } |
| | | |
| | | .menu-source-item:hover .property { |
| | | .anticon-close-circle { |
| | | opacity: 1; |
| | | } |
| | | } |
| | | |
| | | .menu-source-tooltip-box { |
| | | margin-left: 20px; |
| | | .ant-tooltip-content { |
| | | width: 250px; |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, notification } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import { menuOptions } from './option' |
| | | import SourceWrap from './dragsource' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | |
| | | class ModelSource extends Component { |
| | | state = { |
| | | menuOptions: null, |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { components } = this.props |
| | | let options = [] |
| | | |
| | | if (components) { |
| | | options = fromJS(components).toJS() |
| | | } else { |
| | | options = fromJS(menuOptions).toJS() |
| | | } |
| | | |
| | | this.setState({ |
| | | menuOptions: options |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.components && !is(fromJS(this.props.components), fromJS(nextProps.components))) { |
| | | this.setState({ |
| | | menuOptions: fromJS(nextProps.components).toJS() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | triggerDel = (item) => { |
| | | confirm({ |
| | | title: `确定删除<${item.title}>吗?`, |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.getSystemConfig({ |
| | | func: 's_custom_components_adduptdel', |
| | | c_id: item.uuid, |
| | | images: '', |
| | | c_name: item.title, |
| | | long_param: '', |
| | | del_type: 'Y' |
| | | }).then(result => { |
| | | if (result.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '删除成功!', |
| | | duration: 5 |
| | | }) |
| | | |
| | | MKEmitter.emit('updateCustomComponent') |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { menuOptions } = this.state |
| | | |
| | | return ( |
| | | <div className="mob-card-source-box"> |
| | | {menuOptions.map((item, index) => (<SourceWrap key={index} item={item} triggerDel={this.triggerDel} />))} |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default ModelSource |
New file |
| | |
| | | .mob-card-source-box { |
| | | padding: 20px 0px; |
| | | position: relative; |
| | | |
| | | p { |
| | | color: rgba(0, 0, 0, 0.85); |
| | | margin-bottom: 10px; |
| | | } |
| | | } |
New file |
| | |
| | | import bar from '@/assets/mobimg/bar.png' |
| | | import bar1 from '@/assets/mobimg/bar1.png' |
| | | import line from '@/assets/mobimg/line.png' |
| | | import line1 from '@/assets/mobimg/line1.png' |
| | | import tabs from '@/assets/mobimg/tabs.png' |
| | | import group from '@/assets/mobimg/group.png' |
| | | import card1 from '@/assets/mobimg/card1.png' |
| | | import card2 from '@/assets/mobimg/card2.png' |
| | | import TableCard from '@/assets/mobimg/table-card.png' |
| | | import NormalTable from '@/assets/mobimg/normal-table.png' |
| | | import Pie from '@/assets/mobimg/pie.png' |
| | | import Editor from '@/assets/mobimg/editor.png' |
| | | import SandBox from '@/assets/mobimg/sandbox.png' |
| | | import Pie1 from '@/assets/mobimg/ring.png' |
| | | import Pie2 from '@/assets/mobimg/nightingale.png' |
| | | import Mainsearch from '@/assets/mobimg/mainsearch.png' |
| | | |
| | | // 组件配置信息 |
| | | export const menuOptions = [ |
| | | { type: 'menu', url: tabs, component: 'tabs', subtype: 'tabs', title: '标签页', width: 24 }, |
| | | { type: 'menu', url: Mainsearch, component: 'search', subtype: 'mainsearch', title: '搜索条件', width: 24 }, |
| | | { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '数据卡', width: 24 }, |
| | | { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '属性卡', width: 24 }, |
| | | { type: 'menu', url: NormalTable, component: 'table', subtype: 'normaltable', title: '常用表', width: 24 }, |
| | | { type: 'menu', url: TableCard, component: 'table', subtype: 'tablecard', title: '表格', width: 12 }, |
| | | { type: 'menu', url: line, component: 'line', subtype: 'line', title: '折线图', width: 24 }, |
| | | { type: 'menu', url: line1, component: 'line', subtype: 'line1', title: '阶梯折线图', width: 24 }, |
| | | { type: 'menu', url: bar, component: 'bar', subtype: 'bar', title: '柱状图', width: 24 }, |
| | | { type: 'menu', url: bar1, component: 'bar', subtype: 'bar1', title: '条形图', width: 24 }, |
| | | { type: 'menu', url: Pie, component: 'pie', subtype: 'pie', title: '饼图', width: 12 }, |
| | | { type: 'menu', url: Pie1, component: 'pie', subtype: 'ring', title: '环图', width: 12 }, |
| | | { type: 'menu', url: Editor, component: 'editor', subtype: 'brafteditor', title: '富文本', width: 24 }, |
| | | { type: 'menu', url: SandBox, component: 'code', subtype: 'sandbox', title: '自定义', width: 24 }, |
| | | { type: 'menu', url: Pie2, component: 'pie', subtype: 'nightingale', title: '南丁格尔图', width: 12 }, |
| | | { type: 'menu', url: group, component: 'group', subtype: 'normalgroup', title: '分组', width: 24 }, |
| | | ] |
| | |
| | | import { fromJS } from 'immutable' |
| | | import { Spin, notification, Button, Table, Modal, ConfigProvider } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | import enUS from 'antd/es/locale/en_US' |
| | | import zhCN from 'antd/es/locale/zh_CN' |
| | | |
| | |
| | | confirmloading: true |
| | | }) |
| | | |
| | | let ID = '' |
| | | if (visible === 'edit') { |
| | | ID = selectApp.ID |
| | | } else { |
| | | ID = md5(window.GLOB.appkey + res.kei_no) |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_kei_addupt', |
| | | ID: visible === 'edit' ? selectApp.ID : Utils.getuuid(), |
| | | ID: ID, |
| | | exec_type: 'y', |
| | | remark: res.remark, |
| | | kei_no: res.kei_no, |
| | |
| | | let sublist = fromJS(selectApp.sublist).toJS() |
| | | if (subVisible === 'plus') { |
| | | sublist.unshift({ |
| | | ID: Utils.getuuid(), |
| | | ID: md5(window.GLOB.appkey + selectApp.kei_no + res.typename + res.lang), |
| | | ...res |
| | | }) |
| | | } else { |
| | |
| | | |
| | | const MenuForm = asyncComponent(() => import('./menuform')) |
| | | const MenuShell = asyncComponent(() => import('@/menu/menushell')) |
| | | const SourceWrap = asyncComponent(() => import('@/menu/modulesource')) |
| | | const SourceWrap = asyncComponent(() => import('@/pc/modulesource')) |
| | | const BgController = asyncComponent(() => import('@/pc/bgcontroller')) |
| | | const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) |
| | | const PaddingController = asyncComponent(() => import('@/pc/padcontroller')) |
| | |
| | | </Panel> |
| | | {/* 组件添加 */} |
| | | <Panel header={dict['mob.component']} key="component"> |
| | | <SourceWrap MenuType={'pc'} /> |
| | | <SourceWrap /> |
| | | </Panel> |
| | | {customComponents && customComponents.length ? <Panel header="自定义组件" key="cuscomponent"> |
| | | <SourceWrap components={customComponents} MenuType={'pc'} /> |
| | | <SourceWrap components={customComponents} /> |
| | | </Panel> : null} |
| | | <Panel header={'页面背景'} key="background"> |
| | | {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null} |