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

优化代码

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