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

28131 2.0选项卡组件搬到1.0来

上级 66222046
...@@ -6,314 +6,316 @@ import UUID from 'react-native-uuid'; ...@@ -6,314 +6,316 @@ import UUID from 'react-native-uuid';
import { Card, WingBlank } from 'antd-mobile'; import { Card, WingBlank } from 'antd-mobile';
export default class ChildForm extends React.Component { export default class ChildForm extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
const value = props.value || {}; const value = props.value || {};
this.state = value; this.state = value;
} }
triggerChange = (changedValue) => { triggerChange = changedValue => {
// Should provide an event to pass value to Form. // Should provide an event to pass value to Form.
const onChange = this.props.onChange; const onChange = this.props.onChange;
console.log('ChildForm', changedValue); console.log('ChildForm', changedValue);
if (onChange) { if (onChange) {
if(changedValue && typeof changedValue === 'object' && !Object.keys(changedValue).length){ if (changedValue && typeof changedValue === 'object' && !Object.keys(changedValue).length) {
onChange(changedValue); onChange(changedValue);
// onChange(null); // onChange(null);
}else{ } else {
onChange(changedValue); onChange(changedValue);
} }
} }
}; };
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
// Should be a controlled component. // Should be a controlled component.
if ('value' in nextProps) { if ('value' in nextProps) {
const value = nextProps.value; const value = nextProps.value;
this.state = value; this.state = value;
} }
} }
componentDidMount = () => { componentDidMount = () => {
if (Object.keys(this.state).length == 0 && this.props.isEdit) { if (Object.keys(this.state).length == 0 && this.props.isEdit) {
if (this.props.num != null && this.props.num > 0) { if (this.props.num != null && this.props.num > 0) {
const objs = this.state; const objs = this.state;
if (this.props.min != null && this.props.min > this.props.num) { if (this.props.min != null && this.props.min > this.props.num) {
for (var i = 0; i < this.props.min; i++) { for (var i = 0; i < this.props.min; i++) {
objs['id_' + UUID.v4().replace(/-/g, '2')] = {}; objs['id_' + UUID.v4().replace(/-/g, '2')] = {};
} }
} else { } else {
for (var i = 0; i < this.props.num; i++) { for (var i = 0; i < this.props.num; i++) {
objs['id_' + UUID.v4().replace(/-/g, '2')] = {}; objs['id_' + UUID.v4().replace(/-/g, '2')] = {};
} }
} }
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState(objs); this.setState(objs);
} }
this.triggerChange(objs); this.triggerChange(objs);
} }
} }
}; };
delete = (uuid) => { delete = uuid => {
const objs = this.state; const objs = this.state;
const { const {
json: { numCode }, json: { numCode },
form, form,
base52, base52,
} = this.props; } = this.props;
if (this.props.min != null && Object.keys(objs).length - 1 < this.props.min) { if (this.props.min != null && Object.keys(objs).length - 1 < this.props.min) {
message.error('不能小于最小限制'); message.error('不能小于最小限制');
return; return;
} }
const x = form.getFieldsValue()[base52]; const x = form.getFieldsValue()[base52];
delete x[uuid]; delete x[uuid];
delete x['']; delete x[''];
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.state = x; this.state = x;
} }
this.triggerChange(x); this.triggerChange(x);
if (numCode != null) { if (numCode != null) {
this.props.form.setFieldsValue({ [numCode]: Object.keys(objs).length }); this.props.form.setFieldsValue({ [numCode]: Object.keys(objs).length });
} }
}; };
add = () => { add = () => {
const objs = this.state; const objs = this.state;
const { const {
json: { numCode }, json: { numCode },
form, form,
base52, base52,
} = this.props; } = this.props;
if (this.props.max != null && Object.keys(objs).length + 1 > this.props.max) { if (this.props.max != null && Object.keys(objs).length + 1 > this.props.max) {
message.error('不能大于最大限制'); message.error('不能大于最大限制');
return; return;
} }
objs['id_' + UUID.v4().replace(/-/g, '2')] = {}; objs['id_' + UUID.v4().replace(/-/g, '2')] = {};
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState(objs); this.setState(objs);
} }
this.triggerChange(objs); this.triggerChange(objs);
if (numCode != null) { if (numCode != null) {
this.props.form.setFieldsValue({ [numCode]: Object.keys(objs).length }); this.props.form.setFieldsValue({ [numCode]: Object.keys(objs).length });
} }
}; };
render() { render() {
const objs = this.state; const objs = this.state;
const { const {
form, form,
mapData, mapData,
sqlData, sqlData,
defaultValues, defaultValues,
datas, datas,
base52, base52,
isEdit: isEditProps, isEdit: isEditProps,
addName, addName,
deleteName, deleteName,
obj, obj,
isMobile, isMobile,
json, json,
modalInit, modalInit,
isPreview, isPreview,
hfInstance, hfInstance,
getCurrentFormTitle, getCurrentFormTitle,
getCellValue, getCellValue,
taskId, taskId,
datasAll, datasAll,
} = this.props; } = this.props;
const span = json.span || 24; const span = json.span || 24;
const gutter = json.gutter != null ? json.gutter : 0; const gutter = json.gutter != null ? json.gutter : 0;
const rights = this.props.rights; const rights = this.props.rights;
const { disabled } = json; const { disabled } = json;
const isEdit = !disabled && isEditProps; // 29128 北电]资助-新生入学资助管理-批次设置,2张图2问题不要详情改编辑只能修改是否启用 const isEdit = !disabled && isEditProps; // 29128 北电]资助-新生入学资助管理-批次设置,2张图2问题不要详情改编辑只能修改是否启用
// console.log(datasAll); // console.log(datasAll);
if (datas == null) { if (datas == null) {
return <div>还没有配置子表单key</div>; return <div>还没有配置子表单key</div>;
} }
if(!objs){ if (!objs) {
return null; return null;
} }
if (isMobile) { if (isMobile) {
return ( return (
<WingBlank size="lg"> <WingBlank size="lg">
{Object.keys(objs).length > 1 || rights.includes('add') ? ( {Object.keys(objs).length > 1 || rights.includes('add') ? (
<Card> <Card>
<Card.Body style={{ minHeight: 10 }}> <Card.Body style={{ minHeight: 10 }}>
{Object.keys(objs).map((r) => { {Object.keys(objs).map(r => {
if (r == '') { if (r == '') {
return ''; return '';
} }
return ( return (
<Row key={r} gutter={gutter}> <Row key={r} gutter={gutter}>
<Col <Col
style={{ style={{
zIndex: 55, zIndex: 55,
}} }}
span={isEdit ? 24 : span}> span={isEdit ? 24 : span}
<ZdyTable >
changedValues={this.props.changedValues} <ZdyTable
setRealTimeValues={this.props.setRealTimeValues} changedValues={this.props.changedValues}
trees={this.props.trees} setRealTimeValues={this.props.setRealTimeValues}
key={r} trees={this.props.trees}
taskId={taskId} key={r}
modalInit={modalInit} taskId={taskId}
hfInstance={hfInstance} modalInit={modalInit}
currentFormTitle={ hfInstance={hfInstance}
getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null currentFormTitle={
} getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null
hfInstance={hfInstance} }
getCellValue={getCellValue} getCellValue={getCellValue}
formCode={this.props.formCode} formCode={this.props.formCode}
formId={this.props.formId} formId={this.props.formId}
isPreview={isPreview} isPreview={isPreview}
currentFormKey={json.childFormKey} currentFormKey={json.childFormKey}
formConfig={datas} formConfig={datas}
get="mobile" get="mobile"
fatherCode={base52} fatherCode={base52}
isEdit={isEdit} isEdit={isEdit}
index={r} index={r}
obj={objs[r]} obj={objs[r]}
fatherObj={this.props.fatherObj} fatherObj={this.props.fatherObj}
init={objs} init={objs}
isChild={true} isChild={true}
form={form} form={form}
mapData={mapData} mapData={mapData}
sqlData={sqlData} sqlData={sqlData}
datas={datasAll} datas={datasAll}
{...datas} {...datas}
defaultValues={defaultValues} defaultValues={defaultValues}
/> />
</Col> </Col>
{rights.includes('delete') && isEdit ? ( {rights.includes('delete') && isEdit ? (
<Col style={{ textAlign: 'right' }}> <Col style={{ textAlign: 'right' }}>
<Button type="danger" size="small" onClick={this.delete.bind(this, r)}> <Button type="danger" size="small" onClick={this.delete.bind(this, r)}>
{deleteName || '删除'}{' '} {deleteName || '删除'}{' '}
</Button>{' '} </Button>{' '}
</Col> </Col>
) : ( ) : (
'' ''
)} )}
</Row> </Row>
); );
})} })}
{rights.includes('add') && isEdit ? ( {rights.includes('add') && isEdit ? (
<Row> <Row>
<Col style={{ textAlign: 'center' }}> <Col style={{ textAlign: 'center' }}>
<Button <Button
type="primary" type="primary"
size="small" size="small"
style={{ margin: 'auto' }} style={{ margin: 'auto' }}
onClick={this.add}> onClick={this.add}
{addName || '新增'} >
</Button>{' '} {addName || '新增'}
</Col> </Button>{' '}
</Row> </Col>
) : ( </Row>
'' ) : (
)} ''
</Card.Body> )}
</Card> </Card.Body>
) : ( </Card>
'' ) : (
)} ''
</WingBlank> )}
); </WingBlank>
} );
}
/*** /***
* 子表单 * 子表单
* */ * */
return ( return (
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
<Row gutter={gutter}> <Row gutter={gutter}>
{Object.keys(objs).map((r) => { {Object.keys(objs).map(r => {
if (r == '') { if (r == '') {
return ''; return '';
} }
// console.log('子表单', r); // console.log('子表单', r);
// console.log(form.getFieldsValue()); // console.log(form.getFieldsValue());
return ( return (
<Col span={span} key={r}> <Col span={span} key={r}>
<ZdyTable <ZdyTable
changedValues={this.props.changedValues} changedValues={this.props.changedValues}
taskId={taskId} taskId={taskId}
setRealTimeValues={this.props.setRealTimeValues} setRealTimeValues={this.props.setRealTimeValues}
modalInit={modalInit} modalInit={modalInit}
hfInstance={hfInstance} hfInstance={hfInstance}
currentFormTitle={ currentFormTitle={
getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null
} }
getCellValue={getCellValue} getCellValue={getCellValue}
formConfig={datas} formConfig={datas}
key={r} key={r}
fatherCode={base52} fatherCode={base52}
isEdit={isEdit} isEdit={isEdit}
index={r} index={r}
isPreview={isPreview} isPreview={isPreview}
obj={objs[r]} obj={objs[r]}
currentFormKey={json.childFormKey} currentFormKey={json.childFormKey}
formCode={this.props.formCode} formCode={this.props.formCode}
formId={this.props.formId} formId={this.props.formId}
fatherObj={this.props.fatherObj} fatherObj={this.props.fatherObj}
init={objs} init={objs}
isChild={true} isChild={true}
get="web" get="web"
form={form} form={form}
mapData={mapData} mapData={mapData}
sqlData={sqlData} sqlData={sqlData}
datas={datasAll} datas={datasAll}
{...datas} {...datas}
defaultValues={defaultValues} defaultValues={defaultValues}
/> />
{rights.includes('delete') && isEdit ? ( {rights.includes('delete') && isEdit ? (
<Button <Button
size="small" size="small"
style={{ style={{
position: 'absolute', position: 'absolute',
left: ' 95%', left: ' 95%',
top: '10px', top: '10px',
transform: 'translateY(-50%)', transform: 'translateY(-50%)',
borderRadius: '50%', borderRadius: '50%',
height: '13px', height: '13px',
width: '13px', width: '13px',
padding: 0, padding: 0,
lineHeight: '10px', lineHeight: '10px',
}} }}
type="danger" type="danger"
onClick={this.delete.bind(this, r)}> onClick={this.delete.bind(this, r)}
{deleteName || '-'} >
</Button> {deleteName || '-'}
) : ( </Button>
'' ) : (
)} ''
</Col> )}
); </Col>
})} );
</Row> })}
{rights.includes('add') && isEdit ? ( </Row>
<Row> {rights.includes('add') && isEdit ? (
<Col span={24} style={{ textAlign: 'center' }}> <Row>
<Button style={{ margin: 'auto' }} type="primary" onClick={this.add} size="small"> <Col span={24} style={{ textAlign: 'center' }}>
{addName || '新增'} <Button style={{ margin: 'auto' }} type="primary" onClick={this.add} size="small">
</Button> {addName || '新增'}
</Col>{' '} </Button>
</Row> </Col>{' '}
) : ( </Row>
'' ) : (
)} ''
</div> )}
); </div>
} );
}
} }
...@@ -23,6 +23,7 @@ import { ...@@ -23,6 +23,7 @@ import {
Select, Select,
Switch, Switch,
Table, Table,
Tabs,
} from 'antd'; } from 'antd';
import UUID from 'react-native-uuid'; import UUID from 'react-native-uuid';
import QRCode from 'qrcode.react'; import QRCode from 'qrcode.react';
...@@ -86,7 +87,7 @@ import getPopupContainer ...@@ -86,7 +87,7 @@ import getPopupContainer
const { const {
MonthPicker, MonthPicker,
WeekPicker WeekPicker,
} = DatePicker; } = DatePicker;
/** /**
* 日期组件antd3.x有bug 详情见禅道 27152 毕业跟踪调查管理 毕业时间改为年级筛选 * 日期组件antd3.x有bug 详情见禅道 27152 毕业跟踪调查管理 毕业时间改为年级筛选
...@@ -94,6 +95,7 @@ const { ...@@ -94,6 +95,7 @@ const {
const { TextArea } = Input; const { TextArea } = Input;
const { Option } = Select; const { Option } = Select;
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const { TabPane } = Tabs;
const giveRender = (column = {}) => { const giveRender = (column = {}) => {
if (!column?.render) { if (!column?.render) {
...@@ -112,7 +114,7 @@ const giveRender = (column = {}) => { ...@@ -112,7 +114,7 @@ const giveRender = (column = {}) => {
DataColumn, DataColumn,
SqlManageEntity, SqlManageEntity,
formList, formList,
loading loading,
}) => ({ }) => ({
DataColumn, DataColumn,
SqlManageEntity, SqlManageEntity,
...@@ -159,6 +161,14 @@ export default class TableCom extends Component { ...@@ -159,6 +161,14 @@ export default class TableCom extends Component {
callback: callback, callback: callback,
}); });
}; };
changeTabsActiveKey = (activeKey) => {
this.setState({
activeKey,
});
};
showModal = (fk, title, data, modalProps) => { showModal = (fk, title, data, modalProps) => {
// console.log(fk, title, data, modalProps); // console.log(fk, title, data, modalProps);
...@@ -223,7 +233,7 @@ export default class TableCom extends Component { ...@@ -223,7 +233,7 @@ export default class TableCom extends Component {
setSelectedKeys, setSelectedKeys,
selectedKeys, selectedKeys,
confirm, confirm,
clearFilters clearFilters,
}) => ( }) => (
<div style={{ padding: 8 }}> <div style={{ padding: 8 }}>
<Input <Input
...@@ -241,11 +251,11 @@ export default class TableCom extends Component { ...@@ -241,11 +251,11 @@ export default class TableCom extends Component {
}} }}
/> />
<Button <Button
type="primary" type='primary'
onClick={() => this.handleSearch(selectedKeys, confirm)} onClick={() => this.handleSearch(selectedKeys, confirm)}
icon="search" icon='search'
loading={this.props.loading} loading={this.props.loading}
size="small" size='small'
style={{ style={{
width: 90, width: 90,
marginRight: 8, marginRight: 8,
...@@ -256,14 +266,14 @@ export default class TableCom extends Component { ...@@ -256,14 +266,14 @@ export default class TableCom extends Component {
<Button <Button
loading={this.props.loading} loading={this.props.loading}
onClick={() => this.handleReset(clearFilters)} onClick={() => this.handleReset(clearFilters)}
size="small" size='small'
style={{ width: 90 }} style={{ width: 90 }}
> >
重置 重置
</Button> </Button>
</div> </div>
), ),
filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }}/>, filterIcon: filtered => <Icon type='search' style={{ color: filtered ? '#1890ff' : 'red' }} />,
onFilter: (value, record) => onFilter: (value, record) =>
record[dataIndex] record[dataIndex]
? record[dataIndex] ? record[dataIndex]
...@@ -314,7 +324,7 @@ export default class TableCom extends Component { ...@@ -314,7 +324,7 @@ export default class TableCom extends Component {
const { const {
json, json,
mapData, mapData,
obj obj,
} = props; } = props;
if (json == null || this.props.safe) { if (json == null || this.props.safe) {
return; return;
...@@ -430,7 +440,7 @@ export default class TableCom extends Component { ...@@ -430,7 +440,7 @@ export default class TableCom extends Component {
getData = (json, dataColumn, obj, init) => { getData = (json, dataColumn, obj, init) => {
const { const {
formKey, formKey,
uuid uuid,
} = this.props; } = this.props;
let jsonStatic = json; let jsonStatic = json;
json = { json = {
...@@ -444,7 +454,7 @@ export default class TableCom extends Component { ...@@ -444,7 +454,7 @@ export default class TableCom extends Component {
const { dispatch } = this.props; const { dispatch } = this.props;
const { const {
sqlKey, sqlKey,
optionType optionType,
} = json; } = json;
if (optionType === 'sql') { if (optionType === 'sql') {
dispatch({ dispatch({
...@@ -755,7 +765,7 @@ export default class TableCom extends Component { ...@@ -755,7 +765,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'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
...@@ -831,7 +841,7 @@ export default class TableCom extends Component { ...@@ -831,7 +841,7 @@ export default class TableCom extends Component {
e, e,
); );
} }
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
...@@ -944,7 +954,7 @@ export default class TableCom extends Component { ...@@ -944,7 +954,7 @@ export default class TableCom extends Component {
e, e,
); );
} }
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
...@@ -1029,11 +1039,7 @@ export default class TableCom extends Component { ...@@ -1029,11 +1039,7 @@ export default class TableCom extends Component {
e, e,
); );
} }
} else if ( } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
json.comName == 'Echart' ||
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
try { try {
const x = callback(data); const x = callback(data);
if (x != null) { if (x != null) {
...@@ -1172,7 +1178,7 @@ export default class TableCom extends Component { ...@@ -1172,7 +1178,7 @@ export default class TableCom extends Component {
concealModel, concealModel,
}; };
} };
getFunctionValue = (fun, column, json, callback) => { getFunctionValue = (fun, column, json, callback) => {
if (this.props.safe) return; if (this.props.safe) return;
...@@ -1245,7 +1251,7 @@ export default class TableCom extends Component { ...@@ -1245,7 +1251,7 @@ export default class TableCom extends Component {
}, },
); );
} }
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) { } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
this.setState({ option: value }); this.setState({ option: value });
} else { } else {
try { try {
...@@ -1274,7 +1280,7 @@ export default class TableCom extends Component { ...@@ -1274,7 +1280,7 @@ export default class TableCom extends Component {
json, json,
mapData, mapData,
obj, obj,
init init,
} = this.props; } = this.props;
if (json == null) { if (json == null) {
return; return;
...@@ -1325,7 +1331,7 @@ export default class TableCom extends Component { ...@@ -1325,7 +1331,7 @@ export default class TableCom extends Component {
labelName, labelName,
valueName, valueName,
isMeta, isMeta,
filterSql filterSql,
} = json; } = json;
if (isMeta) { if (isMeta) {
// 2022年7月5日 2022 姚鑫国说的 如果是元数据 不需要传这个allValues // 2022年7月5日 2022 姚鑫国说的 如果是元数据 不需要传这个allValues
...@@ -1568,7 +1574,7 @@ export default class TableCom extends Component { ...@@ -1568,7 +1574,7 @@ export default class TableCom extends Component {
getColumn = key => { getColumn = key => {
let { let {
mapData, mapData,
json json,
} = this.props; } = this.props;
const columnIds = json?.columnIds; const columnIds = json?.columnIds;
...@@ -1632,12 +1638,12 @@ export default class TableCom extends Component { ...@@ -1632,12 +1638,12 @@ export default class TableCom extends Component {
modalCode, modalCode,
modalTitle, modalTitle,
modalInit, modalInit,
modalProps modalProps,
} = this.state; } = this.state;
const { const {
getFieldDecorator, getFieldDecorator,
getFieldError, getFieldError,
getFieldProps getFieldProps,
} = this.props.form; } = this.props.form;
const disabled = json != null ? json.disabled : false; const disabled = json != null ? json.disabled : false;
const permRank = json != null ? (json.permRank != null ? json.permRank : 0) : 0; const permRank = json != null ? (json.permRank != null ? json.permRank : 0) : 0;
...@@ -1661,7 +1667,7 @@ export default class TableCom extends Component { ...@@ -1661,7 +1667,7 @@ export default class TableCom extends Component {
) { ) {
return <></>; return <></>;
} }
return <QRCode {...this.state.option} key={uuid}/>; return <QRCode {...this.state.option} key={uuid} />;
} }
if (json.comName == 'Echart') { if (json.comName == 'Echart') {
return ( return (
...@@ -1677,7 +1683,7 @@ export default class TableCom extends Component { ...@@ -1677,7 +1683,7 @@ export default class TableCom extends Component {
); );
} }
if (json.comName == 'Graph') { if (json.comName == 'Graph') {
return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []}/>; return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []} />;
} }
if (json.comName == 'PartForm') { if (json.comName == 'PartForm') {
...@@ -1692,7 +1698,7 @@ export default class TableCom extends Component { ...@@ -1692,7 +1698,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' />)}{' '}
<ZdyTable <ZdyTable
taskId={this.props.taskId} taskId={this.props.taskId}
importExcel={this.props.importExcel} importExcel={this.props.importExcel}
...@@ -1768,7 +1774,7 @@ export default class TableCom extends Component { ...@@ -1768,7 +1774,7 @@ export default class TableCom extends Component {
<> <>
{this.props.form.getFieldDecorator(uid, { {this.props.form.getFieldDecorator(uid, {
initialValue: obj[uuid] || json.initialValue, initialValue: obj[uuid] || json.initialValue,
})(<Input type="hidden"/>)} })(<Input type='hidden' />)}
<span <span
style={{ style={{
fontWeight: get === 'mobile' ? 'bold' : '', fontWeight: get === 'mobile' ? 'bold' : '',
...@@ -1785,7 +1791,7 @@ export default class TableCom extends Component { ...@@ -1785,7 +1791,7 @@ export default class TableCom extends Component {
<> <>
{this.props.form.getFieldDecorator(uid, { {this.props.form.getFieldDecorator(uid, {
initialValue: this.props.form.getFieldsValue()[uid] || json.initialValue, initialValue: this.props.form.getFieldsValue()[uid] || json.initialValue,
})(<Input type="hidden"/>)} })(<Input type='hidden' />)}
<span <span
style={{ style={{
fontWeight: get === 'mobile' ? 'bold' : '', fontWeight: get === 'mobile' ? 'bold' : '',
...@@ -1834,7 +1840,7 @@ export default class TableCom extends Component { ...@@ -1834,7 +1840,7 @@ export default class TableCom extends Component {
cm = ( cm = (
<span style={{ paddingRight: get === 'mobile' ? 8 : '' }}> <span style={{ paddingRight: get === 'mobile' ? 8 : '' }}>
{value} {value}
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</span> </span>
); );
break; break;
...@@ -1842,7 +1848,7 @@ export default class TableCom extends Component { ...@@ -1842,7 +1848,7 @@ export default class TableCom extends Component {
cm = ( cm = (
<span> <span>
{value} {value}
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</span> </span>
); );
...@@ -1860,7 +1866,7 @@ export default class TableCom extends Component { ...@@ -1860,7 +1866,7 @@ export default class TableCom extends Component {
cm = ( cm = (
<span style={{ paddingRight: get == 'mobile' ? 8 : '' }}> <span style={{ paddingRight: get == 'mobile' ? 8 : '' }}>
{value} {value}
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</span> </span>
); );
...@@ -1869,7 +1875,7 @@ export default class TableCom extends Component { ...@@ -1869,7 +1875,7 @@ export default class TableCom extends Component {
cm = ( cm = (
<span> <span>
{value} {value}
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</span> </span>
); );
...@@ -1879,7 +1885,7 @@ export default class TableCom extends Component { ...@@ -1879,7 +1885,7 @@ export default class TableCom extends Component {
<span> <span>
{moment(parseInt(value)) {moment(parseInt(value))
.format('YYYY-MM-DD HH:mm:ss')} .format('YYYY-MM-DD HH:mm:ss')}
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</span> </span>
) : ( ) : (
'' ''
...@@ -1894,14 +1900,14 @@ export default class TableCom extends Component { ...@@ -1894,14 +1900,14 @@ export default class TableCom extends Component {
{filesX.map((f, index2) => { {filesX.map((f, index2) => {
return ( return (
<li key={index2}> <li key={index2}>
<a target="_blank" key={f.path} href={queryFileUrl(f.path)}> <a target='_blank' key={f.path} href={queryFileUrl(f.path)}>
{f.name} {f.name}
</a> </a>
</li> </li>
); );
})} })}
</ul> </ul>
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</> </>
); );
...@@ -1914,14 +1920,14 @@ export default class TableCom extends Component { ...@@ -1914,14 +1920,14 @@ export default class TableCom extends Component {
{files.map((f, index2) => { {files.map((f, index2) => {
return ( return (
<li key={index2}> <li key={index2}>
<a target="_blank" key={f.path} href={queryFileUrl(f.path)}> <a target='_blank' key={f.path} href={queryFileUrl(f.path)}>
{f.name} {f.name}
</a> </a>
</li> </li>
); );
})} })}
</ul> </ul>
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</> </>
); );
...@@ -1946,7 +1952,7 @@ export default class TableCom extends Component { ...@@ -1946,7 +1952,7 @@ export default class TableCom extends Component {
height: json.height, height: json.height,
}} }}
/> />
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</> </>
); );
} }
...@@ -1972,7 +1978,7 @@ export default class TableCom extends Component { ...@@ -1972,7 +1978,7 @@ export default class TableCom extends Component {
height: json.height, height: json.height,
}} }}
/> />
{get === 'mobile' ? <br/> : ''} {get === 'mobile' ? <br /> : ''}
</> </>
); );
} }
...@@ -2007,7 +2013,7 @@ export default class TableCom extends Component { ...@@ -2007,7 +2013,7 @@ export default class TableCom extends Component {
</MobileItem> </MobileItem>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, { {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value, initialValue: value,
})(<Input type="hidden"/>)} })(<Input type='hidden' />)}
</> </>
); );
} }
...@@ -2020,7 +2026,7 @@ export default class TableCom extends Component { ...@@ -2020,7 +2026,7 @@ export default class TableCom extends Component {
{cm} {cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, { {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value, initialValue: value,
})(<Input type="hidden"/>)} })(<Input type='hidden' />)}
</> </>
); );
} }
...@@ -2114,7 +2120,7 @@ export default class TableCom extends Component { ...@@ -2114,7 +2120,7 @@ export default class TableCom extends Component {
</Form.Item> </Form.Item>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, { {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value, initialValue: value,
})(<Input type="hidden"/>)} })(<Input type='hidden' />)}
</> </>
); );
} }
...@@ -2127,7 +2133,7 @@ export default class TableCom extends Component { ...@@ -2127,7 +2133,7 @@ export default class TableCom extends Component {
{cm} {cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, { {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value, initialValue: value,
})(<Input type="hidden"/>)} })(<Input type='hidden' />)}
</> </>
); );
} }
...@@ -2206,19 +2212,19 @@ export default class TableCom extends Component { ...@@ -2206,19 +2212,19 @@ export default class TableCom extends Component {
case 'MobileCard': case 'MobileCard':
let value = obj[dataColumn.base52]; let value = obj[dataColumn.base52];
if (!value || value === 'null') { if (!value || value === 'null') {
return <div/>; return <div />;
} }
cm = <MobileCard value={value} cm = <MobileCard value={value}
json={json} json={json}
getArguments={this.functionArguments} getArguments={this.functionArguments}
tableComProps={this.props} tableComProps={this.props}
dataColumn={dataColumn} dataColumn={dataColumn}
/>; />;
break; break;
case 'WangEditor': case 'WangEditor':
let textV = obj[dataColumn.base52]; let textV = obj[dataColumn.base52];
if (!textV || textV === 'null') { if (!textV || textV === 'null') {
return <div/>; return <div />;
} }
cm = ( cm = (
<div <div
...@@ -2322,7 +2328,7 @@ ${obj[dataColumn.base52]} ...@@ -2322,7 +2328,7 @@ ${obj[dataColumn.base52]}
<Table <Table
get={get} get={get}
columns={this.state.columns} columns={this.state.columns}
size="small" size='small'
dataSource={ds} dataSource={ds}
pagination={false} pagination={false}
/> />
...@@ -2493,7 +2499,7 @@ ${obj[dataColumn.base52]} ...@@ -2493,7 +2499,7 @@ ${obj[dataColumn.base52]}
} }
return ( return (
<li key={index2}> <li key={index2}>
<a target="_blank" key={f.path} href={queryFileUrl(f.path)}> <a target='_blank' key={f.path} href={queryFileUrl(f.path)}>
{f.name} {f.name}
</a> </a>
</li> </li>
...@@ -2520,7 +2526,7 @@ ${obj[dataColumn.base52]} ...@@ -2520,7 +2526,7 @@ ${obj[dataColumn.base52]}
} }
return ( return (
<li key={index2}> <li key={index2}>
<a target="_blank" key={f.filePath} href={queryFileUrl(f.filePath)}> <a target='_blank' key={f.filePath} href={queryFileUrl(f.filePath)}>
{f.fileName} {f.fileName}
</a> </a>
</li> </li>
...@@ -2691,7 +2697,7 @@ ${obj[dataColumn.base52]} ...@@ -2691,7 +2697,7 @@ ${obj[dataColumn.base52]}
if (json.isLink) { if (json.isLink) {
cm = <a {...ev} />; cm = <a {...ev} />;
} else { } else {
cm = <ButtonDiy loading={this.props.loading} type="primary" {...ev} />; cm = <ButtonDiy loading={this.props.loading} type='primary' {...ev} />;
} }
} }
...@@ -2774,7 +2780,7 @@ ${obj[dataColumn.base52]} ...@@ -2774,7 +2780,7 @@ ${obj[dataColumn.base52]}
if (json.isLink) { if (json.isLink) {
cm = <a {...ev} />; cm = <a {...ev} />;
} else { } else {
cm = <ButtonDiy loading={this.props.loading} type="primary" {...ev} />; cm = <ButtonDiy loading={this.props.loading} type='primary' {...ev} />;
} }
} }
...@@ -2836,7 +2842,7 @@ ${obj[dataColumn.base52]} ...@@ -2836,7 +2842,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + title, message: '请选择' + title,
}, },
], ],
})(<SwitchWeb json={json} disabled={disabled}/>); })(<SwitchWeb json={json} disabled={disabled} />);
break; break;
case 'TextArea': case 'TextArea':
...@@ -2917,7 +2923,7 @@ ${obj[dataColumn.base52]} ...@@ -2917,7 +2923,7 @@ ${obj[dataColumn.base52]}
} }
const { const {
disabledInputStyle = {}, disabledInputStyle = {},
addonAfter addonAfter,
} = otherProps; } = otherProps;
let inputStyle = { let inputStyle = {
width: json.width, width: json.width,
...@@ -2968,7 +2974,7 @@ ${obj[dataColumn.base52]} ...@@ -2968,7 +2974,7 @@ ${obj[dataColumn.base52]}
case 'InputHidden': case 'InputHidden':
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue, initialValue: initValue,
})(<Input type="hidden"/>); })(<Input type='hidden' />);
break; break;
case 'InputNumber': case 'InputNumber':
if (json?.otherProps) { if (json?.otherProps) {
...@@ -3021,7 +3027,86 @@ ${obj[dataColumn.base52]} ...@@ -3021,7 +3027,86 @@ ${obj[dataColumn.base52]}
} }
} }
break; break;
case 'Tabs':
let configOption = this.state.option;
if (
!configOption ||
!configOption.data ||
!Array.isArray(configOption.data) ||
!configOption.data.length
) {
return null;
}
const tabsProps = configOption.tabsProps || {};
const tabPaneProps = configOption.tabPaneProps || {};
let activeKey = this.state.activeKey || configOption.data[0].key;
console.log(configOption);
cm = <Tabs
onChange={this.changeTabsActiveKey}
activeKey={activeKey}
{...tabsProps}>
{configOption.data.map((r) => {
return (
<Tabs.TabPane tab={r.title} key={r.key} {...tabPaneProps}>
{activeKey === r.key ? (
<ZdyTable
changedValues={this.props.changedValues}
setRealTimeValues={this.props.setRealTimeValues}
trees={this.props.trees}
taskId={this.props.taskId}
taskAssignee={taskAssignee}
userId={userId}
modalInit={modalInit}
key={r.key}
datas={datas}
get={get}
isChild={true}
currentFormKey={r.key}
isEdit={isEdit}
obj={obj}
init={init}
form={this.props.form}
mapData={mapData}
sqlData={sqlData}
{...datas[r.key]}
defaultValues={defaultValues}
/>
/**
<ZdyTable
key={r}
modalInit={modalInit}
hfInstance={hfInstance}
currentFormTitle={
getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null
}
getCellValue={getCellValue}
formCode={this.props.formCode}
formId={this.props.formId}
isPreview={isPreview}
currentFormKey={json.childFormKey}
formConfig={datas}
get="mobile"
fatherCode={base52}
isEdit={isEdit}
index={r}
obj={objs[r]}
fatherObj={this.props.fatherObj}
init={objs}
isChild={true}
form={form}
mapData={mapData}
sqlData={sqlData}
datas={datasAll}
{...datas}
defaultValues={defaultValues}
/>
* */
) : null}
</Tabs.TabPane>
);
})}
</Tabs>;
break;
/** /**
* 为Radio为单选 * 为Radio为单选
*/ */
...@@ -3037,7 +3122,7 @@ ${obj[dataColumn.base52]} ...@@ -3037,7 +3122,7 @@ ${obj[dataColumn.base52]}
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>;
if ( if (
...@@ -3065,7 +3150,7 @@ ${obj[dataColumn.base52]} ...@@ -3065,7 +3150,7 @@ ${obj[dataColumn.base52]}
case 'Checkbox': case 'Checkbox':
if (get === 'mobile') { if (get === 'mobile') {
cm = ( cm = (
<Flex direction="column" align="start"> <Flex direction='column' align='start'>
{getFieldDecorator(dataColumn.base52, { {getFieldDecorator(dataColumn.base52, {
initialValue: initValue, // 默认值 initialValue: initValue, // 默认值
rules: rules:
...@@ -3077,7 +3162,7 @@ ${obj[dataColumn.base52]} ...@@ -3077,7 +3162,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title, message: '请选择' + dataColumn.title,
}, },
], ],
})(<Checkbox.Group options={options} disabled={disabled}/>)} })(<Checkbox.Group options={options} disabled={disabled} />)}
</Flex> </Flex>
); );
...@@ -3131,7 +3216,7 @@ ${obj[dataColumn.base52]} ...@@ -3131,7 +3216,7 @@ ${obj[dataColumn.base52]}
} }
} }
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
initialValue: !initValue && otherProps?.mode === 'multiple' ? undefined : initValue , initialValue: !initValue && otherProps?.mode === 'multiple' ? undefined : initValue,
rules: rules:
json.vlds && json.vlds.length > 0 json.vlds && json.vlds.length > 0
? json.vlds ? json.vlds
...@@ -3148,7 +3233,7 @@ ${obj[dataColumn.base52]} ...@@ -3148,7 +3233,7 @@ ${obj[dataColumn.base52]}
disabled={selectDis || disabled} disabled={selectDis || disabled}
placeholder={json.placeholder} placeholder={json.placeholder}
style={{ width: json.width }} style={{ width: json.width }}
optionFilterProp="children" optionFilterProp='children'
getPopupContainer={getPopupContainer(this.props.isDynamic, uuid)} getPopupContainer={getPopupContainer(this.props.isDynamic, uuid)}
onFocus={() => { onFocus={() => {
get === 'mobile' // 移动端取消输入键盘弹出 get === 'mobile' // 移动端取消输入键盘弹出
...@@ -3276,7 +3361,7 @@ ${obj[dataColumn.base52]} ...@@ -3276,7 +3361,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title, message: '请选择' + dataColumn.title,
}, },
], ],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json}/>); })(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
} }
if ( if (
...@@ -3446,7 +3531,7 @@ ${obj[dataColumn.base52]} ...@@ -3446,7 +3531,7 @@ ${obj[dataColumn.base52]}
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 = '起止时间';
break; break;
...@@ -3632,7 +3717,7 @@ ${obj[dataColumn.base52]} ...@@ -3632,7 +3717,7 @@ ${obj[dataColumn.base52]}
message: '请输入', message: '请输入',
}, },
], ],
})(<WangEditor json={json} dataColumn={dataColumn} disabled={disabled} uuid={uuid}/>); })(<WangEditor json={json} dataColumn={dataColumn} disabled={disabled} uuid={uuid} />);
break; break;
case 'MobileCard': case 'MobileCard':
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
...@@ -3644,7 +3729,7 @@ ${obj[dataColumn.base52]} ...@@ -3644,7 +3729,7 @@ ${obj[dataColumn.base52]}
getArguments={this.functionArguments} getArguments={this.functionArguments}
tableComProps={this.props} tableComProps={this.props}
dataColumn={dataColumn} dataColumn={dataColumn}
/>); />);
break; break;
case 'RichText': case 'RichText':
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
...@@ -3658,7 +3743,7 @@ ${obj[dataColumn.base52]} ...@@ -3658,7 +3743,7 @@ ${obj[dataColumn.base52]}
message: '请输入', message: '请输入',
}, },
], ],
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled}/>); })(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -3689,7 +3774,7 @@ ${obj[dataColumn.base52]} ...@@ -3689,7 +3774,7 @@ ${obj[dataColumn.base52]}
message: '请输入' + title, message: '请输入' + title,
}, },
], ],
})(<CronEditorDiy/>); })(<CronEditorDiy />);
break; break;
case 'LocationCom': case 'LocationCom':
cm = getFieldDecorator(dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
...@@ -3805,7 +3890,7 @@ ${obj[dataColumn.base52]} ...@@ -3805,7 +3890,7 @@ ${obj[dataColumn.base52]}
message: '请上传图片', message: '请上传图片',
}, },
], ],
})(<ImgUploadCom json={json} disabled={disabled}/>); })(<ImgUploadCom json={json} disabled={disabled} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -3836,7 +3921,7 @@ ${obj[dataColumn.base52]} ...@@ -3836,7 +3921,7 @@ ${obj[dataColumn.base52]}
message: '请上传视频', message: '请上传视频',
}, },
], ],
})(<VideoUploadCom json={json} disabled={disabled}/>); })(<VideoUploadCom json={json} disabled={disabled} />);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -3867,7 +3952,7 @@ ${obj[dataColumn.base52]} ...@@ -3867,7 +3952,7 @@ ${obj[dataColumn.base52]}
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' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -4087,7 +4172,7 @@ ${obj[dataColumn.base52]} ...@@ -4087,7 +4172,7 @@ ${obj[dataColumn.base52]}
label={title} label={title}
data-cell-component-name={json.comName || 'no_com'} data-cell-component-name={json.comName || 'no_com'}
> >
<ShowComName json={json}/> <ShowComName json={json} />
{cm} {cm}
</Form.Item> </Form.Item>
</> </>
...@@ -4182,12 +4267,12 @@ ${obj[dataColumn.base52]} ...@@ -4182,12 +4267,12 @@ ${obj[dataColumn.base52]}
wrapperCol={{ span: json.wrapperSpan }} wrapperCol={{ span: json.wrapperSpan }}
label={title} label={title}
> >
<ShowComName json={json}/> <ShowComName json={json} />
{cm} {cm}
</Form.Item> </Form.Item>
) : ( ) : (
<Form.Item> <Form.Item>
<ShowComName json={json}/> <ShowComName json={json} />
{cm} {cm}
</Form.Item> </Form.Item>
) )
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论