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

拆分代码

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