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

判断是不是字符串的bug

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