提交 ea03463c authored 作者: tb53863844's avatar tb53863844

修复bug

上级 1dc6ee37
......@@ -53,13 +53,15 @@ export default class ZdyTable extends Component {
} = this.props;
if (isPreview || isChild) {
this.setState({
...this.state,
...this.props,
isReady: true,
formConfig: { ...this.state.formConfig, style: this.props.style },
});
this.initExcel({datas:this.props.datas,trees:this.props.trees})
console.log("FFFFFFFFFFFFFFFFFF",this.props.datas,this.props.trees)
this.initExcel({datas:this.props.datas,trees:this.props.trees},()=>{
this.setState({
...this.state,
...this.props,
isReady: true,
formConfig: { ...this.state.formConfig, style: this.props.style },
});
})
return;
}
......@@ -244,14 +246,15 @@ export default class ZdyTable extends Component {
}
hfInstance;
initExcel=(configs)=>{
if(configs==null||configs.trees==null) return
const sheetData = {}
for(var key in configs.trees){
const tr=configs.trees[key]
const data= configs.datas[tr.key]
childExcel=(sheetData,datas,tr)=>{
if(tr.children==null||tr.children.length==0){
}else{
for(var c=0;c<tr.children.length;c++){
this.childExcel(sheetData,datas,tr.children[c])
}
}
const data= datas[tr.key]
const all = []
for(var i=0;i<data.items.length;i++){
const row=data.items[i]
......@@ -269,11 +272,23 @@ export default class ZdyTable extends Component {
}
sheetData[tr.title]=all
}
}
initExcel=(configs,callback)=>{
if(configs==null||configs.trees==null) return
const sheetData = {}
for(var key in configs.trees){
const tr=configs.trees[key]
this.childExcel(sheetData,configs.datas,tr)
}
const hfInstance = HyperFormula.buildFromSheets(sheetData, {});
this.hfInstance=hfInstance
if(callback)callback()
}
getCellValue=(i,j,currentTitle)=>{
......@@ -294,13 +309,17 @@ export default class ZdyTable extends Component {
isPreview, // 是否为预览模式
isChild, // 是否为子表单
} = nextProps;
if (isPreview || isChild) {
this.setState({
...this.state,
...this.props,
isReady: true,
formConfig: { ...this.state.formConfig, style: this.props.style },
});
this.initExcel({datas:nextProps.datas,trees:nextProps.trees},()=>{
this.setState({
...this.state,
...nextProps,
isReady: true,
formConfig: { ...this.state.formConfig, style: nextProps.style },
});
})
return;
}
......@@ -337,6 +356,7 @@ export default class ZdyTable extends Component {
isBorder: this.props.table ? obj.datas[val.formKey].isBorder : xxx.isBorder,
mapData,
currentFormKey: this.props.table ? val.formKey : obj.init,
currentFormTitle:this.getCurrentFormTitle(obj,fk),
sqlData,
isEdit: !this.props.formKey,
items: this.props.table ? obj.datas[val.formKey].items : xxx.items,
......@@ -344,7 +364,7 @@ export default class ZdyTable extends Component {
appId: val.appId,
isReady: true,
formConfig: xxx,
});
},()=> this.initExcel(obj));
return;
}
if (isCg === 'yes') {
......@@ -375,6 +395,7 @@ export default class ZdyTable extends Component {
datas: obj.datas,
isEdit: !this.props.formKey,
currentFormKey: obj.init,
currentFormTitle:this.getCurrentFormTitle(obj,obj.init),
width: xxx.width,
isBorder: xxx.isBorder,
isRowCol: xxx.isRowCol,
......@@ -387,7 +408,7 @@ export default class ZdyTable extends Component {
defaultBinds: this.props.table
? obj.datas[val.taskFormKey].defaultBinds
: xxx.defaultBinds,
});
},()=> this.initExcel(obj));
return;
}
const mapData = {};
......@@ -410,6 +431,11 @@ export default class ZdyTable extends Component {
}
const obj = JSON.parse(val.unifiedServicePatternModel.content);
const xxx = obj.datas[this.props.formKey ? this.props.formKey : obj.init]; // 是否是存在历史表单传入值
const fk=this.props.formKey
? this.props.formKey
: val.taskFormKey
? val.taskFormKey
: obj.init
this.setState({
appId: val.id,
datas: obj.datas,
......@@ -417,11 +443,8 @@ export default class ZdyTable extends Component {
sqlData,
defaultValues: val.unifiedServicePatternModel.defaultValues,
isEdit: !this.props.formKey,
currentFormKey: this.props.formKey
? this.props.formKey
: val.taskFormKey
? val.taskFormKey
: obj.init,
currentFormKey: fk,
currentFormTitle:this.getCurrentFormTitle(obj,fk),
defaultBinds: this.props.table ? obj.datas[val.taskFormKey].defaultBinds : xxx.defaultBinds,
width: this.props.table ? obj.datas[val.taskFormKey].width : xxx.width,
isBorder: this.props.table ? obj.datas[val.taskFormKey].isBorder : xxx.isBorder,
......@@ -431,7 +454,7 @@ export default class ZdyTable extends Component {
init: { ...this.state.init, ...(val.isSecond ? this.props.obj : {}) },
formConfig: xxx,
// init:this.props.get==="mobile"?!!val.content?JSON.parse(val.content):'':{},// 移动端默认值设置
});
},()=> this.initExcel(obj));
} catch (e) {
console.log('公式配置有误', e);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论