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

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

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