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

格式化代码

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