|
@@ -42,7 +42,7 @@ class ChronicInfo extends React.Component{
|
|
parentIndex:null,
|
|
parentIndex:null,
|
|
radioVal:{}, //可能结果选择内容
|
|
radioVal:{}, //可能结果选择内容
|
|
possible:{}, //可能结果
|
|
possible:{}, //可能结果
|
|
- formulaParam: {}, //量表计算公式计算入参
|
|
|
|
|
|
+ calcuFormulaResult: {}, //量表计算公式结果
|
|
};
|
|
};
|
|
|
|
|
|
this.showInfo = this.showInfo.bind(this);
|
|
this.showInfo = this.showInfo.bind(this);
|
|
@@ -122,11 +122,11 @@ class ChronicInfo extends React.Component{
|
|
const item = {
|
|
const item = {
|
|
id:it.id,
|
|
id:it.id,
|
|
name:it.name
|
|
name:it.name
|
|
- };console.log(it,parentId)
|
|
|
|
|
|
+ };
|
|
// 判断:store里已经有该量表就无需重新调接口
|
|
// 判断:store里已经有该量表就无需重新调接口
|
|
if(scaleInfo&&scaleInfo[it.id]){
|
|
if(scaleInfo&&scaleInfo[it.id]){
|
|
this.props.hideList({name:'showTable',value:true});
|
|
this.props.hideList({name:'showTable',value:true});
|
|
- }else{console.log('调接口')
|
|
|
|
|
|
+ }else{
|
|
this.props.getScaleInfo(item);
|
|
this.props.getScaleInfo(item);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -201,8 +201,21 @@ class ChronicInfo extends React.Component{
|
|
const data1 = JSON.parse(JSON.stringify(data))
|
|
const data1 = JSON.parse(JSON.stringify(data))
|
|
setChronicPush(data1)
|
|
setChronicPush(data1)
|
|
}
|
|
}
|
|
- confirmFormula(){//计算公式确定
|
|
|
|
-
|
|
|
|
|
|
+ confirmFormula(v,i){//计算公式确定
|
|
|
|
+ const {calcuFormulaResult} = this.state
|
|
|
|
+ let resultText = '';
|
|
|
|
+ if(v.details[1].content.result) {
|
|
|
|
+ for(let i = 0; i < v.details[1].content.result.length; i++) {
|
|
|
|
+ resultText += v.details[1].content.result[i].text
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ v.details[1].content.resultText = resultText
|
|
|
|
+ calcuFormulaResult[v.id] = v.details[1]
|
|
|
|
+ this.setState({
|
|
|
|
+ calcuFormulaResult: JSON.parse(JSON.stringify(calcuFormulaResult))
|
|
|
|
+ })
|
|
|
|
+ this.closeFormula();
|
|
}
|
|
}
|
|
handleRadio(item,parent,pIndex){//可能结果
|
|
handleRadio(item,parent,pIndex){//可能结果
|
|
let {radioVal} = this.props;
|
|
let {radioVal} = this.props;
|
|
@@ -255,8 +268,18 @@ class ChronicInfo extends React.Component{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
getDetail(){
|
|
getDetail(){
|
|
- const {data,indexs,scaleInfo,formulaResult} = this.props;
|
|
|
|
- const {showInfo,showOption,infoId,formulaId,optionId,possible,radioVal} = this.state;
|
|
|
|
|
|
+ const {indexs,scaleInfo,formulaResult} = this.props;
|
|
|
|
+ let data = this.props.data
|
|
|
|
+ const {showInfo,showOption,infoId,formulaId,optionId,possible,radioVal, calcuFormulaResult} = this.state;
|
|
|
|
+ for(let i = 0; i < data.length; i++) {
|
|
|
|
+ if(calcuFormulaResult[data[i].id]) {
|
|
|
|
+ for(let j = 0; j < data[i].details.length; j++) {
|
|
|
|
+ if(data[i].details[j].type == 2) {
|
|
|
|
+ data[i].details[j] = calcuFormulaResult[data[i].id]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
let list = data&&data.map((v,i)=>{
|
|
let list = data&&data.map((v,i)=>{
|
|
return <div className={style["list"]}>
|
|
return <div className={style["list"]}>
|
|
{v.name?<p>
|
|
{v.name?<p>
|
|
@@ -291,7 +314,7 @@ class ChronicInfo extends React.Component{
|
|
return <div className={style["marTop"]}>
|
|
return <div className={style["marTop"]}>
|
|
<span className={style["limit"]}>
|
|
<span className={style["limit"]}>
|
|
计算公式结果:
|
|
计算公式结果:
|
|
- <i className={style["blue"]} onClick={this.showFormula.bind(this,v.id)}>请选择</i>
|
|
|
|
|
|
+ <i className={style["blue"]} onClick={this.showFormula.bind(this,v.id)}>{calcuFormulaResult[v.id]?calcuFormulaResult[v.id].content.resultText:'请选择'}</i>
|
|
<img src={level1} />
|
|
<img src={level1} />
|
|
</span>
|
|
</span>
|
|
{indexs[i]&&indexs[i].includes(j)?<span className={style["addResult"]}>
|
|
{indexs[i]&&indexs[i].includes(j)?<span className={style["addResult"]}>
|
|
@@ -466,7 +489,6 @@ class ChronicInfo extends React.Component{
|
|
})}
|
|
})}
|
|
</ul>
|
|
</ul>
|
|
</ConfirmModal>
|
|
</ConfirmModal>
|
|
- {console.log(showHide)}
|
|
|
|
{showHide&&showHide.showTable?<ComplexModal onclose={this.closeTable} footer={scaleFooter}
|
|
{showHide&&showHide.showTable?<ComplexModal onclose={this.closeTable} footer={scaleFooter}
|
|
title={tableName}
|
|
title={tableName}
|
|
icon={tableIcon}
|
|
icon={tableIcon}
|