提交 c23e2750 authored 作者: 刘浪's avatar 刘浪
import React, { useMemo } from 'react';
import ReactEcharts from 'echarts-for-react';
export default function EchartsDiy(props){
const { json, uuid, option, value } = props;
const opt = useMemo(() => {
return (value && typeof value === 'object' && Object.keys(value).length) ? value : option;
}, [value, option]);
// console.log(opt);
if(!opt){
return null;
}
return (
<ReactEcharts
style={{ height: json.height || 500 }}
key={uuid}
option={opt}
notMerge={true}
lazyUpdate={true}
theme={'theme_name'}
onEvents={{}}
/>
)
}
...@@ -83,6 +83,7 @@ import ButtonDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/Butto ...@@ -83,6 +83,7 @@ import ButtonDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/Butto
import giveVarcharRules from '@/webPublic/one_stop_public/tableCompon/Split_Index/giveVarcharLength'; import giveVarcharRules from '@/webPublic/one_stop_public/tableCompon/Split_Index/giveVarcharLength';
import getPopupContainer from '@/webPublic/one_stop_public/tableCompon/Split_Index/getPopupContainer'; import getPopupContainer from '@/webPublic/one_stop_public/tableCompon/Split_Index/getPopupContainer';
import StepDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/StepDiy'; import StepDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/StepDiy';
import EchartsDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/EchartsDiy';
/** /**
* 日期组件antd3.x有bug 详情见禅道 27152 毕业跟踪调查管理 毕业时间改为年级筛选 * 日期组件antd3.x有bug 详情见禅道 27152 毕业跟踪调查管理 毕业时间改为年级筛选
...@@ -162,9 +163,11 @@ export default class TableCom extends Component { ...@@ -162,9 +163,11 @@ export default class TableCom extends Component {
const { dispatch } = this.props; const { dispatch } = this.props;
const x = this.props.DataColumn.isShowModal; const x = this.props.DataColumn.isShowModal;
x[fk] = true; x[fk] = true;
this.setState({ this.setState(
{
modalInit: data, modalInit: data,
}, () => { },
() => {
dispatch({ dispatch({
type: 'DataColumn/showModal', type: 'DataColumn/showModal',
payload: { isShowModal: x }, payload: { isShowModal: x },
...@@ -176,8 +179,8 @@ export default class TableCom extends Component { ...@@ -176,8 +179,8 @@ export default class TableCom extends Component {
}); });
}, },
}); });
}) },
);
}; };
/** /**
...@@ -312,7 +315,7 @@ export default class TableCom extends Component { ...@@ -312,7 +315,7 @@ export default class TableCom extends Component {
return; return;
} }
if ( if (
!(this.dataFilter.includes(json.comName) || json.comName == 'TableSelect') && !(this.dataFilter.includes(json.comName) || json.comName === 'TableSelect') &&
json.isFormulaOnce json.isFormulaOnce
) { ) {
return; return;
...@@ -320,7 +323,7 @@ export default class TableCom extends Component { ...@@ -320,7 +323,7 @@ export default class TableCom extends Component {
if ( if (
!( !(
this.dataFilter.includes(json.comName) || this.dataFilter.includes(json.comName) ||
json.comName == 'TableSelect' || json.comName === 'TableSelect' ||
(json.formula != null && json.formula != '') (json.formula != null && json.formula != '')
) )
) { ) {
...@@ -404,7 +407,7 @@ export default class TableCom extends Component { ...@@ -404,7 +407,7 @@ export default class TableCom extends Component {
} }
} }
if (this.dataFilter.includes(json.comName) || json.comName == 'TableSelect') { if (this.dataFilter.includes(json.comName) || json.comName === 'TableSelect') {
const obj2 = { const obj2 = {
...obj, ...obj,
...props.form.getFieldsValue(), ...props.form.getFieldsValue(),
...@@ -713,7 +716,7 @@ export default class TableCom extends Component { ...@@ -713,7 +716,7 @@ export default class TableCom extends Component {
if (callback) { if (callback) {
const data = reqUrls[url].data; const data = reqUrls[url].data;
if (json.optionType && json.optionType == 'func') { if (json.optionType && json.optionType === 'func') {
const res = callback(data); const res = callback(data);
if (res != null && !(typeof res === 'function')) { if (res != null && !(typeof res === 'function')) {
...@@ -727,7 +730,7 @@ export default class TableCom extends Component { ...@@ -727,7 +730,7 @@ export default class TableCom extends Component {
}, },
); );
} }
} else if (json.comName == 'Button') { } else if (json.comName === 'Button') {
try { try {
callback(data); callback(data);
} catch (e) { } catch (e) {
...@@ -903,7 +906,7 @@ export default class TableCom extends Component { ...@@ -903,7 +906,7 @@ export default class TableCom extends Component {
if (!isChange) { if (!isChange) {
if (callback) { if (callback) {
const data = sqlKeys[sqlKey].data; const data = sqlKeys[sqlKey].data;
if (json.optionType && json.optionType == 'func') { if (json.optionType && json.optionType === 'func') {
const res = callback(data); const res = callback(data);
if (res != null && !(typeof res === 'function')) { if (res != null && !(typeof res === 'function')) {
this.setState( this.setState(
...@@ -916,7 +919,7 @@ export default class TableCom extends Component { ...@@ -916,7 +919,7 @@ export default class TableCom extends Component {
}, },
); );
} }
} else if (json.comName == 'Button') { } else if (json.comName === 'Button') {
try { try {
callback(data); callback(data);
} catch (e) { } catch (e) {
...@@ -1045,7 +1048,6 @@ export default class TableCom extends Component { ...@@ -1045,7 +1048,6 @@ export default class TableCom extends Component {
return 'norefeshxxxxxxxxxxxxxxxxxxxx'; return 'norefeshxxxxxxxxxxxxxxxxxxxx';
}; };
getObjValues = () => { getObjValues = () => {
const { isEdit, fatherObj, defaultValues, formKey, form, fatherCode } = this.props; const { isEdit, fatherObj, defaultValues, formKey, form, fatherCode } = this.props;
let obj = {}; let obj = {};
...@@ -1064,7 +1066,7 @@ export default class TableCom extends Component { ...@@ -1064,7 +1066,7 @@ export default class TableCom extends Component {
}; };
} }
return obj; return obj;
} };
functionArguments = (column, callback) => { functionArguments = (column, callback) => {
const base52 = column.base52; const base52 = column.base52;
...@@ -1619,18 +1621,12 @@ export default class TableCom extends Component { ...@@ -1619,18 +1621,12 @@ export default class TableCom extends Component {
} }
return <QRCode {...this.state.option} key={uuid} />; return <QRCode {...this.state.option} key={uuid} />;
} }
if (json.comName == 'Echart') { if (json.comName === 'Echart') {
return ( return this.props.form.getFieldDecorator(uuid, {
<ReactEcharts initialValue: '',
style={{ height: json.height || 500 }} })(
key={uuid} <EchartsDiy json={json} uuid={uuid} option={this.state.option}/>
option={this.state.option || {}} )
notMerge={true}
lazyUpdate={true}
theme={'theme_name'}
onEvents={{}}
/>
);
} }
if (json.comName === 'Graph') { if (json.comName === 'Graph') {
return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []} />; return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []} />;
...@@ -2115,9 +2111,9 @@ export default class TableCom extends Component { ...@@ -2115,9 +2111,9 @@ export default class TableCom extends Component {
if (dataColumn.isNull != null && !dataColumn.isNull) { if (dataColumn.isNull != null && !dataColumn.isNull) {
required = true; required = true;
} }
if(Array.isArray(json.vlds)){ if (Array.isArray(json.vlds)) {
for(let item of json.vlds){ for (let item of json.vlds) {
if(item.required){ if (item.required) {
required = true; // 验证里面填了必填 则必填 required = true; // 验证里面填了必填 则必填
} }
} }
...@@ -2590,12 +2586,8 @@ ${obj[dataColumn.base52]} ...@@ -2590,12 +2586,8 @@ ${obj[dataColumn.base52]}
style={{ style={{
marginLeft: 5, marginLeft: 5,
minHeight: get === 'mobile' ? '200px' : 'auto', minHeight: get === 'mobile' ? '200px' : 'auto',
width: width: get === 'mobile' ? 'auto' : json.width,
get === 'mobile'
? 'auto'
: json.width,
height: get === 'mobile' ? '' : json.height, height: get === 'mobile' ? '' : json.height,
}} }}
/> />
); );
...@@ -3175,8 +3167,12 @@ ${obj[dataColumn.base52]} ...@@ -3175,8 +3167,12 @@ ${obj[dataColumn.base52]}
} }
} }
const optDiy = Array.isArray(json?.options) ? json.options : Array.isArray(options) ? options : []; const optDiy = Array.isArray(json?.options)
if(dataColumn.base52 === 'KjWXQFIprRc'){ ? json.options
: Array.isArray(options)
? options
: [];
if (dataColumn.base52 === 'KjWXQFIprRc') {
// console.log(json, required, dataColumn, optDiy); // console.log(json, required, dataColumn, optDiy);
} }
...@@ -3192,7 +3188,9 @@ ${obj[dataColumn.base52]} ...@@ -3192,7 +3188,9 @@ ${obj[dataColumn.base52]}
}, },
], ],
})( })(
!optDiy.length ? <Input disabled={true} style={{ width: json.width }}/>: !optDiy.length ? (
<Input disabled={true} style={{ width: json.width }} />
) : (
<Select <Select
allowClear allowClear
showSearch showSearch
...@@ -3225,16 +3223,15 @@ ${obj[dataColumn.base52]} ...@@ -3225,16 +3223,15 @@ ${obj[dataColumn.base52]}
} }
{...otherProps} {...otherProps}
> >
{ {optDiy.map(r => {
optDiy.map(r => {
return ( return (
<Option key={r.value} value={r.value}> <Option key={r.value} value={r.value}>
{r.label} {r.label}
</Option> </Option>
); );
}) })}
} </Select>
</Select>, ),
); );
if ( if (
get === 'mobile' && get === 'mobile' &&
...@@ -3441,13 +3438,12 @@ ${obj[dataColumn.base52]} ...@@ -3441,13 +3438,12 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择起止时间', message: '请选择起止时间',
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
let errors = []; let errors = [];
if(!value || !Array.isArray(value) || value.length !== 2){ if (!value || !Array.isArray(value) || value.length !== 2) {
// 移动端起止时间必须是个数组 且 length = 2 // 移动端起止时间必须是个数组 且 length = 2
errors.push(new Error('请选择', rule.field)); errors.push(new Error('请选择', rule.field));
} }
......
...@@ -4,13 +4,19 @@ import { getInfo, transformApi } from '@/highOrderComponent/Service'; ...@@ -4,13 +4,19 @@ import { getInfo, transformApi } from '@/highOrderComponent/Service';
import urlTransform from '@/webPublic/zyd_public/request/urlTransform'; import urlTransform from '@/webPublic/zyd_public/request/urlTransform';
export function hrefWithToken(url, arg = {}) { export function hrefWithToken(url, arg = {
justOpenUrl: false,
params: {},
fileName: '导出',
method: 'GET',
ext: 'xlsx',
}) {
const { const {
justOpenUrl = false, justOpenUrl,
params = {}, params,
fileName = '', fileName,
method = 'GET', method,
ext = 'xlsx', ext,
} = arg; } = arg;
if (!getIsBei_Dian()) { if (!getIsBei_Dian()) {
if (url.indexOf('?') > -1) { if (url.indexOf('?') > -1) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论