|
@@ -14,6 +14,7 @@ import {ComplexModal,ConfirmModal,MiniToast, Radio,CheckBtn} from '@commonComp';
|
|
import AssessResult from '@containers/AssessResult';
|
|
import AssessResult from '@containers/AssessResult';
|
|
import ScaleTable from '@containers/ScaleTable';
|
|
import ScaleTable from '@containers/ScaleTable';
|
|
import Notify from '@commonComp/Notify';
|
|
import Notify from '@commonComp/Notify';
|
|
|
|
+import {deepClone} from '@utils/tools';
|
|
import $ from 'jquery';
|
|
import $ from 'jquery';
|
|
|
|
|
|
/***
|
|
/***
|
|
@@ -75,16 +76,6 @@ class ChronicInfo extends React.Component{
|
|
printContainer: true,
|
|
printContainer: true,
|
|
operaSupport: false,
|
|
operaSupport: false,
|
|
});
|
|
});
|
|
- // setTimeout(() => {//把生成的图片和iframe删掉
|
|
|
|
- // let imgLis = document.querySelectorAll('.canvasImg')
|
|
|
|
- // let iframe = document.getElementsByTagName('iframe')
|
|
|
|
- // for(let i = 0;i < imgLis.length;i++){
|
|
|
|
- // imgLis[i].remove()
|
|
|
|
- // }
|
|
|
|
- // for(let i = 0;i < iframe.length;i++){
|
|
|
|
- // iframe[i].remove()
|
|
|
|
- // }
|
|
|
|
- // }, 500);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
showTableList(id){//量表按钮
|
|
showTableList(id){//量表按钮
|
|
@@ -111,9 +102,6 @@ class ChronicInfo extends React.Component{
|
|
type:22,
|
|
type:22,
|
|
}
|
|
}
|
|
getInfomation&&getInfomation(param);
|
|
getInfomation&&getInfomation(param);
|
|
- /*this.setState({
|
|
|
|
- infoId:id
|
|
|
|
- })*/
|
|
|
|
}
|
|
}
|
|
closeInfo(){//关闭静态知识
|
|
closeInfo(){//关闭静态知识
|
|
this.setState({
|
|
this.setState({
|
|
@@ -208,27 +196,31 @@ class ChronicInfo extends React.Component{
|
|
});
|
|
});
|
|
}
|
|
}
|
|
handleInputformula(v,i, j,idd, e) {
|
|
handleInputformula(v,i, j,idd, e) {
|
|
- const { data, setChronicPush } = this.props;
|
|
|
|
|
|
+ const { data, setChronicPush,calcuValues } = this.props;
|
|
|
|
+ let data1 = JSON.parse(JSON.stringify(data));
|
|
|
|
+ if(calcuValues&&calcuValues[data1[i].id]){
|
|
|
|
+ data1[i].details[j].content=calcuValues&&calcuValues[data1[i].id];
|
|
|
|
+ }
|
|
const text = e.target.value;
|
|
const text = e.target.value;
|
|
- if (data[i].details) {
|
|
|
|
- data[i].details[j].content.details[idd].value = text
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const data1 = JSON.parse(JSON.stringify(data));
|
|
|
|
-
|
|
|
|
- setChronicPush(data1)
|
|
|
|
|
|
+ if (data1[i].details) {
|
|
|
|
+ data1[i].details[j].content.details[idd].value = text
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ setChronicPush(data1,data1[i].id,data1[i].details[j].content)
|
|
}
|
|
}
|
|
handleForRadio(ii,v,i, j,idd, ind){//计算公式
|
|
handleForRadio(ii,v,i, j,idd, ind){//计算公式
|
|
- const { data, setChronicPush } = this.props;
|
|
|
|
- if (data[i].details) {
|
|
|
|
- for(let z = 0; z < data[i].details[j].content.details[idd].details.length; z++) {
|
|
|
|
- data[i].details[j].content.details[idd].details[z].state = 0
|
|
|
|
- }
|
|
|
|
- data[i].details[j].content.details[idd].details[ind].state = 1
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ const { data, setChronicPush,calcuValues } = this.props;
|
|
const data1 = JSON.parse(JSON.stringify(data));
|
|
const data1 = JSON.parse(JSON.stringify(data));
|
|
- setChronicPush(data1)
|
|
|
|
|
|
+ if(calcuValues&&calcuValues[data1[i].id]){
|
|
|
|
+ data1[i].details[j].content=calcuValues&&calcuValues[data1[i].id];
|
|
|
|
+ }
|
|
|
|
+ if (data1[i].details) {
|
|
|
|
+ for(let z = 0; z < data1[i].details[j].content.details[idd].details.length; z++) {
|
|
|
|
+ data1[i].details[j].content.details[idd].details[z].state = 0
|
|
|
|
+ }
|
|
|
|
+ data1[i].details[j].content.details[idd].details[ind].state = 1
|
|
|
|
+ }
|
|
|
|
+ setChronicPush(data1,data1[i].id,data1[i].details[j].content);
|
|
}
|
|
}
|
|
confirmFormula(){//计算公式确定
|
|
confirmFormula(){//计算公式确定
|
|
this.setState({
|
|
this.setState({
|
|
@@ -258,8 +250,13 @@ class ChronicInfo extends React.Component{
|
|
radioVal:Object.assign({},obj.radioVal),//不设置radioVal只有最近一次选中的值
|
|
radioVal:Object.assign({},obj.radioVal),//不设置radioVal只有最近一次选中的值
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- calcuFormula(it,j, v, i) { //计算公式计算
|
|
|
|
- const { calcuFormula, data ,chronicPushItems} = this.props;
|
|
|
|
|
|
+ calcuFormula(item,j, v, i) { //计算公式计算
|
|
|
|
+ const { calcuFormula, data ,chronicPushItems,calcuValues} = this.props;
|
|
|
|
+ let pushObj = deepClone(chronicPushItems);
|
|
|
|
+ if(calcuValues&&calcuValues[pushObj[i].id]){
|
|
|
|
+ pushObj[i].details[j].content=calcuValues&&calcuValues[pushObj[i].id];
|
|
|
|
+ }
|
|
|
|
+ let it = pushObj[i].details[j];
|
|
let allHasInfo = true;
|
|
let allHasInfo = true;
|
|
for (let i = 0; i < it.content.details.length; i++) {
|
|
for (let i = 0; i < it.content.details.length; i++) {
|
|
if(it.content.details[i].controlType == 2) { //输入框类型的有没有填值
|
|
if(it.content.details[i].controlType == 2) { //输入框类型的有没有填值
|
|
@@ -280,21 +277,20 @@ class ChronicInfo extends React.Component{
|
|
|
|
|
|
}
|
|
}
|
|
if(allHasInfo) { //所有都有值,则计算
|
|
if(allHasInfo) { //所有都有值,则计算
|
|
- // delete it.content.resultz
|
|
|
|
let param = {
|
|
let param = {
|
|
type: 2,
|
|
type: 2,
|
|
data: it,
|
|
data: it,
|
|
disId: v.id,
|
|
disId: v.id,
|
|
pIndex: j,
|
|
pIndex: j,
|
|
ppIndex: i
|
|
ppIndex: i
|
|
- }
|
|
|
|
- calcuFormula({param,chronicPushItems})
|
|
|
|
|
|
+ };
|
|
|
|
+ calcuFormula({param,chronicPushItems:pushObj})
|
|
} else { //不是所有值都填过了
|
|
} else { //不是所有值都填过了
|
|
Notify.info('请填写计算公式内容')
|
|
Notify.info('请填写计算公式内容')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
getDetail(){
|
|
getDetail(){
|
|
- const {data,indexs,formulaResult,calcuResult} = this.props;
|
|
|
|
|
|
+ const {data,indexs,formulaResult,calcuResult,calcuValues} = this.props;
|
|
const {formulaId,optionId,possible,radioVal,isFormulaConfirm} = this.state;
|
|
const {formulaId,optionId,possible,radioVal,isFormulaConfirm} = this.state;
|
|
let list = data&&data.map((v,i)=>{
|
|
let list = data&&data.map((v,i)=>{
|
|
return <div className={style["list"]}>
|
|
return <div className={style["list"]}>
|
|
@@ -303,12 +299,6 @@ class ChronicInfo extends React.Component{
|
|
<img src={infoPic} className={style["infoPic"]} onClick={this.showInfo.bind(this,v.id)}/>
|
|
<img src={infoPic} className={style["infoPic"]} onClick={this.showInfo.bind(this,v.id)}/>
|
|
:
|
|
:
|
|
</p>:''}
|
|
</p>:''}
|
|
- {/*<MiniToast title='静态知识'
|
|
|
|
- icon={allTableIcon}
|
|
|
|
- show={infoId&&infoId==v.id?true:false}
|
|
|
|
- close={this.closeInfo}>
|
|
|
|
- {pureText}
|
|
|
|
- </MiniToast>*/}
|
|
|
|
{v.details&&v.details.map((it,j)=>{
|
|
{v.details&&v.details.map((it,j)=>{
|
|
if(it.type==1){
|
|
if(it.type==1){
|
|
return <p>
|
|
return <p>
|
|
@@ -328,6 +318,7 @@ class ChronicInfo extends React.Component{
|
|
}else if(it.type==2){
|
|
}else if(it.type==2){
|
|
const cres = calcuResult&&calcuResult[v.id]||it.content.result;
|
|
const cres = calcuResult&&calcuResult[v.id]||it.content.result;
|
|
const result = cres&&cres[1]&&cres[1].text;
|
|
const result = cres&&cres[1]&&cres[1].text;
|
|
|
|
+ const details = calcuValues&&calcuValues[v.id]&&calcuValues[v.id].details||it.content.details;
|
|
return <div className={style["marTop"]}>
|
|
return <div className={style["marTop"]}>
|
|
<span className={style["limit"]}>
|
|
<span className={style["limit"]}>
|
|
计算公式结果:
|
|
计算公式结果:
|
|
@@ -349,8 +340,8 @@ class ChronicInfo extends React.Component{
|
|
confirm={this.confirmFormula.bind(this,v,i)}
|
|
confirm={this.confirmFormula.bind(this,v,i)}
|
|
footer="true">
|
|
footer="true">
|
|
<table>
|
|
<table>
|
|
- {it.content.details.map((item,idd)=>{
|
|
|
|
- if(item.controlType==3||item.controlType==1){//单选
|
|
|
|
|
|
+ {details.map((item,idd)=>{
|
|
|
|
+ if(item.controlType==0){//单选
|
|
return <tr>
|
|
return <tr>
|
|
<td>
|
|
<td>
|
|
<span>{'请选择'+item.name+':'}</span>
|
|
<span>{'请选择'+item.name+':'}</span>
|
|
@@ -384,7 +375,7 @@ class ChronicInfo extends React.Component{
|
|
</table>
|
|
</table>
|
|
<div className={style["forMulBtn"]} onClick={this.calcuFormula.bind(this,it,j, v, i)}>计算</div>
|
|
<div className={style["forMulBtn"]} onClick={this.calcuFormula.bind(this,it,j, v, i)}>计算</div>
|
|
<table>
|
|
<table>
|
|
- {it.content.result && Array.isArray(it.content.result) &&it.content.result.map((itemResult, resultIndex) => {
|
|
|
|
|
|
+ {cres && Array.isArray(cres) &&cres.map((itemResult, resultIndex) => {
|
|
return <tr>
|
|
return <tr>
|
|
<td>
|
|
<td>
|
|
<span>{itemResult.name+':'}</span>
|
|
<span>{itemResult.name+':'}</span>
|