| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Modal } from 'antd' |
| | | import { Modal } from 'antd' |
| | | import { DownOutlined, UpOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { getChartViewForm } from '@/templates/zshare/formconfig' |
| | | |
| | | import ChartForm from './chartform' |
| | |
| | | class ChartGroupComponent extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, // 菜单配置信息 |
| | | sysRoles: PropTypes.array, // 角色列表,黑名单使用 |
| | | updatechartgroup: PropTypes.func // 图表更新 |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | chartlist: null, // 图表集 |
| | | card: null, // 编辑中元素 |
| | | formlist: null, // 表单信息 |
| | |
| | | icon: 'line-chart', |
| | | Hide: 'false', |
| | | blacklist: [], |
| | | correction: 7 |
| | | barSize: 35 |
| | | } |
| | | } |
| | | |
| | |
| | | let extraActions = config.action.filter(item => ['pop', 'prompt', 'exec'].includes(item.OpenType) && item.Ot === 'notRequired') |
| | | extraActions = extraActions.map(cell => ({value: cell.uuid, text: cell.label})) |
| | | |
| | | if (item.extraAction && extraActions.filter(cell => cell.uuid === item.extraAction).length === 0) { |
| | | if (item.extraAction && extraActions.filter(cell => cell.value === item.extraAction).length === 0) { |
| | | item.extraAction = '' |
| | | } |
| | | |
| | | this.setState({ |
| | | card: item, |
| | | modaltype: _type, |
| | | formlist: getChartViewForm(item, this.props.sysRoles, _columns, actions, extraActions) |
| | | formlist: getChartViewForm(item, _columns, actions, extraActions) |
| | | }) |
| | | } |
| | | |
| | |
| | | */ |
| | | deletechart = (plot) => { |
| | | const { config } = this.props |
| | | const { dict } = this.state |
| | | let _this = this |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` ${plot.title} ?`, |
| | | okText: dict['model.confirm'], |
| | | cancelText: dict['model.cancel'], |
| | | content: `确定删除 ${plot.title} ?`, |
| | | onOk() { |
| | | let _chartlist = fromJS(_this.state.chartlist).toJS() |
| | | let _chartview = _this.state.chartview |
| | |
| | | } |
| | | } |
| | | |
| | | // 已弃用,不在开放添加通道 |
| | | render() { |
| | | const { config } = this.props |
| | | const { dict, chartlist, modaltype, card, chartview } = this.state |
| | | const { chartlist, modaltype, card, chartview } = this.state |
| | | |
| | | return ( |
| | | <div className="model-table-chartview-list"> |
| | | <Icon type="plus" onClick={() => this.handleChart()} /> |
| | | {chartlist.length > 1 ? <Icon type={config.expand ? 'up' : 'down'} onClick={this.onChartChange} /> : null} |
| | | {/* <PlusOutlined onClick={() => this.handleChart()} /> */} |
| | | {chartlist.length > 1 ? (config.expand ? <UpOutlined onClick={this.onChartChange} /> : <DownOutlined onClick={this.onChartChange} />) : null} |
| | | {chartlist.length > 1 ? <DragChartView |
| | | activeKey={chartview} |
| | | list={chartlist} |
| | |
| | | destroyOnClose |
| | | > |
| | | <ChartForm |
| | | dict={dict} |
| | | card={card} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.submitChart} |