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

searchJson函数修改

上级 7d02cbd8
......@@ -81,7 +81,12 @@ const giveRender = (column = {}) => {
return column;
};
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
@connect(({
DataColumn,
SqlManageEntity,
formList,
loading,
}) => ({
DataColumn,
SqlManageEntity,
formList,
......@@ -186,7 +191,12 @@ export default class tableCom extends Component {
};
getColumnSearchProps = (dataIndex, title) => ({
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
filterDropdown: ({
setSelectedKeys,
selectedKeys,
confirm,
clearFilters,
}) => (
<div style={{ padding: 8 }}>
<Input
ref={node => {
......@@ -203,11 +213,11 @@ export default class tableCom extends Component {
}}
/>
<Button
type="primary"
type='primary'
onClick={() => this.handleSearch(selectedKeys, confirm)}
icon="search"
icon='search'
loading={this.props.loading}
size="small"
size='small'
style={{
width: 90,
marginRight: 8,
......@@ -218,20 +228,20 @@ export default class tableCom extends Component {
<Button
loading={this.props.loading}
onClick={() => this.handleReset(clearFilters)}
size="small"
size='small'
style={{ width: 90 }}
>
重置
</Button>
</div>
),
filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }} />,
filterIcon: filtered => <Icon type='search' style={{ color: filtered ? '#1890ff' : 'red' }} />,
onFilter: (value, record) =>
record[dataIndex]
? record[dataIndex]
.toString()
.toLowerCase()
.includes(value.toLowerCase())
.toString()
.toLowerCase()
.includes(value.toLowerCase())
: '',
onFilterDropdownVisibleChange: visible => {
if (visible) {
......@@ -257,8 +267,11 @@ export default class tableCom extends Component {
},
});
searchJson = (value, json, level, labs) => {
if (!json || !Array.isArray(json) || !json.length || !value) {
return;
}
for (var i = 0; i < json.length; i++) {
if (json[i].value == value[level]) {
if (!!value && json[i].value == value[level]) {
labs.push(json[i].label);
if (json[i].children) {
this.searchJson(value, json[i].children, level + 1, labs);
......@@ -269,7 +282,11 @@ export default class tableCom extends Component {
};
componentWillReceiveProps(props) {
const { json, mapData, obj } = props;
const {
json,
mapData,
obj,
} = props;
if (json == null || this.props.safe) {
return;
}
......@@ -327,7 +344,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;
......@@ -349,9 +366,9 @@ export default class tableCom extends Component {
this.props.fatherCode != null
? bindObj
? {
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
...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) {
......@@ -387,7 +404,10 @@ export default class tableCom extends Component {
allValues = JSON.stringify(allValues);
if (json.comName === 'TableSelect') {
const { dispatch } = this.props;
const { sqlKey, optionType } = json;
const {
sqlKey,
optionType,
} = json;
if (optionType === 'sql') {
dispatch({
type: 'SqlManageEntity/find',
......@@ -409,7 +429,8 @@ 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');
}
column = giveRender(column);
......@@ -446,7 +467,8 @@ 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 = {
......@@ -493,7 +515,8 @@ 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');
}
column = giveRender(column);
columns.push(column);
......@@ -632,7 +655,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,
);
}
......@@ -726,7 +749,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,
);
}
......@@ -760,78 +783,79 @@ export default class tableCom extends Component {
data: requestParams,
method: method,
requestType: 'form',
}).then(data => {
// if (!data || !Array.isArray(data)) {
// data = [];
// }
const { reqUrls } = this.state;
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')) {
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
}
} else if (json.comName == 'Button') {
try {
callback(data);
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
try {
const x = callback(data);
if (x != null) {
this.setState({ option: x });
})
.then(data => {
// if (!data || !Array.isArray(data)) {
// data = [];
// }
const { reqUrls } = this.state;
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')) {
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
}
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else {
if (base52) {
} else if (json.comName == 'Button') {
try {
callback(data);
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
try {
const x = callback(data);
// console.log(x, '757');
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
if (x != null) {
this.setState({ option: x });
}
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${
json.comName
}${this.props.i + 1}行,第${this.props.j +
1}列:公式配置有误,回调函数内部错误,`,
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else {
if (base52) {
try {
const x = callback(data);
// console.log(x, '757');
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${
json.comName
}${this.props.i + 1}行,第${this.props.j +
1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
}
}
}
}
},
);
});
},
);
});
return 'norefeshxxxxxxxxxxxxxxxxxxxx';
};
......@@ -951,62 +975,50 @@ export default class tableCom extends Component {
if (getToken() != null) {
pp.token = getToken();
}
uaaRequest(url, pp).then(data => {
const { sqlKeys } = this.state;
sqlKeys[sqlKey].data = data;
this.setState({ sqlKeys });
if (data == null) {
return;
}
uaaRequest(url, pp)
.then(data => {
const { sqlKeys } = this.state;
sqlKeys[sqlKey].data = data;
this.setState({ sqlKeys });
if (data == null) {
return;
}
if (callback) {
if (json.optionType && json.optionType === 'func') {
const res = callback(data);
if (callback) {
if (json.optionType && json.optionType === 'func') {
const res = callback(data);
if (res != null && !(typeof res === 'function')) {
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
}
} else if (json.comName == 'Button') {
try {
callback(data);
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else if (
json.comName == 'Echart' ||
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
try {
const x = callback(data);
if (x != null) {
this.setState({ option: x });
if (res != null && !(typeof res === 'function')) {
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
}
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else {
if (base52) {
} else if (json.comName == 'Button') {
try {
callback(data);
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else if (
json.comName == 'Echart' ||
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
try {
const x = callback(data);
// console.log(x, 938);
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
if (x != null) {
this.setState({ option: x });
}
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
......@@ -1014,10 +1026,23 @@ export default class tableCom extends Component {
e,
);
}
} else {
if (base52) {
try {
const x = callback(data);
// console.log(x, 938);
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
}
}
}
}
});
});
});
return 'norefeshxxxxxxxxxxxxxxxxxxxx';
......@@ -1147,14 +1172,19 @@ export default class tableCom extends Component {
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i +
1}行,第${this.props.j + 1}列:公式配置有误,暂存失败,`,
1}行,第${this.props.j + 1}列:公式配置有误,暂存失败,`,
e,
);
}
};
componentDidMount() {
const { json, mapData, obj, init } = this.props;
const {
json,
mapData,
obj,
init,
} = this.props;
if (json == null) {
return;
}
......@@ -1175,9 +1205,9 @@ export default class tableCom extends Component {
this.props.fatherCode != null
? bindObj
? {
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
...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) {
......@@ -1402,7 +1432,10 @@ export default class tableCom extends Component {
}
};
getColumn = key => {
let { mapData, json } = this.props;
let {
mapData,
json,
} = this.props;
const columnIds = json.columnIds;
......@@ -1445,8 +1478,20 @@ export default class tableCom extends Component {
getCellValue,
} = this.props;
// console.log(this.props.datas);
const { options, labels, selectDis, modalCode, modalTitle, modalInit, modalProps } = this.state;
const { getFieldDecorator, getFieldError, getFieldProps } = this.props.form;
const {
options,
labels,
selectDis,
modalCode,
modalTitle,
modalInit,
modalProps,
} = this.state;
const {
getFieldDecorator,
getFieldError,
getFieldProps,
} = this.props.form;
const disabled = json != null ? json.disabled : false;
const permRank = json != null ? (json.permRank != null ? json.permRank : 0) : 0;
if (json?.label === '账号') {
......@@ -1500,7 +1545,7 @@ export default class tableCom extends Component {
<>
{this.props.form.getFieldDecorator(this.props.uuid, {
initialValue: fk,
})(<Input type="hidden" />)}{' '}
})(<Input type='hidden' />)}{' '}
<ZdyTable
taskId={this.props.taskId}
importExcel={this.props.importExcel}
......@@ -1576,7 +1621,7 @@ export default class tableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: obj[this.props.uuid] || json.initialValue,
})(<Input type="hidden" />)}
})(<Input type='hidden' />)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1593,7 +1638,7 @@ export default class tableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: this.props.form.getFieldsValue()[uid] || json.initialValue,
})(<Input type="hidden" />)}
})(<Input type='hidden' />)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1686,7 +1731,8 @@ export default class tableCom extends Component {
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>
) : (
......@@ -1702,7 +1748,7 @@ export default class tableCom extends Component {
{filesX.map((f, index2) => {
return (
<li key={index2}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
<a target='_blank' key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a>
</li>
......@@ -1722,7 +1768,7 @@ export default class tableCom extends Component {
{files.map((f, index2) => {
return (
<li key={index2}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
<a target='_blank' key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a>
</li>
......@@ -1815,7 +1861,7 @@ export default class tableCom extends Component {
</MobileItem>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden" />)}
})(<Input type='hidden' />)}
</>
);
}
......@@ -1828,7 +1874,7 @@ export default class tableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden" />)}
})(<Input type='hidden' />)}
</>
);
}
......@@ -1922,7 +1968,7 @@ export default class tableCom extends Component {
</Form.Item>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden" />)}
})(<Input type='hidden' />)}
</>
);
}
......@@ -1935,7 +1981,7 @@ export default class tableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden" />)}
})(<Input type='hidden' />)}
</>
);
}
......@@ -1951,9 +1997,9 @@ export default class tableCom extends Component {
this.props.fatherCode != null
? bindObj
? {
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
: { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
: bindObj;
......@@ -2085,18 +2131,18 @@ export default class tableCom extends Component {
<span>
{labels != null
? labels.map((r, i) =>
i == 0 ? (
typeof r == 'string' ? (
<span>{r}</span>
) : (
Object.values(r)
)
) : typeof r == 'string' ? (
<span style={{ marginLeft: 12 }}>{r}</span>
i == 0 ? (
typeof r == 'string' ? (
<span>{r}</span>
) : (
',' + Object.values(r)
),
)
Object.values(r)
)
) : typeof r == 'string' ? (
<span style={{ marginLeft: 12 }}>{r}</span>
) : (
',' + Object.values(r)
),
)
: ''}
</span>
);
......@@ -2119,7 +2165,7 @@ export default class tableCom extends Component {
<Table
get={get}
columns={this.state.columns}
size="small"
size='small'
dataSource={ds}
pagination={false}
/>
......@@ -2152,13 +2198,15 @@ export default class tableCom extends Component {
} else {
cm = (
<span>
{moment(parseInt(obj[begin.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{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',
)}
{moment(parseInt(obj[end.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
);
}
......@@ -2171,16 +2219,18 @@ export default class tableCom extends Component {
if (obj[dataColumn.base52] && obj[dataColumn.base52].indexOf('-') === -1) {
cm = (
<span>
{moment(parseInt(obj[dataColumn.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
{moment(parseInt(obj[dataColumn.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
);
} else {
cm = (
<span>
{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',
)
: ''}
......@@ -2225,18 +2275,18 @@ export default class tableCom extends Component {
cm = (
<ul className={styles.imageUl}>
{Array.isArray(files) &&
files.map((f, index2) => {
return (
<li key={f.path}>
<PictureSignature
json={json}
disabled={true} // 只读模式
basicUrl={queryApiActionPath()}
fileInfo={f}
/>
</li>
);
})}
files.map((f, index2) => {
return (
<li key={f.path}>
<PictureSignature
json={json}
disabled={true} // 只读模式
basicUrl={queryApiActionPath()}
fileInfo={f}
/>
</li>
);
})}
</ul>
);
}
......@@ -2288,7 +2338,7 @@ export default class tableCom extends Component {
}
return (
<li key={index2}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
<a target='_blank' key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a>
</li>
......@@ -2301,39 +2351,39 @@ export default class tableCom extends Component {
cm = (
<ul className={styles.imageUl}>
{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}
type={'UploadCom'}
/>
</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}
type={'UploadCom'}
/>
</li>
);
})}
}
return (
<li key={index2}>
<a
target='_blank'
key={f.filePath}
href={queryApiActionPath() + f.filePath}
>
{f.fileName}
</a>
</li>
);
})}
</ul>
);
}
......@@ -2485,7 +2535,7 @@ export default class tableCom extends Component {
if (json.isLink) {
cm = <a {...ev} />;
} else {
cm = <Button loading={this.props.loading} type="primary" {...ev} />;
cm = <Button loading={this.props.loading} type='primary' {...ev} />;
}
}
......@@ -2567,7 +2617,7 @@ export default class tableCom extends Component {
if (json.isLink) {
cm = <a {...ev} />;
} else {
cm = <Button loading={this.props.loading} type="primary" {...ev} />;
cm = <Button loading={this.props.loading} type='primary' {...ev} />;
}
}
......@@ -2588,11 +2638,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + title,
},
],
{
required: required,
message: '请选择' + title,
},
],
})}
disabled={disabled}
onClick={checked => {
......@@ -2624,11 +2674,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + title,
},
],
{
required: required,
message: '请选择' + title,
},
],
})(
<Switch
disabled={disabled}
......@@ -2655,11 +2705,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(
<TextArea
autoSize={{ minRows: 4 }}
......@@ -2694,11 +2744,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(
<TextArea
autoSize={{ minRows: 4 }}
......@@ -2717,11 +2767,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(
<Input
disabled={disabled}
......@@ -2752,7 +2802,7 @@ export default class tableCom extends Component {
case 'InputHidden':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
})(<Input type="hidden" />);
})(<Input type='hidden' />);
break;
case 'InputNumber':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -2761,11 +2811,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(
<InputNumber
disabled={disabled}
......@@ -2807,11 +2857,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(<Radio.Group options={options} disabled={disabled} />);
if (get == 'mobile') {
cm = <div>{cm}</div>;
......@@ -2840,18 +2890,18 @@ export default class tableCom extends Component {
case 'Checkbox':
if (get === 'mobile') {
cm = (
<Flex direction="column" align="start">
<Flex direction='column' align='start'>
{getFieldDecorator(dataColumn.base52, {
initialValue: initValue, // 默认值
rules:
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(<Checkbox.Group options={options} disabled={disabled} />)}
</Flex>
);
......@@ -2882,11 +2932,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(
<Checkbox.Group
options={options}
......@@ -2911,11 +2961,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(
<Select
allowClear
......@@ -2923,44 +2973,45 @@ export default class tableCom extends Component {
disabled={selectDis || disabled}
placeholder={json.placeholder}
style={{ width: json.width }}
optionFilterProp="children"
optionFilterProp='children'
getPopupContainer={
this.props.isDynamic && document.querySelector('#dynamic_div')
? () => {
return document.querySelector('#dynamic_div');
}
return document.querySelector('#dynamic_div');
}
: ''
}
onFocus={() => {
get === 'mobile' // 移动端取消输入键盘弹出
? setTimeout(() => {
if (document.querySelectorAll(`.ant-select-search__field`).length > 0) {
let ary = [...document.querySelectorAll(`.ant-select-search__field`)];
ary.map(item => {
item.setAttribute('readonly', 'readonly');
// setTimeout(() => {
// ary.map(arr => {
// arr.removeAttribute('readonly');
// })
// });
});
}
})
if (document.querySelectorAll(`.ant-select-search__field`).length > 0) {
let ary = [...document.querySelectorAll(`.ant-select-search__field`)];
ary.map(item => {
item.setAttribute('readonly', 'readonly');
// setTimeout(() => {
// ary.map(arr => {
// arr.removeAttribute('readonly');
// })
// });
});
}
})
: null;
}}
filterOption={(input, option) =>
option
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
? option.props.children.toLowerCase()
.indexOf(input.toLowerCase()) >= 0
: false
}
{...otherProps}
>
{options && options instanceof Array
? options.map(r => (
<Option key={r.value} value={r.value}>
{r.label}
</Option>
))
<Option key={r.value} value={r.value}>
{r.label}
</Option>
))
: ''}
</Select>,
);
......@@ -2999,7 +3050,8 @@ export default class tableCom extends Component {
}
const filterF = function filter(inputValue, path) {
return path.some(
option => option?.label?.toLowerCase()?.indexOf(inputValue.toLowerCase()) > -1,
option => option?.label?.toLowerCase()
?.indexOf(inputValue.toLowerCase()) > -1,
);
};
cm = getFieldDecorator(dataColumn.base52, {
......@@ -3008,11 +3060,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(
<Cascader // 这里的options 获取方式存在bug 公式会重复调用
options={options}
......@@ -3022,8 +3074,8 @@ 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}
......@@ -3039,11 +3091,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
}
......@@ -3076,22 +3128,22 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
validator: (rule, value, callback) => {
let errors = [];
if (
(Object.keys(value).length == 0 ||
Object.keys(value.selects).length == 0) &&
required != null &&
required
) {
errors.push(new Error('请选择至少一个', rule.field));
}
callback(errors);
},
required: required,
{
validator: (rule, value, callback) => {
let errors = [];
if (
(Object.keys(value).length == 0 ||
Object.keys(value.selects).length == 0) &&
required != null &&
required
) {
errors.push(new Error('请选择至少一个', rule.field));
}
callback(errors);
},
],
required: required,
},
],
})(
<TableSelect
get={get}
......@@ -3148,13 +3200,15 @@ export default class tableCom extends Component {
if (!isEdit) {
cm = (
<span>
{moment(parseInt(obj[begin.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{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',
)}
{moment(parseInt(obj[end.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
);
} else {
......@@ -3165,11 +3219,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择起止时间',
},
],
{
required: required,
message: '请选择起止时间',
},
],
})(<MobileDate disabled={disabled} formate={json.format} required={required} />);
if (
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3197,11 +3251,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择起止时间',
},
],
{
required: required,
message: '请选择起止时间',
},
],
})(
<RangePicker
showTime={json.showTime != null ? json.showTime : true}
......@@ -3227,11 +3281,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择起止时间',
},
],
{
required: required,
message: '请选择起止时间',
},
],
})(
<DatePicker
disabled={disabled}
......@@ -3242,21 +3296,22 @@ 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'}
/>,
......@@ -3291,11 +3346,11 @@ export default class tableCom extends Component {
json?.vlds && json?.vlds.length > 0
? json.vlds
: [
{
required,
message: '请进行签章',
},
],
{
required,
message: '请进行签章',
},
],
})(
<SignArray // 签章组件 编辑模式
json={json}
......@@ -3380,11 +3435,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入',
},
],
{
required: required,
message: '请输入',
},
],
})(
<WangEditor
json={json}
......@@ -3401,11 +3456,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入',
},
],
{
required: required,
message: '请输入',
},
],
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />);
if (
get === 'mobile' &&
......@@ -3433,11 +3488,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(<CronEditor style={{ width: 600 }} />);
break;
case 'LocationCom':
......@@ -3447,11 +3502,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请进行定位',
},
],
{
required: required,
message: '请进行定位',
},
],
})(
<LocationCom
get={get}
......@@ -3537,11 +3592,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请上传图片',
},
],
{
required: required,
message: '请上传图片',
},
],
})(<ImgUploadCom json={json} disabled={disabled} />);
if (
get === 'mobile' &&
......@@ -3568,11 +3623,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请上传视频',
},
],
{
required: required,
message: '请上传视频',
},
],
})(<VideoUploadCom json={json} disabled={disabled} />);
if (
get === 'mobile' &&
......@@ -3599,11 +3654,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请进行签名',
},
],
{
required: required,
message: '请进行签名',
},
],
})(
<Signature
width={
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论