| | |
| | | state = { |
| | | dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS, |
| | | mainMenuList: null, // 一级菜单,编辑调整上级菜单时获取 |
| | | subMenulist: null, // 二级菜单 |
| | | subMenulist: [], // 二级菜单 |
| | | editMenu: null, // 编辑三级菜单时设置 |
| | | rootSubmenuKeys: null, |
| | | createThirdMenu: false, |
| | |
| | | async loadsubmenu (menu) { |
| | | if (!menu || !menu.MenuID) { // 没有主菜单时,清空下级菜单 |
| | | this.setState({ |
| | | subMenulist: null, |
| | | subMenulist: [], |
| | | rootSubmenuKeys: [], |
| | | openKeys: [], |
| | | editMenu: null |
| | |
| | | |
| | | if (result.data.length === 0) { // 查询菜单为空 |
| | | this.setState({ |
| | | subMenulist: null, |
| | | subMenulist: [], |
| | | rootSubmenuKeys: [], |
| | | openKeys: [] |
| | | }) |
| | |
| | | if (process.env.NODE_ENV === 'production') { // 用于校验是否存在开发权限 |
| | | window.GLOB.linkurl = window.location.href.split('#')[0] |
| | | } else { |
| | | window.GLOB.linkurl = 'http://qingqiumarket.cn/MKWMS/Index.html' |
| | | window.GLOB.linkurl = '' |
| | | } |
| | | |
| | | |
| | |
| | | if (!_LongParam) { |
| | | _config = fromJS(Source.baseConfig).toJS() |
| | | if (!menu.isSubtable) { // 不是选择主子表时,隐藏标签页 |
| | | _config.tabs = [] |
| | | _config.tabgroups = [{ uuid: 'tabs', sublist: [] }] |
| | | } |
| | | _config.isAdd = true |
| | | } else { |
| | |
| | | } |
| | | |
| | | // 配置默认值,兼容 |
| | | _config.tabs = _config.tabs || [] |
| | | _config.Template = 'CommonTable' |
| | | _config.easyCode = _config.easyCode || '' |
| | | |
| | |
| | | if (config.groups[0] && config.groups[0].sublist[0] && config.groups[0].sublist[0].origin) { |
| | | config.groups[0].sublist = config.groups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | } |
| | | config.tabgroups[0].sublist = config.tabgroups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | |
| | | let btnNames = config.action.map(item => item.label) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Tooltip, Modal, notification, Button } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | |
| | | if (nextProps.pasteContent && nextProps.pasteContent.copyType === 'action') { |
| | | this.setState({actionlist: [...actionlist, nextProps.pasteContent]}) |
| | | this.handleAction(nextProps.pasteContent) |
| | | } else if (!is(fromJS(nextProps.config.action), fromJS(this.props.config.action)) && !is(fromJS(nextProps.config.action), fromJS(actionlist))) { |
| | | this.setState({actionlist: fromJS(nextProps.config.action).toJS()}) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({actionlist: list}) |
| | | this.handleAction(card) |
| | | } else { |
| | | this.setState({actionlist: list}) |
| | | this.props.updateaction({...config, action: list}) |
| | | this.setState({actionlist: list}, () => { |
| | | this.props.updateaction({...config, action: list}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | actionlist: _actionlist, |
| | | copying: false, |
| | | visible: false |
| | | }, () => { |
| | | this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, copyActionId) |
| | | }) |
| | | |
| | | this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, copyActionId) |
| | | }) |
| | | }) |
| | | } |
| | |
| | | |
| | | _actionlist = _actionlist.filter(item => item.uuid !== card.uuid) |
| | | |
| | | _this.setState({ |
| | | actionlist: _actionlist |
| | | }) |
| | | |
| | | let _hasGridbtn = _actionlist.filter(act => act.position === 'grid').length > 0 |
| | | let _gridBtn = config.gridBtn ? fromJS(config.gridBtn).toJS() : null |
| | | |
| | |
| | | card: card |
| | | } |
| | | |
| | | _this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, '', delcard) |
| | | _this.setState({ |
| | | actionlist: _actionlist |
| | | }, () => { |
| | | _this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, '', delcard) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | this.setState({ |
| | | actionlist: _actionlist, |
| | | profVisible: false |
| | | }, () => { |
| | | this.props.updateaction({...config, action: _actionlist}) |
| | | }) |
| | | this.props.updateaction({...config, action: _actionlist}) |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | actionlist: _actionlist |
| | | }, () => { |
| | | this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}) |
| | | }) |
| | | |
| | | this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}) |
| | | }) |
| | | }) |
| | | }) |
| | |
| | | import Card from './card' |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, handleList, handleMenu, deleteMenu }) => { |
| | | const [cards, setCards] = useState(list) |
| | | const Container = ({cardObj, handleList, handleMenu, deleteMenu }) => { |
| | | const [cards, setCards] = useState(cardObj.details) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | | const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] }) |
| | |
| | | handleList(_cards) |
| | | } |
| | | |
| | | if (!is(fromJS(cards), fromJS(list))) { |
| | | setCards(list) |
| | | if (!is(fromJS(cards), fromJS(cardObj.details))) { |
| | | setCards(cardObj.details) |
| | | } |
| | | |
| | | const findCard = id => { |
| | |
| | | accept: 'detail' |
| | | }) |
| | | |
| | | let marginLeft = 0 |
| | | if (cardObj.subelement.includes('avatar')) { |
| | | marginLeft = 48 |
| | | } |
| | | |
| | | return ( |
| | | <div ref={drop} className="ant-card-meta-detail" style={{marginLeft: 48}}> |
| | | <div ref={drop} className="ant-card-meta-detail" style={{marginLeft: marginLeft}}> |
| | | {cards.map(card => ( |
| | | <Card |
| | | key={card.uuid} |
| | |
| | | render() { |
| | | const { card } = this.props |
| | | const { dict, visible, cardcell } = this.state |
| | | let _width = '100%' |
| | | if (card.actions.length > 0) { |
| | | _width = Math.floor((100 / card.actions.length) * 10000) / 10000 + '%' |
| | | } |
| | | |
| | | return ( |
| | | <div className="line-card-edit-box"> |
| | |
| | | className={'ant-card ant-card-bordered chart-card' + (card.widthType === 'ratio' ? ' ant-col ant-col-' + card.cardWidth : '')} |
| | | style={card.widthType === 'absolute' ? { width: card.cardWidth } : null} |
| | | > |
| | | <div className="ant-card-head"> |
| | | <div className="ant-card-head-wrapper"> |
| | | <div className="ant-card-head-title">Card Title</div> |
| | | <div className="ant-card-extra"> |
| | | <span>Action</span> |
| | | {card.subelement.includes('header') ? |
| | | <div className="ant-card-head"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editHeader} /> |
| | | <div className="ant-card-head-wrapper"> |
| | | <div className="ant-card-head-title">{card.header.title.content}</div> |
| | | <div className="ant-card-extra"> |
| | | <span>Action</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div className="ant-card-body"> |
| | | </div> : null |
| | | } |
| | | {card.subelement.includes('content') ? <div className="ant-card-body"> |
| | | <div className="ant-card-meta"> |
| | | <Icon type="plus" onClick={() => this.editdetail()} /> |
| | | {card.cardType === 'card2' ? <div className="ant-card-meta-avatar"> |
| | | <span className="ant-avatar ant-avatar-circle ant-avatar-image" style={{width: 32, height: 32}}> |
| | | <img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt=""/> |
| | | </span> |
| | | </div> : null } |
| | | {card.subelement.includes('avatar') ? |
| | | <div className="ant-card-meta-avatar"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editAvatar} /> |
| | | <span className="ant-avatar ant-avatar-circle ant-avatar-image" style={{width: 32, height: 32}}> |
| | | <img src={card.avatar.content || 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png'} alt=""/> |
| | | </span> |
| | | </div> : null |
| | | } |
| | | <DragDetail |
| | | list={card.details} |
| | | cardObj={card} |
| | | handleList={this.handleList} |
| | | handleMenu={this.editdetail} |
| | | deleteMenu={this.deletedetail} |
| | | /> |
| | | </div> |
| | | </div> |
| | | {card.cardType === 'card2' ? <ul className="ant-card-actions"> |
| | | <li style={{width: '33.3333%'}}> |
| | | <span> |
| | | <Icon type="setting"/> |
| | | </span> |
| | | </li> |
| | | <li style={{width: '33.3333%'}}> |
| | | <span> |
| | | <Icon type="edit"/> |
| | | </span> |
| | | </li> |
| | | <li style={{width: '33.3333%'}}> |
| | | <span> |
| | | <Icon type="edit"/> |
| | | </span> |
| | | </li> |
| | | </ul> : null} |
| | | </div> : null} |
| | | {card.subelement.includes('actions') ? |
| | | <ul className="ant-card-actions"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editAction} /> |
| | | {card.actions.map(item => (<li style={{width: _width}}> |
| | | <span> |
| | | <Icon type={item.icon || 'dash'}/> |
| | | </span> |
| | | </li>))} |
| | | </ul> : null |
| | | } |
| | | </div> |
| | | {/* 显示列编辑 */} |
| | | <Modal |
| | |
| | | { |
| | | uuid: 'card1', |
| | | url: card1, |
| | | type: 'card1' |
| | | subelement: ['content'] |
| | | }, |
| | | { |
| | | uuid: 'card2', |
| | | url: card2, |
| | | type: 'card2' |
| | | subelement: ['content', 'avatar'] |
| | | }, |
| | | { |
| | | uuid: 'card3', |
| | | url: card3, |
| | | type: 'card3' |
| | | subelement: ['content', 'avatar', 'header', 'actions'] |
| | | } |
| | | ] |
| | | } |
| | |
| | | result.Yaxis = result.Yaxis[0] || '' |
| | | } |
| | | } else if (result.chartType === 'card') { |
| | | result.cardType = selectlegend.type |
| | | result.subelement = selectlegend.subelement |
| | | |
| | | if (!result.details) { |
| | | result.details = [ |
| | |
| | | {bold: 'false', uuid: 'carddescription', content: 'Card content', datatype: 'static', align: 'left'} |
| | | ] |
| | | result.actions = [] |
| | | result.title = '' |
| | | result.header = { |
| | | title: {content: 'Card title', datatype: 'static'}, |
| | | actions: [] |
| | | } |
| | | result.avatar = {content: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', datatype: 'static', width: 32, height: 32} |
| | | } |
| | | } |
| | | |
| | |
| | | ) { |
| | | this.setState({columnlist: nextProps.pasteContent.columns}) |
| | | } else if (!is(fromJS(nextProps.config.columns), fromJS(this.props.config.columns)) && !is(fromJS(nextProps.config.columns), fromJS(columnlist))) { |
| | | this.setState({columnlist: nextProps.config.columns}) |
| | | this.setState({columnlist: fromJS(nextProps.config.columns).toJS()}) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({columnlist: list}) |
| | | this.handleColumn(card) |
| | | } else { |
| | | this.setState({columnlist: list}) |
| | | this.props.updatecolumn({...config, columns: list}) |
| | | this.setState({columnlist: list}, ()=> { |
| | | this.props.updatecolumn({...config, columns: list}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | card: null, |
| | | columnlist: _columnlist, |
| | | modaltype: '' |
| | | }, ()=> { |
| | | this.props.updatecolumn({...config, columns: _columnlist}) |
| | | }) |
| | | this.props.updatecolumn({...config, columns: _columnlist}) |
| | | }) |
| | | } else if (modaltype === 'gridbtn') { |
| | | this.gridBtnFormRef.handleConfirm().then(res => { |
| | |
| | | |
| | | _this.setState({ |
| | | columnlist: _columnlist |
| | | }, ()=> { |
| | | _this.props.updatecolumn({...config, columns: _columnlist}) |
| | | }) |
| | | _this.props.updatecolumn({...config, columns: _columnlist}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | card: null, |
| | | columnlist: _columnlist, |
| | | modaltype: '' |
| | | }, ()=> { |
| | | this.props.updatecolumn({...config, columns: _columnlist}) |
| | | }) |
| | | this.props.updatecolumn({...config, columns: _columnlist}) |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState({searchlist: [...searchlist, nextProps.pasteContent]}) |
| | | this.handleSearch(nextProps.pasteContent) |
| | | } else if (!is(fromJS(nextProps.config.search), fromJS(this.props.config.search)) && !is(fromJS(nextProps.config.search), fromJS(searchlist))) { |
| | | this.setState({searchlist: nextProps.config.search}) |
| | | this.setState({searchlist: fromJS(nextProps.config.search).toJS()}) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({searchlist: list}) |
| | | this.handleSearch(card) |
| | | } else { |
| | | this.setState({searchlist: list}) |
| | | this.props.updatesearch({...config, search: list}) |
| | | this.setState({searchlist: list}, ()=> { |
| | | this.props.updatesearch({...config, search: list}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | sqlVerifing: false, |
| | | searchlist: _searchlist, |
| | | visible: false |
| | | }, ()=> { |
| | | this.props.updatesearch({...config, search: _searchlist}, optionLibs) |
| | | }) |
| | | this.props.updatesearch({...config, search: _searchlist}, optionLibs) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | |
| | | this.setState({ |
| | | searchlist: _searchlist, |
| | | visible: false |
| | | }, ()=> { |
| | | this.props.updatesearch({...config, search: _searchlist}, optionLibs) |
| | | }) |
| | | this.props.updatesearch({...config, search: _searchlist}, optionLibs) |
| | | } |
| | | }) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | // 数据源处理 |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | // 数据源处理, 存在显示列时 |
| | | if (arr_field) { |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | _dataresource = `select ${_setting.laypage !== 'false' ? 'top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_setting.order}) as rows from ${_dataresource}) tmptable ${_setting.laypage !== 'false' ? 'where rows > 0' : ''} order by tmptable.rows` |
| | | _dataresource = `select ${_setting.laypage !== 'false' ? 'top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_setting.order}) as rows from ${_dataresource}) tmptable ${_setting.laypage !== 'false' ? 'where rows > 0' : ''} order by tmptable.rows` |
| | | } |
| | | |
| | | if (_setting.queryType === 'statistics') { |
| | | regoptions.forEach(item => { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Tooltip, Modal, notification } from 'antd' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 标签组变化时,更新标签 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { tabgroups } = this.state |
| | | |
| | | if (!is(fromJS(nextProps.config.tabgroups), fromJS(this.props.config.tabgroups)) && !is(fromJS(nextProps.config.tabgroups), fromJS(tabgroups))) { |
| | | this.setState({tabgroups: fromJS(nextProps.config.tabgroups).toJS()}) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 元素添加或拖动时顺序变化 |
| | | */ |
| | | handleList = (list, card, groupId) => { |
| | |
| | | this.setState({tabgroups: _tabgroups}) |
| | | this.handleTab(card, _group) |
| | | } else { |
| | | this.setState({tabgroups: _tabgroups}) |
| | | this.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | this.setState({tabgroups: _tabgroups}, () => { |
| | | this.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | group: null, |
| | | tabgroups: tabgroups, |
| | | visible: false |
| | | }, () => { |
| | | this.props.updatetabs({...config, tabgroups: tabgroups}) |
| | | }) |
| | | this.props.updatetabs({...config, tabgroups: tabgroups}) |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | _this.setState({ |
| | | tabgroups: tabgroups |
| | | }, () => { |
| | | _this.props.updatetabs({...config, tabgroups: tabgroups}, [card]) |
| | | }) |
| | | _this.props.updatetabs({...config, tabgroups: tabgroups}, [card]) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | _this.setState({ |
| | | tabgroups: _tabgroups |
| | | }, () => { |
| | | _this.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | }) |
| | | _this.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | |
| | | _tabgroups = _tabgroups.filter(_group => _group.uuid !== group.uuid) |
| | | |
| | | _this.setState({ |
| | | tabgroups: _tabgroups |
| | | }, () => { |
| | | _this.props.updatetabs({...config, tabgroups: _tabgroups}, group.sublist) |
| | | }) |
| | | _this.props.updatetabs({...config, tabgroups: _tabgroups}, group.sublist) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | this.setState({ |
| | | tabgroups: _tabgroups |
| | | }, () => { |
| | | this.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | }) |
| | | this.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | |
| | | notification.success({ |
| | | top: 92, |
| | |
| | | group: null, |
| | | tabgroups: _tabgroups, |
| | | visible: false |
| | | }, () => { |
| | | this.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | }) |
| | | this.props.updatetabs({...config, tabgroups: _tabgroups}) |
| | | } else { |
| | | this.setState({ |
| | | card: null, |