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

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

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