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

// 钟是志 2021年9月28日 16:19:46 解决 checkbox 多选负值不上的bug

上级 b5ee86dc
...@@ -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 {
...@@ -25,13 +25,13 @@ import { ...@@ -25,13 +25,13 @@ 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 {Editor} from 'draft-js'; import { 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 {Card, Flex, List as MobileList, Switch as MobileSwitch} from 'antd-mobile'; import { Card, Flex, List as MobileList, Switch as MobileSwitch } 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';
...@@ -45,26 +45,26 @@ import router from 'umi/router'; ...@@ -45,26 +45,26 @@ 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 {cloneDeep, isEmpty, isNaN} from 'lodash'; import { cloneDeep, isEmpty, isNaN } 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 {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';
import MobileCascader from "./CascaderDiy/MobileCascader"; import MobileCascader from './CascaderDiy/MobileCascader';
import {equal, errorHandler, getBase64, getRender, isJSON} from './Split_Index/staticInfo'; import { equal, errorHandler, getBase64, getRender, isJSON } from './Split_Index/staticInfo';
const {TextArea} = Input; const { TextArea } = Input;
const {Option} = Select; const { Option } = Select;
const {RangePicker} = DatePicker; const { RangePicker } = DatePicker;
@connect(({DataColumn, SqlManageEntity, formList, loading}) => ({ @connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
DataColumn, DataColumn,
SqlManageEntity, SqlManageEntity,
formList, formList,
...@@ -100,22 +100,22 @@ export default class tableCom extends Component { ...@@ -100,22 +100,22 @@ export default class tableCom extends Component {
} }
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,
...@@ -152,7 +152,7 @@ export default class tableCom extends Component { ...@@ -152,7 +152,7 @@ export default class tableCom extends Component {
count = []; count = [];
handleSearch = (selectedKeys, confirm) => { handleSearch = (selectedKeys, confirm) => {
confirm(); confirm();
this.setState({searchText: selectedKeys[0]}); this.setState({ searchText: selectedKeys[0] });
}; };
handleReset = clearFilters => { handleReset = clearFilters => {
...@@ -167,8 +167,8 @@ export default class tableCom extends Component { ...@@ -167,8 +167,8 @@ export default class tableCom extends Component {
}; };
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;
...@@ -177,7 +177,7 @@ export default class tableCom extends Component { ...@@ -177,7 +177,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"
...@@ -185,7 +185,7 @@ export default class tableCom extends Component { ...@@ -185,7 +185,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>
...@@ -193,19 +193,19 @@ export default class tableCom extends Component { ...@@ -193,19 +193,19 @@ 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]
.toString() .toString()
.toLowerCase() .toLowerCase()
.includes(value.toLowerCase()) .includes(value.toLowerCase())
: '', : '',
onFilterDropdownVisibleChange: visible => { onFilterDropdownVisibleChange: visible => {
if (visible) { if (visible) {
...@@ -216,7 +216,7 @@ export default class tableCom extends Component { ...@@ -216,7 +216,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()}
...@@ -240,7 +240,7 @@ export default class tableCom extends Component { ...@@ -240,7 +240,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;
} }
...@@ -298,7 +298,7 @@ export default class tableCom extends Component { ...@@ -298,7 +298,7 @@ export default class tableCom extends Component {
console.log( console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props
.i + 1}行,第${this.props.j + .i + 1}行,第${this.props.j +
1}列:存在循环风险,1秒内执行超过10次,现已停止执行,请检查,`, 1}列:存在循环风险,1秒内执行超过10次,现已停止执行,请检查,`,
); );
return; return;
...@@ -319,14 +319,14 @@ export default class tableCom extends Component { ...@@ -319,14 +319,14 @@ export default class tableCom extends Component {
let dataColumn = let dataColumn =
this.props.fatherCode != null this.props.fatherCode != null
? bindObj ? bindObj
? { ? {
...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) {
...@@ -354,18 +354,18 @@ export default class tableCom extends Component { ...@@ -354,18 +354,18 @@ export default class tableCom extends Component {
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 = [];
...@@ -384,7 +384,7 @@ export default class tableCom extends Component { ...@@ -384,7 +384,7 @@ export default class tableCom extends Component {
break; break;
} }
} }
this.setState({columns}); this.setState({ columns });
} }
}, },
}); });
...@@ -422,18 +422,18 @@ export default class tableCom extends Component { ...@@ -422,18 +422,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 });
}, },
}); });
} }
...@@ -442,7 +442,7 @@ export default class tableCom extends Component { ...@@ -442,7 +442,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 = [];
...@@ -459,7 +459,7 @@ export default class tableCom extends Component { ...@@ -459,7 +459,7 @@ export default class tableCom extends Component {
break; break;
} }
} }
this.setState({columns}); this.setState({ columns });
} }
}, },
}); });
...@@ -467,6 +467,7 @@ export default class tableCom extends Component { ...@@ -467,6 +467,7 @@ export default class tableCom extends Component {
} }
if (json.optionType != null && this.dataFilter.includes(json.comName)) { if (json.optionType != null && this.dataFilter.includes(json.comName)) {
// 获取 下拉枚举值
switch (json.optionType) { switch (json.optionType) {
case 'reference': case 'reference':
if (dataColumn.referenceObjId != null) { if (dataColumn.referenceObjId != null) {
...@@ -503,14 +504,14 @@ export default class tableCom extends Component { ...@@ -503,14 +504,14 @@ export default class tableCom extends Component {
if (json.funcs != null && json.funcs != '') { if (json.funcs != null && json.funcs != '') {
if (json.comName == 'Cascader') { if (json.comName == 'Cascader') {
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.getFieldsValue()[base52]; let vlu = this.props.form.getFieldsValue()[base52];
const labs = []; const labs = [];
this.searchJson(vlu, this.state.options, 0, labs); this.searchJson(vlu, this.state.options, 0, labs);
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;
...@@ -518,7 +519,7 @@ export default class tableCom extends Component { ...@@ -518,7 +519,7 @@ export default class tableCom extends Component {
const labs = []; const labs = [];
this.searchJson(vlu, this.state.options, 0, labs); this.searchJson(vlu, this.state.options, 0, labs);
this.setState({labels: labs}); this.setState({ labels: labs });
} }
}); });
} catch (e) { } catch (e) {
...@@ -526,7 +527,7 @@ export default class tableCom extends Component { ...@@ -526,7 +527,7 @@ export default class tableCom extends Component {
} }
} else { } else {
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.getFieldsValue()[base52]; let vlu = this.props.form.getFieldsValue()[base52];
...@@ -546,7 +547,7 @@ export default class tableCom extends Component { ...@@ -546,7 +547,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;
...@@ -568,7 +569,7 @@ export default class tableCom extends Component { ...@@ -568,7 +569,7 @@ export default class tableCom extends Component {
} }
} }
this.setState({labels: labs}); this.setState({ labels: labs });
} }
}); });
} catch (e) { } catch (e) {
...@@ -583,11 +584,12 @@ export default class tableCom extends Component { ...@@ -583,11 +584,12 @@ export default class tableCom extends Component {
setValues = (base52, json, values) => { setValues = (base52, json, values) => {
try { try {
// console.log(values);
this.props.form.setFieldsValue(values); this.props.form.setFieldsValue(values);
} catch (e) { } catch (e) {
console.log( console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i +
1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`, 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e, e,
); );
} }
...@@ -603,7 +605,7 @@ export default class tableCom extends Component { ...@@ -603,7 +605,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;
...@@ -626,7 +628,7 @@ export default class tableCom extends Component { ...@@ -626,7 +628,7 @@ export default class tableCom extends Component {
} }
} }
} else { } else {
reqUrls[url] = {params: params}; reqUrls[url] = { params: params };
isChange = true; isChange = true;
} }
...@@ -638,7 +640,7 @@ export default class tableCom extends Component { ...@@ -638,7 +640,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();
}); });
} }
...@@ -653,15 +655,11 @@ export default class tableCom extends Component { ...@@ -653,15 +655,11 @@ export default class tableCom extends Component {
); );
//message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10) //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
} }
} else if ( } else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
json.comName == 'Echart' ||
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
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(
...@@ -674,11 +672,12 @@ export default class tableCom extends Component { ...@@ -674,11 +672,12 @@ 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}); // console.log(x, '674');
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 +
1}列:公式配置有误,回调函数内部错误,`, 1}列:公式配置有误,回调函数内部错误,`,
e, e,
); );
} }
...@@ -716,16 +715,16 @@ export default class tableCom extends Component { ...@@ -716,16 +715,16 @@ export default class tableCom extends Component {
// if (!data || !Array.isArray(data)) { // if (!data || !Array.isArray(data)) {
// data = []; // data = [];
// } // }
const {reqUrls} = this.state; const { reqUrls } = this.state;
if (reqUrls && reqUrls[url]) { if (reqUrls && reqUrls[url]) {
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();
}); });
} }
...@@ -739,15 +738,11 @@ export default class tableCom extends Component { ...@@ -739,15 +738,11 @@ export default class tableCom extends Component {
e, e,
); );
} }
} else if ( } else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
json.comName == 'Echart' ||
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
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(
...@@ -760,7 +755,8 @@ export default class tableCom extends Component { ...@@ -760,7 +755,8 @@ 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}); // console.log(x, '757');
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 `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
...@@ -779,7 +775,7 @@ export default class tableCom extends Component { ...@@ -779,7 +775,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;
...@@ -808,7 +804,7 @@ export default class tableCom extends Component { ...@@ -808,7 +804,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) {
...@@ -817,7 +813,7 @@ export default class tableCom extends Component { ...@@ -817,7 +813,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();
}); });
} }
...@@ -839,7 +835,7 @@ export default class tableCom extends Component { ...@@ -839,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(
...@@ -852,7 +848,8 @@ export default class tableCom extends Component { ...@@ -852,7 +848,8 @@ 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}); // console.log(x, 853);
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 `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
...@@ -867,7 +864,7 @@ export default class tableCom extends Component { ...@@ -867,7 +864,7 @@ 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
...@@ -879,7 +876,7 @@ export default class tableCom extends Component { ...@@ -879,7 +876,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();
} }
...@@ -889,9 +886,9 @@ export default class tableCom extends Component { ...@@ -889,9 +886,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;
} }
...@@ -901,7 +898,7 @@ export default class tableCom extends Component { ...@@ -901,7 +898,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();
}); });
} }
...@@ -923,7 +920,7 @@ export default class tableCom extends Component { ...@@ -923,7 +920,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(
...@@ -936,7 +933,8 @@ export default class tableCom extends Component { ...@@ -936,7 +933,8 @@ 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}); // console.log(x, 938);
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 `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
...@@ -1049,19 +1047,15 @@ export default class tableCom extends Component { ...@@ -1049,19 +1047,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 ( } else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
json.comName == 'Echart' || this.setState({ option: value });
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
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 `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
...@@ -1075,24 +1069,24 @@ export default class tableCom extends Component { ...@@ -1075,24 +1069,24 @@ export default class tableCom extends Component {
} catch (e) { } catch (e) {
console.log( console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i + `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i +
1}行,第${this.props.j + 1}列:公式配置有误,暂存失败,`, 1}行,第${this.props.j + 1}列:公式配置有误,暂存失败,`,
e, e,
); );
} }
}; };
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 });
}, },
}); });
} }
...@@ -1102,14 +1096,14 @@ export default class tableCom extends Component { ...@@ -1102,14 +1096,14 @@ export default class tableCom extends Component {
let dataColumn = let dataColumn =
this.props.fatherCode != null this.props.fatherCode != null
? bindObj ? bindObj
? { ? {
...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) {
...@@ -1126,12 +1120,12 @@ export default class tableCom extends Component { ...@@ -1126,12 +1120,12 @@ export default class tableCom extends Component {
} }
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;
...@@ -1148,9 +1142,10 @@ export default class tableCom extends Component { ...@@ -1148,9 +1142,10 @@ 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}); // console.log(base52, 1144);
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) {
...@@ -1162,17 +1157,18 @@ export default class tableCom extends Component { ...@@ -1162,17 +1157,18 @@ 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 => {
// console.log(options);
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
let vl = this.props.form.getFieldsValue()[base52]; let vl = this.props.form.getFieldsValue()[base52];
const optionsx = []; const optionsx = [];
...@@ -1181,6 +1177,10 @@ export default class tableCom extends Component { ...@@ -1181,6 +1177,10 @@ export default class tableCom extends Component {
if (vl == options[i][valueName] && !isExist) { if (vl == options[i][valueName] && !isExist) {
isExist = true; isExist = true;
} }
if(Array.isArray(vl) && vl.length && vl.includes(options[i][valueName]) && !isExist){
// 钟是志 2021年9月28日 16:19:46 解决 checkbox 多选负值不上的bug
isExist = true;
}
optionsx.push({ optionsx.push({
label: options[i][labelName], label: options[i][labelName],
value: options[i][valueName], value: options[i][valueName],
...@@ -1189,10 +1189,11 @@ export default class tableCom extends Component { ...@@ -1189,10 +1189,11 @@ 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}); // console.log(1186, base52);
this.props.form.setFieldsValue({ [base52]: null });
} }
this.setState({options: optionsx, selectDis: false}); this.setState({ options: optionsx, selectDis: false });
}, },
}); });
} }
...@@ -1219,18 +1220,18 @@ export default class tableCom extends Component { ...@@ -1219,18 +1220,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++) {
...@@ -1239,23 +1240,23 @@ export default class tableCom extends Component { ...@@ -1239,23 +1240,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++) {
...@@ -1264,13 +1265,13 @@ export default class tableCom extends Component { ...@@ -1264,13 +1265,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;
...@@ -1289,7 +1290,6 @@ export default class tableCom extends Component { ...@@ -1289,7 +1290,6 @@ export default class tableCom extends Component {
}; };
render() { render() {
/** /**
* json为申请表单 * json为申请表单
* obj为查看详情用户输入值 * obj为查看详情用户输入值
...@@ -1313,8 +1313,8 @@ export default class tableCom extends Component { ...@@ -1313,8 +1313,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) {
...@@ -1331,12 +1331,12 @@ export default class tableCom extends Component { ...@@ -1331,12 +1331,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}
...@@ -1347,7 +1347,7 @@ export default class tableCom extends Component { ...@@ -1347,7 +1347,7 @@ export default class tableCom extends Component {
); );
} }
if (json.comName == 'Graph') { if (json.comName == 'Graph') {
return <Neo4jD3Com key={this.props.uuid} json={json} option={this.state.option || []}/>; return <Neo4jD3Com key={this.props.uuid} json={json} option={this.state.option || []} />;
} }
if (json.comName == 'PartForm') { if (json.comName == 'PartForm') {
...@@ -1362,7 +1362,7 @@ export default class tableCom extends Component { ...@@ -1362,7 +1362,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
taskId={this.props.taskId} taskId={this.props.taskId}
setRealTimeValues={this.props.setRealTimeValues} setRealTimeValues={this.props.setRealTimeValues}
...@@ -1399,7 +1399,7 @@ export default class tableCom extends Component { ...@@ -1399,7 +1399,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 = ( const xx = (
<div style={{textAlign: 'center', height: value == null ? 20 : null}}>{value}</div> <div style={{ textAlign: 'center', height: value == null ? 20 : null }}>{value}</div>
); );
return xx; return xx;
} }
...@@ -1418,7 +1418,7 @@ export default class tableCom extends Component { ...@@ -1418,7 +1418,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={{
fontWeight: get == 'mobile' ? 'bold' : '', fontWeight: get == 'mobile' ? 'bold' : '',
...@@ -1435,7 +1435,7 @@ export default class tableCom extends Component { ...@@ -1435,7 +1435,7 @@ export default class tableCom extends Component {
<> <>
{this.props.form.getFieldDecorator(uid, { {this.props.form.getFieldDecorator(uid, {
initialValue: this.props.form.getFieldsValue()[uid] || json.initialValue, initialValue: this.props.form.getFieldsValue()[uid] || json.initialValue,
})(<Input type="hidden"/>)} })(<Input type="hidden" />)}
<span <span
style={{ style={{
fontWeight: get == 'mobile' ? 'bold' : '', fontWeight: get == 'mobile' ? 'bold' : '',
...@@ -1470,7 +1470,7 @@ export default class tableCom extends Component { ...@@ -1470,7 +1470,7 @@ export default class tableCom extends Component {
cm = ( cm = (
<span> <span>
{value} {value}
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</span> </span>
); );
break; break;
...@@ -1478,25 +1478,25 @@ export default class tableCom extends Component { ...@@ -1478,25 +1478,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>
); );
...@@ -1505,7 +1505,7 @@ export default class tableCom extends Component { ...@@ -1505,7 +1505,7 @@ export default class tableCom extends Component {
cm = ( cm = (
<span> <span>
{value} {value}
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</span> </span>
); );
...@@ -1514,7 +1514,7 @@ export default class tableCom extends Component { ...@@ -1514,7 +1514,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>
) : ( ) : (
'' ''
...@@ -1534,7 +1534,7 @@ export default class tableCom extends Component { ...@@ -1534,7 +1534,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}
/> />
); );
...@@ -1548,22 +1548,22 @@ export default class tableCom extends Component { ...@@ -1548,22 +1548,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}}/>; cm = <div style={{ width: json.width, height: json.height }} />;
} 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 /> : ''}
</> </>
); );
} }
...@@ -1571,15 +1571,15 @@ export default class tableCom extends Component { ...@@ -1571,15 +1571,15 @@ 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 }} />;
} 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 /> : ''}
</> </>
); );
} }
...@@ -1594,8 +1594,8 @@ export default class tableCom extends Component { ...@@ -1594,8 +1594,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}
...@@ -1606,15 +1606,15 @@ export default class tableCom extends Component { ...@@ -1606,15 +1606,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" />)}
</> </>
); );
} }
...@@ -1627,7 +1627,7 @@ export default class tableCom extends Component { ...@@ -1627,7 +1627,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" />)}
</> </>
); );
} }
...@@ -1701,8 +1701,8 @@ export default class tableCom extends Component { ...@@ -1701,8 +1701,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}
...@@ -1713,15 +1713,15 @@ export default class tableCom extends Component { ...@@ -1713,15 +1713,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" />)}
</> </>
); );
} }
...@@ -1734,7 +1734,7 @@ export default class tableCom extends Component { ...@@ -1734,7 +1734,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" />)}
</> </>
); );
} }
...@@ -1749,15 +1749,15 @@ export default class tableCom extends Component { ...@@ -1749,15 +1749,15 @@ export default class tableCom extends Component {
let dataColumn = let dataColumn =
this.props.fatherCode != null this.props.fatherCode != null
? bindObj ? bindObj
? { ? {
...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;
...@@ -1765,7 +1765,7 @@ export default class tableCom extends Component { ...@@ -1765,7 +1765,7 @@ 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) {
...@@ -1785,6 +1785,14 @@ export default class tableCom extends Component { ...@@ -1785,6 +1785,14 @@ export default class tableCom extends Component {
} }
} }
} }
// console.table({
// objinit,
// fatherCode: this.props.fatherCode,
// json,
// index: this.props.index,
// bindObj,
// dataColumn,
// });
// if(initValue === null || initValue === undefined){ // if(initValue === null || initValue === undefined){
// initValue = ''; // initValue = '';
...@@ -1865,18 +1873,18 @@ export default class tableCom extends Component { ...@@ -1865,18 +1873,18 @@ export default class tableCom extends Component {
<span> <span>
{labels != null {labels != null
? labels.map((r, i) => ? labels.map((r, i) =>
i == 0 ? ( i == 0 ? (
typeof r == 'string' ? ( typeof r == 'string' ? (
<span>{r}</span> <span>{r}</span>
) : (
Object.values(r)
)
) : typeof r == 'string' ? (
<span style={{ marginLeft: 12 }}>{r}</span>
) : ( ) : (
Object.values(r) ',' + Object.values(r)
) ),
) : typeof r == 'string' ? ( )
<span style={{marginLeft: 12}}>{r}</span>
) : (
',' + Object.values(r)
),
)
: ''} : ''}
</span> </span>
); );
...@@ -1922,7 +1930,7 @@ export default class tableCom extends Component { ...@@ -1922,7 +1930,7 @@ export default class tableCom extends Component {
ivs.push(moment(parseInt(initValue))); ivs.push(moment(parseInt(initValue)));
if (end != null && init[end.base52]) { if (end != null && init[end.base52]) {
ivs.push(moment(parseInt(init[end.base52]))); ivs.push(moment(parseInt(init[end.base52])));
}else{ } else {
ivs.push(moment()); ivs.push(moment());
} }
} }
...@@ -1961,8 +1969,8 @@ export default class tableCom extends Component { ...@@ -1961,8 +1969,8 @@ export default class tableCom extends Component {
<span> <span>
{obj[dataColumn.base52] {obj[dataColumn.base52]
? moment(+new Date(obj[dataColumn.base52])).format( ? moment(+new Date(obj[dataColumn.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss', json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
) )
: ''} : ''}
</span> </span>
); );
...@@ -2004,7 +2012,7 @@ export default class tableCom extends Component { ...@@ -2004,7 +2012,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>
); );
} }
...@@ -2023,41 +2031,41 @@ export default class tableCom extends Component { ...@@ -2023,41 +2031,41 @@ export default class tableCom extends Component {
cm = ( cm = (
<ul> <ul>
{Array.isArray(files) && {Array.isArray(files) &&
files.map((f, index2) => { files.map((f, index2) => {
// if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) { // if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) {
// return ( // return (
// <img // <img
// key={index2} // key={index2}
// style={{ width: 100, height: 100 }} // style={{ width: 100, height: 100 }}
// src={queryApiActionPath() + f.filePath} // src={queryApiActionPath() + f.filePath}
// /> // />
// ); // );
// } // }
if (get === 'web' || !this.props.isPrint) { if (get === 'web' || !this.props.isPrint) {
return (
<li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name} />
</li>
);
}
return ( return (
<li key={index2}> <li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name}/> <a
target="_blank"
key={f.filePath}
href={queryApiActionPath() + f.filePath}
>
{f.fileName}
</a>
</li> </li>
); );
} })}
return (
<li key={index2}>
<a
target="_blank"
key={f.filePath}
href={queryApiActionPath() + f.filePath}
>
{f.fileName}
</a>
</li>
);
})}
</ul> </ul>
); );
} }
} else { } else {
cm = ( cm = (
<span style={{display: 'inline-block', width: '100%', textAlign: 'center'}}> <span style={{ display: 'inline-block', width: '100%', textAlign: 'center' }}>
暂无附件 暂无附件
</span> </span>
); );
...@@ -2085,7 +2093,7 @@ export default class tableCom extends Component { ...@@ -2085,7 +2093,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 }}
/> />
); );
} }
...@@ -2112,7 +2120,7 @@ export default class tableCom extends Component { ...@@ -2112,7 +2120,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 }}
/> />
); );
} }
...@@ -2178,7 +2186,7 @@ export default class tableCom extends Component { ...@@ -2178,7 +2186,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;
...@@ -2242,6 +2250,7 @@ export default class tableCom extends Component { ...@@ -2242,6 +2250,7 @@ export default class tableCom extends Component {
break; break;
} }
} else { } else {
//编辑模式
if (json.vlds && json.vlds.length > 0) { if (json.vlds && json.vlds.length > 0) {
for (let i in json.vlds) { for (let i in json.vlds) {
if (json.vlds[i].validatorFunc && json.vlds[i].validatorFunc != '') { if (json.vlds[i].validatorFunc && json.vlds[i].validatorFunc != '') {
...@@ -2259,7 +2268,7 @@ export default class tableCom extends Component { ...@@ -2259,7 +2268,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;
...@@ -2283,10 +2292,10 @@ export default class tableCom extends Component { ...@@ -2283,10 +2292,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}
/>, />,
...@@ -2315,8 +2324,8 @@ export default class tableCom extends Component { ...@@ -2315,8 +2324,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}
...@@ -2330,10 +2339,10 @@ export default class tableCom extends Component { ...@@ -2330,10 +2339,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}
...@@ -2356,7 +2365,7 @@ export default class tableCom extends Component { ...@@ -2356,7 +2365,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 => {
...@@ -2387,7 +2396,7 @@ export default class tableCom extends Component { ...@@ -2387,7 +2396,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}
...@@ -2404,11 +2413,11 @@ export default class tableCom extends Component { ...@@ -2404,11 +2413,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}
/>, />,
); );
...@@ -2422,8 +2431,8 @@ export default class tableCom extends Component { ...@@ -2422,8 +2431,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}
...@@ -2435,7 +2444,7 @@ export default class tableCom extends Component { ...@@ -2435,7 +2444,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, {
...@@ -2443,7 +2452,7 @@ export default class tableCom extends Component { ...@@ -2443,7 +2452,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}
...@@ -2464,8 +2473,8 @@ export default class tableCom extends Component { ...@@ -2464,8 +2473,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}
...@@ -2484,8 +2493,8 @@ export default class tableCom extends Component { ...@@ -2484,8 +2493,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 (
...@@ -2496,8 +2505,8 @@ export default class tableCom extends Component { ...@@ -2496,8 +2505,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}
...@@ -2519,8 +2528,8 @@ export default class tableCom extends Component { ...@@ -2519,8 +2528,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>
); );
...@@ -2532,8 +2541,8 @@ export default class tableCom extends Component { ...@@ -2532,8 +2541,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}
...@@ -2543,14 +2552,14 @@ export default class tableCom extends Component { ...@@ -2543,14 +2552,14 @@ export default class tableCom extends Component {
break; break;
} }
// console.log(dataColumn.base52);
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: '请选择' + 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':
...@@ -2559,37 +2568,37 @@ export default class tableCom extends Component { ...@@ -2559,37 +2568,37 @@ 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')
? () => { ? () => {
return document.querySelector('#dynamic_div'); return document.querySelector('#dynamic_div');
} }
: '' : ''
} }
onFocus={() => { onFocus={() => {
get === 'mobile' // 移动端取消输入键盘弹出 get === 'mobile' // 移动端取消输入键盘弹出
? setTimeout(() => { ? setTimeout(() => {
if (document.querySelectorAll(`.ant-select-search__field`).length > 0) { if (document.querySelectorAll(`.ant-select-search__field`).length > 0) {
let ary = [...document.querySelectorAll(`.ant-select-search__field`)]; let ary = [...document.querySelectorAll(`.ant-select-search__field`)];
ary.map(item => { ary.map(item => {
item.setAttribute('readonly', 'readonly'); item.setAttribute('readonly', 'readonly');
// setTimeout(() => { // setTimeout(() => {
// ary.map(arr => { // ary.map(arr => {
// arr.removeAttribute('readonly'); // arr.removeAttribute('readonly');
// }) // })
// }); // });
}); });
} }
}) })
: null; : null;
}} }}
filterOption={(input, option) => filterOption={(input, option) =>
...@@ -2600,10 +2609,10 @@ export default class tableCom extends Component { ...@@ -2600,10 +2609,10 @@ export default class tableCom extends Component {
> >
{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}
</Option> </Option>
)) ))
: ''} : ''}
</Select>, </Select>,
); );
...@@ -2616,8 +2625,8 @@ export default class tableCom extends Component { ...@@ -2616,8 +2625,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}
...@@ -2636,7 +2645,7 @@ export default class tableCom extends Component { ...@@ -2636,7 +2645,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: '请选择' + dataColumn.title}], : [{ required: required, message: '请选择' + dataColumn.title }],
})( })(
<Cascader <Cascader
options={options} options={options}
...@@ -2646,12 +2655,12 @@ export default class tableCom extends Component { ...@@ -2646,12 +2655,12 @@ export default class tableCom extends Component {
getPopupContainer={ getPopupContainer={
this.props.isDynamic && document.querySelector('#dynamic_div') this.props.isDynamic && document.querySelector('#dynamic_div')
? () => { ? () => {
return document.querySelector('#dynamic_div'); return document.querySelector('#dynamic_div');
} }
: '' : ''
} }
placeholder={json.placeholder} placeholder={json.placeholder}
style={{width: json.width}} style={{ width: json.width }}
/>, />,
); );
if (get === 'mobile') { if (get === 'mobile') {
...@@ -2660,8 +2669,8 @@ export default class tableCom extends Component { ...@@ -2660,8 +2669,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 }],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json}/>); })(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
} }
if ( if (
...@@ -2673,8 +2682,8 @@ export default class tableCom extends Component { ...@@ -2673,8 +2682,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}
...@@ -2693,22 +2702,22 @@ export default class tableCom extends Component { ...@@ -2693,22 +2702,22 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if ( if (
(Object.keys(value).length == 0 || (Object.keys(value).length == 0 ||
Object.keys(value.selects).length == 0) && Object.keys(value.selects).length == 0) &&
required != null && required != null &&
required required
) { ) {
var errors = []; var errors = [];
errors.push(new Error('请选择至少一个', rule.field)); errors.push(new Error('请选择至少一个', rule.field));
} }
callback(errors); callback(errors);
},
required: required,
}, },
required: required, ],
},
],
})( })(
<TableSelect <TableSelect
get={get} get={get}
...@@ -2730,8 +2739,8 @@ export default class tableCom extends Component { ...@@ -2730,8 +2739,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}
...@@ -2744,20 +2753,20 @@ export default class tableCom extends Component { ...@@ -2744,20 +2753,20 @@ 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) {
ivs.push(moment(parseInt(initValue))); ivs.push(moment(parseInt(initValue)));
if(init && init[end.base52]){ if (init && init[end.base52]) {
ivs.push(moment(parseInt(init[end.base52]))); ivs.push(moment(parseInt(init[end.base52])));
}else if(obj && obj[end.base52]){ } else if (obj && obj[end.base52]) {
ivs.push(moment(parseInt(obj[end.base52]))); ivs.push(moment(parseInt(obj[end.base52])));
// 钟是志 2021年9月28日13:59:48 // 钟是志 2021年9月28日13:59:48
// 禅道bug http://scjoyedu.eicp.net:88/zentao/bug-view-21843.html // 禅道bug http://scjoyedu.eicp.net:88/zentao/bug-view-21843.html
// 不知道怎么改 init 为空对象 暂时处理为从obj里面拿 // 不知道怎么改 init 为空对象 暂时处理为从obj里面拿
}else{ } else {
ivs.push(moment()); ivs.push(moment());
} }
} }
...@@ -2781,8 +2790,8 @@ export default class tableCom extends Component { ...@@ -2781,8 +2790,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)) &&
...@@ -2791,8 +2800,8 @@ export default class tableCom extends Component { ...@@ -2791,8 +2800,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}
...@@ -2807,7 +2816,7 @@ export default class tableCom extends Component { ...@@ -2807,7 +2816,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}
...@@ -2829,7 +2838,7 @@ export default class tableCom extends Component { ...@@ -2829,7 +2838,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}
...@@ -2837,22 +2846,21 @@ export default class tableCom extends Component { ...@@ -2837,22 +2846,21 @@ export default class tableCom extends Component {
onOpenChange={ onOpenChange={
get === 'mobile' get === 'mobile'
? () => { ? () => {
// 取消唤起移动端小键盘 // 取消唤起移动端小键盘
setTimeout(() => { setTimeout(() => {
if (document.querySelector('.ant-calendar-input ')) { if (document.querySelector('.ant-calendar-input ')) {
document
.querySelector('.ant-calendar-input ')
.setAttribute('readonly', 'readonly');
setTimeout(() => {
document document
.querySelector('.ant-calendar-input ') .querySelector('.ant-calendar-input ')
.removeAttribute('readonly'); .setAttribute('readonly', 'readonly');
}); setTimeout(() => {
} document
}); .querySelector('.ant-calendar-input ')
} .removeAttribute('readonly');
: () => { });
} }
});
}
: () => {}
} }
format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'} format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'}
/>, />,
...@@ -2866,8 +2874,8 @@ export default class tableCom extends Component { ...@@ -2866,8 +2874,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}
...@@ -2884,7 +2892,7 @@ export default class tableCom extends Component { ...@@ -2884,7 +2892,7 @@ export default class tableCom extends Component {
} }
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: {files: files}, initialValue: { files: files },
rules: [ rules: [
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
...@@ -2915,8 +2923,8 @@ export default class tableCom extends Component { ...@@ -2915,8 +2923,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,8 +2938,8 @@ export default class tableCom extends Component { ...@@ -2930,8 +2938,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: '请输入' }],
})(<DraftEditorCom placeholder={json.placeholder}/>); })(<DraftEditorCom placeholder={json.placeholder} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -2941,8 +2949,8 @@ export default class tableCom extends Component { ...@@ -2941,8 +2949,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}
...@@ -2956,8 +2964,8 @@ export default class tableCom extends Component { ...@@ -2956,8 +2964,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: '请输入' + title}], : [{ required: required, message: '请输入' + title }],
})(<CronEditor style={{width: 600}}/>); })(<CronEditor style={{ width: 600 }} />);
break; break;
case 'LocationCom': case 'LocationCom':
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
...@@ -2965,7 +2973,7 @@ export default class tableCom extends Component { ...@@ -2965,7 +2973,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}
...@@ -2985,8 +2993,8 @@ export default class tableCom extends Component { ...@@ -2985,8 +2993,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,7 +3003,7 @@ export default class tableCom extends Component { ...@@ -2995,7 +3003,7 @@ export default class tableCom extends Component {
} }
break; break;
case 'ChildForm': case 'ChildForm':
cm = getFieldDecorator(dataColumn.base52, {initialValue: initValue || {}})( cm = getFieldDecorator(dataColumn.base52, { initialValue: initValue || {} })(
<ChildForm <ChildForm
taskId={this.props.taskId} taskId={this.props.taskId}
setRealTimeValues={this.props.setRealTimeValues} setRealTimeValues={this.props.setRealTimeValues}
...@@ -3032,8 +3040,8 @@ export default class tableCom extends Component { ...@@ -3032,8 +3040,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}
...@@ -3047,8 +3055,8 @@ export default class tableCom extends Component { ...@@ -3047,8 +3055,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) ||
...@@ -3058,8 +3066,8 @@ export default class tableCom extends Component { ...@@ -3058,8 +3066,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}
...@@ -3073,8 +3081,8 @@ export default class tableCom extends Component { ...@@ -3073,8 +3081,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: '请上传视频' }],
})(<VideoUploadCom json={json} disabled={disabled}/>); })(<VideoUploadCom json={json} disabled={disabled} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -3084,8 +3092,8 @@ export default class tableCom extends Component { ...@@ -3084,8 +3092,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}
...@@ -3099,7 +3107,7 @@ export default class tableCom extends Component { ...@@ -3099,7 +3107,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={
...@@ -3119,8 +3127,8 @@ export default class tableCom extends Component { ...@@ -3119,8 +3127,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}
...@@ -3160,7 +3168,7 @@ export default class tableCom extends Component { ...@@ -3160,7 +3168,7 @@ 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}
...@@ -3192,7 +3200,7 @@ export default class tableCom extends Component { ...@@ -3192,7 +3200,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>
); );
...@@ -3310,8 +3318,8 @@ export default class tableCom extends Component { ...@@ -3310,8 +3318,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}
...@@ -3394,8 +3402,8 @@ export default class tableCom extends Component { ...@@ -3394,8 +3402,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}
...@@ -3403,8 +3411,8 @@ export default class tableCom extends Component { ...@@ -3403,8 +3411,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}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论