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

修复bug

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