提交 81ed3047 authored 作者: 钟是志's avatar 钟是志

34150 学生提交的工作内容,老师收到的表,日期安顺序排列

上级 99ea70fd
...@@ -4,6 +4,15 @@ import ZdyTable from '../Table'; ...@@ -4,6 +4,15 @@ import ZdyTable from '../Table';
import { getOrderUid } from './splitChildForm'; import { getOrderUid } from './splitChildForm';
import { Card } from 'antd-mobile'; import { Card } from 'antd-mobile';
const sortKeys = (a = '', b = '') => {
if (a && b && typeof a === 'string' && typeof b === 'string' && a.length > 13 && b.length > 13) {
return Number(a.slice(0, 13)) - Number(b.slice(0, 13));
} else {
return 0;
}
};
export default class ChildForm extends React.Component { export default class ChildForm extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -12,7 +21,7 @@ export default class ChildForm extends React.Component { ...@@ -12,7 +21,7 @@ export default class ChildForm extends React.Component {
this.state = value; this.state = value;
} }
triggerChange = changedValue => { triggerChange = (changedValue) => {
const onChange = this.props.onChange; const onChange = this.props.onChange;
if (onChange) { if (onChange) {
onChange(changedValue); onChange(changedValue);
...@@ -53,7 +62,7 @@ export default class ChildForm extends React.Component { ...@@ -53,7 +62,7 @@ export default class ChildForm extends React.Component {
} }
} }
}; };
delete = uuid => { delete = (uuid) => {
const objs = this.state; const objs = this.state;
const { const {
json: { numCode }, json: { numCode },
...@@ -140,68 +149,72 @@ export default class ChildForm extends React.Component { ...@@ -140,68 +149,72 @@ export default class ChildForm extends React.Component {
} }
if (isMobile) { if (isMobile) {
return ( // 2022年11月24日 姚新国说的 把干掉两翼留白 解决北电科工作情况考核 移动端样式的问题 return (
// 2022年11月24日 姚新国说的 把干掉两翼留白 解决北电科工作情况考核 移动端样式的问题
<div> <div>
{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)
if (r == '') { .sort((a, b) => {
return ''; return sortKeys(a,b);
} })
return ( .map((r) => {
<Row key={r} gutter={gutter}> if (r == '') {
<Col return '';
style={{ }
zIndex: 55, return (
}} <Row key={r} gutter={gutter}>
span={isEdit ? 24 : span} <Col
> style={{
<ZdyTable zIndex: 55,
changedValues={this.props.changedValues} }}
setRealTimeValues={this.props.setRealTimeValues} span={isEdit ? 24 : span}>
trees={this.props.trees} <ZdyTable
key={r} changedValues={this.props.changedValues}
taskId={taskId} setRealTimeValues={this.props.setRealTimeValues}
modalInit={modalInit} trees={this.props.trees}
hfInstance={hfInstance} key={r}
currentFormTitle={ taskId={taskId}
getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null modalInit={modalInit}
} hfInstance={hfInstance}
getCellValue={getCellValue} currentFormTitle={
formCode={this.props.formCode} getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null
formId={this.props.formId} }
isPreview={isPreview} getCellValue={getCellValue}
currentFormKey={json.childFormKey} formCode={this.props.formCode}
formConfig={datas} formId={this.props.formId}
get="mobile" isPreview={isPreview}
fatherCode={base52} currentFormKey={json.childFormKey}
isEdit={isEdit} formConfig={datas}
index={r} get="mobile"
obj={objs[r]} fatherCode={base52}
fatherObj={this.props.fatherObj} isEdit={isEdit}
init={objs} index={r}
isChild={true} obj={objs[r]}
form={form} fatherObj={this.props.fatherObj}
mapData={mapData} init={objs}
sqlData={sqlData} isChild={true}
datas={datasAll} form={form}
{...datas} mapData={mapData}
defaultValues={defaultValues} sqlData={sqlData}
/> datas={datasAll}
</Col> {...datas}
{rights.includes('delete') && isEdit ? ( defaultValues={defaultValues}
<Col style={{ textAlign: 'right' }}> />
<Button type="danger" size="small" onClick={this.delete.bind(this, r)}>
{deleteName || '删除'}{' '}
</Button>{' '}
</Col> </Col>
) : ( {rights.includes('delete') && isEdit ? (
'' <Col style={{ textAlign: 'right' }}>
)} <Button type="danger" size="small" onClick={this.delete.bind(this, r)}>
</Row> {deleteName || '删除'}{' '}
); </Button>{' '}
})} </Col>
) : (
''
)}
</Row>
);
})}
{rights.includes('add') && isEdit ? ( {rights.includes('add') && isEdit ? (
<Row> <Row>
...@@ -210,8 +223,7 @@ export default class ChildForm extends React.Component { ...@@ -210,8 +223,7 @@ export default class ChildForm extends React.Component {
type="primary" type="primary"
size="small" size="small"
style={{ margin: 'auto' }} style={{ margin: 'auto' }}
onClick={this.add} onClick={this.add}>
>
{addName || '新增'} {addName || '新增'}
</Button>{' '} </Button>{' '}
</Col> </Col>
...@@ -228,76 +240,78 @@ export default class ChildForm extends React.Component { ...@@ -228,76 +240,78 @@ export default class ChildForm extends React.Component {
); );
} }
/*** /***
* 子表单 * 子表单
* */ * */
return ( return (
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
<Row gutter={gutter}> <Row gutter={gutter}>
{Object.keys(objs).map(r => { {Object.keys(objs)
if (r == '') { .sort((a, b) => {
return ''; return sortKeys(a,b);
} })
return ( .map((r) => {
<Col span={span} key={r}> if (r == '') {
<ZdyTable return '';
changedValues={this.props.changedValues} }
taskId={taskId} return (
setRealTimeValues={this.props.setRealTimeValues} <Col span={span} key={r}>
modalInit={modalInit} <ZdyTable
hfInstance={hfInstance} changedValues={this.props.changedValues}
currentFormTitle={ taskId={taskId}
getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null setRealTimeValues={this.props.setRealTimeValues}
} modalInit={modalInit}
getCellValue={getCellValue} hfInstance={hfInstance}
formConfig={datas} currentFormTitle={
key={r} getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null
fatherCode={base52} }
isEdit={isEdit} getCellValue={getCellValue}
index={r} formConfig={datas}
isPreview={isPreview} key={r}
obj={objs[r]} fatherCode={base52}
currentFormKey={json.childFormKey} isEdit={isEdit}
formCode={this.props.formCode} index={r}
formId={this.props.formId} isPreview={isPreview}
fatherObj={this.props.fatherObj} obj={objs[r]}
init={objs} currentFormKey={json.childFormKey}
isChild={true} formCode={this.props.formCode}
get="web" formId={this.props.formId}
form={form} fatherObj={this.props.fatherObj}
mapData={mapData} init={objs}
sqlData={sqlData} isChild={true}
datas={datasAll} get="web"
{...datas} form={form}
defaultValues={defaultValues} mapData={mapData}
/> sqlData={sqlData}
datas={datasAll}
{...datas}
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 || '-'}
{deleteName || '-'} </Button>
</Button> ) : (
) : ( ''
'' )}
)} </Col>
</Col> );
); })}
})}
</Row> </Row>
{rights.includes('add') && isEdit ? ( {rights.includes('add') && isEdit ? (
<Row> <Row>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论