提交 baa43d1b authored 作者: 姚鑫国's avatar 姚鑫国

新增Tree组件

上级 bda6718e
import React from 'react';
import { Tree } from 'antd';
export default class TreeDiy extends React.Component {
constructor(props) {
super(props);
const allJson = props.option || {};
this.state = {
allJson,
};
}
// static getDerivedStateFromProps(nextProps, prevState) {
// if ('value' in nextProps) {
// return { ...nextProps.value }; // 更新state
// }
// }
// componentDidUpdate(prevProps, prevState) {}
render() {
return <Tree {...this.state.allJson} />;
}
}
...@@ -37,6 +37,7 @@ import TreeSelectDiy from '../TreeSelect/index'; ...@@ -37,6 +37,7 @@ import TreeSelectDiy from '../TreeSelect/index';
import { connect } from 'dva'; import { connect } from 'dva';
import UploadCom from '../libs/UploadCom'; import UploadCom from '../libs/UploadCom';
import TableSelect from '../libs/TableSelect'; import TableSelect from '../libs/TableSelect';
import TreeDiy from '../libs/TreeDiy';
import LocationCom from '../libs/LocationCom'; import LocationCom from '../libs/LocationCom';
import MobileDate from '../libs/MobileDate'; import MobileDate from '../libs/MobileDate';
import ChildForm from '../libs/ChildForm'; import ChildForm from '../libs/ChildForm';
...@@ -87,7 +88,7 @@ import StepDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/StepDiy ...@@ -87,7 +88,7 @@ import StepDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/StepDiy
import EchartsDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/EchartsDiy'; import EchartsDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/EchartsDiy';
import { getServicesNomal } from '../Services/services'; import { getServicesNomal } from '../Services/services';
import { import {
getHeaderListApi, getHeaderListApi,
getSqlDataApi, getSqlDataApi,
findApi, findApi,
getSqlOptionsApi, getSqlOptionsApi,
...@@ -150,10 +151,10 @@ export default class TableCom extends Component { ...@@ -150,10 +151,10 @@ export default class TableCom extends Component {
}; };
this.excludeKeys = ['defaultValues', '']; this.excludeKeys = ['defaultValues', ''];
this.otherProps = {}; this.otherProps = {};
if(props.json?.otherProps){ if (props.json?.otherProps) {
try { try {
this.otherProps = new Function(props.json?.otherProps)(); this.otherProps = new Function(props.json?.otherProps)();
}catch (e) { } catch (e) {
} }
} }
...@@ -288,9 +289,9 @@ export default class TableCom extends Component { ...@@ -288,9 +289,9 @@ export default class TableCom extends Component {
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) {
...@@ -412,9 +413,9 @@ export default class TableCom extends Component { ...@@ -412,9 +413,9 @@ export default class TableCom extends Component {
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) {
...@@ -676,7 +677,7 @@ export default class TableCom extends Component { ...@@ -676,7 +677,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,
); );
} }
...@@ -748,7 +749,7 @@ export default class TableCom extends Component { ...@@ -748,7 +749,7 @@ export default class TableCom extends Component {
); );
//message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10) //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
} }
} else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph', 'Tabs', 'Tree'].includes(json.comName)) {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
...@@ -770,7 +771,7 @@ export default class TableCom extends Component { ...@@ -770,7 +771,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,
); );
} }
...@@ -823,7 +824,7 @@ export default class TableCom extends Component { ...@@ -823,7 +824,7 @@ export default class TableCom extends Component {
e, e,
); );
} }
} else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph', 'Tabs', 'Tree'].includes(json.comName)) {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
...@@ -844,10 +845,9 @@ export default class TableCom extends Component { ...@@ -844,10 +845,9 @@ export default class TableCom extends Component {
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x }); if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
} catch (e) { } catch (e) {
console.log( console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${ `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName
json.comName
}${this.props.i + 1}行,第${this.props.j + }${this.props.i + 1}行,第${this.props.j +
1}列:公式配置有误,回调函数内部错误,`, 1}列:公式配置有误,回调函数内部错误,`,
e, e,
); );
} }
...@@ -934,7 +934,7 @@ export default class TableCom extends Component { ...@@ -934,7 +934,7 @@ export default class TableCom extends Component {
e, e,
); );
} }
} else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph', 'Tabs', 'Tree'].includes(json.comName)) {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
...@@ -1017,7 +1017,7 @@ export default class TableCom extends Component { ...@@ -1017,7 +1017,7 @@ export default class TableCom extends Component {
e, e,
); );
} }
} else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph', 'Tabs', 'Tree'].includes(json.comName)) {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
...@@ -1234,7 +1234,7 @@ export default class TableCom extends Component { ...@@ -1234,7 +1234,7 @@ export default class TableCom extends Component {
}, },
); );
} }
} else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph', 'Tabs', 'Tree'].includes(json.comName)) {
this.setState({ option: value }); this.setState({ option: value });
} else { } else {
try { try {
...@@ -1252,7 +1252,7 @@ export default class TableCom extends Component { ...@@ -1252,7 +1252,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,
); );
} }
...@@ -1275,9 +1275,9 @@ export default class TableCom extends Component { ...@@ -1275,9 +1275,9 @@ export default class TableCom extends Component {
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) {
...@@ -1479,16 +1479,16 @@ export default class TableCom extends Component { ...@@ -1479,16 +1479,16 @@ export default class TableCom extends Component {
allValues, allValues,
}).then(options => { }).then(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({
label: options[i][dataColumn.referenceNameName], label: options[i][dataColumn.referenceNameName],
value: options[i][dataColumn.referenceCodeName], value: options[i][dataColumn.referenceCodeName],
});
}
this.setState({
options: optionsx,
selectDis: false,
}); });
}
this.setState({
options: optionsx,
selectDis: false,
});
}); });
} else if (!this.props.isEdit && Object.keys(obj).length > 0) { } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
if (obj[dataColumn.base52]) { if (obj[dataColumn.base52]) {
...@@ -1511,16 +1511,16 @@ export default class TableCom extends Component { ...@@ -1511,16 +1511,16 @@ export default class TableCom extends Component {
allValues, allValues,
}).then(options => { }).then(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({
label: options[i][dataColumn.referenceNameName], label: options[i][dataColumn.referenceNameName],
value: options[i][dataColumn.referenceCodeName], value: options[i][dataColumn.referenceCodeName],
});
}
this.setState({
options: optionsx,
selectDis: false,
}); });
}
this.setState({
options: optionsx,
selectDis: false,
});
}); });
} }
}; };
...@@ -1612,7 +1612,7 @@ export default class TableCom extends Component { ...@@ -1612,7 +1612,7 @@ export default class TableCom extends Component {
return this.props.form.getFieldDecorator(uuid, { return this.props.form.getFieldDecorator(uuid, {
initialValue: '', initialValue: '',
})( })(
<EchartsDiy json={json} uuid={uuid} option={this.state.option}/> <EchartsDiy json={json} uuid={uuid} option={this.state.option} />
) )
} }
if (json.comName === 'Graph') { if (json.comName === 'Graph') {
...@@ -1658,7 +1658,7 @@ export default class TableCom extends Component { ...@@ -1658,7 +1658,7 @@ export default class TableCom extends Component {
{this.props.form.getFieldDecorator(uuid, { {this.props.form.getFieldDecorator(uuid, {
initialValue: fk, initialValue: fk,
})(<Input type="hidden" />)} })(<Input type="hidden" />)}
{json.isLabel?(<Form.Item {json.isLabel ? (<Form.Item
labelCol={{ span: json.labelSpan }} labelCol={{ span: json.labelSpan }}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{ span: json.wrapperSpan }}
label={json.label} label={json.label}
...@@ -1673,17 +1673,17 @@ export default class TableCom extends Component { ...@@ -1673,17 +1673,17 @@ export default class TableCom extends Component {
{...datas[fk]} {...datas[fk]}
form={this.props.form} form={this.props.form}
/> />
</Form.Item>):( <ZdyTable </Form.Item>) : (<ZdyTable
{...this.partFormProps} {...this.partFormProps}
currentFormTitle={ currentFormTitle={
this.props.getCurrentFormTitle ? this.props.getCurrentFormTitle(fk) : null this.props.getCurrentFormTitle ? this.props.getCurrentFormTitle(fk) : null
} }
key={fk} key={fk}
currentFormKey={fk} currentFormKey={fk}
{...datas[fk]} {...datas[fk]}
form={this.props.form} form={this.props.form}
/>)} />)}
</> </>
); );
} }
...@@ -1732,6 +1732,16 @@ export default class TableCom extends Component { ...@@ -1732,6 +1732,16 @@ export default class TableCom extends Component {
return xx; return xx;
} }
if (json.comName === 'Tree') {
if (!(this.state.option && this.state.option.treeData)) {
return <>无treeData配置项</>;
}
const xx = (
<TreeDiy json={this.props.json} option={this.state.option} />
);
return xx;
}
// if([ // if([
// // 'Select', // // 'Select',
// // 'Input', // // 'Input',
...@@ -2147,9 +2157,9 @@ export default class TableCom extends Component { ...@@ -2147,9 +2157,9 @@ export default class TableCom extends Component {
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}].${uuid}` } : { base52: `${this.props.fatherCode}.[${this.props.index}].${uuid}` }
: bindObj; : bindObj;
...@@ -2294,18 +2304,18 @@ ${obj[dataColumn.base52]} ...@@ -2294,18 +2304,18 @@ ${obj[dataColumn.base52]}
<span> <span>
{labels != null {labels != null
? labels.map((r, i) => ? labels.map((r, i) =>
i == 0 ? ( i == 0 ? (
typeof r == 'string' ? ( typeof r == 'string' ? (
<span>{r}</span> <span>{r}</span>
) : (
Object.values(r)
)
) : typeof r == 'string' ? (
<span style={{ marginLeft: 12 }}>{r}</span>
) : ( ) : (
',' + Object.values(r) Object.values(r)
), )
) ) : typeof r == 'string' ? (
<span style={{ marginLeft: 12 }}>{r}</span>
) : (
',' + Object.values(r)
),
)
: ''} : ''}
</span> </span>
); );
...@@ -2338,8 +2348,8 @@ ${obj[dataColumn.base52]} ...@@ -2338,8 +2348,8 @@ ${obj[dataColumn.base52]}
if (Array.isArray(labels) && labels.length && typeof labels[0] === 'object') { if (Array.isArray(labels) && labels.length && typeof labels[0] === 'object') {
stringLabels = ''; stringLabels = '';
let vLabels = []; let vLabels = [];
for(let item of labels){ // 解决禅道 32141 如果存在其他问题 估计要从otherProps中获取是否是多选 如果不是多选只取一个值 for (let item of labels) { // 解决禅道 32141 如果存在其他问题 估计要从otherProps中获取是否是多选 如果不是多选只取一个值
if(Object.values(item)){ if (Object.values(item)) {
vLabels.push(Object.values(item)); vLabels.push(Object.values(item));
} }
} }
...@@ -2421,8 +2431,8 @@ ${obj[dataColumn.base52]} ...@@ -2421,8 +2431,8 @@ ${obj[dataColumn.base52]}
<span> <span>
{vTime {vTime
? moment(+new Date(vTime)).format( ? moment(+new Date(vTime)).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss', json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
) )
: ''} : ''}
</span> </span>
); );
...@@ -2504,10 +2514,10 @@ ${obj[dataColumn.base52]} ...@@ -2504,10 +2514,10 @@ ${obj[dataColumn.base52]}
} }
} }
cm = <UploadComReadOnly get={get} cm = <UploadComReadOnly get={get}
obj={obj} obj={obj}
dataColumn={dataColumn} dataColumn={dataColumn}
isPrint={this.props.isPrint} isPrint={this.props.isPrint}
otherProps={otherProps} otherProps={otherProps}
/> />
break; break;
case 'ImgUploadCom': case 'ImgUploadCom':
...@@ -2759,11 +2769,11 @@ ${obj[dataColumn.base52]} ...@@ -2759,11 +2769,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择' + title, message: '请选择' + title,
}, },
], ],
})} })}
disabled={disabled} disabled={disabled}
onClick={checked => { onClick={checked => {
...@@ -2776,7 +2786,7 @@ ${obj[dataColumn.base52]} ...@@ -2776,7 +2786,7 @@ ${obj[dataColumn.base52]}
} }
> >
{(json.isMobileLabel != null && json.isMobileLabel) || {(json.isMobileLabel != null && json.isMobileLabel) ||
(json.isMobileLabel == null && json.isLabel) (json.isMobileLabel == null && json.isLabel)
? title ? title
: ''} : ''}
</MobileList.Item> </MobileList.Item>
...@@ -2790,11 +2800,11 @@ ${obj[dataColumn.base52]} ...@@ -2790,11 +2800,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择' + title, message: '请选择' + title,
}, },
], ],
})(<SwitchWeb json={json} disabled={disabled} />); })(<SwitchWeb json={json} disabled={disabled} />);
break; break;
...@@ -2940,11 +2950,11 @@ ${obj[dataColumn.base52]} ...@@ -2940,11 +2950,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请输入' + title, message: '请输入' + title,
}, },
], ],
})( })(
<InputNumber <InputNumber
disabled={disabled} disabled={disabled}
...@@ -3047,7 +3057,7 @@ ${obj[dataColumn.base52]} ...@@ -3047,7 +3057,7 @@ ${obj[dataColumn.base52]}
defaultValues={defaultValues} defaultValues={defaultValues}
/> />
* */ * */
null} null}
</Tabs.TabPane> </Tabs.TabPane>
); );
})} })}
...@@ -3064,11 +3074,11 @@ ${obj[dataColumn.base52]} ...@@ -3064,11 +3074,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择' + dataColumn.title, message: '请选择' + dataColumn.title,
}, },
], ],
})(<Radio.Group options={options} disabled={disabled} />); })(<Radio.Group options={options} disabled={disabled} />);
if (get == 'mobile') { if (get == 'mobile') {
cm = <div>{cm}</div>; cm = <div>{cm}</div>;
...@@ -3104,11 +3114,11 @@ ${obj[dataColumn.base52]} ...@@ -3104,11 +3114,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择' + dataColumn.title, message: '请选择' + dataColumn.title,
}, },
], ],
})(<Checkbox.Group options={options} disabled={disabled} />)} })(<Checkbox.Group options={options} disabled={disabled} />)}
</Flex> </Flex>
); );
...@@ -3139,11 +3149,11 @@ ${obj[dataColumn.base52]} ...@@ -3139,11 +3149,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择' + dataColumn.title, message: '请选择' + dataColumn.title,
}, },
], ],
})( })(
<Checkbox.Group <Checkbox.Group
options={options} options={options}
...@@ -3152,7 +3162,7 @@ ${obj[dataColumn.base52]} ...@@ -3152,7 +3162,7 @@ ${obj[dataColumn.base52]}
/>, />,
); );
break; break;
case 'TreeSelect': case 'TreeSelect':
if (json?.otherProps) { if (json?.otherProps) {
otherProps = json?.otherProps; otherProps = json?.otherProps;
try { try {
...@@ -3196,8 +3206,8 @@ ${obj[dataColumn.base52]} ...@@ -3196,8 +3206,8 @@ ${obj[dataColumn.base52]}
const optDiy = Array.isArray(json?.options) const optDiy = Array.isArray(json?.options)
? json.options ? json.options
: Array.isArray(options) : Array.isArray(options)
? options ? options
: []; : [];
// if(uuid === 'violation_type_id'){ // if(uuid === 'violation_type_id'){
// console.log(json); // console.log(json);
// } // }
...@@ -3211,11 +3221,11 @@ ${obj[dataColumn.base52]} ...@@ -3211,11 +3221,11 @@ ${obj[dataColumn.base52]}
Array.isArray(json.vlds) && json.vlds.length > 0 Array.isArray(json.vlds) && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择' + dataColumn.title, message: '请选择' + dataColumn.title,
}, },
], ],
})( })(
!optDiy.length ? ( !optDiy.length ? (
<Input disabled={true} style={{ width: json.width }} /> <Input disabled={true} style={{ width: json.width }} />
...@@ -3231,18 +3241,18 @@ ${obj[dataColumn.base52]} ...@@ -3231,18 +3241,18 @@ ${obj[dataColumn.base52]}
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) =>
...@@ -3314,11 +3324,11 @@ ${obj[dataColumn.base52]} ...@@ -3314,11 +3324,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择' + dataColumn.title, message: '请选择' + dataColumn.title,
}, },
], ],
})( })(
<Cascader // 这里的options 获取方式存在bug 公式会重复调用 <Cascader // 这里的options 获取方式存在bug 公式会重复调用
options={options} options={options}
...@@ -3340,11 +3350,11 @@ ${obj[dataColumn.base52]} ...@@ -3340,11 +3350,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择' + dataColumn.title, message: '请选择' + dataColumn.title,
}, },
], ],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />); })(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
} }
...@@ -3377,22 +3387,22 @@ ${obj[dataColumn.base52]} ...@@ -3377,22 +3387,22 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
let errors = []; let errors = [];
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
) { ) {
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}
...@@ -3467,20 +3477,20 @@ ${obj[dataColumn.base52]} ...@@ -3467,20 +3477,20 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择起止时间', message: '请选择起止时间',
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
let errors = []; let errors = [];
if (!value || !Array.isArray(value) || value.length !== 2) { if (!value || !Array.isArray(value) || value.length !== 2) {
// 移动端起止时间必须是个数组 且 length = 2 // 移动端起止时间必须是个数组 且 length = 2
errors.push(new Error('请选择', rule.field)); errors.push(new Error('请选择', rule.field));
} }
callback(errors); callback(errors);
},
}, },
], },
],
})( })(
<MobileDate <MobileDate
disabled={disabled} disabled={disabled}
...@@ -3517,11 +3527,11 @@ ${obj[dataColumn.base52]} ...@@ -3517,11 +3527,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择起止时间', message: '请选择起止时间',
}, },
], ],
})(<RangePickerDiy json={json} disabled={disabled} uuid={uuid} />); })(<RangePickerDiy json={json} disabled={disabled} uuid={uuid} />);
} }
if (json.label == null) title = '起止时间'; if (json.label == null) title = '起止时间';
...@@ -3549,11 +3559,11 @@ ${obj[dataColumn.base52]} ...@@ -3549,11 +3559,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请选择起止时间', message: '请选择起止时间',
}, },
], ],
})( })(
<DatePicker <DatePicker
disabled={disabled} disabled={disabled}
...@@ -3562,21 +3572,21 @@ ${obj[dataColumn.base52]} ...@@ -3562,21 +3572,21 @@ ${obj[dataColumn.base52]}
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'}
{...otherProps} {...otherProps}
...@@ -3613,11 +3623,11 @@ ${obj[dataColumn.base52]} ...@@ -3613,11 +3623,11 @@ ${obj[dataColumn.base52]}
json?.vlds && json?.vlds.length > 0 json?.vlds && json?.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required, required,
message: '请进行签章', message: '请进行签章',
}, },
], ],
})( })(
<SignArray // 签章组件 编辑模式 <SignArray // 签章组件 编辑模式
json={json} json={json}
...@@ -3701,11 +3711,11 @@ ${obj[dataColumn.base52]} ...@@ -3701,11 +3711,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请输入', message: '请输入',
}, },
], ],
})(<WangEditor json={json} dataColumn={dataColumn} disabled={disabled} uuid={uuid} />); })(<WangEditor json={json} dataColumn={dataColumn} disabled={disabled} uuid={uuid} />);
break; break;
case 'Steps': case 'Steps':
...@@ -3742,11 +3752,11 @@ ${obj[dataColumn.base52]} ...@@ -3742,11 +3752,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请输入', message: '请输入',
}, },
], ],
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />); })(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
...@@ -3773,11 +3783,11 @@ ${obj[dataColumn.base52]} ...@@ -3773,11 +3783,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请输入' + title, message: '请输入' + title,
}, },
], ],
})(<CronEditorDiy />); })(<CronEditorDiy />);
break; break;
case 'LocationCom': case 'LocationCom':
...@@ -3787,22 +3797,22 @@ ${obj[dataColumn.base52]} ...@@ -3787,22 +3797,22 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required, required,
message: '请获取定位信息', message: '请获取定位信息',
validator: (rule, valueThis, callback) => { validator: (rule, valueThis, callback) => {
let errors = []; let errors = [];
console.log(valueThis); console.log(valueThis);
if ( if (
(!valueThis || !JSON.stringify(valueThis).includes('address')) && (!valueThis || !JSON.stringify(valueThis).includes('address')) &&
required required
) { ) {
errors.push(new Error('请获取定位信息', rule.field)); errors.push(new Error('请获取定位信息', rule.field));
} }
callback(errors); callback(errors);
},
}, },
], },
],
})( })(
<LocationCom <LocationCom
get={get} get={get}
...@@ -3888,12 +3898,12 @@ ${obj[dataColumn.base52]} ...@@ -3888,12 +3898,12 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请上传图片', message: '请上传图片',
}, },
], ],
})(<ImgUploadCom json={json} disabled={disabled} otherProps={this.otherProps}/>); })(<ImgUploadCom json={json} disabled={disabled} otherProps={this.otherProps} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -3919,11 +3929,11 @@ ${obj[dataColumn.base52]} ...@@ -3919,11 +3929,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请上传视频', message: '请上传视频',
}, },
], ],
})(<VideoUploadCom json={json} disabled={disabled} />); })(<VideoUploadCom json={json} disabled={disabled} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
...@@ -3950,11 +3960,11 @@ ${obj[dataColumn.base52]} ...@@ -3950,11 +3960,11 @@ ${obj[dataColumn.base52]}
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
: [ : [
{ {
required: required, required: required,
message: '请进行签名', message: '请进行签名',
}, },
], ],
})(<Signature width={json.width} height={json.height} get={get} />); })(<Signature width={json.width} height={json.height} get={get} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论