| | |
| | | } |
| | | } |
| | | }, |
| | | "@uiw/react-codemirror": { |
| | | "version": "2.2.1", |
| | | "resolved": "https://registry.npmjs.org/@uiw/react-codemirror/-/react-codemirror-2.2.1.tgz", |
| | | "integrity": "sha512-sHumpCEno+3Tkha5lC8rwYgWGnRYA8zB0Jh+SOuNvsoMzcqAyVw3Yz+tlu6z2TEINcD9lUWdY6KlvDsi9TRq3w==", |
| | | "requires": { |
| | | "codemirror": "5.52.2", |
| | | "prop-types": "15.7.2" |
| | | } |
| | | }, |
| | | "@webassemblyjs/ast": { |
| | | "version": "1.8.5", |
| | | "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", |
| | |
| | | "@svgr/webpack": "4.3.2", |
| | | "@typescript-eslint/eslint-plugin": "1.13.0", |
| | | "@typescript-eslint/parser": "1.13.0", |
| | | "@uiw/react-codemirror": "^2.2.1", |
| | | "antd": "^3.23.2", |
| | | "antd-mobile": "^2.3.3", |
| | | "axios": "^0.19.0", |
| | |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | gotoDoc = () => { |
| | | if (options.sysType === 'local' && window.GLOB.mainSystemApi) { |
| | | let ssodomain = window.GLOB.mainSystemApi.replace('/webapi/dostars', '') |
| | | let url = `${ssodomain}/doc/index.html#?appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}` |
| | | window.open(url) |
| | | } else if (options.sysType === 'SSO' || options.sysType === 'cloud') { |
| | | window.open(`${window.location.href.replace(/\/index.html(.*)|\/#(.*)/ig, '')}/doc/index.html#?appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}`) |
| | | } |
| | | } |
| | | |
| | | render () { |
| | | const { thdMenuList, searchkey } = this.state |
| | | |
| | |
| | | <Menu.Item className="header-subSystem" key={'sub' + index} onClick={() => {this.changeSystem(system)}}> {system.AppName} </Menu.Item> |
| | | ))} |
| | | </Menu.SubMenu> : null} */} |
| | | <Menu.Item key="2" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item> |
| | | <Menu.Item key="2" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> |
| | | <Menu.Item key="3" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item> |
| | | </Menu> |
| | | ) |
| | | |
| | |
| | | 'main.all': 'All', |
| | | 'main.cancel': 'Cancel', |
| | | 'main.logout': 'Logout', |
| | | 'main.doc': '文档中心', |
| | | 'main.logout.hint': 'Are you sure you want to log out?', |
| | | 'main.password': 'Change the password', |
| | | 'main.password.origin': 'Original Password', |
| | |
| | | 'main.all': '全部', |
| | | 'main.cancel': '取消', |
| | | 'main.logout': '退出', |
| | | 'main.doc': '文档中心', |
| | | 'main.logout.hint': '您确定要退出吗?', |
| | | 'main.password': '修改密码', |
| | | 'main.password.origin': '原密码', |
| | |
| | | // import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon, notification } from 'antd' |
| | | import moment from 'moment' |
| | | // import CodeMirror from '@uiw/react-codemirror' |
| | | |
| | | // import 'codemirror/theme/monokai.css' |
| | | // import 'codemirror/theme/eclipse.css' |
| | | // import 'codemirror/addon/selection/active-line' |
| | | // import 'codemirror/addon/hint/javascript-hint' |
| | | // import 'codemirror/addon/hint/show-hint' |
| | | // import 'codemirror/addon/hint/show-hint.css' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | {getFieldDecorator('dataresource', { |
| | | initialValue: setting.dataresource || '' |
| | | })(<TextArea rows={4} />)} |
| | | {/* <CodeMirror |
| | | value={'code'} |
| | | options={{ |
| | | theme: 'eclipse', |
| | | lineNumbers: false, |
| | | mode: 'SQL', |
| | | extraKeys: {"Ctrl": "autocomplete"}, |
| | | styleActiveLine: true |
| | | }} |
| | | /> */} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'inner' ? <Col span={8}> |
| | |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <ChartComponent |
| | | BID={BID} |
| | | plot={item} |
| | | config={config} |
| | | data={this.state.data} |
| | | getexceloutparam={this.getexceloutparam} |
| | | loading={this.state.loading} |
| | | /> |
| | | </Col> |
| | |
| | | <ChartComponent |
| | | plot={item} |
| | | config={config} |
| | | BID={this.props.BID} |
| | | Tab={this.props.Tab} |
| | | data={this.state.data} |
| | | getexceloutparam={this.getexceloutparam} |
| | | loading={this.state.loading} |
| | | /> |
| | | </Col> |
| | |
| | | class ExcelIn extends Component { |
| | | static propTpyes = { |
| | | btn: PropTypes.object, // 按钮信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | returndata: PropTypes.func, // 获取返回数据 |
| | | triggerExcelIn: PropTypes.func // 修改上传状态 |
| | | } |
| | |
| | | |
| | | exceltrigger = () => { |
| | | const { excelId } = this.state |
| | | let _excelInput = document.getElementById(excelId + this.props.MenuID) |
| | | let _excelInput = document.getElementById(excelId) |
| | | |
| | | if (_excelInput) { |
| | | _excelInput.click() |
| | |
| | | render() { |
| | | return ( |
| | | <span> |
| | | {this.state.excelId ? <input className="excel-in-input" id={this.state.excelId + this.props.MenuID} type='file' accept='.xlsx, .xls' onAbort={this.onImportExcel} onChange={this.onImportExcel} /> : null} |
| | | {this.state.excelId ? <input className="excel-in-input" id={this.state.excelId} type='file' accept='.xlsx, .xls' onAbort={this.onImportExcel} onChange={this.onImportExcel} /> : null} |
| | | </span> |
| | | ) |
| | | } |
| | |
| | | |
| | | class ExcelInButton extends Component { |
| | | static propTpyes = { |
| | | show: PropTypes.any, // 显示样式 |
| | | BID: PropTypes.string, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | btn: PropTypes.object, // 按钮 |
| | | columns: PropTypes.array, // 字段列 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | triggerBtn: PropTypes.any, |
| | | } |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { btn, show } = this.props |
| | | const { loading } = this.state |
| | | |
| | | return ( |
| | | <div className="mk-btn-wrap"> |
| | | <Button |
| | | {!show ? <Button |
| | | className={'mk-btn mk-' + btn.class} |
| | | icon={btn.icon} |
| | | onClick={() => {this.actionTrigger()}} |
| | | loading={loading} |
| | | >{btn.label}</Button> |
| | | <ExcelIn MenuID={this.props.MenuID} btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> |
| | | >{btn.label}</Button> : null} |
| | | {show === 'icon' ? <Button |
| | | className="import-icon" |
| | | icon="upload" |
| | | onClick={() => {this.actionTrigger()}} |
| | | loading={loading} |
| | | title={btn.label} |
| | | ></Button> : null} |
| | | <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | .mk-btn-wrap { |
| | | display: inline-block; |
| | | |
| | | .import-icon { |
| | | border: 0; |
| | | box-shadow: unset; |
| | | } |
| | | } |
| | |
| | | class ExcelOutButton extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.string, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | show: PropTypes.any, // 显示样式 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | btn: PropTypes.object, // 按钮 |
| | | columns: PropTypes.array, // 字段列 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | getexceloutparam: PropTypes.func, // 获取表格中参数 |
| | | triggerBtn: PropTypes.any, |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { btn, show } = this.props |
| | | const { loading } = this.state |
| | | |
| | | return ( |
| | | <div className="mk-btn-wrap"> |
| | | <Button |
| | | {!show ? <Button |
| | | className={'mk-btn mk-' + btn.class} |
| | | icon={btn.icon} |
| | | onClick={() => {this.actionTrigger()}} |
| | | loading={loading} |
| | | >{btn.label}</Button> |
| | | >{btn.label}</Button> : null} |
| | | {show === 'icon' ? <Button |
| | | className="export-icon" |
| | | icon="download" |
| | | onClick={() => {this.actionTrigger()}} |
| | | loading={loading} |
| | | title={btn.label} |
| | | ></Button> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | .mk-btn-wrap { |
| | | display: inline-block; |
| | | |
| | | .export-icon { |
| | | border: 0; |
| | | box-shadow: unset; |
| | | } |
| | | } |
| | |
| | | BID={BID} |
| | | Tab={Tab} |
| | | btn={item} |
| | | BData={BData} |
| | | setting={setting} |
| | | columns={logcolumns} |
| | | ContainerId={ContainerId} |
| | | selectedData={selectedData} |
| | | triggerBtn={this.state.triggerBtn} |
| | | updateStatus={this.updateStatus} |
| | |
| | | BID={BID} |
| | | Tab={Tab} |
| | | btn={item} |
| | | BData={BData} |
| | | setting={setting} |
| | | columns={logcolumns} |
| | | ContainerId={ContainerId} |
| | | triggerBtn={this.state.triggerBtn} |
| | | getexceloutparam={getexceloutparam} |
| | | updateStatus={this.updateStatus} |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import { Button } from 'antd' |
| | | |
| | | /** |
| | | * @description 异步加载模块 |
| | | * @param {*} importComponent |
| | | */ |
| | | export default function asyncComponent(importComponent) { |
| | | return class extends Component { |
| | | constructor(props) { |
| | | super(props) |
| | | |
| | | this.state = { |
| | | component: null |
| | | } |
| | | } |
| | | |
| | | async componentDidMount() { |
| | | const {default: component} = await importComponent() |
| | | |
| | | this.setState({component}) |
| | | } |
| | | |
| | | // <Button className="loading-skeleton" disabled={true}></Button> // 骨架按钮 |
| | | render() { |
| | | const C = this.state.component |
| | | const btn = this.props.btn || {} |
| | | |
| | | return C ? |
| | | <C {...this.props} /> : |
| | | <Button icon={btn.OpenType === 'excelOut' ? 'download' : 'upload'} disabled={true} title={btn.label} style={{border: 0, background: 'transparent'}}></Button> |
| | | } |
| | | } |
| | | } |
| | |
| | | import DataSet from '@antv/data-set' |
| | | import { Spin, Empty, Select } from 'antd' |
| | | |
| | | import asyncComponent from './asyncButtonComponent' |
| | | 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 ExcelOutButton = asyncComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton')) |
| | | const ExcelInButton = asyncComponent(() => import('@/tabviews/zshare/actionList/excelInbutton')) |
| | | |
| | | class LineChart extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, |
| | | Tab: PropTypes.any, |
| | | plot: PropTypes.object, |
| | | data: PropTypes.array, |
| | | loading: PropTypes.bool, |
| | | config: PropTypes.object |
| | | config: PropTypes.object, |
| | | getexceloutparam: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | empty: true, |
| | | actions: [], |
| | | chartId: Utils.getuuid(), |
| | | chartData: [], |
| | | chartFields: [], |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { plot, data } = this.props |
| | | |
| | | const { plot, data, config } = this.props |
| | | let _state = {} |
| | | let actions = [] |
| | | config.action.forEach(item => { |
| | | if (!plot.actions || plot.actions.length === 0) return |
| | | if (!(item.OpenType === 'excelOut' || (item.OpenType === 'excelIn' && item.Ot === 'notRequired'))) return |
| | | if (plot.actions.includes(item.uuid)) { |
| | | actions.push(fromJS(item).toJS()) |
| | | } |
| | | }) |
| | | |
| | | if (plot.datatype === 'statistics' && (plot.chartType === 'line' || plot.chartType === 'bar')) { |
| | | let result = this.getStaticMsg(data) |
| | | _state.chartData = result.data |
| | | _state.chartFields = result.chartFields |
| | | _state.selectFields = result.selectFields |
| | | _state.actions = actions |
| | | |
| | | this.setState(_state, () => { |
| | | this.viewrender() |
| | | }) |
| | | } else { |
| | | this.setState({ actions }) |
| | | this.viewrender() |
| | | } |
| | | } |
| | |
| | | |
| | | getdata = () => { |
| | | const { data, plot, config } = this.props |
| | | |
| | | let vFields = plot.Yaxis && typeof(plot.Yaxis) === 'string' ? [plot.Yaxis] : plot.Yaxis |
| | | let _columns = config.columns.filter(col => vFields.includes(col.field)) |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { plot, loading } = this.props |
| | | const { empty, chartFields, selectFields } = this.state |
| | | const { plot, loading, config, BID, Tab } = this.props |
| | | const { empty, chartFields, selectFields, actions } = this.state |
| | | |
| | | return ( |
| | | <div className="line-chart-plot-box"> |
| | |
| | | > |
| | | {chartFields.map((item, i) => <Select.Option key={i} value={item}>{item}</Select.Option>)} |
| | | </Select> : null} |
| | | <div className={'canvas' + (empty ? ' empty' : '')} style={{minHeight: plot.height ? plot.height : 400}} id={this.state.chartId}></div> |
| | | <div className="canvas-wrap"> |
| | | <div className={'chart-action ' + (plot.title ? 'with-title' : '')}> |
| | | {actions.map(item => { |
| | | if (item.OpenType === 'excelOut') { |
| | | return ( |
| | | <ExcelOutButton |
| | | key={item.uuid} |
| | | BID={BID} |
| | | Tab={Tab} |
| | | btn={item} |
| | | show="icon" |
| | | setting={config.setting} |
| | | getexceloutparam={this.props.getexceloutparam} |
| | | updateStatus={() => {}} |
| | | /> |
| | | ) |
| | | } else { |
| | | return ( |
| | | <ExcelInButton |
| | | key={item.uuid} |
| | | BID={BID} |
| | | Tab={Tab} |
| | | btn={item} |
| | | show="icon" |
| | | setting={config.setting} |
| | | updateStatus={() => {}} |
| | | /> |
| | | ) |
| | | } |
| | | })} |
| | | </div> |
| | | <div className={'canvas' + (empty ? ' empty' : '')} style={{minHeight: plot.height ? plot.height : 400}} id={this.state.chartId}></div> |
| | | </div> |
| | | {empty ? <Empty description={false}/> : null} |
| | | </div> |
| | | ) |
| | |
| | | .line-chart-plot-box { |
| | | margin-bottom: 30px; |
| | | |
| | | .canvas { |
| | | .canvas-wrap { |
| | | margin: 0 20px; |
| | | position: relative; |
| | | border-top: 1px solid transparent; |
| | | .chart-action { |
| | | position: absolute; |
| | | top: 2px; |
| | | right: 5px; |
| | | z-index: 1; |
| | | } |
| | | .chart-action.with-title { |
| | | top: 35px; |
| | | } |
| | | } |
| | | |
| | | .canvas { |
| | | margin: 0; |
| | | border: 1px solid #e8e8e8; |
| | | padding: 25px 15px; |
| | | } |
| | |
| | | position: relative; |
| | | float: right; |
| | | top: -40px; |
| | | z-index: 1; |
| | | } |
| | | } |
| | | } |
| | |
| | | columns: _columns, |
| | | selectlegend: _selectlegend, |
| | | formlist: formlist.map(item => { |
| | | if (item.key === 'height' && ['table', 'card'].includes(_type)) { |
| | | if (item.key === 'actions' && ['table', 'card'].includes(_type)) { // 按钮组 |
| | | item.hidden = true |
| | | } else if (item.key === 'height' && ['table', 'card'].includes(_type)) { |
| | | item.hidden = true |
| | | } else if (item.key === 'widthType' && _type === 'card') { |
| | | item.hidden = false |
| | |
| | | legends: syslegends[value] || null, |
| | | selectlegend: syslegends[value] ? syslegends[value][0] : null, |
| | | formlist: formlist.map(item => { |
| | | if (item.key === 'height' && ['table', 'card'].includes(value)) { |
| | | if (item.key === 'actions' && ['table', 'card'].includes(value)) { // 按钮组 |
| | | item.hidden = true |
| | | } else if (item.key === 'height' && ['table', 'card'].includes(value)) { |
| | | item.hidden = true |
| | | } else if (item.key === 'widthType' && value === 'card') { |
| | | item.hidden = false |
| | |
| | | } |
| | | } |
| | | |
| | | let actions = config.action.filter(item => item.OpenType === 'excelOut' || (item.OpenType === 'excelIn' && item.Ot === 'notRequired')) |
| | | actions = actions.map(cell => ({value: cell.uuid, text: cell.label})) |
| | | |
| | | if (item.actions && item.actions.length > 0) { |
| | | let keys = actions.map(cell => cell.value) |
| | | item.actions = item.actions.filter(cell => keys.includes(cell)) |
| | | } |
| | | |
| | | this.setState({ |
| | | card: item, |
| | | modaltype: _type, |
| | | formlist: getChartViewForm(item, this.props.sysRoles, _columns) |
| | | formlist: getChartViewForm(item, this.props.sysRoles, _columns, actions) |
| | | }) |
| | | } |
| | | |
| | |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} roleList // 角色列表-黑名单 |
| | | * @param {Array} columns // 显示列 |
| | | * @param {Array} actions // 按钮组 |
| | | */ |
| | | export function getChartViewForm (card, roleList = [], _columns) { |
| | | export function getChartViewForm (card, roleList = [], _columns, actions) { |
| | | let _charts = [{ |
| | | value: 'line', |
| | | text: '折线图' |
| | |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'actions', |
| | | label: '按钮组', |
| | | initVal: card.actions || [], |
| | | required: false, |
| | | options: actions |
| | | } |
| | | ] |
| | | } |