Explorar o código

导入异常选中按钮文字联动。事件监听条件限制

luolei %!s(int64=5) %!d(string=hai) anos
pai
achega
7be6e996d4

+ 4 - 4
src/components/EmergencyProcedure/EmergencyPart/index.jsx

@@ -21,12 +21,12 @@ class EmergencyProcedure extends React.Component {
   componentDidMount(){
     const height = getWindowInnerHeight()-144;
     this.$cont.current.style.height = height+"px";
-    if(this.$cont.current){
-      windowEventHandler('resize', ()=>{
+    windowEventHandler('resize', ()=>{
+      if(this.$cont.current){
         const height = getWindowInnerHeight()-144;
         this.$cont.current.style.height = height+"px";
-      });
-    }
+      }
+    });
   }
   componentWillReceiveProps(nextState){
     if(nextState.idx != this.props.idx){

+ 4 - 4
src/components/MedicalInfo/index.jsx

@@ -76,12 +76,12 @@ class MedicalInfo extends Component {
   componentDidMount(){
     const height = getWindowInnerHeight()-170;
     this.$cont.current.style.height = height+"px";
-    if(this.$cont.current){
-      windowEventHandler('resize', ()=>{
+    windowEventHandler('resize', ()=>{
+      if(this.$cont.current){
         const height = getWindowInnerHeight()-170;
         this.$cont.current.style.height = height+"px";
-      });
-    }
+      }
+    });
   }
   componentWillReceiveProps(){
     this.setState({

+ 4 - 2
src/components/PushItems/index.jsx

@@ -136,8 +136,10 @@ class PushItems extends Component {
     this.$cont.current.style.height = height + "px";
 
     windowEventHandler('resize', ()=>{
-      const height = getWindowInnerHeight() - 200;
-      this.$cont.current.style.height = height + "px";
+      if(this.$cont.current){
+        const height = getWindowInnerHeight() - 200;
+        this.$cont.current.style.height = height + "px";
+      }
     });
   }
 

+ 4 - 4
src/components/ScaleSearch/index.jsx

@@ -91,12 +91,12 @@ class ScaleSearch extends Component {
   componentDidMount(){
     const height = getWindowInnerHeight()-170;
     this.$cont.current.style.height = height+"px";
-    if(this.$cont.current){
-      windowEventHandler('resize', ()=>{
+    windowEventHandler('resize', ()=>{
+      if(this.$cont.current){
         const height = getWindowInnerHeight()-170;
         this.$cont.current.style.height = height+"px";
-      });
-    }
+      }
+    });
   }
   componentWillReceiveProps(){
     this.setState({

+ 6 - 6
src/components/TemplateItems/index.jsx

@@ -17,12 +17,12 @@ class TemplateItems extends React.Component {
     componentDidMount(){
         const height = getWindowInnerHeight()-206;
         this.$cont.current.style.height = height+"px";
-        if(this.$cont.current){
-          windowEventHandler('resize', ()=>{
-            const height = getWindowInnerHeight()-206;
-            this.$cont.current.style.height = height+"px";
-          });
-        }
+        windowEventHandler('resize', ()=>{
+            if(this.$cont.current){
+                const height = getWindowInnerHeight()-206;
+                this.$cont.current.style.height = height+"px";
+            }
+        });
     }
     genItems() {
         const Items = [];

+ 7 - 59
src/components/WrapModalBody/WrapModalTableSon/index.jsx

@@ -7,86 +7,34 @@ import {getStatusImg} from '@utils/tools';
 class WrapModalTableSon extends React.Component {
   constructor(props) {
     super(props);
-    this.state = {
-      msg:'选中异常值数据'
-    }
     this.getImgPath = this.getImgPath.bind(this)
-    this.selectWaring = this.selectWaring.bind(this)
-    this.allCheckImportIns = this.allCheckImportIns.bind(this)
-    this.selectOneCheck = this.selectOneCheck.bind(this)
-  }
-  selectOneCheck(name,groupName,item){
-    const {selectOneCheck,allCheck} = this.props
-    selectOneCheck&&selectOneCheck(name,groupName,item)
-    
-    setTimeout(() => {
-      console.log(allCheck,78787)
-    }, 1000);
   }
   getImgPath(name,groupName,item){
-    const { checkedList } = this.props;
+    const { checkedList,selectOneCheck } = this.props;
     let num = 0;
     for(let k = 0;k < checkedList.length;k++){
       let tmpLis = checkedList[k];
       if(tmpLis == name){
-        return <img className={style.check} onClick={()=>this.selectOneCheck(name,groupName,item)} src={check_right} alt="" />
+        return <img className={style.check} onClick={()=>selectOneCheck(name,groupName,item)} src={check_right} alt="" />
       }else{
         ++num
       }
     }
     if(num == checkedList.length){
-      return <img className={style.check} onClick={()=>this.selectOneCheck(name,groupName,item)} src={check_circle} alt="" />
-    }
-  }
-  selectWaring(){
-    let tmpMsg = this.state.msg
-    const { selectWaring,hospitalSonInspect,checkedList,allCheck } = this.props;
-    // console.log(checkedList)
-    // let tmpAll = false,num=0;
-    // if(hospitalSonInspect&&hospitalSonInspect.lisExcelWrapper){
-    //   for(let i = 0;i < hospitalSonInspect.lisExcelWrapper.length;i++){
-    //     for(let j = 0;j < checkedList.length;j++){
-    //       if(hospitalSonInspect.lisExcelWrapper[i].itemName == checkedList[j]&&hospitalSonInspect.lisExcelWrapper[i].type!=0){
-    //         num++
-    //       }
-          
-    //     }
-    //   }
-    // }
-    // console.log(num,'sssssssssssssss')
-    // this.setState({
-    //   msg:(num == 0)?'取消选中异常值数据集':'选中异常值数据'
-    // },()=>{
-    //   selectWaring&&selectWaring()
-    // })
-    this.setState({
-      msg:tmpMsg=='取消选中异常值数据集'?'选中异常值数据':'取消选中异常值数据集'
-    })
-    selectWaring&&selectWaring()
-  }
-  allCheckImportIns(){
-    const { allCheckImportIns,allCheck } = this.props;
-    if(!allCheck){
-      this.setState({
-        msg:'取消选中异常值数据集'
-      })
-    }else{
-      this.setState({
-        msg:'选中异常值数据'
-      })
+      return <img className={style.check} onClick={()=>selectOneCheck(name,groupName,item)} src={check_circle} alt="" />
     }
-    allCheckImportIns&&allCheckImportIns()
   }
+
   render() {
-    const { hospitalSonInspect,allCheck } = this.props;
+    const { hospitalSonInspect,allCheck,btnMsg,selectWaring,allCheckImportIns } = this.props;
     return <div className={style['modalTable']}>
       <div className={style.sonTitle}>
-        <span>组名称 : {hospitalSonInspect.groupName}</span><span className={style.btn} onClick={this.selectWaring}>{this.state.msg}</span>
+        <span>组名称 : {hospitalSonInspect.groupName}</span><span className={style.btn} onClick={selectWaring}>{btnMsg}</span>
       </div>
       <div className={`${style.SonTable}`}>
         <table>
           <tr className={style.head}>
-            <td className={`${style.fst}`} onClick={this.allCheckImportIns}><img className={style.check} src={allCheck?check_right:check_circle} alt="" />全选</td>
+            <td className={`${style.fst}`} onClick={allCheckImportIns}><img className={style.check} src={allCheck?check_right:check_circle} alt="" />全选</td>
             <td className={`${style.sec}`}>编号</td>
             <td className={`${style.trd}`}>项目名称</td>
             <td className={`${style.four}`}>结果</td>

+ 2 - 1
src/components/WrapModalBody/index.jsx

@@ -18,7 +18,7 @@ class WrapModalBody extends React.Component {
     dragBox('previewWrapper', 'previewStatic', 'del')
   }
   render() {
-    const { handleSearch, hospitalInspect,height,selectOneCheck, handleGetSonList,selectWaring,message, hospitalSonInspect,allCheckImportIns,allCheck,checkedList,selectGroupList } = this.props;
+    const { btnMsg,handleSearch, hospitalInspect,height,selectOneCheck, handleGetSonList,selectWaring,message, hospitalSonInspect,allCheckImportIns,allCheck,checkedList,selectGroupList } = this.props;
     return <div className={style['container']}>
       <div className={`${style.left}`}>
         <WrapModalTitle handleSearch={handleSearch} message={message}></WrapModalTitle>
@@ -36,6 +36,7 @@ class WrapModalBody extends React.Component {
             selectOneCheck={selectOneCheck}
             selectGroupList={selectGroupList}
             hospitalSonInspect={hospitalSonInspect}
+            btnMsg={btnMsg}
           ></WrapModalTableSon>:null
         }
       </div>

+ 1 - 0
src/containers/WrapModalBody.js

@@ -24,6 +24,7 @@ function mapStateToProps(state) {
     allCheck: state.wrapModalBody.allCheck,
     selectGroupList: state.wrapModalBody.selectGroupList,
     checkedList: state.wrapModalBody.checkedList,
+    btnMsg: state.wrapModalBody.btnMsg,
   }
 }
 

+ 1 - 0
src/store/actions/wrapModalBody.js

@@ -28,3 +28,4 @@ export const getHospitalInspectDetailList = (list,name,time) => ({         //检
 })
 
 
+

+ 22 - 0
src/store/reducers/wrapModalBody.js

@@ -20,6 +20,7 @@ const initWrapModal = {
   selectGroupList:[],//选的组的明细可能有多个组
   allCheck:false,//全选反选
   checkedList:[],//选中的小项
+  btnMsg:'选中全部异常值数据'
 }
 
 export default (state = initWrapModal, action) => {
@@ -90,6 +91,7 @@ export default (state = initWrapModal, action) => {
             warArr.push(listWrap.lisExcelWrapper[m])
             checked.push(tmpName)
           }
+          newState.btnMsg = "取消选中全部异常值数据集"
         }else{//全部的选中就去掉所有异常选中的
           for(let n = 0;n < tmpCheckedLis.length;n++){
             if(tmpType == 0 && tmpName == tmpCheckedLis[n]){//已选的正常的选项要保留
@@ -99,6 +101,7 @@ export default (state = initWrapModal, action) => {
               checked.push(tmpName)
             }
           }
+          newState.btnMsg = "选中全部异常值数据"
         }
       }
       for(let i = 0;i < tmpGroup.length;i++){
@@ -182,6 +185,23 @@ export default (state = initWrapModal, action) => {
           newState.allCheck = false;
         }
       }
+
+      let selectNum=0;
+      let tmpCheckedList = JSON.parse(JSON.stringify(newState.checkedList))
+      for(let m =0;m < listWrap.lisExcelWrapper.length;m++){
+        let tmpName = listWrap.lisExcelWrapper[m].itemName
+        let tmpType = listWrap.lisExcelWrapper[m].type
+        if(tmpType != 0 && (tmpCheckedList.filter(item=>item == tmpName)).length == 0){
+          ++selectNum
+        }
+      }
+      for(let m =0;m < listWrap.lisExcelWrapper.length;m++){
+        if(selectNum>0){
+          newState.btnMsg = "选中全部异常值数据"
+        }else{
+          newState.btnMsg = "取消选中全部异常值数据集"
+        }
+      }
       return newState;
   }
   if (action.type == SET_ALLCHECK_INS) {
@@ -205,6 +225,7 @@ export default (state = initWrapModal, action) => {
         if(numFst==0){
           tmpGroup.push(listWrap)
         }
+        newState.btnMsg = "取消选中全部异常值数据集"
         newState.checkedList=[...tmpCheckedLis]
         newState.selectGroupList = [...tmpGroup]
       }else{//反选
@@ -213,6 +234,7 @@ export default (state = initWrapModal, action) => {
             tmpGroup.splice(j,1)
           }
         }
+        newState.btnMsg = "选中全部异常值数据"
         newState.checkedList=[]
         newState.selectGroupList = [...tmpGroup]
       }

+ 1 - 1
src/utils/tools.js

@@ -151,7 +151,7 @@ const getUrlArgObject = (parm) => {
     return args[parm];//返回对象  
 } 
 const getAllDataList =(baseList) =>{           //获取所有模块结构化的数据
-    let jsonData = {};console.log(111,baseList)
+    let jsonData = {};//console.log(111,baseList)
     //月经史公式
     const other = baseList.otherHistory;
     jsonData.lis = {};