| | |
| | | } |
| | | }, |
| | | { |
| | | title: '显示(值/%)', |
| | | dataIndex: 'show', |
| | | inputType: 'select', |
| | | editable: true, |
| | | required: false, |
| | | width: '12%', |
| | | options: [ |
| | | { value: 'value', text: '数值'}, |
| | | { value: 'percent', text: '百分比'} |
| | | ], |
| | | render: (text, record) => { |
| | | let trans = {'value': '数值', 'percent': '百分比'} |
| | | return trans[text] || '' |
| | | } |
| | | }, |
| | | { |
| | | title: '最小值', |
| | | dataIndex: 'min', |
| | | inputType: 'number', |
| | |
| | | } |
| | | }) |
| | | |
| | | if (config.plot.correction) { |
| | | delete config.plot.correction // 数据修正(已弃用) |
| | | config.plot.barSize = 35 |
| | | let plot = fromJS(config.plot).toJS() |
| | | |
| | | if (plot.correction) { |
| | | delete plot.correction // 数据修正(已弃用) |
| | | plot.barSize = 35 |
| | | } |
| | | |
| | | if (plot.datatype !== 'statistics') { |
| | | if (plot.colors) { |
| | | plot.colors = plot.colors.map(item => { |
| | | if (fieldName[item.type]) { |
| | | item.label = fieldName[item.type] |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | if (plot.customs) { |
| | | plot.customs = plot.customs.map(item => { |
| | | if (fieldName[item.type]) { |
| | | item.name = fieldName[item.type] |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | view: 'normal', |
| | | ramp: config.plot.ramp || 'false', |
| | | datatype: config.plot.datatype || 'query', |
| | | ramp: plot.ramp || 'false', |
| | | datatype: plot.datatype || 'query', |
| | | fieldName: fieldName, |
| | | plot: fromJS(config.plot).toJS(), |
| | | baseFormlist: getBaseForm(config.plot), |
| | | formlist: getOptionForm(config.plot, config.columns) |
| | | plot: plot, |
| | | baseFormlist: getBaseForm(plot, config.columns), |
| | | formlist: getOptionForm(plot, config.columns) |
| | | }) |
| | | } |
| | | |
| | |
| | | if (key === 'datatype') { |
| | | this.setState({ |
| | | datatype: val, |
| | | formlist: formlist.map(item => { |
| | | formlist: fromJS(formlist).toJS().map(item => { |
| | | if (['Yaxis'].includes(item.key)) { |
| | | item.hidden = val === 'statistics' |
| | | } else if (['InfoType', 'InfoValue'].includes(item.key)) { |
| | |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'label') { |
| | | this.setState({formlist: fromJS(formlist).toJS().map(cell => { |
| | | if (!['labelColor', 'labelValue'].includes(cell.key)) return cell |
| | | |
| | | if (cell.key === 'labelColor') { |
| | | if (val !== 'true') { |
| | | cell.hidden = true |
| | | } else { |
| | | cell.hidden = false |
| | | } |
| | | } else { |
| | | if (val === 'false') { |
| | | cell.hidden = true |
| | | } else { |
| | | cell.hidden = false |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | })}) |
| | | } |
| | | } |
| | | |
| | |
| | | if (!err) { |
| | | let _plot = {...plot, ...values} |
| | | |
| | | if (values.datatype === 'statistics' || values.datatype !== plot.datatype) { |
| | | _plot.enabled = 'false' |
| | | _plot.customs = [] |
| | | } else if (!values.Yaxis || !plot.Yaxis || !is(fromJS(values.Yaxis), fromJS(plot.Yaxis))) { |
| | | _plot.enabled = 'false' |
| | | _plot.customs = [] |
| | | _plot.colors = null |
| | | } |
| | | |
| | | if (values.datatype !== plot.datatype) { |
| | | _plot.colors = null |
| | | } |
| | | if (values.datatype === 'statistics') { |
| | | _plot.enabled = 'false' |
| | | _plot.customs = [] |
| | | delete _plot.Yaxis |
| | | } else if (!is(fromJS(values.Yaxis), fromJS(plot.Yaxis || []))) { |
| | | _plot.enabled = 'false' |
| | | _plot.colors = null |
| | | |
| | | let labels = {} |
| | | config.columns.forEach(col => { |
| | | labels[col.field] = col.label |
| | | }) |
| | | |
| | | let cus = {} |
| | | _plot.customs && _plot.customs.forEach(m => { |
| | | cus[m.type] = m |
| | | }) |
| | | _plot.customs = _plot.Yaxis.map((item, i) => { |
| | | if (cus[item]) return cus[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | | name: labels[item] || item, |
| | | axis: i === 0 ? 'true' : 'false', |
| | | label: 'false', |
| | | title: 'true', |
| | | shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth'] |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | } else if (view === 'base') { |
| | | this.baseRef.handleConfirm().then(res => { |
| | | let _plot = {...plot, ...res} |
| | | |
| | | if (res.click === 'menu') { |
| | | delete _plot.menus |
| | | } else if (res.click === 'menus') { |
| | | delete _plot.menu |
| | | } else { |
| | | delete _plot.menus |
| | | delete _plot.menu |
| | | } |
| | | |
| | | delete _plot.MenuID |
| | | delete _plot.MenuName |
| | | delete _plot.MenuNo |
| | | delete _plot.tabType |
| | | |
| | | if (_plot.click === 'menu' && sessionStorage.getItem('appType') === '' && _plot.menu) { |
| | | let list = null |
| | | try { |
| | | list = JSON.parse(sessionStorage.getItem('thdMenuList')) || [] |
| | | } catch (e) { |
| | | list = [] |
| | | } |
| | | |
| | | let id = _plot.menu[_plot.menu.length - 1] |
| | | |
| | | list.forEach(item => { |
| | | if (item.MenuID === id) { |
| | | _plot.MenuID = id |
| | | _plot.MenuName = item.MenuName |
| | | _plot.MenuNo = item.MenuNo |
| | | _plot.tabType = item.type |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | plot: _plot, |
| | |
| | | if (!err) { |
| | | let _plot = {...plot, ...values} |
| | | |
| | | if (values.datatype === 'statistics' || values.datatype !== plot.datatype) { |
| | | _plot.enabled = 'false' |
| | | _plot.customs = [] |
| | | } else if (!values.Yaxis || !plot.Yaxis || !is(fromJS(values.Yaxis), fromJS(plot.Yaxis))) { |
| | | _plot.enabled = 'false' |
| | | _plot.customs = [] |
| | | _plot.colors = null |
| | | } |
| | | |
| | | let labels = {} |
| | | config.columns.forEach(col => { |
| | | labels[col.field] = col.label |
| | | }) |
| | | |
| | | if (values.datatype !== 'statistics' && (!_plot.customs || _plot.customs.length === 0)) { |
| | | if (values.datatype !== plot.datatype) { |
| | | _plot.colors = null |
| | | } |
| | | if (values.datatype === 'statistics') { |
| | | _plot.enabled = 'false' |
| | | _plot.customs = [] |
| | | delete _plot.Yaxis |
| | | } else if (!is(fromJS(values.Yaxis), fromJS(plot.Yaxis || []))) { |
| | | _plot.enabled = 'false' |
| | | _plot.colors = null |
| | | |
| | | let cus = {} |
| | | _plot.customs && _plot.customs.forEach(m => { |
| | | cus[m.type] = m |
| | | }) |
| | | _plot.customs = _plot.Yaxis.map((item, i) => { |
| | | if (cus[item]) return cus[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | |
| | | } |
| | | }) |
| | | } |
| | | if (values.datatype !== plot.datatype || !_plot.colors) { |
| | | |
| | | if (!_plot.colors) { |
| | | _plot.colors = [] |
| | | if (_plot.datatype === 'query') { |
| | | let limit = chartColors.length |
| | |
| | | }) |
| | | } else if (view === 'base') { |
| | | this.baseRef.handleConfirm().then(res => { |
| | | let _plot = {...plot, ...res} |
| | | |
| | | if (res.click === 'menu') { |
| | | delete _plot.menus |
| | | } else if (res.click === 'menus') { |
| | | delete _plot.menu |
| | | } else { |
| | | delete _plot.menus |
| | | delete _plot.menu |
| | | } |
| | | |
| | | delete _plot.MenuID |
| | | delete _plot.MenuName |
| | | delete _plot.MenuNo |
| | | delete _plot.tabType |
| | | |
| | | if (_plot.click === 'menu' && sessionStorage.getItem('appType') === '' && _plot.menu) { |
| | | let list = null |
| | | try { |
| | | list = JSON.parse(sessionStorage.getItem('thdMenuList')) || [] |
| | | } catch (e) { |
| | | list = [] |
| | | } |
| | | |
| | | let id = _plot.menu[_plot.menu.length - 1] |
| | | |
| | | list.forEach(item => { |
| | | if (item.MenuID === id) { |
| | | _plot.MenuID = id |
| | | _plot.MenuName = item.MenuName |
| | | _plot.MenuNo = item.MenuNo |
| | | _plot.tabType = item.type |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | plot: {...plot, ...res}, |
| | | plot: _plot, |
| | | view: tab |
| | | }) |
| | | }) |
| | |
| | | <div className="line-chart-drawer-form"> |
| | | <EditOutlined title="编辑" onClick={this.showDrawer}/> |
| | | <Modal |
| | | wrapClassName="popview-modal menu-chart-edit-modal" |
| | | title={config.type === 'bar' ? '柱状图编辑' : '折线图编辑'} |
| | | wrapClassName="mk-pop-modal" |
| | | visible={visible} |
| | | width={950} |
| | | width={1000} |
| | | maskClosable={false} |
| | | onOk={this.onSubmit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | {config.name ? <div className="mk-com-name">{config.name} - 编辑</div> : null} |
| | | <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}> |
| | | <TabPane tab="组件设置" key="base"> |
| | | <NormalForm dict={this.props.dict} formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> |
| | |
| | | </Form> |
| | | </Col> |
| | | <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>注:使用自定义设置时,显示的坐标轴第一个在左侧,第二个在右侧,多余的不生效。</Col> |
| | | <EditTable actions={['edit', 'move']} data={plot.customs || []} columns={cusColumns} onChange={this.changeCustom}/> |
| | | <EditTable indexShow={false} actions={['edit', 'move']} data={plot.customs || []} columns={cusColumns} onChange={this.changeCustom}/> |
| | | </TabPane> : null} |
| | | </Tabs> |
| | | </Modal> |