提交 5a8214ba authored 作者: 钟是志's avatar 钟是志

判断是不是字符串的bug

上级 aac8e489
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* 2019年9月22日 * 2019年9月22日
* 动态表格组件返回对应的组件 * 动态表格组件返回对应的组件
*/ */
import React, { Component } from 'react'; import React, {Component} from 'react';
import md5 from 'js-md5'; import md5 from 'js-md5';
import FormModal from './FormModal'; import FormModal from './FormModal';
import { import {
...@@ -28,7 +28,7 @@ import { ...@@ -28,7 +28,7 @@ import {
} from 'antd'; } from 'antd';
import UUID from 'react-native-uuid'; import UUID from 'react-native-uuid';
import QRCode from 'qrcode.react'; import QRCode from 'qrcode.react';
import { EditorState, Editor } from 'draft-js'; import {EditorState, Editor} from 'draft-js';
import MyBlockRenderer from '../App/MyBlockRender'; import MyBlockRenderer from '../App/MyBlockRender';
import CronEditor from 'antd-cron-editor'; import CronEditor from 'antd-cron-editor';
import { import {
...@@ -47,7 +47,7 @@ import { ...@@ -47,7 +47,7 @@ import {
} from 'antd-mobile'; } from 'antd-mobile';
import ReactEcharts from 'echarts-for-react'; import ReactEcharts from 'echarts-for-react';
import ZdyTable from '../Table/index'; import ZdyTable from '../Table/index';
import { connect } from 'dva'; import {connect} from 'dva';
import UploadCom from '../libs/UploadCom'; import UploadCom from '../libs/UploadCom';
import TableSelect from '../libs/TableSelect'; import TableSelect from '../libs/TableSelect';
import LocationCom from '../libs/LocationCom'; import LocationCom from '../libs/LocationCom';
...@@ -61,24 +61,27 @@ import router from 'umi/router'; ...@@ -61,24 +61,27 @@ import router from 'umi/router';
import TableList from '../libs/TableList'; import TableList from '../libs/TableList';
import styles from './style.less'; import styles from './style.less';
import config from '@/webPublic/one_stop_public/config'; import config from '@/webPublic/one_stop_public/config';
import { isEmpty, isNaN, cloneDeep } from 'lodash'; import {isEmpty, isNaN, cloneDeep} from 'lodash';
import { queryApiActionPath } from '../utils/queryConfig'; import {queryApiActionPath} from '../utils/queryConfig';
import { extend } from 'umi-request'; import {extend} from 'umi-request';
import Highlighter from 'react-highlight-words'; import Highlighter from 'react-highlight-words';
import Signature from '../Signature'; import Signature from '../Signature';
import { changeToDraftState } from '../utils/myutils'; import {changeToDraftState} from '../utils/myutils';
import baseX from 'base-x'; import baseX from 'base-x';
import { Base16Encode } from '../Base16/index'; import {Base16Encode} from '../Base16/index';
import { getToken } from '../utils/token'; import {getToken} from '../utils/token';
import { formulaList } from '../excelInitFuc/functionList'; import {formulaList} from '../excelInitFuc/functionList';
import FilePreview from '../filePreview'; import FilePreview from '../filePreview';
import DraftEditorCom from '../App/DraftEditorCom'; import DraftEditorCom from '../App/DraftEditorCom';
import MobileItem from './MobileItem'; import MobileItem from './MobileItem';
const Bs64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; const Bs64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const base64 = baseX(Bs64); const base64 = baseX(Bs64);
function getBase64(value) { function getBase64(value) {
return value ? base64.encode(new Buffer(value)) : null; return value ? base64.encode(new Buffer(value)) : null;
} }
const codeMessage = { const codeMessage = {
200: '服务器成功返回请求的数据。', 200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。', 201: '新建或修改数据成功。',
...@@ -96,13 +99,13 @@ const codeMessage = { ...@@ -96,13 +99,13 @@ const codeMessage = {
503: '服务不可用,服务器暂时过载或维护。', 503: '服务不可用,服务器暂时过载或维护。',
504: '网关超时。', 504: '网关超时。',
}; };
const { TextArea } = Input; const {TextArea} = Input;
const { Option } = Select; const {Option} = Select;
const must = <span style={{ color: '#FF5350', marginLeft: 5, marginRight: 5 }}>*</span>; const must = <span style={{color: '#FF5350', marginLeft: 5, marginRight: 5}}>*</span>;
const { MonthPicker, RangePicker } = DatePicker; const {MonthPicker, RangePicker} = DatePicker;
const AgreeItem = MobileCheckbox.AgreeItem; const AgreeItem = MobileCheckbox.AgreeItem;
const errorHandler = error => { const errorHandler = error => {
const { response } = error; const {response} = error;
if (response && response.status) { if (response && response.status) {
const errorText = codeMessage[response.status] || response.statusText; const errorText = codeMessage[response.status] || response.statusText;
...@@ -118,7 +121,7 @@ const errorHandler = error => { ...@@ -118,7 +121,7 @@ const errorHandler = error => {
} }
}; };
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({ @connect(({DataColumn, SqlManageEntity, formList, loading}) => ({
DataColumn, DataColumn,
SqlManageEntity, SqlManageEntity,
formList, formList,
...@@ -149,24 +152,24 @@ export default class tableCom extends Component { ...@@ -149,24 +152,24 @@ export default class tableCom extends Component {
}, },
}; };
excludeKeys = ['defaultValues', '']; excludeKeys = ['defaultValues', ''];
closeModal = (fk,callback) => { closeModal = (fk, callback) => {
const { dispatch } = this.props; const {dispatch} = this.props;
const x = this.props.DataColumn.isShowModal const x = this.props.DataColumn.isShowModal
x[fk]=false x[fk] = false
dispatch({ dispatch({
type: 'DataColumn/showModal', type: 'DataColumn/showModal',
payload: { isShowModal:x }, payload: {isShowModal: x},
callback: callback, callback: callback,
}); });
}; };
showModal = (fk, title, data, modalProps) => { showModal = (fk, title, data, modalProps) => {
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
dispatch({ dispatch({
type: 'DataColumn/showModal', type: 'DataColumn/showModal',
payload: { isShowModal:x}, payload: {isShowModal: x},
callback: () => { callback: () => {
this.setState({ this.setState({
modalInit: data, modalInit: data,
...@@ -323,7 +326,7 @@ export default class tableCom extends Component { ...@@ -323,7 +326,7 @@ export default class tableCom extends Component {
? props.src ? props.src
: config.httpServer + props.src : config.httpServer + props.src
: null; : null;
const pp = { ...props, src: src }; const pp = {...props, src: src};
return <img {...pp} />; return <img {...pp} />;
} }
}; };
...@@ -373,17 +376,17 @@ export default class tableCom extends Component { ...@@ -373,17 +376,17 @@ export default class tableCom extends Component {
handleSearch = (selectedKeys, confirm) => { handleSearch = (selectedKeys, confirm) => {
confirm(); confirm();
this.setState({ searchText: selectedKeys[0] }); this.setState({searchText: selectedKeys[0]});
}; };
handleReset = clearFilters => { handleReset = clearFilters => {
clearFilters(); clearFilters();
this.setState({ searchText: '' }); this.setState({searchText: ''});
}; };
getColumnSearchProps = (dataIndex, title) => ({ getColumnSearchProps = (dataIndex, title) => ({
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => ( filterDropdown: ({setSelectedKeys, selectedKeys, confirm, clearFilters}) => (
<div style={{ padding: 8 }}> <div style={{padding: 8}}>
<Input <Input
ref={node => { ref={node => {
this.searchInput = node; this.searchInput = node;
...@@ -392,7 +395,7 @@ export default class tableCom extends Component { ...@@ -392,7 +395,7 @@ export default class tableCom extends Component {
value={selectedKeys[0]} value={selectedKeys[0]}
onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])} onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
onPressEnter={() => this.handleSearch(selectedKeys, confirm)} onPressEnter={() => this.handleSearch(selectedKeys, confirm)}
style={{ width: 188, marginBottom: 8, display: 'block' }} style={{width: 188, marginBottom: 8, display: 'block'}}
/> />
<Button <Button
type="primary" type="primary"
...@@ -400,7 +403,7 @@ export default class tableCom extends Component { ...@@ -400,7 +403,7 @@ export default class tableCom extends Component {
icon="search" icon="search"
loading={this.props.loading} loading={this.props.loading}
size="small" size="small"
style={{ width: 90, marginRight: 8 }} style={{width: 90, marginRight: 8}}
> >
搜索 搜索
</Button> </Button>
...@@ -408,13 +411,13 @@ export default class tableCom extends Component { ...@@ -408,13 +411,13 @@ export default class tableCom extends Component {
loading={this.props.loading} loading={this.props.loading}
onClick={() => this.handleReset(clearFilters)} onClick={() => this.handleReset(clearFilters)}
size="small" size="small"
style={{ width: 90 }} style={{width: 90}}
> >
重置 重置
</Button> </Button>
</div> </div>
), ),
filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }} />, filterIcon: filtered => <Icon type="search" style={{color: filtered ? '#1890ff' : 'red'}}/>,
onFilter: (value, record) => onFilter: (value, record) =>
record[dataIndex] record[dataIndex]
? record[dataIndex] ? record[dataIndex]
...@@ -431,7 +434,7 @@ export default class tableCom extends Component { ...@@ -431,7 +434,7 @@ export default class tableCom extends Component {
if (text != null) { if (text != null) {
return ( return (
<Highlighter <Highlighter
highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }} highlightStyle={{backgroundColor: '#ffc069', padding: 0}}
searchWords={[this.state.searchText]} searchWords={[this.state.searchText]}
autoEscape autoEscape
textToHighlight={text.toString()} textToHighlight={text.toString()}
...@@ -444,7 +447,7 @@ export default class tableCom extends Component { ...@@ -444,7 +447,7 @@ export default class tableCom extends Component {
}); });
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
const { json, mapData, obj } = props; const {json, mapData, obj} = props;
if (json == null || this.props.safe) { if (json == null || this.props.safe) {
return; return;
} }
...@@ -518,10 +521,10 @@ export default class tableCom extends Component { ...@@ -518,10 +521,10 @@ export default class tableCom extends Component {
...bindObj, ...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`, base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
} }
: { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` } : {base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}`}
: bindObj; : bindObj;
if (this.props.fatherCode == null && dataColumn == null) if (this.props.fatherCode == null && dataColumn == null)
dataColumn = { base52: this.props.uuid }; dataColumn = {base52: this.props.uuid};
if (!this.props.isEdit && this.props.fatherCode) { if (!this.props.isEdit && this.props.fatherCode) {
if (bindObj != null) { if (bindObj != null) {
...@@ -543,23 +546,24 @@ export default class tableCom extends Component { ...@@ -543,23 +546,24 @@ export default class tableCom extends Component {
this.getFunctionValue(json.formula, dataColumn, json); this.getFunctionValue(json.formula, dataColumn, json);
} }
} }
dataFilter = ['Select', 'Radio', 'Checkbox']; dataFilter = ['Select', 'Radio', 'Checkbox'];
getData = (json, dataColumn, obj, init) => { getData = (json, dataColumn, obj, init) => {
const allValues = JSON.stringify(obj); const allValues = JSON.stringify(obj);
if (json.comName == 'TableSelect') { if (json.comName == 'TableSelect') {
const { dispatch } = this.props; const {dispatch} = this.props;
const { sqlKey, optionType } = json; const {sqlKey, optionType} = json;
if (optionType == 'sql') { if (optionType == 'sql') {
dispatch({ dispatch({
type: 'SqlManageEntity/find', type: 'SqlManageEntity/find',
payload: { sqlKey: sqlKey }, payload: {sqlKey: sqlKey},
callback: sqlModel => { callback: sqlModel => {
this.setState({ sqlModel }); this.setState({sqlModel});
if (sqlModel.dataObjId) { if (sqlModel.dataObjId) {
dispatch({ dispatch({
type: 'formList/getHead', type: 'formList/getHead',
payload: { dataObjId: sqlModel.dataObjId }, payload: {dataObjId: sqlModel.dataObjId},
callback: datas => { callback: datas => {
if (datas) { if (datas) {
const columns = []; const columns = [];
...@@ -578,7 +582,7 @@ export default class tableCom extends Component { ...@@ -578,7 +582,7 @@ export default class tableCom extends Component {
break; break;
} }
} }
this.setState({ columns }); this.setState({columns});
} }
}, },
}); });
...@@ -616,18 +620,18 @@ export default class tableCom extends Component { ...@@ -616,18 +620,18 @@ export default class tableCom extends Component {
columns.push(column); columns.push(column);
} }
this.setState({ columns }); this.setState({columns});
} }
dispatch({ dispatch({
type: 'DataColumn/getSqlData', type: 'DataColumn/getSqlData',
payload: { sqlKey, allValues }, payload: {sqlKey, allValues},
callback: list => { callback: list => {
const x = { const x = {
list: list, list: list,
pagination: false, pagination: false,
}; };
this.setState({ dataSource: x }); this.setState({dataSource: x});
}, },
}); });
} }
...@@ -636,7 +640,7 @@ export default class tableCom extends Component { ...@@ -636,7 +640,7 @@ export default class tableCom extends Component {
} else if (optionType == 'reference' && dataColumn.referenceObjId) { } else if (optionType == 'reference' && dataColumn.referenceObjId) {
dispatch({ dispatch({
type: 'formList/getHead', type: 'formList/getHead',
payload: { dataObjId: dataColumn.referenceObjId }, payload: {dataObjId: dataColumn.referenceObjId},
callback: datas => { callback: datas => {
if (datas) { if (datas) {
const columns = []; const columns = [];
...@@ -653,7 +657,7 @@ export default class tableCom extends Component { ...@@ -653,7 +657,7 @@ export default class tableCom extends Component {
break; break;
} }
} }
this.setState({ columns }); this.setState({columns});
} }
}, },
}); });
...@@ -698,7 +702,7 @@ export default class tableCom extends Component { ...@@ -698,7 +702,7 @@ export default class tableCom extends Component {
let enu; let enu;
try { try {
this.getFunctionValue(json.funcs, { base52: this.props.uuid }, json, () => { this.getFunctionValue(json.funcs, {base52: this.props.uuid}, json, () => {
if (init != null && Object.keys(init).length > 0) { if (init != null && Object.keys(init).length > 0) {
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
let vlu = this.props.form.getFieldValue(base52); let vlu = this.props.form.getFieldValue(base52);
...@@ -717,7 +721,7 @@ export default class tableCom extends Component { ...@@ -717,7 +721,7 @@ export default class tableCom extends Component {
} }
} }
this.setState({ labels: labs }); this.setState({labels: labs});
} else if (!this.props.isEdit && Object.keys(obj).length > 0) { } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
...@@ -739,7 +743,7 @@ export default class tableCom extends Component { ...@@ -739,7 +743,7 @@ export default class tableCom extends Component {
} }
} }
this.setState({ labels: labs }); this.setState({labels: labs});
} }
}); });
} catch (e) { } catch (e) {
...@@ -761,10 +765,10 @@ export default class tableCom extends Component { ...@@ -761,10 +765,10 @@ export default class tableCom extends Component {
e, e,
); );
} }
if(!this.props.isEdit){ if (!this.props.isEdit) {
if(this.props.setRealTimeValues){ if (this.props.setRealTimeValues) {
this.props.setRealTimeValues(values) this.props.setRealTimeValues(values)
} }
...@@ -777,7 +781,7 @@ export default class tableCom extends Component { ...@@ -777,7 +781,7 @@ export default class tableCom extends Component {
if (url.indexOf('http') === -1) { if (url.indexOf('http') === -1) {
url = config.httpServer + url; url = config.httpServer + url;
} }
const { reqUrls } = this.state; const {reqUrls} = this.state;
if (reqUrls[url] != null) { if (reqUrls[url] != null) {
const ps = reqUrls[url].params; const ps = reqUrls[url].params;
...@@ -800,7 +804,7 @@ export default class tableCom extends Component { ...@@ -800,7 +804,7 @@ export default class tableCom extends Component {
} }
} }
} else { } else {
reqUrls[url] = { params: params }; reqUrls[url] = {params: params};
isChange = true; isChange = true;
} }
...@@ -812,7 +816,7 @@ export default class tableCom extends Component { ...@@ -812,7 +816,7 @@ export default class tableCom extends Component {
const res = callback(data); const res = callback(data);
if (res != null && !(typeof res === 'function')) { if (res != null && !(typeof res === 'function')) {
this.setState({ options: res, selectDis: false }, () => { this.setState({options: res, selectDis: false}, () => {
if (orgCallback) orgCallback(); if (orgCallback) orgCallback();
}); });
} }
...@@ -831,7 +835,7 @@ export default class tableCom extends Component { ...@@ -831,7 +835,7 @@ export default class tableCom extends Component {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
this.setState({ option: x }); this.setState({option: x});
} }
} catch (e) { } catch (e) {
console.log( console.log(
...@@ -844,7 +848,7 @@ export default class tableCom extends Component { ...@@ -844,7 +848,7 @@ export default class tableCom extends Component {
if (base52) { if (base52) {
try { try {
const x = callback(data); const x = callback(data);
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x }); if (x == null || x != 'NaN') this.props.form.setFieldsValue({[base52]: x});
} catch (e) { } catch (e) {
console.log( console.log(
`页面${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j + `页面${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j +
...@@ -880,15 +884,15 @@ export default class tableCom extends Component { ...@@ -880,15 +884,15 @@ export default class tableCom extends Component {
method: method, method: method,
requestType: 'form', requestType: 'form',
}).then(data => { }).then(data => {
const { reqUrls } = this.state; const {reqUrls} = this.state;
reqUrls[url].data = data; reqUrls[url].data = data;
this.setState({ res: data, reqUrls }, () => { this.setState({res: data, reqUrls}, () => {
if (callback) { if (callback) {
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({ options: res, selectDis: false }, () => { this.setState({options: res, selectDis: false}, () => {
if (orgCallback) orgCallback(); if (orgCallback) orgCallback();
}); });
} }
...@@ -906,7 +910,7 @@ export default class tableCom extends Component { ...@@ -906,7 +910,7 @@ export default class tableCom extends Component {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
this.setState({ option: x }); this.setState({option: x});
} }
} catch (e) { } catch (e) {
console.log( console.log(
...@@ -919,7 +923,7 @@ export default class tableCom extends Component { ...@@ -919,7 +923,7 @@ export default class tableCom extends Component {
if (base52) { if (base52) {
try { try {
const x = callback(data); const x = callback(data);
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x }); if (x == null || x != 'NaN') this.props.form.setFieldsValue({[base52]: x});
} catch (e) { } catch (e) {
console.log( console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j + `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j +
...@@ -939,7 +943,7 @@ export default class tableCom extends Component { ...@@ -939,7 +943,7 @@ export default class tableCom extends Component {
sqlUtil = (base52, json, orgCallback, sqlKey, params, callback, options = {}) => { sqlUtil = (base52, json, orgCallback, sqlKey, params, callback, options = {}) => {
//查缓存 //查缓存
var isChange = false; var isChange = false;
const { sqlKeys } = this.state; const {sqlKeys} = this.state;
if (sqlKeys[sqlKey] != null) { if (sqlKeys[sqlKey] != null) {
const ps = sqlKeys[sqlKey].params; const ps = sqlKeys[sqlKey].params;
...@@ -970,7 +974,7 @@ export default class tableCom extends Component { ...@@ -970,7 +974,7 @@ export default class tableCom extends Component {
} else { } else {
sqlKeys[sqlKey] = { params: params, options: options }; sqlKeys[sqlKey] = {params: params, options: options};
isChange = true; isChange = true;
} }
if (!isChange) { if (!isChange) {
...@@ -979,7 +983,7 @@ export default class tableCom extends Component { ...@@ -979,7 +983,7 @@ export default class tableCom extends Component {
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({ options: res, selectDis: false }, () => { this.setState({options: res, selectDis: false}, () => {
if (orgCallback) orgCallback(); if (orgCallback) orgCallback();
}); });
} }
...@@ -997,7 +1001,7 @@ export default class tableCom extends Component { ...@@ -997,7 +1001,7 @@ export default class tableCom extends Component {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
this.setState({ option: x }); this.setState({option: x});
} }
} catch (e) { } catch (e) {
console.log( console.log(
...@@ -1010,7 +1014,7 @@ export default class tableCom extends Component { ...@@ -1010,7 +1014,7 @@ export default class tableCom extends Component {
if (base52) { if (base52) {
try { try {
const x = callback(data); const x = callback(data);
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x }); if (x == null || x != 'NaN') this.props.form.setFieldsValue({[base52]: x});
} catch (e) { } catch (e) {
console.log( console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j + `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j +
...@@ -1025,9 +1029,8 @@ export default class tableCom extends Component { ...@@ -1025,9 +1029,8 @@ export default class tableCom extends Component {
} }
const url = queryApiActionPath() + '/DataColumnApi/getSqlData'; const url = queryApiActionPath() + '/DataColumnApi/getSqlData';
this.setState({ sqlKeys }, () => { this.setState({sqlKeys}, () => {
const umiRequest = extend({ const umiRequest = extend({
errorHandler, // 默认错误处理 errorHandler, // 默认错误处理
credentials: options.credentials || 'omit', // 默认请求是否带上cookie credentials: options.credentials || 'omit', // 默认请求是否带上cookie
...@@ -1039,7 +1042,7 @@ export default class tableCom extends Component { ...@@ -1039,7 +1042,7 @@ export default class tableCom extends Component {
...this.props.defaultValues[this.props.formKey], ...this.props.defaultValues[this.props.formKey],
...options ...options
}); });
const pp = { sqlKey: Base16Encode(sqlKey), params, allValues: Base16Encode(allValues) }; const pp = {sqlKey: Base16Encode(sqlKey), params, allValues: Base16Encode(allValues)};
if (getToken() != null) { if (getToken() != null) {
pp.token = getToken(); pp.token = getToken();
} }
...@@ -1049,9 +1052,9 @@ export default class tableCom extends Component { ...@@ -1049,9 +1052,9 @@ export default class tableCom extends Component {
method: 'POST', method: 'POST',
requestType: 'form', requestType: 'form',
}).then(data => { }).then(data => {
const { sqlKeys } = this.state; const {sqlKeys} = this.state;
sqlKeys[sqlKey].data = data; sqlKeys[sqlKey].data = data;
this.setState({ sqlKeys }); this.setState({sqlKeys});
if (data == null) { if (data == null) {
return; return;
} }
...@@ -1061,7 +1064,7 @@ export default class tableCom extends Component { ...@@ -1061,7 +1064,7 @@ export default class tableCom extends Component {
const res = callback(data); const res = callback(data);
if (res != null && !(typeof res === 'function')) { if (res != null && !(typeof res === 'function')) {
this.setState({ options: res, selectDis: false }, () => { this.setState({options: res, selectDis: false}, () => {
if (orgCallback) orgCallback(); if (orgCallback) orgCallback();
}); });
} }
...@@ -1079,7 +1082,7 @@ export default class tableCom extends Component { ...@@ -1079,7 +1082,7 @@ export default class tableCom extends Component {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
this.setState({ option: x }); this.setState({option: x});
} }
} catch (e) { } catch (e) {
console.log( console.log(
...@@ -1092,7 +1095,7 @@ export default class tableCom extends Component { ...@@ -1092,7 +1095,7 @@ export default class tableCom extends Component {
if (base52) { if (base52) {
try { try {
const x = callback(data); const x = callback(data);
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x }); if (x == null || x != 'NaN') this.props.form.setFieldsValue({[base52]: x});
} catch (e) { } catch (e) {
console.log( console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j + `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j +
...@@ -1206,15 +1209,15 @@ export default class tableCom extends Component { ...@@ -1206,15 +1209,15 @@ export default class tableCom extends Component {
return value; return value;
} else if (json.optionType && json.optionType == 'func') { } else if (json.optionType && json.optionType == 'func') {
if (value != null && !(typeof value === 'function')) { if (value != null && !(typeof value === 'function')) {
this.setState({ options: value, selectDis: false }, () => { this.setState({options: value, selectDis: false}, () => {
if (callback) callback(); if (callback) callback();
}); });
} }
} else if (json.comName == 'Echart' || json.comName == 'QRCode' || json.comName == 'Graph') { } else if (json.comName == 'Echart' || json.comName == 'QRCode' || json.comName == 'Graph') {
this.setState({ option: value }); this.setState({option: value});
} else { } else {
try { try {
this.props.form.setFieldsValue({ [base52]: value }); this.props.form.setFieldsValue({[base52]: value});
} catch { } catch {
console.log( console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j + `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j +
...@@ -1233,18 +1236,19 @@ export default class tableCom extends Component { ...@@ -1233,18 +1236,19 @@ export default class tableCom extends Component {
); );
} }
}; };
componentDidMount() { componentDidMount() {
const { json, mapData, obj, init } = this.props; const {json, mapData, obj, init} = this.props;
if (json == null) { if (json == null) {
return; return;
} }
if (json.sqlKey != null && json.sqlKey != '') { if (json.sqlKey != null && json.sqlKey != '') {
const { dispatch } = this.props; const {dispatch} = this.props;
dispatch({ dispatch({
type: 'SqlManageEntity/find', type: 'SqlManageEntity/find',
payload: { sqlKey: json.sqlKey }, payload: {sqlKey: json.sqlKey},
callback: res => { callback: res => {
this.setState({ sqlContent: res.sql }); this.setState({sqlContent: res.sql});
}, },
}); });
} }
...@@ -1258,10 +1262,10 @@ export default class tableCom extends Component { ...@@ -1258,10 +1262,10 @@ export default class tableCom extends Component {
...bindObj, ...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`, base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
} }
: { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` } : {base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}`}
: bindObj; : bindObj;
if (this.props.fatherCode == null && dataColumn == null) if (this.props.fatherCode == null && dataColumn == null)
dataColumn = { base52: this.props.uuid }; dataColumn = {base52: this.props.uuid};
if (!this.props.isEdit && this.props.fatherCode) { if (!this.props.isEdit && this.props.fatherCode) {
if (bindObj != null) { if (bindObj != null) {
...@@ -1276,13 +1280,14 @@ export default class tableCom extends Component { ...@@ -1276,13 +1280,14 @@ export default class tableCom extends Component {
this.getFunctionValue(json.formula, dataColumn, json); this.getFunctionValue(json.formula, dataColumn, json);
} }
} }
fetchData3 = (obj, dataColumn, init, sqlKey, labelName, valueName, allValues) => { fetchData3 = (obj, dataColumn, init, sqlKey, labelName, valueName, allValues) => {
const { dispatch } = this.props; const {dispatch} = this.props;
if (init != null && Object.keys(init).length > 0) { if (init != null && Object.keys(init).length > 0) {
dispatch({ dispatch({
type: 'DataColumn/getSqlOptions', type: 'DataColumn/getSqlOptions',
payload: { sqlKey, allValues }, payload: {sqlKey, allValues},
callback: options => { callback: options => {
const optionsx = []; const optionsx = [];
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
...@@ -1299,9 +1304,9 @@ export default class tableCom extends Component { ...@@ -1299,9 +1304,9 @@ export default class tableCom extends Component {
} }
if (!isExist && vl != null && options.length > 0) { if (!isExist && vl != null && options.length > 0) {
this.props.form.setFieldsValue({ [base52]: null }); this.props.form.setFieldsValue({[base52]: null});
} }
this.setState({ options: optionsx, selectDis: false }); this.setState({options: optionsx, selectDis: false});
}, },
}); });
} else if (!this.props.isEdit && Object.keys(obj).length > 0) { } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
...@@ -1313,16 +1318,16 @@ export default class tableCom extends Component { ...@@ -1313,16 +1318,16 @@ export default class tableCom extends Component {
if (obj[base52]) { if (obj[base52]) {
dispatch({ dispatch({
type: 'DataColumn/getSqlLabels', type: 'DataColumn/getSqlLabels',
payload: { sqlKey, values: obj[base52], labelName, valueName, allValues }, payload: {sqlKey, values: obj[base52], labelName, valueName, allValues},
callback: labels => { callback: labels => {
this.setState({ labels, selectDis: false }); this.setState({labels, selectDis: false});
}, },
}); });
} }
} else { } else {
dispatch({ dispatch({
type: 'DataColumn/getSqlOptions', type: 'DataColumn/getSqlOptions',
payload: { sqlKey, allValues }, payload: {sqlKey, allValues},
callback: options => { callback: options => {
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
let vl = this.props.form.getFieldValue(base52); let vl = this.props.form.getFieldValue(base52);
...@@ -1340,10 +1345,10 @@ export default class tableCom extends Component { ...@@ -1340,10 +1345,10 @@ export default class tableCom extends Component {
if (!isExist && vl != null && options.length > 0) { if (!isExist && vl != null && options.length > 0) {
//console.log("isExist",optionsx,vl,isExist) //console.log("isExist",optionsx,vl,isExist)
this.props.form.setFieldsValue({ [base52]: null }); this.props.form.setFieldsValue({[base52]: null});
} }
this.setState({ options: optionsx, selectDis: false }); this.setState({options: optionsx, selectDis: false});
}, },
}); });
} }
...@@ -1370,18 +1375,18 @@ export default class tableCom extends Component { ...@@ -1370,18 +1375,18 @@ export default class tableCom extends Component {
} }
} }
this.setState({ labels: labels, selectDis: false }); this.setState({labels: labels, selectDis: false});
} else { } else {
this.setState({ options: options, selectDis: false }); this.setState({options: options, selectDis: false});
} }
}; };
fetchData = (obj, dataColumn, init, filterSql, allValues) => { fetchData = (obj, dataColumn, init, filterSql, allValues) => {
const { dispatch } = this.props; const {dispatch} = this.props;
if (init != null && Object.keys(init).length > 0) { if (init != null && Object.keys(init).length > 0) {
dispatch({ dispatch({
type: 'DataColumn/getOptions', type: 'DataColumn/getOptions',
payload: { id: dataColumn.id, filterSql, allValues }, payload: {id: dataColumn.id, filterSql, allValues},
callback: options => { callback: options => {
const optionsx = []; const optionsx = [];
for (var i = 0; i < options.length; i++) { for (var i = 0; i < options.length; i++) {
...@@ -1390,23 +1395,23 @@ export default class tableCom extends Component { ...@@ -1390,23 +1395,23 @@ export default class tableCom extends Component {
value: options[i][dataColumn.referenceCodeName], value: options[i][dataColumn.referenceCodeName],
}); });
} }
this.setState({ options: optionsx, selectDis: false }); this.setState({options: optionsx, selectDis: false});
}, },
}); });
} else if (!this.props.isEdit && Object.keys(obj).length > 0) { } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
if (obj[dataColumn.base52]) { if (obj[dataColumn.base52]) {
dispatch({ dispatch({
type: 'DataColumn/getLabels', type: 'DataColumn/getLabels',
payload: { id: dataColumn.id, values: obj[dataColumn.base52], filterSql, allValues }, payload: {id: dataColumn.id, values: obj[dataColumn.base52], filterSql, allValues},
callback: labels => { callback: labels => {
this.setState({ labels, selectDis: false }); this.setState({labels, selectDis: false});
}, },
}); });
} }
} else { } else {
dispatch({ dispatch({
type: 'DataColumn/getOptions', type: 'DataColumn/getOptions',
payload: { id: dataColumn.id, filterSql, allValues }, payload: {id: dataColumn.id, filterSql, allValues},
callback: options => { callback: options => {
const optionsx = []; const optionsx = [];
for (var i = 0; i < options.length; i++) { for (var i = 0; i < options.length; i++) {
...@@ -1415,13 +1420,13 @@ export default class tableCom extends Component { ...@@ -1415,13 +1420,13 @@ export default class tableCom extends Component {
value: options[i][dataColumn.referenceCodeName], value: options[i][dataColumn.referenceCodeName],
}); });
} }
this.setState({ options: optionsx, selectDis: false }); this.setState({options: optionsx, selectDis: false});
}, },
}); });
} }
}; };
getColumn = key => { getColumn = key => {
let { mapData, json } = this.props; let {mapData, json} = this.props;
const columnIds = json.columnIds; const columnIds = json.columnIds;
...@@ -1462,8 +1467,8 @@ export default class tableCom extends Component { ...@@ -1462,8 +1467,8 @@ export default class tableCom extends Component {
currentFormTitle, currentFormTitle,
getCellValue getCellValue
} = this.props; } = this.props;
const { options, labels, selectDis, modalCode, modalTitle, modalInit, modalProps } = this.state; const {options, labels, selectDis, modalCode, modalTitle, modalInit, modalProps} = this.state;
const { getFieldDecorator, getFieldError, getFieldProps } = this.props.form; const {getFieldDecorator, getFieldError, getFieldProps} = this.props.form;
const disabled = json != null ? json.disabled : false; const disabled = json != null ? json.disabled : false;
const permRank = json != null ? (json.permRank != null ? json.permRank : 0) : 0; const permRank = json != null ? (json.permRank != null ? json.permRank : 0) : 0;
if (json == null) { if (json == null) {
...@@ -1480,12 +1485,12 @@ export default class tableCom extends Component { ...@@ -1480,12 +1485,12 @@ export default class tableCom extends Component {
this.state.option.value == null this.state.option.value == null
) )
return <></>; return <></>;
return <QRCode {...this.state.option} key={this.props.uuid} />; return <QRCode {...this.state.option} key={this.props.uuid}/>;
} }
if (json.comName == 'Echart') { if (json.comName == 'Echart') {
return ( return (
<ReactEcharts <ReactEcharts
style={{ height: json.height || 500 }} style={{height: json.height || 500}}
key={this.props.uuid} key={this.props.uuid}
option={this.state.option || {}} option={this.state.option || {}}
notMerge={true} notMerge={true}
...@@ -1500,7 +1505,7 @@ export default class tableCom extends Component { ...@@ -1500,7 +1505,7 @@ export default class tableCom extends Component {
<Neo4jD3Com <Neo4jD3Com
key={this.props.uuid} key={this.props.uuid}
json={json} json={json}
option={this.state.option || []} /> option={this.state.option || []}/>
); );
} }
...@@ -1517,7 +1522,7 @@ export default class tableCom extends Component { ...@@ -1517,7 +1522,7 @@ export default class tableCom extends Component {
<> <>
{this.props.form.getFieldDecorator(this.props.uuid, { {this.props.form.getFieldDecorator(this.props.uuid, {
initialValue: fk, initialValue: fk,
})(<Input type="hidden" />)}{' '} })(<Input type="hidden"/>)}{' '}
<ZdyTable <ZdyTable
setRealTimeValues={this.props.setRealTimeValues} setRealTimeValues={this.props.setRealTimeValues}
hfInstance={this.props.hfInstance} hfInstance={this.props.hfInstance}
...@@ -1550,7 +1555,7 @@ export default class tableCom extends Component { ...@@ -1550,7 +1555,7 @@ export default class tableCom extends Component {
} }
if (json.comName == 'Excel') { if (json.comName == 'Excel') {
const value = getCellValue(i, j, currentFormTitle) const value = getCellValue(i, j, currentFormTitle)
const xx = <div style={{ textAlign: "center", height: value == null ? 20 : null }}>{value}</div> const xx = <div style={{textAlign: "center", height: value == null ? 20 : null}}>{value}</div>
return xx; return xx;
} }
if (json.comName == 'Label') { if (json.comName == 'Label') {
...@@ -1568,7 +1573,7 @@ export default class tableCom extends Component { ...@@ -1568,7 +1573,7 @@ export default class tableCom extends Component {
<> <>
{this.props.form.getFieldDecorator(uid, { {this.props.form.getFieldDecorator(uid, {
initialValue: obj[this.props.uuid] || json.initialValue, initialValue: obj[this.props.uuid] || json.initialValue,
})(<Input type="hidden" />)} })(<Input type="hidden"/>)}
<span <span
style={{ style={{
...@@ -1586,7 +1591,7 @@ export default class tableCom extends Component { ...@@ -1586,7 +1591,7 @@ export default class tableCom extends Component {
<> <>
{this.props.form.getFieldDecorator(uid, { {this.props.form.getFieldDecorator(uid, {
initialValue: this.props.form.getFieldValue(uid) || json.initialValue, initialValue: this.props.form.getFieldValue(uid) || json.initialValue,
})(<Input type="hidden" />)} })(<Input type="hidden"/>)}
<span <span
style={{ style={{
...@@ -1622,7 +1627,7 @@ export default class tableCom extends Component { ...@@ -1622,7 +1627,7 @@ export default class tableCom extends Component {
cm = ( cm = (
<span> <span>
{value} {value}
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br/> : ''}
</span> </span>
); );
break; break;
...@@ -1630,25 +1635,25 @@ export default class tableCom extends Component { ...@@ -1630,25 +1635,25 @@ export default class tableCom extends Component {
cm = ( cm = (
<span> <span>
{value} {value}
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br/> : ''}
</span> </span>
); );
break; break;
case 'Input': case 'Input':
cm = ( cm = (
<span style={{ paddingRight: get == 'mobile' ? 8 : '' }}> <span style={{paddingRight: get == 'mobile' ? 8 : ''}}>
{value} {value}
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br/> : ''}
</span> </span>
); );
break; break;
case 'Cron': case 'Cron':
cm = ( cm = (
<span style={{ paddingRight: get == 'mobile' ? 8 : '' }}> <span style={{paddingRight: get == 'mobile' ? 8 : ''}}>
{value} {value}
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br/> : ''}
</span> </span>
); );
...@@ -1657,7 +1662,7 @@ export default class tableCom extends Component { ...@@ -1657,7 +1662,7 @@ export default class tableCom extends Component {
cm = ( cm = (
<span> <span>
{value} {value}
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br/> : ''}
</span> </span>
); );
...@@ -1666,7 +1671,7 @@ export default class tableCom extends Component { ...@@ -1666,7 +1671,7 @@ export default class tableCom extends Component {
cm = value ? ( cm = value ? (
<span> <span>
{moment(parseInt(value)).format('YYYY-MM-DD HH:mm:ss')} {moment(parseInt(value)).format('YYYY-MM-DD HH:mm:ss')}
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br/> : ''}
</span> </span>
) : ( ) : (
'' ''
...@@ -1686,7 +1691,7 @@ export default class tableCom extends Component { ...@@ -1686,7 +1691,7 @@ export default class tableCom extends Component {
return ( return (
<img <img
key={index2} key={index2}
style={{ width: 100, height: 100 }} style={{width: 100, height: 100}}
src={queryApiActionPath() + f.path} src={queryApiActionPath() + f.path}
/> />
); );
...@@ -1700,22 +1705,22 @@ export default class tableCom extends Component { ...@@ -1700,22 +1705,22 @@ export default class tableCom extends Component {
); );
})} })}
</ul> </ul>
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br/> : ''}
</> </>
); );
break; break;
case 'ImgUploadCom': case 'ImgUploadCom':
if (value == null || value == '') { if (value == null || value == '') {
cm = <div style={{ width: json.width, height: json.height }}></div>; cm = <div style={{width: json.width, height: json.height}}></div>;
} else { } else {
cm = ( cm = (
<> <>
<img <img
src={config.httpServer + value} src={config.httpServer + value}
style={{ width: json.width, height: json.height }} style={{width: json.width, height: json.height}}
/> />
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br/> : ''}
</> </>
); );
} }
...@@ -1723,16 +1728,16 @@ export default class tableCom extends Component { ...@@ -1723,16 +1728,16 @@ export default class tableCom extends Component {
break; break;
case 'VideoUploadCom': case 'VideoUploadCom':
if (value == null || value == '') { if (value == null || value == '') {
cm = <div style={{ width: json.width, height: json.height }}> cm = <div style={{width: json.width, height: json.height}}>
</div>; </div>;
} else { } else {
cm = ( cm = (
<> <>
<img <img
src={config.httpServer + value} src={config.httpServer + value}
style={{ width: json.width, height: json.height }} style={{width: json.width, height: json.height}}
/> />
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br/> : ''}
</> </>
); );
} }
...@@ -1747,8 +1752,8 @@ export default class tableCom extends Component { ...@@ -1747,8 +1752,8 @@ export default class tableCom extends Component {
return ( return (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''} label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
> >
{cm} {cm}
...@@ -1759,15 +1764,15 @@ export default class tableCom extends Component { ...@@ -1759,15 +1764,15 @@ export default class tableCom extends Component {
<> <>
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''} label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
> >
{cm} {cm}
</MobileItem> </MobileItem>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, { {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value, initialValue: value,
})(<Input type="hidden" />)} })(<Input type="hidden"/>)}
</> </>
); );
} }
...@@ -1780,7 +1785,7 @@ export default class tableCom extends Component { ...@@ -1780,7 +1785,7 @@ export default class tableCom extends Component {
{cm} {cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, { {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value, initialValue: value,
})(<Input type="hidden" />)} })(<Input type="hidden"/>)}
</> </>
); );
} }
...@@ -1854,8 +1859,8 @@ export default class tableCom extends Component { ...@@ -1854,8 +1859,8 @@ export default class tableCom extends Component {
} else { } else {
return ( return (
<Form.Item <Form.Item
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''} label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
> >
{cm} {cm}
...@@ -1866,15 +1871,15 @@ export default class tableCom extends Component { ...@@ -1866,15 +1871,15 @@ export default class tableCom extends Component {
return ( return (
<> <>
<Form.Item <Form.Item
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''} label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
> >
{cm} {cm}
</Form.Item> </Form.Item>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, { {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value, initialValue: value,
})(<Input type="hidden" />)} })(<Input type="hidden"/>)}
</> </>
); );
} }
...@@ -1887,7 +1892,7 @@ export default class tableCom extends Component { ...@@ -1887,7 +1892,7 @@ export default class tableCom extends Component {
{cm} {cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, { {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value, initialValue: value,
})(<Input type="hidden" />)} })(<Input type="hidden"/>)}
</> </>
); );
} }
...@@ -1906,11 +1911,11 @@ export default class tableCom extends Component { ...@@ -1906,11 +1911,11 @@ export default class tableCom extends Component {
...bindObj, ...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`, base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
} }
: { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` } : {base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}`}
: bindObj; : bindObj;
if (this.props.fatherCode == null && dataColumn == null) { if (this.props.fatherCode == null && dataColumn == null) {
dataColumn = { base52: this.props.uuid }; dataColumn = {base52: this.props.uuid};
} }
if (dataColumn.isNull != null && !dataColumn.isNull) { if (dataColumn.isNull != null && !dataColumn.isNull) {
required = true; required = true;
...@@ -1918,9 +1923,9 @@ export default class tableCom extends Component { ...@@ -1918,9 +1923,9 @@ export default class tableCom extends Component {
var title = json.label || (dataColumn && dataColumn.title); var title = json.label || (dataColumn && dataColumn.title);
var initValue; var initValue;
const objinit = { ...init, ...obj }; const objinit = {...init, ...obj};
if (objinit != null&&Object.keys(objinit).length>0) { if (objinit != null && Object.keys(objinit).length > 0) {
if (this.props.fatherCode != null) { if (this.props.fatherCode != null) {
initValue = initValue =
objinit[this.props.index] != null objinit[this.props.index] != null
...@@ -1949,13 +1954,13 @@ export default class tableCom extends Component { ...@@ -1949,13 +1954,13 @@ export default class tableCom extends Component {
dataColumn.base52 = this.props.uuid; dataColumn.base52 = this.props.uuid;
} }
} }
switch (json.comName) { switch (json.comName) {
// 电子签章展示 // 电子签章展示
// case 'Signature': // case 'Signature':
// cm = <img src={queryApiActionPath()+obj[dataColumn.base52]} /> // cm = <img src={queryApiActionPath()+obj[dataColumn.base52]} />
// break; // break;
case 'RichText': case 'RichText':
// console.log(obj[dataColumn.base52]);
cm = ( cm = (
<Editor <Editor
key={dataColumn.base52} key={dataColumn.base52}
...@@ -2023,7 +2028,7 @@ export default class tableCom extends Component { ...@@ -2023,7 +2028,7 @@ export default class tableCom extends Component {
Object.values(r) Object.values(r)
) )
) : typeof r == 'string' ? ( ) : typeof r == 'string' ? (
<span style={{ marginLeft: 12 }}>{r}</span> <span style={{marginLeft: 12}}>{r}</span>
) : ( ) : (
',' + Object.values(r) ',' + Object.values(r)
), ),
...@@ -2148,7 +2153,7 @@ export default class tableCom extends Component { ...@@ -2148,7 +2153,7 @@ export default class tableCom extends Component {
if (get === 'web' && !this.props.isPrint) { if (get === 'web' && !this.props.isPrint) {
return ( return (
<li key={index2}> <li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name} /> <FilePreview path={queryApiActionPath() + f.path} pathName={f.name}/>
</li> </li>
); );
} }
...@@ -2180,7 +2185,7 @@ export default class tableCom extends Component { ...@@ -2180,7 +2185,7 @@ export default class tableCom extends Component {
if (get === 'web' || !this.props.isPrint) { if (get === 'web' || !this.props.isPrint) {
return ( return (
<li key={index2}> <li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name} /> <FilePreview path={queryApiActionPath() + f.path} pathName={f.name}/>
</li> </li>
); );
} }
...@@ -2201,7 +2206,7 @@ export default class tableCom extends Component { ...@@ -2201,7 +2206,7 @@ export default class tableCom extends Component {
} }
} else { } else {
cm = ( cm = (
<span style={{ display: 'inline-block', width: '100%', textAlign: 'center' }}> <span style={{display: 'inline-block', width: '100%', textAlign: 'center'}}>
暂无附件 暂无附件
</span> </span>
); );
...@@ -2212,7 +2217,8 @@ export default class tableCom extends Component { ...@@ -2212,7 +2217,8 @@ export default class tableCom extends Component {
if (obj[dataColumn.base52] == null || obj[dataColumn.base52] == '') { if (obj[dataColumn.base52] == null || obj[dataColumn.base52] == '') {
cm = <div style={{ cm = <div style={{
width: json.width, width: json.width,
height: json.height}}> height: json.height
}}>
</div>; </div>;
} else { } else {
...@@ -2226,7 +2232,7 @@ export default class tableCom extends Component { ...@@ -2226,7 +2232,7 @@ export default class tableCom extends Component {
) : ( ) : (
<img <img
src={config.httpServer + obj[dataColumn.base52]} src={config.httpServer + obj[dataColumn.base52]}
style={{ width: json.width, height: json.height }} style={{width: json.width, height: json.height}}
/> />
); );
} }
...@@ -2236,7 +2242,8 @@ export default class tableCom extends Component { ...@@ -2236,7 +2242,8 @@ export default class tableCom extends Component {
if (obj[dataColumn.base52] == null || obj[dataColumn.base52] == '') { if (obj[dataColumn.base52] == null || obj[dataColumn.base52] == '') {
cm = <div style={{ cm = <div style={{
width: json.width, width: json.width,
height: json.height }}> height: json.height
}}>
</div>; </div>;
} else { } else {
...@@ -2250,7 +2257,7 @@ export default class tableCom extends Component { ...@@ -2250,7 +2257,7 @@ export default class tableCom extends Component {
) : ( ) : (
<img <img
src={config.httpServer + obj[dataColumn.base52]} src={config.httpServer + obj[dataColumn.base52]}
style={{ width: json.width, height: json.height }} style={{width: json.width, height: json.height}}
/> />
); );
} }
...@@ -2275,7 +2282,8 @@ export default class tableCom extends Component { ...@@ -2275,7 +2282,8 @@ export default class tableCom extends Component {
case 'ChildForm': case 'ChildForm':
const xxxxx = obj[dataColumn.base52]; const xxxxx = obj[dataColumn.base52];
if (xxxxx == null) { if (xxxxx == null) {
cm = <></>; Chil cm = <></>;
Chil
break; break;
} }
if (Object.keys(xxxxx).length > 0) { if (Object.keys(xxxxx).length > 0) {
...@@ -2316,7 +2324,7 @@ export default class tableCom extends Component { ...@@ -2316,7 +2324,7 @@ export default class tableCom extends Component {
let events = {}; let events = {};
if (json.events != null) { if (json.events != null) {
events = this.getFunctionValue(json.events, { base52: this.props.uuid }, json); events = this.getFunctionValue(json.events, {base52: this.props.uuid}, json);
} }
if (events && events.dom) { if (events && events.dom) {
cm = events.dom; cm = events.dom;
...@@ -2383,7 +2391,7 @@ export default class tableCom extends Component { ...@@ -2383,7 +2391,7 @@ export default class tableCom extends Component {
let events = {}; let events = {};
if (json.events != null) { if (json.events != null) {
events = this.getFunctionValue(json.events, { base52: this.props.uuid }, json); events = this.getFunctionValue(json.events, {base52: this.props.uuid}, json);
} }
if (events && events.dom) { if (events && events.dom) {
cm = events.dom; cm = events.dom;
...@@ -2407,10 +2415,10 @@ export default class tableCom extends Component { ...@@ -2407,10 +2415,10 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [{required: required, message: '请输入' + title}],
})( })(
<TextArea <TextArea
autosize={{ minRows: 4 }} autosize={{minRows: 4}}
disabled={disabled} disabled={disabled}
placeholder={json.placeholder} placeholder={json.placeholder}
/>, />,
...@@ -2439,8 +2447,8 @@ export default class tableCom extends Component { ...@@ -2439,8 +2447,8 @@ export default class tableCom extends Component {
) { ) {
cm = ( cm = (
<Form.Item <Form.Item
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2453,10 +2461,10 @@ export default class tableCom extends Component { ...@@ -2453,10 +2461,10 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [{required: required, message: '请输入' + title}],
})( })(
<TextArea <TextArea
autosize={{ minRows: 4 }} autosize={{minRows: 4}}
disabled={disabled} disabled={disabled}
rows={4} rows={4}
placeholder={json.placeholder} placeholder={json.placeholder}
...@@ -2479,7 +2487,7 @@ export default class tableCom extends Component { ...@@ -2479,7 +2487,7 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + title }], : [{required: required, message: '请选择' + title}],
})} })}
disabled={disabled} disabled={disabled}
onClick={checked => { onClick={checked => {
...@@ -2506,7 +2514,7 @@ export default class tableCom extends Component { ...@@ -2506,7 +2514,7 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + title }], : [{required: required, message: '请选择' + title}],
})( })(
<Switch <Switch
disabled={disabled} disabled={disabled}
...@@ -2523,11 +2531,11 @@ export default class tableCom extends Component { ...@@ -2523,11 +2531,11 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [{required: required, message: '请输入' + title}],
})( })(
<Input <Input
disabled={disabled} disabled={disabled}
style={{ width: json.width }} style={{width: json.width}}
placeholder={json.placeholder} placeholder={json.placeholder}
/>, />,
); );
...@@ -2541,8 +2549,8 @@ export default class tableCom extends Component { ...@@ -2541,8 +2549,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2554,7 +2562,7 @@ export default class tableCom extends Component { ...@@ -2554,7 +2562,7 @@ export default class tableCom extends Component {
case 'InputHidden': case 'InputHidden':
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue, initialValue: initValue,
})(<Input type="hidden" />); })(<Input type="hidden"/>);
break; break;
case 'InputNumber': case 'InputNumber':
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
...@@ -2562,7 +2570,7 @@ export default class tableCom extends Component { ...@@ -2562,7 +2570,7 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [{required: required, message: '请输入' + title}],
})( })(
<InputNumber <InputNumber
disabled={disabled} disabled={disabled}
...@@ -2583,8 +2591,8 @@ export default class tableCom extends Component { ...@@ -2583,8 +2591,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2603,8 +2611,8 @@ export default class tableCom extends Component { ...@@ -2603,8 +2611,8 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [{required: required, message: '请选择' + dataColumn.title}],
})(<Radio.Group options={options} disabled={disabled} />); })(<Radio.Group options={options} disabled={disabled}/>);
if (get == 'mobile') { if (get == 'mobile') {
cm = <div>{cm}</div>; cm = <div>{cm}</div>;
if ( if (
...@@ -2615,8 +2623,8 @@ export default class tableCom extends Component { ...@@ -2615,8 +2623,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2638,8 +2646,8 @@ export default class tableCom extends Component { ...@@ -2638,8 +2646,8 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [{required: required, message: '请选择' + dataColumn.title}],
})(<Checkbox.Group options={options} disabled={disabled} />)} })(<Checkbox.Group options={options} disabled={disabled}/>)}
</Flex> </Flex>
); );
...@@ -2651,8 +2659,8 @@ export default class tableCom extends Component { ...@@ -2651,8 +2659,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2668,8 +2676,8 @@ export default class tableCom extends Component { ...@@ -2668,8 +2676,8 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [{required: required, message: '请选择' + dataColumn.title}],
})(<Checkbox.Group options={options} disabled={disabled} />); })(<Checkbox.Group options={options} disabled={disabled}/>);
break; break;
case 'Select': case 'Select':
...@@ -2678,14 +2686,14 @@ export default class tableCom extends Component { ...@@ -2678,14 +2686,14 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择' + dataColumn.title }], : [{required: required, message: '请选择' + dataColumn.title}],
})( })(
<Select <Select
allowClear allowClear
showSearch showSearch
disabled={selectDis || disabled} disabled={selectDis || disabled}
placeholder={json.placeholder} placeholder={json.placeholder}
style={{ width: json.width }} style={{width: json.width}}
optionFilterProp="children" optionFilterProp="children"
getPopupContainer={ getPopupContainer={
this.props.isDynamic && document.querySelector('#dynamic_div') this.props.isDynamic && document.querySelector('#dynamic_div')
...@@ -2717,7 +2725,7 @@ export default class tableCom extends Component { ...@@ -2717,7 +2725,7 @@ export default class tableCom extends Component {
: false : false
} }
> >
{options&&options instanceof Array {options && options instanceof Array
? options.map(r => ( ? options.map(r => (
<Option key={r.value} value={r.value}> <Option key={r.value} value={r.value}>
{r.label} {r.label}
...@@ -2735,8 +2743,8 @@ export default class tableCom extends Component { ...@@ -2735,8 +2743,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2790,8 +2798,8 @@ export default class tableCom extends Component { ...@@ -2790,8 +2798,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2804,7 +2812,7 @@ export default class tableCom extends Component { ...@@ -2804,7 +2812,7 @@ export default class tableCom extends Component {
const begin = dataColumn; const begin = dataColumn;
var end = this.getColumn('c2'); var end = this.getColumn('c2');
if (end == null) { if (end == null) {
end = { base52: this.props.uuid + '_2' }; end = {base52: this.props.uuid + '_2'};
} }
const ivs = []; const ivs = [];
if (initValue != null && init != null) { if (initValue != null && init != null) {
...@@ -2830,8 +2838,8 @@ export default class tableCom extends Component { ...@@ -2830,8 +2838,8 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择起止时间' }], : [{required: required, message: '请选择起止时间'}],
})(<MobileDate disabled={disabled} formate={json.format} />); })(<MobileDate disabled={disabled} formate={json.format}/>);
if ( if (
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
(json.isMobileLabel == null && json.isLabel)) && (json.isMobileLabel == null && json.isLabel)) &&
...@@ -2840,8 +2848,8 @@ export default class tableCom extends Component { ...@@ -2840,8 +2848,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2855,7 +2863,7 @@ export default class tableCom extends Component { ...@@ -2855,7 +2863,7 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择起止时间' }], : [{required: required, message: '请选择起止时间'}],
})( })(
<RangePicker <RangePicker
showTime={json.showTime != null ? json.showTime : true} showTime={json.showTime != null ? json.showTime : true}
...@@ -2877,7 +2885,7 @@ export default class tableCom extends Component { ...@@ -2877,7 +2885,7 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请选择起止时间' }], : [{required: required, message: '请选择起止时间'}],
})( })(
<DatePicker <DatePicker
disabled={disabled} disabled={disabled}
...@@ -2899,7 +2907,8 @@ export default class tableCom extends Component { ...@@ -2899,7 +2907,8 @@ export default class tableCom extends Component {
} }
}); });
} }
: () => { } : () => {
}
} }
format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'} format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'}
/>, />,
...@@ -2913,8 +2922,8 @@ export default class tableCom extends Component { ...@@ -2913,8 +2922,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2930,7 +2939,7 @@ export default class tableCom extends Component { ...@@ -2930,7 +2939,7 @@ export default class tableCom extends Component {
files = initValue.files; files = initValue.files;
} }
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: { files: files }, initialValue: {files: files},
rules: [ rules: [
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
...@@ -2954,8 +2963,8 @@ export default class tableCom extends Component { ...@@ -2954,8 +2963,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2964,13 +2973,14 @@ export default class tableCom extends Component { ...@@ -2964,13 +2973,14 @@ export default class tableCom extends Component {
} }
break; break;
case 'RichText': case 'RichText':
debugger;
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue, initialValue: initValue,
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' }], : [{required: required, message: '请输入'}],
})(<DraftEditorCom placeholder={json.placeholder} />); })(<DraftEditorCom placeholder={json.placeholder}/>);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -2980,8 +2990,8 @@ export default class tableCom extends Component { ...@@ -2980,8 +2990,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -2995,9 +3005,9 @@ export default class tableCom extends Component { ...@@ -2995,9 +3005,9 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请输入' + title }], : [{required: required, message: '请输入' + title}],
})( })(
<CronEditor style={{width:600}}/> <CronEditor style={{width: 600}}/>
); );
break; break;
case 'LocationCom': case 'LocationCom':
...@@ -3006,7 +3016,7 @@ export default class tableCom extends Component { ...@@ -3006,7 +3016,7 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请进行定位' }], : [{required: required, message: '请进行定位'}],
})( })(
<LocationCom <LocationCom
get={get} get={get}
...@@ -3026,8 +3036,8 @@ export default class tableCom extends Component { ...@@ -3026,8 +3036,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -3075,8 +3085,8 @@ export default class tableCom extends Component { ...@@ -3075,8 +3085,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -3090,8 +3100,8 @@ export default class tableCom extends Component { ...@@ -3090,8 +3100,8 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请上传图片' }], : [{required: required, message: '请上传图片'}],
})(<ImgUploadCom json={json} disabled={disabled} />); })(<ImgUploadCom json={json} disabled={disabled}/>);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -3101,8 +3111,8 @@ export default class tableCom extends Component { ...@@ -3101,8 +3111,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -3116,7 +3126,7 @@ export default class tableCom extends Component { ...@@ -3116,7 +3126,7 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请上传视频' }], : [{required: required, message: '请上传视频'}],
})(<VideoUploadCom json={json} })(<VideoUploadCom json={json}
disabled={disabled} disabled={disabled}
/>); />);
...@@ -3129,8 +3139,8 @@ export default class tableCom extends Component { ...@@ -3129,8 +3139,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -3144,7 +3154,7 @@ export default class tableCom extends Component { ...@@ -3144,7 +3154,7 @@ export default class tableCom extends Component {
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [{ required: required, message: '请进行签名' }], : [{required: required, message: '请进行签名'}],
})( })(
<Signature <Signature
width={ width={
...@@ -3164,8 +3174,8 @@ export default class tableCom extends Component { ...@@ -3164,8 +3174,8 @@ export default class tableCom extends Component {
cm = ( cm = (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -3205,12 +3215,12 @@ export default class tableCom extends Component { ...@@ -3205,12 +3215,12 @@ export default class tableCom extends Component {
if (json.isLabel) { if (json.isLabel) {
if (get === 'mobile' && !this.props.isEdit) { if (get === 'mobile' && !this.props.isEdit) {
return ( return (
<Card style={{ margin: 5, border: '1px solid #ccc' }}> <Card style={{margin: 5, border: '1px solid #ccc'}}>
{modalCode ? ( {modalCode ? (
<FormModal <FormModal
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this,modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}
> >
<ZdyTable <ZdyTable
...@@ -3236,7 +3246,7 @@ export default class tableCom extends Component { ...@@ -3236,7 +3246,7 @@ export default class tableCom extends Component {
) : ( ) : (
'' ''
)} )}
<Card.Header title={<span style={{ fontSize: 14 }}>{title}:</span>} /> <Card.Header title={<span style={{fontSize: 14}}>{title}:</span>}/>
<Card.Body>{cm}</Card.Body> <Card.Body>{cm}</Card.Body>
</Card> </Card>
); );
...@@ -3291,7 +3301,7 @@ export default class tableCom extends Component { ...@@ -3291,7 +3301,7 @@ export default class tableCom extends Component {
<FormModal <FormModal
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this,modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}
> >
<ZdyTable <ZdyTable
...@@ -3327,7 +3337,7 @@ export default class tableCom extends Component { ...@@ -3327,7 +3337,7 @@ export default class tableCom extends Component {
<FormModal <FormModal
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this,modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}
> >
<ZdyTable <ZdyTable
...@@ -3354,8 +3364,8 @@ export default class tableCom extends Component { ...@@ -3354,8 +3364,8 @@ export default class tableCom extends Component {
'' ''
)} )}
<Form.Item <Form.Item
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -3370,7 +3380,7 @@ export default class tableCom extends Component { ...@@ -3370,7 +3380,7 @@ export default class tableCom extends Component {
<FormModal <FormModal
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this,modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}
> >
<ZdyTable <ZdyTable
...@@ -3407,7 +3417,7 @@ export default class tableCom extends Component { ...@@ -3407,7 +3417,7 @@ export default class tableCom extends Component {
<FormModal <FormModal
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this,modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}
> >
<ZdyTable <ZdyTable
...@@ -3436,8 +3446,8 @@ export default class tableCom extends Component { ...@@ -3436,8 +3446,8 @@ export default class tableCom extends Component {
{json.isMobileLabel && !isEdit && get == 'mobile' ? ( {json.isMobileLabel && !isEdit && get == 'mobile' ? (
<MobileItem <MobileItem
isPreview={isPreview} isPreview={isPreview}
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
...@@ -3445,8 +3455,8 @@ export default class tableCom extends Component { ...@@ -3445,8 +3455,8 @@ export default class tableCom extends Component {
) : isEdit && get == 'web' ? ( ) : isEdit && get == 'web' ? (
json.isLabel ? ( json.isLabel ? (
<Form.Item <Form.Item
labelCol={{ span: json.labelSpan }} labelCol={{span: json.labelSpan}}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{span: json.wrapperSpan}}
label={title} label={title}
> >
{cm} {cm}
......
import { import {
EditorState, convertFromRaw, convertToRaw, CompositeDecorator, EditorState, convertFromRaw, convertToRaw, CompositeDecorator,
} from 'draft-js'; } from 'draft-js';
import { message } from 'antd' import {message} from 'antd'
import { stateToHTML } from 'draft-js-export-html'; import {stateToHTML} from 'draft-js-export-html';
import moment from 'moment'; import moment from 'moment';
import {isJSON} from "@/webPublic/one_stop_public/copy";
function findLinkEntities(contentBlock, callback, contentState) { function findLinkEntities(contentBlock, callback, contentState) {
contentBlock.findEntityRanges( contentBlock.findEntityRanges(
...@@ -19,13 +19,12 @@ function findLinkEntities(contentBlock, callback, contentState) { ...@@ -19,13 +19,12 @@ function findLinkEntities(contentBlock, callback, contentState) {
console.log(arguments); console.log(arguments);
callback(...arguments); callback(...arguments);
} }
); );
} }
const Link = (props) => { const Link = (props) => {
const { url } = props.contentState.getEntity(props.entityKey).getData(); const {url} = props.contentState.getEntity(props.entityKey).getData();
return ( return (
<a href={url} target="_blank"> <a href={url} target="_blank">
...@@ -40,29 +39,30 @@ const decorator = new CompositeDecorator([ ...@@ -40,29 +39,30 @@ const decorator = new CompositeDecorator([
component: Link component: Link
} }
]); ]);
export function changeHtml(msg) { export function changeHtml(msg) {
var msg = msg.replace(/<\/?[^>]*>/g, ''); //去除HTML Tag var msg = msg.replace(/<\/?[^>]*>/g, ''); //去除HTML Tag
msg = msg.replace(/[|]*\n/, '') //去除行尾空格 msg = msg.replace(/[|]*\n/, '') //去除行尾空格
msg = msg.replace(/&npsp;/ig, ''); //去掉npsp msg = msg.replace(/&npsp;/ig, ''); //去掉npsp
return msg; return msg;
} }
export function changeToDraftState(blocks) {
export function changeToDraftState(blocks) {
if (blocks == null || blocks == "") { if (blocks == null || blocks == "") {
return EditorState.createEmpty(decorator) return EditorState.createEmpty(decorator)
} }
let x; let x;
if(blocks instanceof String){ if (typeof blocks === 'string' && blocks) {
try{ try {
x = JSON.parse(blocks) x = JSON.parse(blocks)
}catch(e){ } catch (e) {
return EditorState.createEmpty(decorator) return EditorState.createEmpty(decorator)
} }
}else{ } else {
x=blocks x = blocks
} }
if(!x.blocks){ if (!x.blocks) {
return EditorState.createEmpty(decorator) return EditorState.createEmpty(decorator)
} }
...@@ -71,31 +71,35 @@ export function changeToDraftState(blocks) { ...@@ -71,31 +71,35 @@ export function changeToDraftState(blocks) {
const b = convertFromRaw(x); const b = convertFromRaw(x);
return EditorState.createWithContent(b, decorator) return EditorState.createWithContent(b, decorator)
} }
export function changeFromDraftState(editorState) { export function changeFromDraftState(editorState) {
const x = editorState.getCurrentContent() const x = editorState.getCurrentContent()
const blocks = JSON.stringify(convertToRaw(x)) const blocks = JSON.stringify(convertToRaw(x))
const content = stateToHTML(x) const content = stateToHTML(x)
return { content, blocks } return {content, blocks}
} }
export function changeToDraftState2(blocks) { export function changeToDraftState2(blocks) {
const b = convertFromRaw(blocks); const b = convertFromRaw(blocks);
return EditorState.createWithContent(b, decorator) return EditorState.createWithContent(b, decorator)
} }
export function changeFromDraftState2(editorState) { export function changeFromDraftState2(editorState) {
if(editorState==null) return; if (editorState == null) return;
const x = editorState.getCurrentContent() const x = editorState.getCurrentContent()
const blocks = convertToRaw(x) const blocks = convertToRaw(x)
return blocks return blocks
} }
export function preHandle(values) { export function preHandle(values) {
for (var key in values) { for (var key in values) {
if(!values[key]) continue; if (!values[key]) continue;
if (key.indexOf("$") > -1) { if (key.indexOf("$") > -1) {
var xx = key.split("$") var xx = key.split("$")
for (var i = 0; i < xx.length; i++) { for (var i = 0; i < xx.length; i++) {
...@@ -112,22 +116,22 @@ export function preHandle(values) { ...@@ -112,22 +116,22 @@ export function preHandle(values) {
if (values[key] != null) { if (values[key] != null) {
if (values[key] instanceof moment) { if (values[key] instanceof moment) {
values[key] = values[key].valueOf() values[key] = values[key].valueOf()
}else if (values[key] instanceof Date) { } else if (values[key] instanceof Date) {
values[key] = values[key].valueOf() values[key] = values[key].valueOf()
} else if (values[key] instanceof Boolean) { } else if (values[key] instanceof Boolean) {
values[key] = values[key] ? 0 : 1 values[key] = values[key] ? 0 : 1
}else if(values[key] instanceof Object&&key!='defaultValues'){ } else if (values[key] instanceof Object && key != 'defaultValues') {
//处理子表单中的日期值 //处理子表单中的日期值
let objValues = values[key]; let objValues = values[key];
for(let k in objValues){ for (let k in objValues) {
if(k!=''&&objValues[k] instanceof Object){ if (k != '' && objValues[k] instanceof Object) {
let childObj = objValues[k]; let childObj = objValues[k];
for(let j in childObj){ for (let j in childObj) {
if(childObj[j]!=null){ if (childObj[j] != null) {
if (childObj[j] instanceof moment) { if (childObj[j] instanceof moment) {
values[key][k][j] = values[key][k][j].valueOf() values[key][k][j] = values[key][k][j].valueOf()
}else if (childObj[j] instanceof Date) { } else if (childObj[j] instanceof Date) {
values[key][k][j] = values[key][k][j].valueOf() values[key][k][j] = values[key][k][j].valueOf()
} else if (childObj[j] instanceof Boolean) { } else if (childObj[j] instanceof Boolean) {
values[key][k][j] = values[key][k][j] ? 0 : 1 values[key][k][j] = values[key][k][j] ? 0 : 1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论