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

格式化代码

上级 a9f585ed
......@@ -59,16 +59,18 @@ export default class ZdyTable extends Component {
// if(this.props.currentFormKey === 'aa20cdbd-2019-45ea-8cdf-715aa46e132e'){
// }
if (isPreview || isChild) {
this.initExcel({
this.initExcel(
{
datas: this.props.datas,
trees: this.props.trees
}, () => {
trees: this.props.trees,
},
() => {
this.setState({
...this.state,
...this.props,
formConfig: {
...this.state.formConfig,
style: this.props.style
style: this.props.style,
},
isReady: true,
viewMode:
......@@ -78,7 +80,8 @@ export default class ZdyTable extends Component {
? this.props.datas[this.props.currentFormKey].viewMode
: null,
});
});
},
);
return;
}
......@@ -286,10 +289,7 @@ 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++) {
......@@ -303,20 +303,18 @@ 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: {
comName: 'Excel',
cwidth: c.width,
cheight: c.height
cheight: c.height,
},
});
} else {
rows.push({
uuid: 'id_' + UUID.v4()
.replace(/-/g, '2'),
uuid: 'id_' + UUID.v4().replace(/-/g, '2'),
row: c.rowSpan,
col: c.colSpan,
content: {
......@@ -337,8 +335,7 @@ 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: [] },
......@@ -354,7 +351,7 @@ export default class ZdyTable extends Component {
if (datas[uuid] == null) {
trees.push({
title: sheets[s].name,
key: uuid
key: uuid,
});
}
datas[uuid] = {
......@@ -389,7 +386,7 @@ export default class ZdyTable extends Component {
}
const data = datas[tr.key];
const all = [];
if(data && data.item){
if (data && data.item) {
for (var i = 0; i < data.items.length; i++) {
const row = data.items[i];
const r = [];
......@@ -405,7 +402,6 @@ export default class ZdyTable extends Component {
}
}
sheetData[tr.title] = all;
};
configs;
......@@ -464,12 +460,13 @@ export default class ZdyTable extends Component {
: null,
formConfig: {
...this.state.formConfig,
style: nextProps.style
style: nextProps.style,
},
},
() => this.initExcel({
() =>
this.initExcel({
datas: nextProps.datas,
trees: nextProps.trees
trees: nextProps.trees,
}),
);
return;
......@@ -664,7 +661,6 @@ export default class ZdyTable extends Component {
this.setState({ objRealTime: obj });
};
getT = (trees, key) => {
for (var i in trees) {
if (trees[i].key == key) {
return trees[i].title;
......@@ -675,8 +671,6 @@ export default class ZdyTable extends Component {
}
}
return null;
};
render() {
......@@ -717,7 +711,6 @@ export default class ZdyTable extends Component {
isWebPrint, // 打印界面
isWebPrintEnd,
isPreview,
} = this.props;
const trees = this.configs && this.configs.trees ? this.configs.trees : this.props.trees;
......@@ -772,8 +765,7 @@ 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':
......@@ -786,7 +778,7 @@ export default class ZdyTable extends Component {
{this.props.postData?.isUpdate ? (
<div style={{ margin: '100px 24px 24px' }}>
<div style={{ textAlign: 'center' }}>
<img style={{ marginRight: 30 }} src={maintain}/>
<img style={{ marginRight: 30 }} src={maintain} />
</div>
<p
style={{
......@@ -805,8 +797,7 @@ export default class ZdyTable extends Component {
<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 ||
......@@ -826,7 +817,7 @@ export default class ZdyTable extends Component {
return this.props.form.getFieldDecorator(name, {
initialValue: value,
})(<Input type="hidden"/>);
})(<Input type="hidden" />);
})
: ''}
<Row>
......@@ -858,13 +849,12 @@ export default class ZdyTable extends Component {
return;
}
if (cell.uuid) {
if(cell.content){
if (cell.content) {
cell.content = {
...cell.content,
...getActiveJson(currentFormKey, cell.uuid),
};
if(window.zdyTableTemplateWillMountProps?.allDisabled){
if (window.zdyTableTemplateWillMountProps?.allDisabled) {
cell.content.disabled = true;
}
}
......@@ -894,8 +884,9 @@ export default class ZdyTable extends Component {
rowSpan={cell.row}
colSpan={cell.col}
key={j}
data-cell-id={cell.uuid || 'no_uuid_' + Math.random()
.slice(0, 6)}
data-cell-id={
cell.uuid || 'no_uuid_' + Math.random().slice(0, 6)
}
data-com-name={cell.content?.comName || 'empty'}
style={{
overflow: 'auto',
......@@ -967,7 +958,7 @@ export default class ZdyTable extends Component {
</table>
{style.pageBreakAfter != null ? (
<div style={{ pageBreakAfter: style.pageBreakAfter }}/>
<div style={{ pageBreakAfter: style.pageBreakAfter }} />
) : (
''
)}
......@@ -985,7 +976,7 @@ export default class ZdyTable extends Component {
{this.props.postData?.isUpdate ? (
<div style={{ margin: '100px 24px 24px' }}>
<div style={{ textAlign: 'center' }}>
<img style={{ width: '100%' }} src={maintain}/>
<img style={{ width: '100%' }} src={maintain} />
</div>
<p
style={{
......@@ -1003,8 +994,7 @@ export default class ZdyTable extends Component {
) : (
<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 ||
......@@ -1024,7 +1014,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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论