ソースを参照

管理评估量表显示,列表加入量表显示未完

zhouna 6 年 前
コミット
d5a7193108

+ 5 - 19
src/components/ChronicInfo/index.jsx

@@ -35,10 +35,6 @@ class ChronicInfo extends React.Component{
       formulaId:null, //计算公式
       optionId:null,  //可能结果,
       isAssessConfirm:false,    //是否点击评估弹窗确定按钮
-      tableName:'' , //点击的量表名称
-      tableId:null ,//点击的量表id
-      parentId:null ,
-      parentIndex:null,
       radioVal:{},  //可能结果选择内容
       possible:{},  //可能结果
       formulaParam: {}, //量表计算公式计算入参
@@ -123,8 +119,8 @@ class ChronicInfo extends React.Component{
       });
     } 
   }
-  showTable(it,parentId,parentIndex){
-    const {formulaResult,scaleInfo} = this.props;
+  showTable(it){
+    const {scaleInfo} = this.props;
     // 密西根糖尿病周围神经病评分(MDNS), id:40744
     const item = {
       id:it.id,
@@ -132,26 +128,17 @@ class ChronicInfo extends React.Component{
     };
     // 判断:store里已经有该量表就无需重新调接口
     if(scaleInfo&&scaleInfo[it.id]){
-      this.props.hideList({name:'showTable',value:true});
+      this.props.hideList({name:'showTable',value:true},it);
     }else{
       this.props.getScaleInfo(item);
     }
 
     this.setState({
-      tableName:it.name,
-      tableId:it.id,
-      parentId:parentId,
-      parentIndex:parentIndex,
       formulaId:null, //关闭计算公式和可能结果弹窗
       optionId:null
     })
   }
   closeTable(){
-    this.setState({
-      tableName:'',
-      tableId:null,
-      parentId:null,
-    })
     this.props.hideList({name:'showTable',value:false});
   }
   showFormula(id){//计算公式
@@ -440,7 +427,6 @@ class ChronicInfo extends React.Component{
       <span className={style['okBtn']} onClick={()=>this.closeTable()}>确定</span>
     </div>;
     const {chronicMagItem,tableList,chronicDesease,formulaResult,showHide} = this.props;
-    const {tableName,tableId,parentId,parentIndex} = this.state;
     return <div className={style["tips"]} style={{marginBottom:'15px'}}>
               <div className={`${style["tips-title"]} ${style["chronic"]}`}>
                 <div className={style["tips-name"]}>
@@ -472,12 +458,12 @@ class ChronicInfo extends React.Component{
                       </ul>
               </ConfirmModal>
               {showHide&&showHide.showTable?<ComplexModal onclose={this.closeTable} footer={scaleFooter}
-                      title={tableName}
+                      title={showHide.name}
                       icon={tableIcon}
                       top={20}
                       bottom={20}
                       width={820}>
-                <ScaleTable title={tableName} tableId={tableId} parentId={parentId} parentIndex={parentIndex}></ScaleTable>
+                <ScaleTable title={showHide.name} tableId={showHide.id}></ScaleTable>
               </ComplexModal>:''}
       </div>
   }

+ 0 - 18
src/components/DiagnosticList/index.jsx

@@ -192,23 +192,6 @@ class DiagnosticList extends Component {
             });
         }
     }
-    showTable(it,parentId,parentIndex){
-      // 密西根糖尿病周围神经病评分(MDNS), id:40744
-      const item = {
-        id:it.id,
-        name:it.name
-      };
-      this.props.hideList({name:'showTable',value:true});
-
-      this.setState({
-        tableName:it.name,
-        tableId:it.id,
-        parentId:parentId,
-        parentIndex:parentIndex,
-        formulaId:null, //关闭计算公式和可能结果弹窗
-        optionId:null
-      })
-    }
     handleListClick(){
 
     }
@@ -284,7 +267,6 @@ class DiagnosticList extends Component {
                        <AssessResult handleSave={saveAssessInfos}
                                      handleSavePossible={this.handleSavePossible}
                                      closeAssess={this.showAssessFn.bind(this)}
-                                     showScaleFn={this.showTable.bind(this)}
                                      showListScale={this.handleListClick.bind(this)}
                                      radioVal={radioVal}
                                      possible={possible}

+ 3 - 8
src/components/ScaleTable/index.jsx

@@ -132,8 +132,7 @@ class ScaleTable extends React.Component{
   }
 
   handleFormula(data){//得分计算
-    const {tableId,parentId,scaleInfo,parentIndex} = this.props; 
-    const {valueData} = this.state; 
+    const {valueData} = this.state;
     this.setState({
       start:true
     })
@@ -158,10 +157,7 @@ class ScaleTable extends React.Component{
     // 将计算结果存在state,防止页面跳动问题
     const params = {
       type:1,
-      data:valueData,
-      pId:parentId,
-      id:tableId,
-      pIndex:parentIndex
+      data:valueData
     }
     const that = this;
     getFormulaResult(params).then((res)=>{
@@ -206,7 +202,7 @@ class ScaleTable extends React.Component{
   }
   componentWillUnmount(){
     // 储存计算结果和选择后的data
-    const {tableId,getResult,parentId,parentIndex,scaleInfo,saveScaleData,formulaResult} = this.props; 
+    const {tableId,getResult,scaleInfo,saveScaleData,formulaResult} = this.props;
     const {valueData,scaleResult1,start} = this.state; 
     // 替换表格内容--1)没有点计算且没有计算结果;2)点了计算
     const scaleResult = scaleResult1 || formulaResult&&formulaResult[tableId]; //量表计算结果
@@ -228,7 +224,6 @@ class ScaleTable extends React.Component{
         type:1,
         data:scaleResult1,
         id:tableId,
-        pIndex:parentIndex
       }
       getResult&&getResult(params);
     }  

+ 9 - 0
src/containers/AssessResult.js

@@ -6,6 +6,7 @@ import {billing} from '@store/async-actions/pushMessage';
 import {getAssessData,getIndexData} from '@store/async-actions/fetchModules';
 import {SET_ASSESS_DATA,SET_INDEX_DATA,SET_INDEX_SUB_TYPE,REMOVE_ASSESS_ITEMS,CLEAR_INDEX_DATA,SET_CHRONIC_CALCU_RESULT} from '@types/assessResult';
 import {parseChartData,deepClone} from '@utils/tools';
+import {SHOW_TABLE_LIST,HIDE_TABLE_LIST} from '@store/types/pushMessage';
 
 /***
  * 管理评估逻辑:
@@ -94,6 +95,14 @@ function mapDispatchToProps(dispatch) {
         type: SET_CHRONIC_CALCU_RESULT,
         data:deepClone(data)
       })
+    },
+    showScaleFn(item){
+      dispatch({
+        type:SHOW_TABLE_LIST,
+        name:'showTable',
+        value:true,
+        item:Object.assign({},item)
+      });
     }
   }
 }

+ 4 - 4
src/containers/ChronicInfo.js

@@ -35,11 +35,12 @@ function mapDispatchToProps(dispatch){
       dispatch(getTableList(id))
       // dispatch({type:SHOW_TABLE_LIST})
     },
-    hideList(item){
+    hideList(param,item){
       dispatch({
         type:SHOW_TABLE_LIST,
-        name:item.name,
-        value:item.value
+        name:param.name,
+        value:param.value,
+        item:item?Object.assign({},item):undefined
       })
     },
     getScaleInfo(item){
@@ -47,7 +48,6 @@ function mapDispatchToProps(dispatch){
     },
     addAssessItem(row,pIndex,i){         //加入评估记录
       let obj = Object.assign({},row);
-      //obj.details[i].add=true;
       dispatch({
         type:ADD_ASSESS_ITEMS,
         data:obj,

+ 1 - 8
src/containers/DiagnosticList.js

@@ -14,7 +14,6 @@ import {MODI_LOADING} from '@store/types/homePage.js';
 import {saveMessage} from "../store/async-actions/print";
 import {SET_SAVE_ASSESS_DATA} from "@types/assessResult";
 import {saveClickNum} from '@store/async-actions/homePage';
-import {SHOW_TABLE_LIST,HIDE_TABLE_LIST} from '@store/types/pushMessage';
 
 
 function mapStateToProps(state) {
@@ -32,6 +31,7 @@ function mapStateToProps(state) {
         typeConfig: state.typeConfig.typeConfig,
         wholeResults:assessResult.wholeResults,
         scaleInfo: pushMessage.scaleInfo,//量表内容
+        showHide: pushMessage.showHide,
     }
 }
 
@@ -127,13 +127,6 @@ function mapDispatchToProps(dispatch) {
             }
           }
         },
-        hideList(item){
-          dispatch({
-            type:SHOW_TABLE_LIST,
-            name:item.name,
-            value:item.value
-          })
-        },
     }
 }
 

+ 2 - 1
src/store/async-actions/pushMessage.js

@@ -186,7 +186,8 @@ export const getScaleInfo = (it)=>{
                 dispatch({
                     type:SHOW_TABLE_LIST,
                     name:'showTable',
-                    value:true
+                    value:true,
+                    item:Object.assign({},it)
                 })
             }else{
                 Notify.info(result.msg||'暂无量表信息')

+ 1 - 1
src/store/reducers/pushMessage.js

@@ -67,7 +67,7 @@ export default function(state = initState, action) {
       res.tableList = action.data;
       return res;
     case SHOW_TABLE_LIST://显示、隐藏量表列表
-      res.showHide = Object.assign({},res.showHide,{[action.name]:action.value});
+      res.showHide = Object.assign({},res.showHide,{[action.name]:action.value},action.item);
       return res;
     case SET_CHRONIC_PUSHS:
       res.chronicPushItems = action.data;