提交 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,22 +163,24 @@ export default class TableCom extends Component { ...@@ -162,22 +163,24 @@ 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({ },
type: 'DataColumn/showModal', () => {
payload: { isShowModal: x }, dispatch({
callback: () => { type: 'DataColumn/showModal',
this.setState({ payload: { isShowModal: x },
modalTitle: title, callback: () => {
modalCode: fk, this.setState({
modalProps: modalProps, modalTitle: title,
}); modalCode: fk,
}, modalProps: modalProps,
}); });
}) },
});
},
);
}; };
/** /**
...@@ -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,
}} }}
/> />
); );
...@@ -3030,35 +3022,35 @@ ${obj[dataColumn.base52]} ...@@ -3030,35 +3022,35 @@ ${obj[dataColumn.base52]}
defaultValues={defaultValues} defaultValues={defaultValues}
/> />
) : /** ) : /**
<ZdyTable <ZdyTable
key={r} key={r}
modalInit={modalInit} modalInit={modalInit}
hfInstance={hfInstance} hfInstance={hfInstance}
currentFormTitle={ currentFormTitle={
getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null
} }
getCellValue={getCellValue} getCellValue={getCellValue}
formCode={this.props.formCode} formCode={this.props.formCode}
formId={this.props.formId} formId={this.props.formId}
isPreview={isPreview} isPreview={isPreview}
currentFormKey={json.childFormKey} currentFormKey={json.childFormKey}
formConfig={datas} formConfig={datas}
get="mobile" get="mobile"
fatherCode={base52} fatherCode={base52}
isEdit={isEdit} isEdit={isEdit}
index={r} index={r}
obj={objs[r]} obj={objs[r]}
fatherObj={this.props.fatherObj} fatherObj={this.props.fatherObj}
init={objs} init={objs}
isChild={true} isChild={true}
form={form} form={form}
mapData={mapData} mapData={mapData}
sqlData={sqlData} sqlData={sqlData}
datas={datasAll} datas={datasAll}
{...datas} {...datas}
defaultValues={defaultValues} defaultValues={defaultValues}
/> />
* */ * */
null} null}
</Tabs.TabPane> </Tabs.TabPane>
); );
...@@ -3175,15 +3167,19 @@ ${obj[dataColumn.base52]} ...@@ -3175,15 +3167,19 @@ ${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);
} }
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: !initValue && otherProps?.mode === 'multiple' ? undefined : initValue, initialValue: !initValue && otherProps?.mode === 'multiple' ? undefined : initValue,
rules: rules:
Array.isArray(json.vlds) && json.vlds.length > 0 Array.isArray(json.vlds) && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
...@@ -3192,49 +3188,50 @@ ${obj[dataColumn.base52]} ...@@ -3192,49 +3188,50 @@ ${obj[dataColumn.base52]}
}, },
], ],
})( })(
!optDiy.length ? <Input disabled={true} style={{ width: json.width }}/>: !optDiy.length ? (
<Select <Input disabled={true} style={{ width: json.width }} />
allowClear ) : (
showSearch <Select
disabled={selectDis || disabled} allowClear
placeholder={json.placeholder} showSearch
style={{ width: json.width }} disabled={selectDis || disabled}
optionFilterProp="children" placeholder={json.placeholder}
getPopupContainer={getPopupContainer(this.props.isDynamic, uuid)} style={{ width: json.width }}
onFocus={() => { optionFilterProp="children"
get === 'mobile' // 移动端取消输入键盘弹出 getPopupContainer={getPopupContainer(this.props.isDynamic, uuid)}
? setTimeout(() => { onFocus={() => {
if (document.querySelectorAll(`.ant-select-search__field`).length > 0) { get === 'mobile' // 移动端取消输入键盘弹出
let ary = [...document.querySelectorAll(`.ant-select-search__field`)]; ? setTimeout(() => {
ary.map(item => { if (document.querySelectorAll(`.ant-select-search__field`).length > 0) {
item.setAttribute('readonly', 'readonly'); let ary = [...document.querySelectorAll(`.ant-select-search__field`)];
// setTimeout(() => { ary.map(item => {
// ary.map(arr => { item.setAttribute('readonly', 'readonly');
// arr.removeAttribute('readonly'); // setTimeout(() => {
// }) // ary.map(arr => {
// }); // arr.removeAttribute('readonly');
}); // })
} // });
}) });
: null; }
}} })
filterOption={(input, option) => : null;
option }}
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 filterOption={(input, option) =>
: false option
} ? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
{...otherProps} : false
> }
{ {...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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论