浏览代码

Squashed commit of the following:

commit 7ab97d32ae5663dd04118f943557f800fbcf688e
Merge: d1abfc9 eb3810e
Author: liucf <liucf@zjlantone.com>
Date:   Mon May 13 16:56:39 2019 +0800

    Merge branch 'ChronicMag' of http://192.168.2.236:10080/zhouna/newICSS into ChronicMag

commit d1abfc945fb67ce4d4cec28b60f95ed19894fc37
Author: liucf <liucf@zjlantone.com>
Date:   Mon May 13 16:56:28 2019 +0800

    输入框类型onInput事件处理;可能结果下拉框的值与选择结果保持一致

commit eb3810e976a66fc4dfc2a6b2a7180fdf55e4d1c5
Author: zhouna <zhouna@zjlantone.com>
Date:   Mon May 13 16:48:56 2019 +0800

    图表图标对应

commit 3291b1f2c1446fbaabef6cd7aca9a182772dc3ea
Author: zhouna <zhouna@zjlantone.com>
Date:   Mon May 13 15:46:31 2019 +0800

    管理评估添加loading

commit 9ed2c65f42508ae1510b6044512f3f6639af384c
Author: zhouna <zhouna@zjlantone.com>
Date:   Mon May 13 15:17:32 2019 +0800

    历史评估图表显示bug修改1359
liucf 6 年之前
父节点
当前提交
29a58217d9

+ 16 - 3
src/common/components/InlineTag/index.jsx

