Pārlūkot izejas kodu

Merge branch 'firefox26_bugfix' into dev/new1

luolei 5 gadi atpakaļ
vecāks
revīzija
a0d9341658

+ 2 - 3
src/components/AddInspect/index.jsx

@@ -2,7 +2,7 @@ import React from 'react';
 import { SearchOption, InspectCommon, Calendar, Notify, ConfirmModal, Add, DelToast } from '@commonComp';
 import SlideExcel from './SlideExcel';
 import SlideSelect from './SlideSelect';
-import { deepClone, getPageCoordinate, getStatusImg ,getCurrentDate,setPosition} from '@utils/tools';
+import { deepClone, getPageCoordinate, getStatusImg ,getCurrentDate,setPosition,getCalendarDate} from '@utils/tools';
 import styles from './index.less';
 import ScrollArea from 'react-scrollbar';
 import store from '@store';
@@ -135,8 +135,7 @@ class Inspect extends React.Component {
     this.props.setHighter(48)
   }
   handleChangeDate(info) {
-    // let date = info.year+'-'+info.month.toString().padStart(2,'0')+'-'+info.day.toString().padStart(2,'0')
-    let date = info.year+'-'+info.month.toString().padStart(2,'0')+'-'+info.day.toString().padStart(2,'0')+' '+info.hour.toString().padStart(2,'0')+':'+info.minute.toString().padStart(2,'0')+':'+info.second.toString().padStart(2,'0');
+    let date = getCalendarDate(info);
     this.setState({ dateTime: date, date: false })
   }
   handleSearchShow(e) {

+ 1 - 0
src/components/MainSuit/index.jsx

@@ -163,6 +163,7 @@ class MainSuit extends Component{
       }
       ev.target.blur();
       ev.target.innerText?(ev.target.innerText = data.substr(0,config.limited)):(ev.target.innerHTML = data.substr(0,config.limited));  //输入法内输入多个字再按enter的情况
+      console.log(333,data,ev)
       // ev.target.blur();
       this.setState({
         inpText:data.substr(0,config.limited),

+ 3 - 1
src/components/RadioInpDrop/index.jsx

@@ -196,11 +196,12 @@ class RadioInpDrop extends Component{
     if(!show&&tmpDom){
       $(tmpDom).parent().parent().prev().attr({"contentEditable":true})
     }
+    // 移除双击编辑 onDoubleClick={hideTag?null:this.handledbClick}
     return <div className={style['container']} ref = {this.$cont}>
       <div className={this.getClass()}
            onBlur={this.handleEditLabel}
            contentEditable={this.state.editable}
-           onDoubleClick={hideTag?null:this.handledbClick}
+           
            onClick={(e)=>this.handleShow(e,true)}
            onKeyDown={handleEnter}>
         {vals?this.parseInputDom():<span>{placeholder}</span>}
@@ -231,6 +232,7 @@ class InputComp extends Component{
       const inp = this.$inp.current;
       const value = this.props.value;
       setTimeout(function(){
+        inp.innerText?(inp.innerText = ''):(inp.innerHTML = '');
         inp.innerText?(inp.innerText = value):(inp.innerHTML = value);
       })
     }

+ 12 - 9
src/components/TimeInterval/index.jsx

@@ -59,11 +59,13 @@ class TimeInterval extends React.Component {
   timeSure(date) {
     const { getStartTime, getEndTime } = this.props;
     if (this.state.flg == 1) {
-      let time = getCalendarDate(date, true);
-      let dateBegin = (new Date(time)).getTime()
-      let dateEnd = (new Date(this.state.endTime)).getTime()
+      let time = getCalendarDate(date);
+      let tmpTime = time.replace(/ |:/g, '-').split('-');
+      let arr = this.state.endTime.replace(/ |:/g, '-').split('-');
+      let dateBegin = (new Date(Date.UTC(tmpTime[0],tmpTime[1],tmpTime[2],tmpTime[3],tmpTime[4]))).getTime();
+      let dateEnd = (new Date(Date.UTC(arr[0], arr[1], arr[2], arr[3],arr[4]))).getTime();
       let dateDes = (dateEnd - dateBegin)/(24 * 3600 * 1000)
-      if(dateEnd < dateBegin){
+      if(dateEnd - dateBegin < 0){
         Notify.info("终止时间不能早于起始时间");
         return
       }else if(dateDes>90){
@@ -76,13 +78,14 @@ class TimeInterval extends React.Component {
         timeLisStart: date//事件组件的日期
       })
       getStartTime(time)
-
     } else if (this.state.flg == 2) {
-      let time = getCalendarDate(date, true);
-      let dateBegin = (new Date(this.state.startTime)).getTime()
-      let dateEnd = (new Date(time)).getTime()
+      let time = getCalendarDate(date);
+      let tmpTime = time.replace(/ |:/g, '-').split('-');
+      let arr = this.state.endTime.replace(/ |:/g, '-').split('-');
+      let dateBegin = (new Date(Date.UTC(arr[0], arr[1], arr[2], arr[3],arr[4]))).getTime();
+      let dateEnd = (new Date(Date.UTC(tmpTime[0],tmpTime[1],tmpTime[2],tmpTime[3],tmpTime[4]))).getTime();
       let dateDes = (dateEnd - dateBegin)/(24 * 3600 * 1000)
-      if(dateEnd < dateBegin){
+      if(dateEnd - dateBegin < 0){
         Notify.info("终止时间不能早于起始时间");
         return
       }else if(dateDes>90){

+ 2 - 1
src/containers/AssistCheck.js

@@ -7,6 +7,7 @@ import { assistLable,delAssistLabel,changeAssistVal,changeDate,allCheckImports,s
 import { getSearchList,getInstroduce ,getImportLists,getSonDetailList} from '@store/async-actions/assistCheck';
 import {ISREAD} from '@store/types/homePage.js';
 import {billing, getConceptDetail} from '@store/async-actions/pushMessage';
+import { getCalendarDate} from '@utils/tools';
 
 function mapStateToProps(state) {//console.log(state)
     return {
@@ -67,7 +68,7 @@ function mapDispatchToProps(dispatch, store) {
             dispatch(changeAssistVal(val,idx))
         },
         handleChangeDate(info,idx){
-            let date = info.year+'-'+info.month.toString().padStart(2,'0')+'-'+info.day.toString().padStart(2,'0')+' '+info.hour.toString().padStart(2,'0')+':'+info.minute.toString().padStart(2,'0')+':'+info.second.toString().padStart(2,'0');
+            let date = getCalendarDate(info);
             dispatch(changeDate(date,idx))
         },
         //右侧推送

+ 9 - 15
src/utils/tools.js

@@ -817,9 +817,9 @@ function getCurrentDate(flg,con){
     var h = myDate.getHours();
     var m = myDate.getMinutes();
     var s = myDate.getSeconds();
-    date = year+link+mon.toString().padStart(2,'0')+link+day.toString().padStart(2,'0')+' '+h.toString().padStart(2,'0')+':'+m.toString().padStart(2,'0')+':'+s.toString().padStart(2,'0');
+    date = year+link+(mon<10?"0"+mon:mon)+link+(day<10?"0"+day:day)+' '+(h<10?"0"+h:h)+':'+(m<10?"0"+m:m)+':'+(s<10?"0"+s:s);
   }else{
-    date = year+link+mon.toString().padStart(2,'0')+link+day.toString().padStart(2,'0');
+    date = year+link+(mon<10?"0"+mon:mon)+link+(day<10?"0"+day:day);
   }
   return date;
 }
@@ -925,11 +925,11 @@ function dateParser(timestamp,link = '-'){
   let year = time.getFullYear();
   let month = time.getMonth()+1;
   let date = time.getDate();
-  let hour = time.getHours().toString().padStart(2,'0');
-  let minute = time.getMinutes().toString().padStart(2,'0');
-  let second = time.getSeconds().toString().padStart(2,'0');
+  let hour = time.getHours();
+  let minute = time.getMinutes();
+  let second = time.getSeconds();
   // let result = year+link+month+link+date;
-  let result = year+link+(month<10?"0"+month:month)+link+(date<10?"0"+date:date)+' '+hour+':'+minute+':'+second;
+  let result = year+link+(month<10?"0"+month:month)+link+(date<10?"0"+date:date)+' '+(hour<10?"0"+hour:hour)+':'+(minute<10?"0"+minute:minute)+':'+(second<10?"0"+second:second);
   return result;
 }
 
@@ -1175,15 +1175,9 @@ function getIds(data){
  * @param {时间是否包含时分秒} flg 
  * @param {连接符} con 
  */
-function getCalendarDate(info,flg,con) {
-  let date = '';
-  let time = flg?flg:false;
-  let conect = con?con:'-';
-  if(time){
-    date = info.year + conect + (info.month).toString().padStart(2,'0') + conect + (info.day).toString().padStart(2,'0') + ' '+(info.hour).toString().padStart(2,'0')+':'+(info.minute).toString().padStart(2,'0')+':'+(info.second).toString().padStart(2,'0');
-  }else{
-    date = info.year + conect + (info.month < 10 ? '0' + info.month : info.month) + conect + (info.day < 10 ? '0' + info.day : info.day);
-  }
+function getCalendarDate(info) {
+  let conect = '-';
+  let date = info.year + conect + (info.month < 10 ? '0' + info.month : info.month) + conect + (info.day < 10 ? '0' + info.day : info.day) + ' '+ (info.hour < 10 ? '0' + info.hour : info.hour)+':'+ (info.minute < 10 ? '0' + info.minute : info.minute)+':'+ (info.second < 10 ? '0' + info.second : info.second);
   return date;
 }