|
@@ -23,14 +23,11 @@ class ScaleItem extends Component {
|
|
parentId:'',
|
|
parentId:'',
|
|
showScale:false,
|
|
showScale:false,
|
|
optionId:'',
|
|
optionId:'',
|
|
- possible:props.possible||{},
|
|
|
|
radioVal:props.radioVal||{},
|
|
radioVal:props.radioVal||{},
|
|
formulaId:''
|
|
formulaId:''
|
|
};
|
|
};
|
|
this.getItems = this.getItems.bind(this);
|
|
this.getItems = this.getItems.bind(this);
|
|
this.getDetailItems = this.getDetailItems.bind(this);
|
|
this.getDetailItems = this.getDetailItems.bind(this);
|
|
- this.showScaleFn = this.showScaleFn.bind(this);
|
|
|
|
- this.closeScaleFn = this.closeScaleFn.bind(this);
|
|
|
|
this.showOption = this.showOption.bind(this);
|
|
this.showOption = this.showOption.bind(this);
|
|
this.closeOption = this.closeOption.bind(this);
|
|
this.closeOption = this.closeOption.bind(this);
|
|
this.closeFormula = this.closeFormula.bind(this);
|
|
this.closeFormula = this.closeFormula.bind(this);
|
|
@@ -46,13 +43,20 @@ class ScaleItem extends Component {
|
|
optionId:null
|
|
optionId:null
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- confirmOption(parent,pIndex){
|
|
|
|
|
|
+ confirmOption(parentId){
|
|
|
|
+ const {handleRes} = this.props;
|
|
const {radioVal,possible} = this.state;
|
|
const {radioVal,possible} = this.state;
|
|
- this.setState({
|
|
|
|
|
|
+ handleRes&&handleRes(parentId,{
|
|
possible:Object.assign({},possible,radioVal),
|
|
possible:Object.assign({},possible,radioVal),
|
|
radioVal:Object.assign({},possible,radioVal),//不设置radioVal只有最近一次选中的值
|
|
radioVal:Object.assign({},possible,radioVal),//不设置radioVal只有最近一次选中的值
|
|
- optionId:null
|
|
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ this.closeOption();
|
|
|
|
+ }
|
|
|
|
+ handleShowScale(item,parentId){
|
|
|
|
+ const {showScaleFn,closeAssess} = this.props;
|
|
|
|
+ closeAssess&&closeAssess(); //关闭评估弹窗
|
|
|
|
+ showScaleFn&&showScaleFn(item,parentId); //显示量表
|
|
|
|
+
|
|
}
|
|
}
|
|
handleRadio(item,parent,pIndex){
|
|
handleRadio(item,parent,pIndex){
|
|
let {radioVal} = this.props;
|
|
let {radioVal} = this.props;
|
|
@@ -78,12 +82,13 @@ class ScaleItem extends Component {
|
|
}
|
|
}
|
|
getDetailItems(item,i){
|
|
getDetailItems(item,i){
|
|
let arr = [],temp='';
|
|
let arr = [],temp='';
|
|
- const {indexs} = this.props;
|
|
|
|
- const {optionId,radioVal,possible,formulaId} = this.state;
|
|
|
|
|
|
+ const {indexs,result} = this.props;
|
|
|
|
+ const {optionId,formulaId,radioVal} = this.state;
|
|
|
|
+ const possible=result&&result[item.id]&&result[item.id].possible;
|
|
item.details.map((it,j)=>{
|
|
item.details.map((it,j)=>{
|
|
if(indexs[i]&&indexs[i].includes(j)){
|
|
if(indexs[i]&&indexs[i].includes(j)){
|
|
if(it.type==1){ //量表
|
|
if(it.type==1){ //量表
|
|
- temp =<span className={style['scale']} onClick={()=>this.showScaleFn(it.content.name,it.content.id,item.id)}>【{it.content.name}】</span>;
|
|
|
|
|
|
+ temp =<span className={style['scale']} onClick={()=>this.handleShowScale(it.content,item.id)}>【{it.content.name}】</span>;
|
|
}else if(it.type==2){ //计算公式
|
|
}else if(it.type==2){ //计算公式
|
|
temp = <div className={style['results']}>
|
|
temp = <div className={style['results']}>
|
|
<span>计算公式:</span>
|
|
<span>计算公式:</span>
|
|
@@ -151,20 +156,20 @@ class ScaleItem extends Component {
|
|
}else if(it.type==3){
|
|
}else if(it.type==3){
|
|
temp = <div className={style['results']}>
|
|
temp = <div className={style['results']}>
|
|
<span>可能结果:</span>
|
|
<span>可能结果:</span>
|
|
- <span onClick={this.showOption.bind(this,item.id)} className={style["blue"]}>{possible[i]?possible[i]:'请选择'}</span>
|
|
|
|
|
|
+ <span onClick={this.showOption.bind(this,item.id)} className={style["blue"]}>{possible&&possible[i]?possible[i]:'请选择'}</span>
|
|
<img src={level1} />
|
|
<img src={level1} />
|
|
<MiniToast title='结果选择'
|
|
<MiniToast title='结果选择'
|
|
icon={checkIcon}
|
|
icon={checkIcon}
|
|
show={optionId&&optionId==item.id?true:false}
|
|
show={optionId&&optionId==item.id?true:false}
|
|
close={this.closeOption}
|
|
close={this.closeOption}
|
|
- confirm={this.confirmOption.bind(this,item,i)}
|
|
|
|
|
|
+ confirm={this.confirmOption.bind(this,item.id)}
|
|
footer="true">
|
|
footer="true">
|
|
<div className={style["infoOption"]}>
|
|
<div className={style["infoOption"]}>
|
|
<span>{it.content.name?it.content.name+':':''}</span>
|
|
<span>{it.content.name?it.content.name+':':''}</span>
|
|
{it.content.details&&it.content.details.map((lis,ind)=>{
|
|
{it.content.details&&it.content.details.map((lis,ind)=>{
|
|
return <div className={style["chooseItem"]}>
|
|
return <div className={style["chooseItem"]}>
|
|
<Radio label={lis.detailName}
|
|
<Radio label={lis.detailName}
|
|
- isSelect={radioVal[i]==lis.detailName}
|
|
|
|
|
|
+ isSelect={radioVal&&radioVal[i]==lis.detailName}
|
|
handleClick={this.handleRadio.bind(this,lis,item,i)}>
|
|
handleClick={this.handleRadio.bind(this,lis,item,i)}>
|
|
</Radio>
|
|
</Radio>
|
|
</div>
|
|
</div>
|
|
@@ -190,23 +195,6 @@ class ScaleItem extends Component {
|
|
return this.getDetailItems(it,i);
|
|
return this.getDetailItems(it,i);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- showScaleFn(name,id,pid){
|
|
|
|
- const {getScaleData,scaleInfo} = this.props;
|
|
|
|
- this.setState({
|
|
|
|
- scaleId:id,
|
|
|
|
- scaleName:name,
|
|
|
|
- parentId:pid,
|
|
|
|
- showScale:true
|
|
|
|
- });
|
|
|
|
- if(!scaleInfo[id]){
|
|
|
|
- getScaleData&&getScaleData({id,name});
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- closeScaleFn(){
|
|
|
|
- this.setState({
|
|
|
|
- showScale:false
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
onPrint() {
|
|
onPrint() {
|
|
let dom = this.state.showTable?$("#printcontent"):$("#AssistResult");
|
|
let dom = this.state.showTable?$("#printcontent"):$("#AssistResult");
|
|
dom.jqprint({
|
|
dom.jqprint({
|
|
@@ -222,16 +210,7 @@ class ScaleItem extends Component {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
render() {
|
|
render() {
|
|
- const {title,handleInp,scaleInfo,disabled} = this.props;
|
|
|
|
- const {scaleName,scaleId,parentId,showScale} = this.state;
|
|
|
|
- const footer = <div className={style['footer']}>
|
|
|
|
- <span className={style['print']} onClick={this.onPrint}><img src={printIcon} alt=""/>打印</span>
|
|
|
|
- <span className={style['okBtn']} onClick={()=>{}}>确定</span>
|
|
|
|
- </div>;
|
|
|
|
- const scaleFooter = <div className={style['footer']}>
|
|
|
|
- <span className={style['print']} onClick={this.onPrint}><img src={printIcon} alt=""/>打印</span>
|
|
|
|
- <span className={style['okBtn']} onClick={()=>this.closeTable()}>确定</span>
|
|
|
|
- </div>;
|
|
|
|
|
|
+ const {title,handleInp,disabled} = this.props;
|
|
return <div className={style['assess-item']}>
|
|
return <div className={style['assess-item']}>
|
|
<h2>{title}</h2>
|
|
<h2>{title}</h2>
|
|
<div className={style['item-content']}>
|
|
<div className={style['item-content']}>
|
|
@@ -248,14 +227,6 @@ class ScaleItem extends Component {
|
|
</li>
|
|
</li>
|
|
</ul>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
- {showScale?<ComplexModal onclose={this.closeScaleFn} footer={scaleFooter}
|
|
|
|
- title={scaleName}
|
|
|
|
- icon={tableIcon}
|
|
|
|
- top={20}
|
|
|
|
- bottom={20}
|
|
|
|
- width={820}>
|
|
|
|
- <ScaleTable title={scaleName} tableId={scaleId} parentId={parentId}></ScaleTable>
|
|
|
|
- </ComplexModal>:''}
|
|
|
|
</div>;
|
|
</div>;
|
|
}
|
|
}
|
|
}
|
|
}
|