|
@@ -226,12 +226,11 @@ class ScaleTable extends React.Component{
|
|
|
return ''
|
|
|
}
|
|
|
componentWillReceiveProps(nextProps){
|
|
|
- const {tableId,saveScaleData,getResult,closeTable,scaleInfo,unscroeClose} = this.props;
|
|
|
+ const {tableId,closeTable,unscroeClose} = this.props;
|
|
|
const {valueData} = this.state;
|
|
|
const data = nextProps.scaleInfo;
|
|
|
- // if(JSON.stringify(data) !== '{}' && data[tableId]){
|
|
|
if(JSON.stringify(data) !== '{}' && data[tableId] && JSON.stringify(valueData) == '{}'){
|
|
|
- let scale = this.filterScale(data[tableId]);
|
|
|
+ let scale = this.filterScale(data[tableId].data);
|
|
|
this.setState({
|
|
|
valueData:scale.content?JSON.parse(scale.content):{}
|
|
|
})
|
|
@@ -260,7 +259,7 @@ class ScaleTable extends React.Component{
|
|
|
const {tableId,scaleInfo,resetFlag} = this.props;
|
|
|
resetFlag&&resetFlag();//重置确定标识
|
|
|
if(scaleInfo&&scaleInfo[tableId]){
|
|
|
- let scale = this.filterScale(scaleInfo[tableId]);
|
|
|
+ let scale = this.filterScale(scaleInfo[tableId].data);
|
|
|
// 回读非计算量表结果result
|
|
|
let data = scale.content?JSON.parse(scale.content):{};
|
|
|
let result = {};
|
|
@@ -287,12 +286,12 @@ class ScaleTable extends React.Component{
|
|
|
}
|
|
|
componentWillUnmount(){
|
|
|
// 储存计算结果和选择后的data
|
|
|
- const {tableId,getResult,scaleInfo,saveScaleData,formulaResult,comfirnFlag,flagT} = this.props;
|
|
|
+ const {title,tableId,getResult,scaleInfo,saveScaleData,formulaResult,comfirnFlag,flagT} = this.props;
|
|
|
const {valueData,scaleResult1,start} = this.state;
|
|
|
// 替换表格内容--1)没有点计算且没有计算结果;2)点了计算
|
|
|
const scaleResult = scaleResult1 || formulaResult&&formulaResult[tableId]; //量表计算结果
|
|
|
if(start || !scaleResult && valueData.scaleType==1){//仅计分量表储存
|
|
|
- let allDatas = scaleInfo[tableId]?JSON.parse(JSON.stringify(scaleInfo[tableId])):'' ;
|
|
|
+ let allDatas = scaleInfo[tableId]&&scaleInfo[tableId].data?[...scaleInfo[tableId].data]:'' ;
|
|
|
if(allDatas){
|
|
|
for(let i=0; i<allDatas.length; i++){
|
|
|
if(allDatas[i].type==1){
|
|
@@ -300,7 +299,7 @@ class ScaleTable extends React.Component{
|
|
|
}
|
|
|
}
|
|
|
// 需求:未点计算,直接点确定、关闭也保存选中数据 4-30
|
|
|
- saveScaleData&&saveScaleData({id:tableId,data:allDatas});
|
|
|
+ saveScaleData&&saveScaleData({id:tableId,data:allDatas,name:title});
|
|
|
}
|
|
|
}
|
|
|
if(scaleResult1){
|
|
@@ -328,14 +327,14 @@ class ScaleTable extends React.Component{
|
|
|
}
|
|
|
getResult&&getResult(params);
|
|
|
// 存数据源
|
|
|
- let allDatas = scaleInfo[tableId]?JSON.parse(JSON.stringify(scaleInfo[tableId])):'' ;
|
|
|
+ let allDatas = scaleInfo[tableId]&&scaleInfo[tableId].data?[...scaleInfo[tableId].data]:'' ;
|
|
|
if(allDatas){
|
|
|
for(let i=0; i<allDatas.length; i++){
|
|
|
if(allDatas[i].type==1){
|
|
|
allDatas[i].content = JSON.stringify(valueData);
|
|
|
}
|
|
|
}
|
|
|
- saveScaleData&&saveScaleData({id:tableId,data:allDatas});
|
|
|
+ saveScaleData&&saveScaleData({id:tableId,data:allDatas,name:title});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -425,7 +424,7 @@ class ScaleTable extends React.Component{
|
|
|
|
|
|
render(){
|
|
|
const {scaleInfo,tableId,formulaResult,resRef} = this.props;
|
|
|
- const data = scaleInfo[tableId];
|
|
|
+ const data = scaleInfo[tableId].data;
|
|
|
let {selecteds,scaleResult1} = this.state;
|
|
|
const scale = data && this.filterScale(data);
|
|
|
const datas = scale && scale.content && JSON.parse(scale.content);
|