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

优化代码

上级 57df4c91
...@@ -288,7 +288,10 @@ export default class ZdyTable extends Component { ...@@ -288,7 +288,10 @@ export default class ZdyTable extends Component {
this.props.importExcel(res, callback); this.props.importExcel(res, callback);
return; return;
} }
const { datas, trees } = this.configs; const {
datas,
trees,
} = this.configs;
const sheets = res.sheets; const sheets = res.sheets;
for (var s = 0; s < sheets.length; s++) { for (var s = 0; s < sheets.length; s++) {
...@@ -302,7 +305,8 @@ export default class ZdyTable extends Component { ...@@ -302,7 +305,8 @@ export default class ZdyTable extends Component {
const c = rr[j]; const c = rr[j];
if (c.value == null || c.value == '') { if (c.value == null || c.value == '') {
rows.push({ rows.push({
uuid: 'id_' + UUID.v4().replace(/-/g, '2'), uuid: 'id_' + UUID.v4()
.replace(/-/g, '2'),
row: c.rowSpan, row: c.rowSpan,
col: c.colSpan, col: c.colSpan,
content: { content: {
...@@ -313,7 +317,8 @@ export default class ZdyTable extends Component { ...@@ -313,7 +317,8 @@ export default class ZdyTable extends Component {
}); });
} else { } else {
rows.push({ rows.push({
uuid: 'id_' + UUID.v4().replace(/-/g, '2'), uuid: 'id_' + UUID.v4()
.replace(/-/g, '2'),
row: c.rowSpan, row: c.rowSpan,
col: c.colSpan, col: c.colSpan,
content: { content: {
...@@ -334,7 +339,8 @@ export default class ZdyTable extends Component { ...@@ -334,7 +339,8 @@ export default class ZdyTable extends Component {
for (var j = 0; j < charts.length; j++) { for (var j = 0; j < charts.length; j++) {
const chartModel = charts[j]; const chartModel = charts[j];
rows.push({ rows.push({
uuid: 'id_' + UUID.v4().replace(/-/g, '2'), uuid: 'id_' + UUID.v4()
.replace(/-/g, '2'),
content: { content: {
comName: 'Echart', comName: 'Echart',
columnIds: { c1: [] }, columnIds: { c1: [] },
...@@ -764,7 +770,8 @@ export default class ZdyTable extends Component { ...@@ -764,7 +770,8 @@ export default class ZdyTable extends Component {
if (!isReady) return <></>; if (!isReady) return <></>;
if (this.props.postData?.isUpdate) { if (this.props.postData?.isUpdate) {
updateTime = moment(+this.props.postData?.updateTime).format('llll'); updateTime = moment(+this.props.postData?.updateTime)
.format('llll');
} }
switch (get) { switch (get) {
case 'web': case 'web':
...@@ -793,10 +800,11 @@ export default class ZdyTable extends Component { ...@@ -793,10 +800,11 @@ export default class ZdyTable extends Component {
</p> </p>
</div> </div>
) : ( ) : (
<div id="web_table"> <div id='web_table'>
<Form className="login-form"> <Form className='login-form'>
{isEdit && defaultBinds {isEdit && defaultBinds
? Object.keys(defaultBinds).map((k) => { ? Object.keys(defaultBinds)
.map((k) => {
const r = defaultBinds[k]; const r = defaultBinds[k];
if ( if (
r.columnIds == null || r.columnIds == null ||
...@@ -816,7 +824,7 @@ export default class ZdyTable extends Component { ...@@ -816,7 +824,7 @@ export default class ZdyTable extends Component {
return this.props.form.getFieldDecorator(name, { return this.props.form.getFieldDecorator(name, {
initialValue: value, initialValue: value,
})(<Input type="hidden" />); })(<Input type='hidden' />);
}) })
: ''} : ''}
<Row> <Row>
...@@ -835,8 +843,8 @@ export default class ZdyTable extends Component { ...@@ -835,8 +843,8 @@ export default class ZdyTable extends Component {
...style, ...style,
}} }}
border={border} border={border}
cellSpacing="0" cellSpacing='0'
cellPadding="0"> cellPadding='0'>
<tbody> <tbody>
{items.map((row, i) => { {items.map((row, i) => {
const allhidden = this.checkAllHidden(row); const allhidden = this.checkAllHidden(row);
...@@ -884,7 +892,8 @@ export default class ZdyTable extends Component { ...@@ -884,7 +892,8 @@ export default class ZdyTable extends Component {
colSpan={cell.col} colSpan={cell.col}
key={j} key={j}
data-cell-id={ data-cell-id={
cell.uuid || 'no_uuid_' + Math.random().slice(0, 6) cell.uuid || 'no_uuid_' + Math.random()
.slice(0, 6)
} }
data-com-name={cell.content?.comName || 'empty'} data-com-name={cell.content?.comName || 'empty'}
style={{ style={{
...@@ -894,7 +903,7 @@ export default class ZdyTable extends Component { ...@@ -894,7 +903,7 @@ export default class ZdyTable extends Component {
? cell.content.calign ? cell.content.calign
: 'left', : 'left',
...(isBorder ...(isBorder
? cell?.content?.comName == 'InputHidden' || ? cell?.content?.comName === 'InputHidden' ||
!cell?.content?.comName !cell?.content?.comName
? {} ? {}
: borderStyle : borderStyle
...@@ -991,9 +1000,10 @@ export default class ZdyTable extends Component { ...@@ -991,9 +1000,10 @@ export default class ZdyTable extends Component {
</p> </p>
</div> </div>
) : ( ) : (
<Form {...formItemLayout} id="mobile_table" className="login-form"> <Form {...formItemLayout} id='mobile_table' className='login-form'>
{defaultBinds {defaultBinds
? Object.keys(defaultBinds).map((k) => { ? Object.keys(defaultBinds)
.map((k) => {
const r = defaultBinds[k]; const r = defaultBinds[k];
if ( if (
r.columnIds == null || r.columnIds == null ||
...@@ -1013,7 +1023,7 @@ export default class ZdyTable extends Component { ...@@ -1013,7 +1023,7 @@ export default class ZdyTable extends Component {
return this.props.form.getFieldDecorator(name, { return this.props.form.getFieldDecorator(name, {
initialValue: value, initialValue: value,
})(<Input type="hidden" />); })(<Input type='hidden' />);
}) })
: ''} : ''}
<IsNewTable <IsNewTable
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论