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

28131 2.0选项卡组件搬到1.0来

上级 66222046
......@@ -13,16 +13,16 @@ export default class ChildForm extends React.Component {
this.state = value;
}
triggerChange = (changedValue) => {
triggerChange = changedValue => {
// Should provide an event to pass value to Form.
const onChange = this.props.onChange;
console.log('ChildForm', changedValue);
if (onChange) {
if(changedValue && typeof changedValue === 'object' && !Object.keys(changedValue).length){
if (changedValue && typeof changedValue === 'object' && !Object.keys(changedValue).length) {
onChange(changedValue);
// onChange(null);
}else{
} else {
onChange(changedValue);
}
}
......@@ -57,7 +57,7 @@ export default class ChildForm extends React.Component {
}
}
};
delete = (uuid) => {
delete = uuid => {
const objs = this.state;
const {
json: { numCode },
......@@ -139,7 +139,7 @@ export default class ChildForm extends React.Component {
return <div>还没有配置子表单key</div>;
}
if(!objs){
if (!objs) {
return null;
}
......@@ -149,7 +149,7 @@ export default class ChildForm extends React.Component {
{Object.keys(objs).length > 1 || rights.includes('add') ? (
<Card>
<Card.Body style={{ minHeight: 10 }}>
{Object.keys(objs).map((r) => {
{Object.keys(objs).map(r => {
if (r == '') {
return '';
}
......@@ -159,7 +159,8 @@ export default class ChildForm extends React.Component {
style={{
zIndex: 55,
}}
span={isEdit ? 24 : span}>
span={isEdit ? 24 : span}
>
<ZdyTable
changedValues={this.props.changedValues}
setRealTimeValues={this.props.setRealTimeValues}
......@@ -171,7 +172,6 @@ export default class ChildForm extends React.Component {
currentFormTitle={
getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null
}
hfInstance={hfInstance}
getCellValue={getCellValue}
formCode={this.props.formCode}
formId={this.props.formId}
......@@ -214,7 +214,8 @@ export default class ChildForm extends React.Component {
type="primary"
size="small"
style={{ margin: 'auto' }}
onClick={this.add}>
onClick={this.add}
>
{addName || '新增'}
</Button>{' '}
</Col>
......@@ -237,7 +238,7 @@ export default class ChildForm extends React.Component {
return (
<div style={{ width: '100%' }}>
<Row gutter={gutter}>
{Object.keys(objs).map((r) => {
{Object.keys(objs).map(r => {
if (r == '') {
return '';
}
......@@ -292,7 +293,8 @@ export default class ChildForm extends React.Component {
lineHeight: '10px',
}}
type="danger"
onClick={this.delete.bind(this, r)}>
onClick={this.delete.bind(this, r)}
>
{deleteName || '-'}
</Button>
) : (
......
......@@ -23,6 +23,7 @@ import {
Select,
Switch,
Table,
Tabs,
} from 'antd';
import UUID from 'react-native-uuid';
import QRCode from 'qrcode.react';
......@@ -86,7 +87,7 @@ import getPopupContainer
const {
MonthPicker,
WeekPicker
WeekPicker,
} = DatePicker;
/**
* 日期组件antd3.x有bug 详情见禅道 27152 毕业跟踪调查管理 毕业时间改为年级筛选
......@@ -94,6 +95,7 @@ const {
const { TextArea } = Input;
const { Option } = Select;
const { RangePicker } = DatePicker;
const { TabPane } = Tabs;
const giveRender = (column = {}) => {
if (!column?.render) {
......@@ -112,7 +114,7 @@ const giveRender = (column = {}) => {
DataColumn,
SqlManageEntity,
formList,
loading
loading,
}) => ({
DataColumn,
SqlManageEntity,
......@@ -159,6 +161,14 @@ export default class TableCom extends Component {
callback: callback,
});
};
changeTabsActiveKey = (activeKey) => {
this.setState({
activeKey,
});
};
showModal = (fk, title, data, modalProps) => {
// console.log(fk, title, data, modalProps);
......@@ -223,7 +233,7 @@ export default class TableCom extends Component {
setSelectedKeys,
selectedKeys,
confirm,
clearFilters
clearFilters,
}) => (
<div style={{ padding: 8 }}>
<Input
......@@ -241,11 +251,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,
......@@ -256,14 +266,14 @@ 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]
......@@ -314,7 +324,7 @@ export default class TableCom extends Component {
const {
json,
mapData,
obj
obj,
} = props;
if (json == null || this.props.safe) {
return;
......@@ -430,7 +440,7 @@ export default class TableCom extends Component {
getData = (json, dataColumn, obj, init) => {
const {
formKey,
uuid
uuid,
} = this.props;
let jsonStatic = json;
json = {
......@@ -444,7 +454,7 @@ export default class TableCom extends Component {
const { dispatch } = this.props;
const {
sqlKey,
optionType
optionType,
} = json;
if (optionType === 'sql') {
dispatch({
......@@ -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)
}
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
} else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
try {
const x = callback(data);
if (x != null) {
......@@ -831,7 +841,7 @@ export default class TableCom extends Component {
e,
);
}
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
} else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
try {
const x = callback(data);
if (x != null) {
......@@ -944,7 +954,7 @@ export default class TableCom extends Component {
e,
);
}
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
} else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
try {
const x = callback(data);
if (x != null) {
......@@ -1029,11 +1039,7 @@ export default class TableCom extends Component {
e,
);
}
} else if (
json.comName == 'Echart' ||
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
} else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
try {
const x = callback(data);
if (x != null) {
......@@ -1172,7 +1178,7 @@ export default class TableCom extends Component {
concealModel,
};
}
};
getFunctionValue = (fun, column, json, callback) => {
if (this.props.safe) return;
......@@ -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 });
} else {
try {
......@@ -1274,7 +1280,7 @@ export default class TableCom extends Component {
json,
mapData,
obj,
init
init,
} = this.props;
if (json == null) {
return;
......@@ -1325,7 +1331,7 @@ export default class TableCom extends Component {
labelName,
valueName,
isMeta,
filterSql
filterSql,
} = json;
if (isMeta) {
// 2022年7月5日 2022 姚鑫国说的 如果是元数据 不需要传这个allValues
......@@ -1568,7 +1574,7 @@ export default class TableCom extends Component {
getColumn = key => {
let {
mapData,
json
json,
} = this.props;
const columnIds = json?.columnIds;
......@@ -1632,12 +1638,12 @@ export default class TableCom extends Component {
modalCode,
modalTitle,
modalInit,
modalProps
modalProps,
} = this.state;
const {
getFieldDecorator,
getFieldError,
getFieldProps
getFieldProps,
} = this.props.form;
const disabled = json != null ? json.disabled : false;
const permRank = json != null ? (json.permRank != null ? json.permRank : 0) : 0;
......@@ -1661,7 +1667,7 @@ export default class TableCom extends Component {
) {
return <></>;
}
return <QRCode {...this.state.option} key={uuid}/>;
return <QRCode {...this.state.option} key={uuid} />;
}
if (json.comName == 'Echart') {
return (
......@@ -1677,7 +1683,7 @@ export default class TableCom extends Component {
);
}
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') {
......@@ -1692,7 +1698,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uuid, {
initialValue: fk,
})(<Input type="hidden"/>)}{' '}
})(<Input type='hidden' />)}{' '}
<ZdyTable
taskId={this.props.taskId}
importExcel={this.props.importExcel}
......@@ -1768,7 +1774,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: obj[uuid] || json.initialValue,
})(<Input type="hidden"/>)}
})(<Input type='hidden' />)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1785,7 +1791,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' : '',
......@@ -1834,7 +1840,7 @@ export default class TableCom extends Component {
cm = (
<span style={{ paddingRight: get === 'mobile' ? 8 : '' }}>
{value}
{get === 'mobile' ? <br/> : ''}
{get === 'mobile' ? <br /> : ''}
</span>
);
break;
......@@ -1842,7 +1848,7 @@ export default class TableCom extends Component {
cm = (
<span>
{value}
{get === 'mobile' ? <br/> : ''}
{get === 'mobile' ? <br /> : ''}
</span>
);
......@@ -1860,7 +1866,7 @@ export default class TableCom extends Component {
cm = (
<span style={{ paddingRight: get == 'mobile' ? 8 : '' }}>
{value}
{get === 'mobile' ? <br/> : ''}
{get === 'mobile' ? <br /> : ''}
</span>
);
......@@ -1869,7 +1875,7 @@ export default class TableCom extends Component {
cm = (
<span>
{value}
{get === 'mobile' ? <br/> : ''}
{get === 'mobile' ? <br /> : ''}
</span>
);
......@@ -1879,7 +1885,7 @@ export default class TableCom extends Component {
<span>
{moment(parseInt(value))
.format('YYYY-MM-DD HH:mm:ss')}
{get === 'mobile' ? <br/> : ''}
{get === 'mobile' ? <br /> : ''}
</span>
) : (
''
......@@ -1894,14 +1900,14 @@ export default class TableCom extends Component {
{filesX.map((f, index2) => {
return (
<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}
</a>
</li>
);
})}
</ul>
{get === 'mobile' ? <br/> : ''}
{get === 'mobile' ? <br /> : ''}
</>
);
......@@ -1914,14 +1920,14 @@ export default class TableCom extends Component {
{files.map((f, index2) => {
return (
<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}
</a>
</li>
);
})}
</ul>
{get === 'mobile' ? <br/> : ''}
{get === 'mobile' ? <br /> : ''}
</>
);
......@@ -1946,7 +1952,7 @@ export default class TableCom extends Component {
height: json.height,
}}
/>
{get === 'mobile' ? <br/> : ''}
{get === 'mobile' ? <br /> : ''}
</>
);
}
......@@ -1972,7 +1978,7 @@ export default class TableCom extends Component {
height: json.height,
}}
/>
{get === 'mobile' ? <br/> : ''}
{get === 'mobile' ? <br /> : ''}
</>
);
}
......@@ -2007,7 +2013,7 @@ export default class TableCom extends Component {
</MobileItem>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden"/>)}
})(<Input type='hidden' />)}
</>
);
}
......@@ -2020,7 +2026,7 @@ export default class TableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden"/>)}
})(<Input type='hidden' />)}
</>
);
}
......@@ -2114,7 +2120,7 @@ export default class TableCom extends Component {
</Form.Item>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden"/>)}
})(<Input type='hidden' />)}
</>
);
}
......@@ -2127,7 +2133,7 @@ export default class TableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden"/>)}
})(<Input type='hidden' />)}
</>
);
}
......@@ -2206,7 +2212,7 @@ export default class TableCom extends Component {
case 'MobileCard':
let value = obj[dataColumn.base52];
if (!value || value === 'null') {
return <div/>;
return <div />;
}
cm = <MobileCard value={value}
json={json}
......@@ -2218,7 +2224,7 @@ export default class TableCom extends Component {
case 'WangEditor':
let textV = obj[dataColumn.base52];
if (!textV || textV === 'null') {
return <div/>;
return <div />;
}
cm = (
<div
......@@ -2322,7 +2328,7 @@ ${obj[dataColumn.base52]}
<Table
get={get}
columns={this.state.columns}
size="small"
size='small'
dataSource={ds}
pagination={false}
/>
......@@ -2493,7 +2499,7 @@ ${obj[dataColumn.base52]}
}
return (
<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}
</a>
</li>
......@@ -2520,7 +2526,7 @@ ${obj[dataColumn.base52]}
}
return (
<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}
</a>
</li>
......@@ -2691,7 +2697,7 @@ ${obj[dataColumn.base52]}
if (json.isLink) {
cm = <a {...ev} />;
} 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]}
if (json.isLink) {
cm = <a {...ev} />;
} 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]}
message: '请选择' + title,
},
],
})(<SwitchWeb json={json} disabled={disabled}/>);
})(<SwitchWeb json={json} disabled={disabled} />);
break;
case 'TextArea':
......@@ -2917,7 +2923,7 @@ ${obj[dataColumn.base52]}
}
const {
disabledInputStyle = {},
addonAfter
addonAfter,
} = otherProps;
let inputStyle = {
width: json.width,
......@@ -2968,7 +2974,7 @@ ${obj[dataColumn.base52]}
case 'InputHidden':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
})(<Input type="hidden"/>);
})(<Input type='hidden' />);
break;
case 'InputNumber':
if (json?.otherProps) {
......@@ -3021,7 +3027,86 @@ ${obj[dataColumn.base52]}
}
}
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为单选
*/
......@@ -3037,7 +3122,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title,
},
],
})(<Radio.Group options={options} disabled={disabled}/>);
})(<Radio.Group options={options} disabled={disabled} />);
if (get == 'mobile') {
cm = <div>{cm}</div>;
if (
......@@ -3065,7 +3150,7 @@ ${obj[dataColumn.base52]}
case 'Checkbox':
if (get === 'mobile') {
cm = (
<Flex direction="column" align="start">
<Flex direction='column' align='start'>
{getFieldDecorator(dataColumn.base52, {
initialValue: initValue, // 默认值
rules:
......@@ -3077,7 +3162,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title,
},
],
})(<Checkbox.Group options={options} disabled={disabled}/>)}
})(<Checkbox.Group options={options} disabled={disabled} />)}
</Flex>
);
......@@ -3131,7 +3216,7 @@ ${obj[dataColumn.base52]}
}
}
cm = getFieldDecorator(dataColumn.base52, {
initialValue: !initValue && otherProps?.mode === 'multiple' ? undefined : initValue ,
initialValue: !initValue && otherProps?.mode === 'multiple' ? undefined : initValue,
rules:
json.vlds && json.vlds.length > 0
? json.vlds
......@@ -3148,7 +3233,7 @@ ${obj[dataColumn.base52]}
disabled={selectDis || disabled}
placeholder={json.placeholder}
style={{ width: json.width }}
optionFilterProp="children"
optionFilterProp='children'
getPopupContainer={getPopupContainer(this.props.isDynamic, uuid)}
onFocus={() => {
get === 'mobile' // 移动端取消输入键盘弹出
......@@ -3276,7 +3361,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title,
},
],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json}/>);
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
}
if (
......@@ -3446,7 +3531,7 @@ ${obj[dataColumn.base52]}
message: '请选择起止时间',
},
],
})(<RangePickerDiy json={json} disabled={disabled} uuid={uuid}/>);
})(<RangePickerDiy json={json} disabled={disabled} uuid={uuid} />);
}
if (json.label == null) title = '起止时间';
break;
......@@ -3632,7 +3717,7 @@ ${obj[dataColumn.base52]}
message: '请输入',
},
],
})(<WangEditor json={json} dataColumn={dataColumn} disabled={disabled} uuid={uuid}/>);
})(<WangEditor json={json} dataColumn={dataColumn} disabled={disabled} uuid={uuid} />);
break;
case 'MobileCard':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -3658,7 +3743,7 @@ ${obj[dataColumn.base52]}
message: '请输入',
},
],
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled}/>);
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3689,7 +3774,7 @@ ${obj[dataColumn.base52]}
message: '请输入' + title,
},
],
})(<CronEditorDiy/>);
})(<CronEditorDiy />);
break;
case 'LocationCom':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -3805,7 +3890,7 @@ ${obj[dataColumn.base52]}
message: '请上传图片',
},
],
})(<ImgUploadCom json={json} disabled={disabled}/>);
})(<ImgUploadCom json={json} disabled={disabled} />);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3836,7 +3921,7 @@ ${obj[dataColumn.base52]}
message: '请上传视频',
},
],
})(<VideoUploadCom json={json} disabled={disabled}/>);
})(<VideoUploadCom json={json} disabled={disabled} />);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3867,7 +3952,7 @@ ${obj[dataColumn.base52]}
message: '请进行签名',
},
],
})(<Signature width={json.width} height={json.height} get={get}/>);
})(<Signature width={json.width} height={json.height} get={get} />);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -4087,7 +4172,7 @@ ${obj[dataColumn.base52]}
label={title}
data-cell-component-name={json.comName || 'no_com'}
>
<ShowComName json={json}/>
<ShowComName json={json} />
{cm}
</Form.Item>
</>
......@@ -4182,12 +4267,12 @@ ${obj[dataColumn.base52]}
wrapperCol={{ span: json.wrapperSpan }}
label={title}
>
<ShowComName json={json}/>
<ShowComName json={json} />
{cm}
</Form.Item>
) : (
<Form.Item>
<ShowComName json={json}/>
<ShowComName json={json} />
{cm}
</Form.Item>
)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论