@@ -21,7 +21,7 @@ class InlineTag extends Component {
     this.$span = React.createRef();
     this.state = {
       editable:false,
-      value:props.value
+      value:props.value||''
     };
     this.changeToEdit = this.changeToEdit.bind(this);
     this.changeToClick = this.changeToClick.bind(this);
@@ -47,17 +47,30 @@ class InlineTag extends Component {
     });
   }
   handleInput(e){       //输入时保存临时值,在修改灰显为黑色时判断用
+    const {handleInput,ikey,prefix,suffix} = this.props;
     const text = e.target.innerText || e.target.innerHTML;
+    // 内容全部删除时,要把空值存到store,否则会遗留最后一个字且为灰色无法删除
+    if(!text){
+      this.$span.current.innerText?(this.$span.current.innerText=''):(this.$span.current.innerHTML='');      //修改生成文字变成输入的2倍bug
+      handleInput&&handleInput({text:text,ikey,prefix,suffix});
+      this.setState({
+        value:" "
+      });
+      return
+    }
     this.setState({
       value:text
     });
-   // e.target.innerText = text;
+   // e.target.innerText = text;  
   }
   handleBlur(e){         //鼠标离开是保存值到store中
     const {value} = this.state;
     const {handleInput,ikey,prefix,suffix} = this.props;
     this.$span.current.innerText?(this.$span.current.innerText=''):(this.$span.current.innerHTML='');      //修改生成文字变成输入的2倍bug
-    handleInput&&handleInput({text:value,ikey,prefix,suffix});
+    handleInput&&handleInput({text:value.trim(),ikey,prefix,suffix});
+    this.setState({
+      value:value.trim()
+    });
   }
   handleFocus(e){
     e.stopPropagation();

+ 2 - 1
src/components/AssessResult/AssessHis/index.jsx

@@ -44,7 +44,7 @@ class AssessResultHis extends Component {
   }
   handoutTypes(obj,item,i){
     const {wholeAssess,wholeIndexs,chooseSelecteds,scaleResult,wholeResults,wholeAssessText} =obj;
-    const {getIndexData,inquiryDate,indexData,timeTypes} = this.props;
+    const {getIndexData,inquiryDate,indexData,timeTypes,indexNames} = this.props;
     const {chartTimeTypes} = this.state;
     const name = item.regionName+":";
     const list = item.data&&item.data.rows;
@@ -64,6 +64,7 @@ class AssessResultHis extends Component {
       case 10:    //数据来源于后台
         return <ChartItem title={name}
                           data={indexData||{}}
+                          names={indexNames||{}}
                           timeTypes={JSON.stringify(chartTimeTypes||{})=='{}'?timeTypes&&timeTypes[i]:chartTimeTypes[i]}
                           initFn={getIndexData}
                           endDate={inquiryDate}

+ 2 - 2
src/components/AssessResult/ChartItem/index.jsx

@@ -177,8 +177,8 @@ class Chart extends Component{
         type: 'line',
         data: values,
         showAllSymbol:true,
-        symbol:config.chartSymbols[(len+j)%8],
-        symbolSize:7,
+        symbol:'image://'+require('@common/images/'+((len+j)%8+1)+'.png'),//config.chartSymbols[(len+j)%8],
+        symbolSize:10,
         itemStyle:{
           color:config.chartColors[(len+j)%8]
         }

+ 1 - 1
src/components/AssessResult/ScaleItem/index.jsx

@@ -326,7 +326,7 @@ class ScaleItem extends Component {
     });
   }
   render() {
-    const {title,handleInp,disabled,isRecommend,formulaResult} = this.props;
+    const {title,handleInp,disabled,isRecommend} = this.props;
     return <div className={style['assess-item']}>
       {isRecommend?'':<h2>{title}</h2>}
       <div className={style['item-content']}>

+ 2 - 0
src/components/AssessResult/index.jsx

@@ -7,6 +7,7 @@ import Information from '../Information'
 import ChartItem from "./ChartItem";
 import Notify from '@commonComp/Notify';
 import {readyKeepHistory} from '@utils/tools';
+import loadingIcon from '@common/images/loading.gif';
 
 class AssessResult extends Component {
   constructor(props) {
@@ -145,6 +146,7 @@ class AssessResult extends Component {
       <div className={style['printShow']}>
         <Information></Information>
       </div>
+      {!(data&&data.length>0)?<p className={style['loading']}><img src={loadingIcon} alt='loading...'/></p>:''}
       {data && data.map((it, i) => {
         return this.handoutTypes(it, i);
       })}

+ 10 - 0
src/components/AssessResult/index.less

@@ -187,6 +187,16 @@
     margin-right: 3px;
   }
 }
+.loading{
+  text-align: center;
+  position: absolute;
+  top: 49%;
+  left: 49%;
+  img{
+    width: 40px;
+  }
+}
+
 @media print {
   .printShow,.textareaStatic {
     display: block;

+ 12 - 3
src/components/ChronicInfo/index.jsx

@@ -116,9 +116,18 @@ class ChronicInfo extends React.Component{
     })
   }
   closeOption(){
-    this.setState({
-      optionId:null
-    })
+    // 关闭-有可能结果则保持与结果一致,没有就保持最新选择的内容
+    let {possible,radioVal} = this.state;
+    if(JSON.stringify(possible)=='{}'){
+      this.setState({
+        optionId:null
+      })
+    }else{
+      this.setState({
+        radioVal:Object.assign({},radioVal,possible),
+        optionId:null,
+      });
+    } 
   }
   showTable(it,parentId,parentIndex){
     const {formulaResult,scaleInfo} = this.props;

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

@@ -39,7 +39,7 @@ class NumberDrop extends Component{
     this.handleNumFocus = this.handleNumFocus.bind(this);
     this.handleBlur = this.handleBlur.bind(this);
     this.changeToEdit = this.changeToEdit.bind(this);
-    //this.handleKeyDowm = this.handleKeyDowm.bind(this);
+    // this.handleKeyDowm = this.handleKeyDowm.bind(this);
     this.beyondArea = this.beyondArea.bind(this);
   }
   select(text){        //选中键盘上数字事件
@@ -191,17 +191,17 @@ class NumberDrop extends Component{
     const {handleHide} = this.props;
     handleHide&&handleHide();
   }
-  /*handleKeyDowm(e){
-    handleEnter();
+  // handleKeyDowm(e){
+    // handleEnter();
     //只能输入数字
-    const key = e.key;
+    /*const key = e.key;
     const ctrlOn = e.ctrlKey;
     const isCopyPaste = ctrlOn&&(key=='v'||key=='c');
     if((!/[0-9|.|~|\/]/.test(key)&&key.length==1&&!isCopyPaste)){
       e.preventDefault();
       return false;
-    }
-  }*/
+    }*/
+  // }
   getClasses(){         //整个标签是否有值的状态
     const {hideTag,placeholder,value,isImports} = this.props;
     const $span = this.$span.current;

+ 2 - 18
src/containers/AssessResult.js

@@ -5,8 +5,7 @@ import {ISREAD} from '@store/types/homePage.js';
 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} from '@types/assessResult';
-import store from '@store';
-import {SET_SCALE_INFO} from "../store/types/pushMessage";
+import {parseChartData} from '@utils/tools';
 
 /***
  * 管理评估逻辑:
@@ -94,22 +93,7 @@ function mapDispatchToProps(dispatch) {
   }
 }
 
-function parseChartData(indexData){
-  let arr=[],obj={},temp={};
-  let nameArr=[],nameObj={};
-  if(!indexData){
-    return [];
-  }
-  indexData.itemIndexData.map((it)=>{
-    temp=indexData.indexConfigData.find((i)=>{return it.itemName==i.indexUnique});
-    arr=obj[temp.indexDesc]||[];
-    nameArr=nameObj[temp.indexDesc]||[];
-    obj[temp.indexDesc]=[...arr,it];
-    nameObj[temp.indexDesc]=[...nameArr,it.itemName];
-  });
-  //nameObj,obj;
-  return {nameObj,obj};
-}
+
 const AssessResultContainer = connect(mapStateToProps, mapDispatchToProps)(AssessResult);
 
 export default AssessResultContainer;

+ 2 - 16
src/containers/AssessResultHis.js

@@ -6,6 +6,7 @@ import {billing} from '@store/async-actions/pushMessage';
 import {getAssessHis,getIndexData} from '@store/async-actions/fetchModules';
 import {SET_ASSESS_DATA,SET_INDEX_DATA} from '@types/assessResult';
 import {SET_ASSESS_HISTORY_DATA,SET_ASSESS_HISTORY_LOADING} from '@types/assessResultHis';
+import {parseChartData} from '@utils/tools';
 
 /***
  * 管理评估逻辑:
@@ -22,6 +23,7 @@ function mapStateToProps(state) {
   return {
     list:assessResultHis,    //已获取到的历史评估列表
     indexData:assessResult.indexData,
+    indexNames:assessResult.indexNames,
     loading:assessResultHis.loading,
     timeTypes:assessResult.indexTimeTypes,    //图表切换的维度
   }
@@ -76,22 +78,6 @@ function mapDispatchToProps(dispatch) {
   }
 }
 
-function parseChartData(indexData){
-  let arr=[],obj={},temp={};
-  let nameArr=[],nameObj={};  //暂弃
-  if(!indexData){
-    return [];
-  }
-  indexData.itemIndexData.map((it)=>{
-    temp=indexData.indexConfigData.find((i)=>{return it.itemName==i.indexUnique});
-    arr=obj[temp.orderNo]||[];
-    nameArr=nameObj[temp.orderNo]||[];
-    obj[temp.orderNo]=[...arr,it];
-    nameObj[temp.orderNo]=[...nameArr,it.itemName];
-  });
-  //nameObj,obj;
-  return obj;
-}
 const AssessResultHisContainer = connect(mapStateToProps, mapDispatchToProps)(AssessResultHis);
 
 export default AssessResultHisContainer;

+ 5 - 1
src/store/actions/checkBody.js

@@ -425,7 +425,11 @@ export function setInputLabel(state,action){
       item.value=text;
     }
   }
-  res.saveText[i] = prefix+text+suffix;//console.log(res)
+  if(text){
+    res.saveText[i] = prefix+text+suffix;
+  }else{//删除完要清空
+    res.saveText[i] = "";
+  }
   res.update = Math.random();
   return res;
 }

+ 5 - 1
src/store/actions/currentIll.js

@@ -871,7 +871,11 @@ export function setInputLabel(state,action){
       item.value=text;
     }
   }
-  res.saveText[i] = prefix+text+suffix;
+  if(text){
+    res.saveText[i] = prefix+text+suffix;
+  }else{//删除完要清空
+    res.saveText[i] = "";
+  }
   res.update = Math.random();
   return res;
 }

+ 5 - 1
src/store/actions/mainSuit.js

@@ -741,7 +741,11 @@ export function setInputLabel(state,action){
       item.value=text;
     }
   }
-  res.saveText[i] = prefix+text+suffix;//console.log(res)
+  if(text){
+    res.saveText[i] = prefix+text+suffix;
+  }else{//删除完要清空
+    res.saveText[i] = "";
+  }
   res.update = Math.random();
   return res;
 }

+ 5 - 1
src/store/actions/otherHistory.js

@@ -216,7 +216,11 @@ export function setOtherInput(state,action){
   if(res.data[i]){
     res.data[i].value=text;
   }
-  res.saveText[i] = prefix+text+suffix;
+  if(text){
+    res.saveText[i] = prefix+text+suffix;
+  }else{//删除完要清空
+    res.saveText[i] = "";
+  }
   res.update = Math.random();
   return res;
 }

+ 20 - 0
src/utils/tools.js

@@ -920,6 +920,25 @@ function readyKeepHistory(){
     return 3;
   }
 }
+
+//评估图表数据转换
+function parseChartData(indexData){
+  let arr=[],obj={},temp={};
+  let nameArr=[],nameObj={};
+  if(!indexData){
+    return [];
+  }
+  indexData.itemIndexData.map((it)=>{
+    temp=indexData.indexConfigData.find((i)=>{return it.itemName==i.indexUnique});
+    arr=obj[temp.indexDesc]||[];
+    nameArr=nameObj[temp.indexDesc]||[];
+    obj[temp.indexDesc]=[...arr,it];
+    nameObj[temp.indexDesc]=[...nameArr,it.itemName];
+  });
+  //nameObj,obj;
+  return {nameObj,obj};
+}
+
 module.exports = {
     checkType: Type.checkType,
     regexp,
@@ -955,4 +974,5 @@ module.exports = {
     getCurrentDate,
     ifOtherClear,
     readyKeepHistory,
+    parseChartData,
 };