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

拆分代码

上级 ae872145
...@@ -44,9 +44,8 @@ export function getBase64(value) { ...@@ -44,9 +44,8 @@ export function getBase64(value) {
return value ? base64.encode(new Buffer(value)) : null; return value ? base64.encode(new Buffer(value)) : null;
} }
const excludeKeys = ['defaultValues', ''];
const equal = (obj1, obj2, json, sqlContent, depth, props) => { const equal = (obj1, obj2, json, sqlContent, depth, props, excludeKeys) => {
if (obj1 == null && obj2 != null) { if (obj1 == null && obj2 != null) {
return false; return false;
} }
...@@ -135,7 +134,7 @@ const equal = (obj1, obj2, json, sqlContent, depth, props) => { ...@@ -135,7 +134,7 @@ const equal = (obj1, obj2, json, sqlContent, depth, props) => {
var xx = true; var xx = true;
for (var i = 0; i < obj1[key].length; i++) { for (var i = 0; i < obj1[key].length; i++) {
if (!equal(obj1[key][i], obj2[key][i], json, sqlContent, depth + 1)) { if (!equal(obj1[key][i], obj2[key][i], json, sqlContent, depth + 1, props, excludeKeys)) {
xx = false; xx = false;
break; break;
} }
...@@ -147,7 +146,7 @@ const equal = (obj1, obj2, json, sqlContent, depth, props) => { ...@@ -147,7 +146,7 @@ const equal = (obj1, obj2, json, sqlContent, depth, props) => {
} }
} }
} else if (obj1[key] instanceof Object) { } else if (obj1[key] instanceof Object) {
const x = equal(obj1[key], obj2[key], json, sqlContent, depth + 1); const x = equal(obj1[key], obj2[key], json, sqlContent, depth + 1, props, excludeKeys);
if (!x) { if (!x) {
res = false; res = false;
......
...@@ -57,13 +57,14 @@ import { formulaList } from '../excelInitFuc/functionList'; ...@@ -57,13 +57,14 @@ 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 { errorHandler, getBase64, equal, getRender, isJSON } from './Split_Index/staticInfo'; import { errorHandler, getBase64, equal, 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,
...@@ -96,6 +97,7 @@ export default class tableCom extends Component { ...@@ -96,6 +97,7 @@ export default class tableCom extends Component {
pagination: false, pagination: false,
}, },
}; };
this.excludeKeys = ['defaultValues', ''];
} }
closeModal = (fk, callback) => { closeModal = (fk, callback) => {
...@@ -108,7 +110,6 @@ export default class tableCom extends Component { ...@@ -108,7 +110,6 @@ export default class tableCom extends Component {
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;
...@@ -134,7 +135,7 @@ export default class tableCom extends Component { ...@@ -134,7 +135,7 @@ export default class tableCom extends Component {
file = { file = {
name: 'file', name: 'file',
action: queryApiActionPath() + '/upload', action: queryApiActionPath() + '/upload',
onChange: info => { onChange: (info) => {
if (info.file.status !== 'uploading') { if (info.file.status !== 'uploading') {
this.setState({ this.setState({
img: info.file.response, img: info.file.response,
...@@ -155,7 +156,7 @@ export default class tableCom extends Component { ...@@ -155,7 +156,7 @@ export default class tableCom extends Component {
this.setState({ searchText: selectedKeys[0] }); this.setState({ searchText: selectedKeys[0] });
}; };
handleReset = clearFilters => { handleReset = (clearFilters) => {
clearFilters(); clearFilters();
this.resetSearchText(); this.resetSearchText();
}; };
...@@ -170,12 +171,12 @@ export default class tableCom extends Component { ...@@ -170,12 +171,12 @@ export default class tableCom extends Component {
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;
}} }}
placeholder={`请输入${title}`} placeholder={`请输入${title}`}
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' }}
/> />
...@@ -185,34 +186,34 @@ export default class tableCom extends Component { ...@@ -185,34 +186,34 @@ 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>
<Button <Button
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) {
setTimeout(() => this.searchInput.select()); setTimeout(() => this.searchInput.select());
} }
}, },
render: text => { render: (text) => {
if (text != null) { if (text != null) {
return ( return (
<Highlighter <Highlighter
...@@ -260,14 +261,14 @@ export default class tableCom extends Component { ...@@ -260,14 +261,14 @@ export default class tableCom extends Component {
return; return;
} }
const obj2 = props.form.getFieldsValue(); const obj2 = props.form.getFieldsValue();
const bb = equal(this.obj, obj2, json, this.state.sqlContent, 1, this.props); const bb = equal(this.obj, obj2, json, this.state.sqlContent, 1, this.props, this.excludeKeys);
let bb2 = true; let bb2 = true;
let childObj2 = {}; let childObj2 = {};
if (props.fatherCode) { if (props.fatherCode) {
if (obj2 != null && obj2[props.fatherCode]) { if (obj2 != null && obj2[props.fatherCode]) {
childObj2 = obj2[props.fatherCode][props.index]; childObj2 = obj2[props.fatherCode][props.index];
bb2 = equal(this.childObj, childObj2, json, this.state.sqlContent, 1, this.props); bb2 = equal(this.childObj, childObj2, json, this.state.sqlContent, 1, this.props, this.excludeKeys);
} }
} }
...@@ -290,7 +291,7 @@ export default class tableCom extends Component { ...@@ -290,7 +291,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;
...@@ -311,11 +312,11 @@ export default class tableCom extends Component { ...@@ -311,11 +312,11 @@ 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 };
...@@ -352,13 +353,13 @@ export default class tableCom extends Component { ...@@ -352,13 +353,13 @@ export default class tableCom extends Component {
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 = [];
for (var i = 0; i < datas.length; i++) { for (var i = 0; i < datas.length; i++) {
...@@ -369,7 +370,7 @@ export default class tableCom extends Component { ...@@ -369,7 +370,7 @@ export default class tableCom extends Component {
if ( if (
['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type) ['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)
) { ) {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss'); column.render = (val) => moment(val).format('YYYY-MM-DD HH:mm:ss');
} }
columns.push(column); columns.push(column);
} else { } else {
...@@ -403,7 +404,7 @@ export default class tableCom extends Component { ...@@ -403,7 +404,7 @@ export default class tableCom extends Component {
break; break;
} }
column.render = val => moment(parseInt(val)).format(ff); column.render = (val) => moment(parseInt(val)).format(ff);
} }
if (cll[k].isQuery) { if (cll[k].isQuery) {
column = { column = {
...@@ -420,7 +421,7 @@ export default class tableCom extends Component { ...@@ -420,7 +421,7 @@ export default class tableCom extends Component {
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,
...@@ -435,7 +436,7 @@ export default class tableCom extends Component { ...@@ -435,7 +436,7 @@ export default class tableCom extends Component {
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 = [];
for (var i = 0; i < datas.length; i++) { for (var i = 0; i < datas.length; i++) {
...@@ -444,7 +445,7 @@ export default class tableCom extends Component { ...@@ -444,7 +445,7 @@ export default class tableCom extends Component {
column.title = datas[i].title; column.title = datas[i].title;
column.dataIndex = datas[i].name; column.dataIndex = datas[i].name;
if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)) { if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)) {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss'); column.render = (val) => moment(val).format('YYYY-MM-DD HH:mm:ss');
} }
columns.push(column); columns.push(column);
} else { } else {
...@@ -579,7 +580,7 @@ export default class tableCom extends Component { ...@@ -579,7 +580,7 @@ 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,
); );
} }
...@@ -629,16 +630,8 @@ export default class tableCom extends Component { ...@@ -629,16 +630,8 @@ 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 ( if (res != null && !(typeof res === 'function')) {
res != null && this.setState({ options: res, selectDis: false }, () => {
!(typeof res === 'function')
// && res !== 'norefeshxxxxxxxxxxxxxxxxxxxx'
) {
// console.table(res);
this.setState({
options: res,
selectDis: false,
}, () => {
if (orgCallback) orgCallback(); if (orgCallback) orgCallback();
}); });
} }
...@@ -678,7 +671,7 @@ export default class tableCom extends Component { ...@@ -678,7 +671,7 @@ export default class tableCom extends Component {
} 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,
); );
} }
...@@ -712,28 +705,20 @@ export default class tableCom extends Component { ...@@ -712,28 +705,20 @@ export default class tableCom extends Component {
data: requestParams, data: requestParams,
method: method, method: method,
requestType: 'form', requestType: 'form',
}).then(data => { }).then((data) => {
// 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 ( if (res != null && !(typeof res === 'function')) {
res != null && this.setState({ options: res, selectDis: false }, () => {
!(typeof res === 'function')
//&& res !== 'norefeshxxxxxxxxxxxxxxxxxxxx'
) {
// console.table(res);
this.setState({
options: res,
selectDis: false,
}, () => {
if (orgCallback) orgCallback(); if (orgCallback) orgCallback();
}); });
} }
...@@ -781,32 +766,30 @@ export default class tableCom extends Component { ...@@ -781,32 +766,30 @@ export default class tableCom extends Component {
} }
}); });
}); });
return 'norefeshxxxxxxxxxxxxxxxxxxxx'; return 'norefeshxxxxxxxxxxxxxxxxxxxx';
}; };
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;
if (params.length !== ps.length) { if (params.length != ps.length) {
// 长度不想等 直接更新
isChange = true; isChange = true;
} else { } else {
for (var i = 0; i < params.length; i++) { for (var i = 0; i < params.length; i++) {
if (params[i] != ps[i]) { if (params[i] != ps[i]) {
// 某一个不相等 直接更新
isChange = true; isChange = true;
break; break;
} }
} }
} }
if (!isChange) { if (!isChange) {
const os = sqlKeys[sqlKey].options; // {} const os = sqlKeys[sqlKey].options;
if (Object.keys(options).length !== Object.keys(os).length) { if (Object.keys(options).length != Object.keys(os).length) {
// {}
isChange = true; isChange = true;
} else { } else {
for (var k in options) { for (var k in options) {
...@@ -818,32 +801,20 @@ export default class tableCom extends Component { ...@@ -818,32 +801,20 @@ export default class tableCom extends Component {
} }
} }
} else { } else {
sqlKeys[sqlKey] = { params, options }; sqlKeys[sqlKey] = { params: params, options: options };
isChange = true; isChange = true;
} }
if (!isChange) { if (!isChange) {
if (callback) { if (callback) {
const data = sqlKeys[sqlKey].data; // Array[8]; options const data = sqlKeys[sqlKey].data;
if (json.optionType && json.optionType === 'func') { if (json.optionType && json.optionType == 'func') {
const res = callback(data); const res = callback(data);
if ( if (res != null && !(typeof res === 'function')) {
res != null && this.setState({ options: res, selectDis: false }, () => {
!(typeof res === 'function') if (orgCallback) orgCallback();
// && res !== 'norefeshxxxxxxxxxxxxxxxxxxxx' });
) {
// console.log(res);
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
} }
} else if (json.comName === 'Button') { } else if (json.comName == 'Button') {
try { try {
callback(data); callback(data);
} catch (e) { } catch (e) {
...@@ -853,7 +824,11 @@ export default class tableCom extends Component { ...@@ -853,7 +824,11 @@ export default class tableCom extends Component {
e, e,
); );
} }
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) { } else if (
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) {
...@@ -906,7 +881,7 @@ export default class tableCom extends Component { ...@@ -906,7 +881,7 @@ export default class tableCom extends Component {
data: pp, data: pp,
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 });
...@@ -917,14 +892,9 @@ export default class tableCom extends Component { ...@@ -917,14 +892,9 @@ export default class tableCom extends Component {
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')
// && res !== 'norefeshxxxxxxxxxxxxxxxxxxxx' if (res != null && !(typeof res === 'function')) {
) { this.setState({ options: res, selectDis: false }, () => {
// console.log(res);
this.setState({
options: res,
selectDis: false,
}, () => {
if (orgCallback) orgCallback(); if (orgCallback) orgCallback();
}); });
} }
...@@ -972,6 +942,7 @@ export default class tableCom extends Component { ...@@ -972,6 +942,7 @@ export default class tableCom extends Component {
} }
}); });
}); });
return 'norefeshxxxxxxxxxxxxxxxxxxxx'; return 'norefeshxxxxxxxxxxxxxxxxxxxx';
}; };
...@@ -984,8 +955,8 @@ export default class tableCom extends Component { ...@@ -984,8 +955,8 @@ export default class tableCom extends Component {
* 动态生成表单配置函数所使用 * 动态生成表单配置函数所使用
*/ */
let functionObj = {}; let functionObj = {};
formulaList.map(item => { formulaList.map((item) => {
item.children.map(arr => { item.children.map((arr) => {
functionObj[arr.callKey] = arr.function; functionObj[arr.callKey] = arr.function;
}); });
}); });
...@@ -1059,26 +1030,19 @@ export default class tableCom extends Component { ...@@ -1059,26 +1030,19 @@ export default class tableCom extends Component {
this.props.concealModel, this.props.concealModel,
); );
if (base52) { if (base52) {
if (value === 'norefeshxxxxxxxxxxxxxxxxxxxx') if (value != null && value == 'norefeshxxxxxxxxxxxxxxxxxxxx') {
{} } else {
else {
/** /**
* 会出现重复调用2次,然后NAN造成无限循环 * 会出现重复调用2次,然后NAN造成无限循环
*/ */
if (isNaN(value)) { if (isNaN(value)) {
return; return;
} }
if (json.comName === 'Button') { if (json.comName == 'Button') {
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')) {
// && value !== 'norefeshxxxxxxxxxxxxxxxxxxxx' this.setState({ options: value, selectDis: false }, () => {
) {
// console.log(value);
this.setState({
options: value,
selectDis: false,
}, () => {
if (callback) callback(); if (callback) callback();
}); });
} }
...@@ -1087,9 +1051,7 @@ export default class tableCom extends Component { ...@@ -1087,9 +1051,7 @@ export default class tableCom extends Component {
json.comName == 'QRCode' || json.comName == 'QRCode' ||
json.comName == 'Graph' json.comName == 'Graph'
) { ) {
this.setState({ this.setState({ option: value });
option: value,
});
} else { } else {
try { try {
this.props.form.setFieldsValue({ [base52]: value }); this.props.form.setFieldsValue({ [base52]: value });
...@@ -1106,7 +1068,7 @@ export default class tableCom extends Component { ...@@ -1106,7 +1068,7 @@ 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,
); );
} }
...@@ -1122,7 +1084,7 @@ export default class tableCom extends Component { ...@@ -1122,7 +1084,7 @@ export default class tableCom extends Component {
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 });
}, },
}); });
...@@ -1133,11 +1095,11 @@ export default class tableCom extends Component { ...@@ -1133,11 +1095,11 @@ 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 };
...@@ -1163,7 +1125,7 @@ export default class tableCom extends Component { ...@@ -1163,7 +1125,7 @@ export default class tableCom extends Component {
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;
let vl = this.props.form.getFieldsValue()[base52]; let vl = this.props.form.getFieldsValue()[base52];
...@@ -1181,10 +1143,7 @@ export default class tableCom extends Component { ...@@ -1181,10 +1143,7 @@ export default class tableCom extends Component {
if (!isExist && vl != null && options.length > 0) { if (!isExist && vl != null && options.length > 0) {
this.props.form.setFieldsValue({ [base52]: null }); this.props.form.setFieldsValue({ [base52]: null });
} }
// console.log(optionsx); 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) {
...@@ -1197,11 +1156,8 @@ export default class tableCom extends Component { ...@@ -1197,11 +1156,8 @@ export default class tableCom extends Component {
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({ this.setState({ labels, selectDis: false });
labels,
selectDis: false,
});
}, },
}); });
} }
...@@ -1209,7 +1165,7 @@ export default class tableCom extends Component { ...@@ -1209,7 +1165,7 @@ export default class tableCom extends Component {
dispatch({ dispatch({
type: 'DataColumn/getSqlOptions', type: 'DataColumn/getSqlOptions',
payload: { sqlKey, allValues }, payload: { sqlKey, allValues },
callback: options => { callback: (options) => {
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
let vl = this.props.form.getFieldsValue()[base52]; let vl = this.props.form.getFieldsValue()[base52];
const optionsx = []; const optionsx = [];
...@@ -1228,11 +1184,8 @@ export default class tableCom extends Component { ...@@ -1228,11 +1184,8 @@ export default class tableCom extends Component {
//console.log("isExist",optionsx,vl,isExist) //console.log("isExist",optionsx,vl,isExist)
this.props.form.setFieldsValue({ [base52]: null }); this.props.form.setFieldsValue({ [base52]: null });
} }
// console.log(optionsx);
this.setState({ this.setState({ options: optionsx, selectDis: false });
options: optionsx,
selectDis: false,
});
}, },
}); });
} }
...@@ -1259,15 +1212,9 @@ export default class tableCom extends Component { ...@@ -1259,15 +1212,9 @@ export default class tableCom extends Component {
} }
} }
this.setState({ this.setState({ labels: labels, selectDis: false });
labels,
selectDis: false,
});
} else { } else {
// console.log(options); this.setState({ options: options, selectDis: false });
this.setState({
options,
selectDis: false });
} }
}; };
fetchData = (obj, dataColumn, init, filterSql, allValues) => { fetchData = (obj, dataColumn, init, filterSql, allValues) => {
...@@ -1277,7 +1224,7 @@ export default class tableCom extends Component { ...@@ -1277,7 +1224,7 @@ export default class tableCom extends Component {
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++) {
optionsx.push({ optionsx.push({
...@@ -1285,11 +1232,7 @@ export default class tableCom extends Component { ...@@ -1285,11 +1232,7 @@ export default class tableCom extends Component {
value: options[i][dataColumn.referenceCodeName], value: options[i][dataColumn.referenceCodeName],
}); });
} }
// console.log(optionsx); 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) {
...@@ -1297,11 +1240,8 @@ export default class tableCom extends Component { ...@@ -1297,11 +1240,8 @@ export default class tableCom extends Component {
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({ this.setState({ labels, selectDis: false });
labels,
selectDis: false,
});
}, },
}); });
} }
...@@ -1309,7 +1249,7 @@ export default class tableCom extends Component { ...@@ -1309,7 +1249,7 @@ export default class tableCom extends Component {
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++) {
optionsx.push({ optionsx.push({
...@@ -1317,16 +1257,12 @@ export default class tableCom extends Component { ...@@ -1317,16 +1257,12 @@ export default class tableCom extends Component {
value: options[i][dataColumn.referenceCodeName], value: options[i][dataColumn.referenceCodeName],
}); });
} }
// console.log(optionsx); 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;
...@@ -1480,10 +1416,9 @@ export default class tableCom extends Component { ...@@ -1480,10 +1416,9 @@ export default class tableCom extends Component {
fontWeight: get == 'mobile' ? 'bold' : '', fontWeight: get == 'mobile' ? 'bold' : '',
marginRight: get == 'mobile' ? 12 : '', marginRight: get == 'mobile' ? 12 : '',
}} }}
{...json.props} {...json.props}>
> {obj[this.props.uuid] || json.initialValue}
{obj[this.props.uuid] || json.initialValue} </span>
</span>
</> </>
); );
} else { } else {
...@@ -1497,10 +1432,9 @@ export default class tableCom extends Component { ...@@ -1497,10 +1432,9 @@ export default class tableCom extends Component {
fontWeight: get == 'mobile' ? 'bold' : '', fontWeight: get == 'mobile' ? 'bold' : '',
marginRight: get == 'mobile' ? 12 : '', marginRight: get == 'mobile' ? 12 : '',
}} }}
{...json.props} {...json.props}>
> {this.props.form.getFieldsValue()[uid]}
{this.props.form.getFieldsValue()[uid]} </span>
</span>
</> </>
); );
} }
...@@ -1525,53 +1459,53 @@ export default class tableCom extends Component { ...@@ -1525,53 +1459,53 @@ export default class tableCom extends Component {
case 'TextArea': case 'TextArea':
cm = ( cm = (
<span> <span>
{value} {value}
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br /> : ''}
</span> </span>
); );
break; break;
case 'Switch': case 'Switch':
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>
); );
break; break;
case 'InputNumber': case 'InputNumber':
cm = ( cm = (
<span> <span>
{value} {value}
{get === 'mobile' ? <br /> : ''} {get === 'mobile' ? <br /> : ''}
</span> </span>
); );
break; break;
case 'DatePicker': case 'DatePicker':
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>
) : ( ) : (
'' ''
); );
...@@ -1652,8 +1586,7 @@ export default class tableCom extends Component { ...@@ -1652,8 +1586,7 @@ export default class tableCom extends Component {
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>
); );
...@@ -1664,8 +1597,7 @@ export default class tableCom extends Component { ...@@ -1664,8 +1597,7 @@ export default class tableCom extends Component {
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}`, {
...@@ -1697,8 +1629,7 @@ export default class tableCom extends Component { ...@@ -1697,8 +1629,7 @@ export default class tableCom extends Component {
style={{ style={{
minHeight: 40, minHeight: 40,
lineHeight: '40px', lineHeight: '40px',
}} }}>
>
<Col <Col
className={json.label ? json.label : sqlData[key] ? styles.row_col_div : ''} className={json.label ? json.label : sqlData[key] ? styles.row_col_div : ''}
span={json.labelSpan} span={json.labelSpan}
...@@ -1709,8 +1640,7 @@ export default class tableCom extends Component { ...@@ -1709,8 +1640,7 @@ export default class tableCom extends Component {
overflow: 'hidden', overflow: 'hidden',
fontSize: 14, fontSize: 14,
color: 'rgba(0,0,0,0.85)', color: 'rgba(0,0,0,0.85)',
}} }}>
>
{json.label ? ( {json.label ? (
<> <>
{json.label} {json.label}
...@@ -1719,10 +1649,9 @@ export default class tableCom extends Component { ...@@ -1719,10 +1649,9 @@ export default class tableCom extends Component {
position: 'relative', position: 'relative',
top: '-0.5px', top: '-0.5px',
margin: '0 8px 0 2px', margin: '0 8px 0 2px',
}} }}>
> :
: </span>
</span>
</> </>
) : sqlData[key] ? ( ) : sqlData[key] ? (
<> <>
...@@ -1732,10 +1661,9 @@ export default class tableCom extends Component { ...@@ -1732,10 +1661,9 @@ export default class tableCom extends Component {
position: 'relative', position: 'relative',
top: '-0.5px', top: '-0.5px',
margin: '0 8px 0 2px', margin: '0 8px 0 2px',
}} }}>
> :
: </span>
</span>
</> </>
) : ( ) : (
'' ''
...@@ -1748,8 +1676,7 @@ export default class tableCom extends Component { ...@@ -1748,8 +1676,7 @@ export default class tableCom extends Component {
lineHeight: '40px', lineHeight: '40px',
zoom: 1, zoom: 1,
fontSize: 14, fontSize: 14,
}} }}>
>
{cm} {cm}
</Col> </Col>
</Row> </Row>
...@@ -1759,8 +1686,7 @@ export default class tableCom extends Component { ...@@ -1759,8 +1686,7 @@ 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={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>
); );
...@@ -1771,8 +1697,7 @@ export default class tableCom extends Component { ...@@ -1771,8 +1697,7 @@ 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={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}`, {
...@@ -1805,11 +1730,11 @@ export default class tableCom extends Component { ...@@ -1805,11 +1730,11 @@ 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) {
...@@ -1875,10 +1800,9 @@ export default class tableCom extends Component { ...@@ -1875,10 +1800,9 @@ export default class tableCom extends Component {
<span <span
style={{ style={{
wordBreak: 'break-all', wordBreak: 'break-all',
}} }}>
> {obj[dataColumn.base52]}
{obj[dataColumn.base52]} </span>
</span>
); );
break; break;
case 'Switch': case 'Switch':
...@@ -1890,10 +1814,9 @@ export default class tableCom extends Component { ...@@ -1890,10 +1814,9 @@ export default class tableCom extends Component {
<span <span
style={{ style={{
wordBreak: 'break-all', wordBreak: 'break-all',
}} }}>
> {obj[dataColumn.base52]}
{obj[dataColumn.base52]} </span>
</span>
); );
break; break;
...@@ -1919,8 +1842,9 @@ export default class tableCom extends Component { ...@@ -1919,8 +1842,9 @@ export default class tableCom extends Component {
case 'Checkbox': case 'Checkbox':
cm = ( cm = (
<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>
...@@ -1932,9 +1856,9 @@ export default class tableCom extends Component { ...@@ -1932,9 +1856,9 @@ export default class tableCom extends Component {
) : ( ) : (
',' + Object.values(r) ',' + Object.values(r)
), ),
) )
: ''} : ''}
</span> </span>
); );
break; break;
...@@ -1963,8 +1887,8 @@ export default class tableCom extends Component { ...@@ -1963,8 +1887,8 @@ export default class tableCom extends Component {
} else { } else {
cm = ( cm = (
<span> <span>
{ds.map((r, i) => (i == 0 ? r[json.labelName] : ',' + r[json.labelName]))} {ds.map((r, i) => (i == 0 ? r[json.labelName] : ',' + r[json.labelName]))}
</span> </span>
); );
} }
...@@ -1984,14 +1908,14 @@ export default class tableCom extends Component { ...@@ -1984,14 +1908,14 @@ export default class tableCom extends Component {
} else { } else {
cm = ( cm = (
<span> <span>
{moment(parseInt(obj[begin.base52])).format( {moment(parseInt(obj[begin.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss', json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '} )}{' '}
{' '} {' '}
{moment(parseInt(obj[end.base52])).format( {moment(parseInt(obj[end.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss', json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)} )}
</span> </span>
); );
} }
} else { } else {
...@@ -2003,20 +1927,20 @@ export default class tableCom extends Component { ...@@ -2003,20 +1927,20 @@ export default class tableCom extends Component {
if (obj[dataColumn.base52] && obj[dataColumn.base52].indexOf('-') === -1) { if (obj[dataColumn.base52] && obj[dataColumn.base52].indexOf('-') === -1) {
cm = ( cm = (
<span> <span>
{moment(parseInt(obj[dataColumn.base52])).format( {moment(parseInt(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>
); );
} else { } else {
cm = ( cm = (
<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>
); );
} }
...@@ -2075,43 +1999,42 @@ export default class tableCom extends Component { ...@@ -2075,43 +1999,42 @@ 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}>
<a <FilePreview path={queryApiActionPath() + f.path} pathName={f.name} />
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>
); );
} }
...@@ -2250,7 +2173,7 @@ export default class tableCom extends Component { ...@@ -2250,7 +2173,7 @@ export default class tableCom extends Component {
case 'LocationCom': case 'LocationCom':
cm = ( cm = (
<span> <span>
<LocationCom <LocationCom
get={get} get={get}
btnName={json.btnName} btnName={json.btnName}
btnSucName={json.btnSucName} btnSucName={json.btnSucName}
...@@ -2259,7 +2182,7 @@ export default class tableCom extends Component { ...@@ -2259,7 +2182,7 @@ export default class tableCom extends Component {
showMap={json.showMap} showMap={json.showMap}
value={obj[dataColumn.base52]} value={obj[dataColumn.base52]}
/> />
</span> </span>
); );
break; break;
...@@ -2286,10 +2209,10 @@ export default class tableCom extends Component { ...@@ -2286,10 +2209,10 @@ export default class tableCom extends Component {
default: default:
cm = ( cm = (
<span> <span>
缺乏字段 缺乏字段
{json.comName} {json.comName}
的匹配项 的匹配项
</span> </span>
); );
break; break;
} }
...@@ -2369,8 +2292,7 @@ export default class tableCom extends Component { ...@@ -2369,8 +2292,7 @@ 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}
</Form.Item> </Form.Item>
); );
...@@ -2411,15 +2333,14 @@ export default class tableCom extends Component { ...@@ -2411,15 +2333,14 @@ export default class tableCom extends Component {
: [{ required: required, message: '请选择' + title }], : [{ required: required, message: '请选择' + title }],
})} })}
disabled={disabled} disabled={disabled}
onClick={checked => { onClick={(checked) => {
// set new value // set new value
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
[dataColumn.base52]: checked, [dataColumn.base52]: checked,
}); });
}} }}
/> />
} }>
>
{(json.isMobileLabel != null && json.isMobileLabel) || {(json.isMobileLabel != null && json.isMobileLabel) ||
(json.isMobileLabel == null && json.isLabel) (json.isMobileLabel == null && json.isLabel)
? title ? title
...@@ -2476,8 +2397,7 @@ export default class tableCom extends Component { ...@@ -2476,8 +2397,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2518,8 +2438,7 @@ export default class tableCom extends Component { ...@@ -2518,8 +2438,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2550,8 +2469,7 @@ export default class tableCom extends Component { ...@@ -2550,8 +2469,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2586,8 +2504,7 @@ export default class tableCom extends Component { ...@@ -2586,8 +2504,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2606,8 +2523,6 @@ export default class tableCom extends Component { ...@@ -2606,8 +2523,6 @@ export default class tableCom extends Component {
break; break;
case 'Select': case 'Select':
// console.table(selectDis, disabled);
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue, initialValue: initValue,
rules: rules:
...@@ -2625,39 +2540,38 @@ export default class tableCom extends Component { ...@@ -2625,39 +2540,38 @@ 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');
} }
: '' : ''
} }
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) =>
option option
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 ? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
: false : false
} }>
>
{options && options instanceof Array {options && options instanceof Array
? options.map(r => ( ? options.map((r) => (
<Option key={r.value} value={r.value}> <Option key={r.value} value={r.value}>
{r.label} {r.label}
</Option> </Option>
)) ))
: ''} : ''}
</Select>, </Select>,
); );
...@@ -2672,8 +2586,7 @@ export default class tableCom extends Component { ...@@ -2672,8 +2586,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2700,22 +2613,28 @@ export default class tableCom extends Component { ...@@ -2700,22 +2613,28 @@ 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') {
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 }],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />); })(
<MobileCascader options={options}
label={title}
disabled={disabled}
json={json}
/>);
} }
if ( if (
...@@ -2729,8 +2648,7 @@ export default class tableCom extends Component { ...@@ -2729,8 +2648,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2747,22 +2665,22 @@ export default class tableCom extends Component { ...@@ -2747,22 +2665,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}
...@@ -2786,8 +2704,7 @@ export default class tableCom extends Component { ...@@ -2786,8 +2704,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2808,14 +2725,14 @@ export default class tableCom extends Component { ...@@ -2808,14 +2725,14 @@ export default class tableCom extends Component {
if (!isEdit) { if (!isEdit) {
cm = ( cm = (
<span> <span>
{moment(parseInt(obj[begin.base52])).format( {moment(parseInt(obj[begin.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss', json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '} )}{' '}
{' '} {' '}
{moment(parseInt(obj[end.base52])).format( {moment(parseInt(obj[end.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss', json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)} )}
</span> </span>
); );
} else { } else {
if (get === 'mobile') { if (get === 'mobile') {
...@@ -2836,8 +2753,7 @@ export default class tableCom extends Component { ...@@ -2836,8 +2753,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2879,20 +2795,20 @@ export default class tableCom extends Component { ...@@ -2879,20 +2795,20 @@ 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 ')
.setAttribute('readonly', 'readonly'); .removeAttribute('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'}
...@@ -2909,8 +2825,7 @@ export default class tableCom extends Component { ...@@ -2909,8 +2825,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2924,6 +2839,7 @@ export default class tableCom extends Component { ...@@ -2924,6 +2839,7 @@ export default class tableCom extends Component {
files = initValue.files; files = initValue.files;
} }
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: { files: files }, initialValue: { files: files },
rules: [ rules: [
...@@ -2940,11 +2856,10 @@ export default class tableCom extends Component { ...@@ -2940,11 +2856,10 @@ export default class tableCom extends Component {
}, },
], ],
})( })(
<UploadCom <UploadCom isMultiple={json.isMultiple}
isMultiple={json.isMultiple} accept={json.accept}
accept={json.accept} btnName={json.btnName}
btnName={json.btnName} disabled={disabled || isPreview}
disabled={disabled || isPreview}
/>, />,
); );
if ( if (
...@@ -2958,8 +2873,7 @@ export default class tableCom extends Component { ...@@ -2958,8 +2873,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -2984,8 +2898,7 @@ export default class tableCom extends Component { ...@@ -2984,8 +2898,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -3028,14 +2941,14 @@ export default class tableCom extends Component { ...@@ -3028,14 +2941,14 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
} }
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}
...@@ -3075,8 +2988,7 @@ export default class tableCom extends Component { ...@@ -3075,8 +2988,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -3101,8 +3013,7 @@ export default class tableCom extends Component { ...@@ -3101,8 +3013,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -3127,8 +3038,7 @@ export default class tableCom extends Component { ...@@ -3127,8 +3038,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -3162,8 +3072,7 @@ export default class tableCom extends Component { ...@@ -3162,8 +3072,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
); );
...@@ -3207,8 +3116,7 @@ export default class tableCom extends Component { ...@@ -3207,8 +3116,7 @@ export default class tableCom extends Component {
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}>
>
<ZdyTable <ZdyTable
taskId={this.props.taskId} taskId={this.props.taskId}
taskAssignee={taskAssignee} taskAssignee={taskAssignee}
...@@ -3245,8 +3153,7 @@ export default class tableCom extends Component { ...@@ -3245,8 +3153,7 @@ export default class tableCom extends Component {
style={{ style={{
minHeight: 40, minHeight: 40,
lineHeight: '40px', lineHeight: '40px',
}} }}>
>
<Col <Col
className={title ? styles.row_col_div : ''} className={title ? styles.row_col_div : ''}
span={json.labelSpan} span={json.labelSpan}
...@@ -3257,8 +3164,7 @@ export default class tableCom extends Component { ...@@ -3257,8 +3164,7 @@ export default class tableCom extends Component {
overflow: 'hidden', overflow: 'hidden',
fontSize: 14, fontSize: 14,
color: 'rgba(0,0,0,0.85)', color: 'rgba(0,0,0,0.85)',
}} }}>
>
{title} {title}
{title && ( {title && (
<span <span
...@@ -3266,10 +3172,9 @@ export default class tableCom extends Component { ...@@ -3266,10 +3172,9 @@ export default class tableCom extends Component {
position: 'relative', position: 'relative',
top: '-0.5px', top: '-0.5px',
margin: '0 8px 0 2px', margin: '0 8px 0 2px',
}} }}>
> :
: </span>
</span>
)} )}
</Col> </Col>
<Col <Col
...@@ -3279,8 +3184,7 @@ export default class tableCom extends Component { ...@@ -3279,8 +3184,7 @@ export default class tableCom extends Component {
lineHeight: '40px', lineHeight: '40px',
zoom: 1, zoom: 1,
fontSize: 14, fontSize: 14,
}} }}>
>
{cm} {cm}
</Col> </Col>
{modalCode ? ( {modalCode ? (
...@@ -3288,8 +3192,7 @@ export default class tableCom extends Component { ...@@ -3288,8 +3192,7 @@ export default class tableCom extends Component {
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}>
>
<ZdyTable <ZdyTable
taskId={this.props.taskId} taskId={this.props.taskId}
taskAssignee={taskAssignee} taskAssignee={taskAssignee}
...@@ -3324,8 +3227,7 @@ export default class tableCom extends Component { ...@@ -3324,8 +3227,7 @@ export default class tableCom extends Component {
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}>
>
<ZdyTable <ZdyTable
taskId={this.props.taskId} taskId={this.props.taskId}
taskAssignee={taskAssignee} taskAssignee={taskAssignee}
...@@ -3353,8 +3255,7 @@ export default class tableCom extends Component { ...@@ -3353,8 +3255,7 @@ 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}
</Form.Item> </Form.Item>
</> </>
...@@ -3368,8 +3269,7 @@ export default class tableCom extends Component { ...@@ -3368,8 +3269,7 @@ export default class tableCom extends Component {
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}>
>
<ZdyTable <ZdyTable
taskId={this.props.taskId} taskId={this.props.taskId}
taskAssignee={taskAssignee} taskAssignee={taskAssignee}
...@@ -3406,8 +3306,7 @@ export default class tableCom extends Component { ...@@ -3406,8 +3306,7 @@ export default class tableCom extends Component {
{...modalProps} {...modalProps}
visible={this.props.DataColumn.isShowModal[modalCode]} visible={this.props.DataColumn.isShowModal[modalCode]}
handleCancel={this.closeModal.bind(this, modalCode)} handleCancel={this.closeModal.bind(this, modalCode)}
title={modalTitle} title={modalTitle}>
>
<ZdyTable <ZdyTable
taskId={this.props.taskId} taskId={this.props.taskId}
taskAssignee={taskAssignee} taskAssignee={taskAssignee}
...@@ -3437,8 +3336,7 @@ export default class tableCom extends Component { ...@@ -3437,8 +3336,7 @@ export default class tableCom extends Component {
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}
</MobileItem> </MobileItem>
) : isEdit && get == 'web' ? ( ) : isEdit && get == 'web' ? (
...@@ -3446,8 +3344,7 @@ export default class tableCom extends Component { ...@@ -3446,8 +3344,7 @@ 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}
</Form.Item> </Form.Item>
) : ( ) : (
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论