Bladeren bron

时间插件修改,区间选择组件完成

Luolei 6 jaren geleden
bovenliggende
commit
63897f7a04

+ 1 - 1
src/common/components/Calendar/Content/index.jsx

@@ -12,7 +12,7 @@ class Content extends React.Component {
     }
 
     genItems(){
-        let is_now_month=this.props.selectTime.year===this.props.year && this.props.selectTime.month===this.props.month;
+      let is_now_month=this.props.selectTime.year===this.props.year && this.props.selectTime.month===this.props.month;
         const Items=[];
         const first_day=new Date(this.props.year,this.props.month-1,1).getDay();
         let key=0;

+ 131 - 97
src/common/components/Calendar/index.jsx

@@ -1,7 +1,7 @@
 import React from 'react'
 import style from './index.less'
 import PropTypes from 'prop-types'
-import {YearList, MonthList} from './SelectList'
+import { YearList, MonthList } from './SelectList'
 import Content from './Content'
 import Time from './Time'
 
@@ -12,114 +12,148 @@ import Time from './Time'
  * needTime:是否显示下方时间输入控件  不显示则默认的时分秒为0
  */
 class Calendar extends React.Component {
-    constructor() {
-        super();
-        const date=new Date();
-        this.year=date.getFullYear();
-        this.month=date.getMonth()+1;
-        this.day=date.getDate();
-        this.inputing=false;
-        this.state = {
-            year:  this.year,
-            month:  this.month,
-            day:  this.day,
-            select:{
-                year:  this.year,
-                month:  this.month,
-                day:  this.day,
-                day: 0,//这里设置初始选中的值
-                hour:0,
-                minute:0,
-                second:0
-            }
-        }
+  constructor(props) {
+    super(props);
+    const date = new Date();
+    this.year = date.getFullYear();
+    this.month = date.getMonth() + 1;
+    this.day = date.getDate();
+    this.inputing = false;
+    this.state = {
+      year: this.year,
+      month: this.month,
+      day: this.day,
+      select: {
+        year: this.year,
+        month: this.month,
+        day:  0,
+        hour:0,
+        minute:0,
+        second:0
+      }
     }
-
-    handleYearSelect(year) {
-        if(year===this.year && this.state.month>this.month){
-            this.setState({
-                year: year,
-                month:this.month
-            });
-        }else{
-            this.setState({
-                year: year
-            });
-        }
+  }
+  componentDidMount(){
+    this.setState({
+      year: this.props.timeLis && this.props.timeLis.year || this.year,
+      month: this.props.timeLis && this.props.timeLis.month || this.month,
+      day: this.props.timeLis && this.props.timeLis.day || this.day,
+      select: {
+        year: this.props.timeLis && this.props.timeLis.year || this.year,
+        month: this.props.timeLis && this.props.timeLis.month || this.month,
+        day: this.props.timeLis && this.props.timeLis.day || this.day,//这里设置初始选中的值
+        hour: this.props.timeLis && this.props.timeLis.hour,
+        minute: this.props.timeLis && this.props.timeLis.minute,
+        second: this.props.timeLis && this.props.timeLis.second
+      }
+    })
+  }
+  handleYearSelect(year) {
+    if (year === this.year && this.state.month > this.month) {
+      this.setState({
+        year: year,
+        month: this.month
+      });
+    } else {
+      this.setState({
+        year: year
+      });
     }
+  }
 
-    handleMonthSelect(month) {
-        this.setState({
-            month: month
-        });
-    }
+  handleMonthSelect(month) {
+    this.setState({
+      month: month
+    });
+  }
 
-    handleChange(info){
-        if(this.inputing){
-            return;
-        }
-        this.inputing=true;
-        info.year=this.state.year;
-        info.month=this.state.month;
-        // info.day = this.day;//没选日就加上默认值
-        if(info.hour==null){
-            info.hour=this.state.select.hour;
-            info.minute=this.state.select.minute;
-            info.second=this.state.select.second;
-        }
-        this.props.handleChange(Object.assign({},info));
-        this.setState({
-            select:info
-        });
+  handleChange(info) {
+    if (this.inputing) {
+      return;
     }
-
-    handleTodayClick(){
-        const info={
-            year:this.year,
-            month:this.month,
-            day:this.day,
-            hour:this.state.select.hour,
-            minute:this.state.select.minute,
-            second:this.state.select.second
-        };
-        this.setState({
-            select:info
-        });
-        this.props.handleChange(info);
+    this.inputing = true;
+    info.year = this.state.year;
+    info.month = this.state.month;
+    // info.day = this.state.day;//没选日就加上默认值
+    if (info.hour == null) {
+      info.hour = this.state.select.hour;
+      info.minute = this.state.select.minute;
+      info.second = this.state.select.second;
     }
-    genTimeComponent(){
-        return this.props.needTime?<Time hour={this.state.select.hour} minute={this.state.select.minute} second={this.state.select.second} day={this.state.select.day} handleChange={(info)=>{this.handleChange(info)}}/>:null;
+    this.props.handleChange(Object.assign({}, info));
+    this.setState({
+      select: info
+    });
+  }
+  timeSure() {
+    if (this.inputing) {
+      return;
     }
-    render() {
-        return (
-            <div className={style.wrapper} style={{top:this.props.top}}>
-                <div className={style.top}>
-                    <div className={style.year}>
-                        <YearList select={this.state.year} canSelectFuture={this.props.canSelectFuture} handleChange={(info) => this.handleYearSelect(info)}/>
-                    </div>
-                    <div className={style.month}>
-                        <MonthList year={this.state.year} canSelectFuture={this.props.canSelectFuture} select={this.state.month} handleChange={(info) => this.handleMonthSelect(info)}/>
-                    </div>
-                    <div className={style.button}>
-                        <button onClick={()=>this.handleTodayClick()}>{'今天'}</button>
-                    </div>
-                </div>
-                <Content selectTime={this.state.select} year={this.state.year} month={this.state.month} handleClick={(info)=>this.handleChange(info)} canSelectFuture={this.props.canSelectFuture}/>
-                {this.genTimeComponent()}
-                <div className={style.timeSure} onClick={()=>this.props.timeSure(this.state.select)}>确定</div>
-            </div>
-        )
+    this.inputing = true;
+    let info = this.state.select
+    info.year = this.state.year;
+    info.month = this.state.month;
+    // info.day = this.state.day;//没选日就加上默认值
+    if (info.hour == null) {
+      info.hour = this.state.select.hour;
+      info.minute = this.state.select.minute;
+      info.second = this.state.select.second;
     }
+    this.props.timeSure(Object.assign({}, info))
+    this.setState({
+      select: info
+    });
+  }
+  handleTodayClick() {
+    const info = {
+      year: this.year,
+      month: this.month,
+      day: this.day,
+      hour: this.state.select.hour,
+      minute: this.state.select.minute,
+      second: this.state.select.second
+    };
+    this.setState({
+      select: info
+    });
+    // this.props.timeSure(Object.assign({}, info))
+    this.props.handleChange(info);
+  }
+  genTimeComponent() {
+    return this.props.needTime ? <Time hour={this.state.select.hour} minute={this.state.select.minute} second={this.state.select.second} day={this.state.select.day} handleChange={(info) => { this.handleChange(info) }} /> : null;
+  }
+  render() {
+    return (
+      <div className={style.wrapper} style={{ top: this.props.top }}>
+        <div className={style.top}>
+          <div className={style.year}>
+            <YearList select={this.state.year} canSelectFuture={this.props.canSelectFuture} handleChange={(info) => this.handleYearSelect(info)} />
+          </div>
+          <div className={style.month}>
+            <MonthList year={this.state.year} canSelectFuture={this.props.canSelectFuture} select={this.state.month} handleChange={(info) => this.handleMonthSelect(info)} />
+          </div>
+          <div className={style.button}>
+            <button onClick={() => this.handleTodayClick()}>{'今天'}</button>
+          </div>
+        </div>
+        <Content selectTime={this.state.select} year={this.state.year} month={this.state.month} day={this.state.day} handleClick={(info) => this.handleChange(info)} canSelectFuture={this.props.canSelectFuture} />
+        {this.genTimeComponent()}
+        {
+          this.props.sure ? <div className={style.timeSure} onClick={() => this.timeSure({})}>确定</div> : ''
+        }
+      </div>
+    )
+  }
 
-    componentDidUpdate(){
-        this.inputing=false;
-    }
+  componentDidUpdate() {
+    this.inputing = false;
+  }
 }
 
 export default Calendar;
 
 Calendar.propTypes = {
-    handleChange: PropTypes.func,
-    needTime:PropTypes.bool,
-    canSelectFuture:PropTypes.bool
+  handleChange: PropTypes.func,
+  needTime: PropTypes.bool,
+  canSelectFuture: PropTypes.bool
 };

+ 6 - 5
src/components/Inspect/index.jsx

@@ -44,7 +44,7 @@ class Inspect extends React.Component {
       isIE: isIE(),
       ieVersion: null,
       height: '-1',
-      hide: true
+      hide: false
     }
     this.handleImportExcel = this.handleImportExcel.bind(this)
     this.cancel = this.cancel.bind(this)
@@ -157,14 +157,13 @@ class Inspect extends React.Component {
     })
   }
   onClose(){
-    console.log(9999)
     this.setState({
       hide: false
     })
     dragBox('previewWrapper','previewStatic','del')
   }
   render() {
-    const { fetchPushInfos, getInfomation, inspectVal, windowHeight, handleCloseExcel, handleChangeValue, labelListActive, list, handleSign, labelList, handleLabelSub, handleClear, handleConfirm, fillActive, changeActivePart, getExcelDataList, delPartItem, inspectList } = this.props;
+    const { fetchPushInfos, getInfomation, inspectVal,handleSearch, windowHeight, handleCloseExcel, handleChangeValue, labelListActive, list, handleSign, labelList, handleLabelSub, handleClear, handleConfirm, fillActive, changeActivePart, getExcelDataList, delPartItem, inspectList } = this.props;
     const { ieVersion, isIE, hide } = this.state;
     const { checkSystemIpt,onClose } = this;
     return (
@@ -175,7 +174,7 @@ class Inspect extends React.Component {
           {/* <div className={this.getStyle()} onClick={ieVersion&&ieVersion<=9?null:this.handleImportExcel}> */}
           <div className={this.getStyle()}>
             {/* <button disabled={ieVersion&&ieVersion>9?true:false}>导入化验结果</button>*/}
-            <div className={styles.pushButton}>导入化验结果</div>
+            <div className={styles.pushButton}>导入化验结果
             <ul className={styles.importSelect}>
               <li className={styles.excelIpt}>
                 <div onClick={ieVersion && ieVersion <= 9 ? null : this.handleImportExcel}>本地导入</div>
@@ -183,9 +182,11 @@ class Inspect extends React.Component {
               </li>
               <li className={`${styles.excelIpt} ${styles.systemIpt}`} onClick={checkSystemIpt}>检查系统导入</li>
             </ul>
+            
+            </div>
             {
               hide ? <WrapModalContainer title={'导入化验数据'} width={1000} onClose={onClose}>
-                <WrapModalBody></WrapModalBody>
+                <WrapModalBody handleSearch={handleSearch}></WrapModalBody>
               </WrapModalContainer> : null
             }
             {/* <input type="file" name="uploadfile" id="choose" style={{ display: 'none' }} ref={(DOM) => this.inputRef = DOM} /> */}

+ 7 - 1
src/components/Inspect/index.less

@@ -43,6 +43,11 @@
         border-radius: 5px;
         color: @template-color;
         cursor: pointer;
+        &:hover {
+          .importSelect {
+            display: block !important;
+          }
+        }
     }
 }
 .title {
@@ -73,13 +78,14 @@
 .importSelect {
   position: absolute;
   width: 120%;
-  top: 30px;
+  top: 29px;
   left: 0;
   z-index: 99;
   font-size: 12px;
   box-shadow: 0 10px 20px 0 #989DA3;
   border: 1px solid #dedede;
   background-color: #fff;
+  display: none;
   li {
     height: 34px;
     line-height: 34px;

+ 99 - 0
src/components/TimeInterval/index.jsx

@@ -0,0 +1,99 @@
+import React from "react";
+import style from "./index.less";
+import { Calendar} from '@commonComp';
+import {getCalendarDate,getCurrentDate} from "@utils/tools";
+
+class TimeInterval extends React.Component {
+  constructor(props) {
+    super(props);
+    const date = new Date();
+    this.state={
+      startTime:getCurrentDate(false,'/')+' 00:00:00',
+      endTime:getCurrentDate(false,'/')+' 23:59:59',
+      show:false,
+      flg:0,
+      timeLisStart:{
+        year:  date.getFullYear(),
+        month:  date.getMonth() + 1,
+        day:  date.getDate(),
+        hour:'00',
+        minute:'00',
+        second:'00'
+      },
+      timeLisEnd:{
+        year:  date.getFullYear(),
+        month:  date.getMonth() + 1,
+        day:  date.getDate(),
+        hour:'23',
+        minute:'59',
+        second:'59'
+      }
+    }
+    this.handleShowTime = this.handleShowTime.bind(this)
+    this.timeSure = this.timeSure.bind(this)
+  }
+  handleChangeDate(date){
+    // console.log(date,'外')
+  }
+  timeSure(date){
+    const {getStartTime,getEndTime} = this.props;
+    if(this.state.flg == 1){
+      this.setState({
+        show:false,
+        startTime:getCalendarDate(date,true,'/'),//页面显示的时间
+        timeLisStart:date//事件组件的日期
+      })
+      getStartTime(getCalendarDate(date,true,'/'))
+    }else if(this.state.flg == 2){
+      this.setState({
+        show:false,
+        endTime:getCalendarDate(date,true,'/'),
+        timeLisEnd:date
+      })
+      getEndTime(getCalendarDate(date,true,'/'))
+    }
+  }
+  handleShowTime(flg){
+    if(this.state.show){
+      this.setState({show:false},()=>{
+        this.setState({
+          show:true,
+          flg:flg
+        })
+      })
+    }else{
+      this.setState({
+        show:true,
+        flg:flg
+      })
+    }
+  }
+  render() {
+    const {startTime,endTime,show,timeLisStart,timeLisEnd,flg} = this.state
+    const {handleShowTime,timeSure,handleChangeDate} = this
+    return <div className={style.timeWrap}>
+      <span>送检时间 : </span>
+          <div className={style.timeIpts}>
+            <input 
+              value={startTime} 
+              readOnly 
+              className={style.ipt} 
+              onClick={()=>handleShowTime(1)} 
+              type="text" 
+              placeholder="起始时间"/>~
+            <input 
+              value={endTime}
+              readOnly
+              className={style.ipt}
+               onClick={()=>handleShowTime(2)} 
+               type="text" 
+               placeholder="终止时间"/>
+          </div>
+          {
+            show?<Calendar timeLis={flg==2?timeLisEnd:timeLisStart} top={40} sure={true} timeSure={timeSure} needTime={true} isShow={true} handleChange={handleChangeDate}></Calendar>:null
+          }
+    </div>
+  }
+}
+
+export default TimeInterval;

+ 13 - 0
src/components/TimeInterval/index.less

@@ -0,0 +1,13 @@
+.timeWrap {
+  display: inline-block;
+}
+.timeIpts{
+  height: 26px;
+  line-height: 26px;
+  display: inline-block;
+  background-color: #fff;
+}
+input.ipt {
+  width: 126px;
+  text-align: center;
+}

+ 73 - 16
src/components/WrapModalBody/Item/index.jsx

@@ -1,45 +1,102 @@
 import React from "react";
 import style from "../index.less";
-import { Calendar} from '@commonComp';
+import {getCalendarDate,getCurrentDate} from "@utils/tools";
+import TimeInterval from '../../TimeInterval';
 
 class Item extends React.Component {
   constructor(props) {
-    super(props)
+    super(props);
+    this.state={
+      startTime:getCurrentDate(false,'/')+' 00:00:00',
+      endTime:getCurrentDate(false,'/')+' 23:59:59',
+      code:'',
+      name:'',
+      sex:'',
+      age:''
+    }
+    this.getStartTime = this.getStartTime.bind(this)
+    this.getEndTime = this.getEndTime.bind(this)
+    this.handleInput = this.handleInput.bind(this)
   }
-  handleChangeDate(date){
-    console.log(date,'外')
+  getStartTime(date){
+    this.setState({startTime:date})
   }
-  timeSure(date){
-    console.log(date,'外')
+  getEndTime(date){
+    this.setState({endTime:date})
+  }
+  handleInput(e,val){
+    switch(val){
+      case 1:
+        this.setState({
+          code:e.target.value
+        })
+        break;
+      case 2:
+        this.setState({
+          name:e.target.value
+        })
+        break;
+      case 3:
+        this.setState({
+          sex:e.target.value
+        })
+        break;
+      case 4:
+        this.setState({
+          age:e.target.value
+        })
+        break;
+    }
   }
   render() {
+    const {handleSearch} = this.props
     return <div className={style['items']}>
       <ul>
         <li className={`${style.code} ${style.pubLi}`}>
           <span>门诊号 : </span>
-          <input type="text" />
+          <input type="text" value={this.state.code}
+            onInput={(e) => { 
+                this.handleInput(e,1)
+            }}
+            onPropertyChange={(e) => {  
+                this.handleInput(e,1)
+            }} />
         </li>
         <li className={`${style.name} ${style.pubLi}`}>
           <span>姓名 : </span>
-          <input type="text" />
+          <input type="text" value={this.state.name}
+            onInput={(e) => { 
+                this.handleInput(e,2)
+            }}
+            onPropertyChange={(e) => {  
+                this.handleInput(e,2)
+            }} />
         </li>
         <li className={`${style.sex} ${style.pubLi}`}>
           <span>性别 : </span>
-          <input type="text" />
+          <input type="text" value={this.state.sex}
+            onInput={(e) => { 
+                this.handleInput(e,3)
+            }}
+            onPropertyChange={(e) => {  
+                this.handleInput(e,3)
+            }} />
         </li>
         <li className={`${style.age} ${style.pubLi}`}>
           <span>年龄 : </span>
-          <input type="text" />
+          <input type="text" value={this.state.age}
+            onInput={(e) => { 
+                this.handleInput(e,4)
+            }}
+            onPropertyChange={(e) => {  
+                this.handleInput(e,4)
+            }} />
         </li>
         <li className={`${style.time} ${style.pubLi}`}>
-          <span>送检时间 : </span>
-          <div className={style.timeIpts}>
-            <input className={style.ipt} type="text" placeholder="起始时间"/>~<input className={style.ipt} type="text" placeholder="终止时间"/>
-          </div>
-          <Calendar top={40} timeSure={this.timeSure} needTime={true} isShow={true} handleChange={this.handleChangeDate.bind(this)}></Calendar>
+          <TimeInterval getStartTime={this.getStartTime} getEndTime={this.getEndTime}></TimeInterval>
         </li>
       </ul>
-      <div className={style.search}>检索</div>
+      <div className={style.search} onClick={()=>handleSearch(this.state)}>检索</div>
     </div>
   }
 }

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

@@ -7,9 +7,9 @@ class WrapModalTitle extends React.Component {
     super(props)
   }
   render() {
-    const { list,message } = this.props;
+    const {handleSearch} = this.props
     return <div className={style['modalTop']}>
-      <Item></Item>
+      <Item handleSearch={handleSearch}></Item>
     </div>
   }
 }

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

@@ -8,10 +8,12 @@ class WrapModalBody extends React.Component {
     super(props)
   }
   render() {
-    const { list,message } = this.props;
+    const { aa,handleSearch } = this.props;
+    console.log(this.props,7777777777777)
+    console.log(handleSearch,7777777777777)
     return <div className={style['container']}>
       <div className={`${style.left}`}>
-        <WrapModalTitle></WrapModalTitle>
+        <WrapModalTitle handleSearch={handleSearch}></WrapModalTitle>
         <WrapModalTable></WrapModalTable>
       </div>
       <div className={`${style.right}`}>

+ 1 - 1
src/components/WrapModalBody/index.less

@@ -85,7 +85,7 @@
         background-color: #fff;
       }
       input.ipt {
-        width: 122px;
+        width: 126px;
         text-align: center;
       }
     }

+ 72 - 52
src/containers/Inspect.js

@@ -1,61 +1,81 @@
 import React from 'react';
-import {connect} from 'react-redux';
+import {
+  connect
+} from 'react-redux';
 import Inspect from '@components/Inspect';
-import {getSearchList,getSublableList } from '@store/async-actions/inspect';
-import {setLabel,fillActived,fillActiveDetail,checkValueIsChange,delExcelLis,clearLabel,delPartItem} from '@store/actions/inspect';
-import {billing, getConceptDetail} from '@store/async-actions/pushMessage';
-function mapStateToProps(state) {//console.log(state)
-    return {
-        list:state.inspect.list,
-        labelList:state.inspect.labelList,
-        fillActive:state.inspect.fillActive,
-        getExcelDataList:state.inspect.getExcelDataList,
-        labelListActive:state.inspect.labelListActive,
-        inspectList:state.homePage.inspectList,
-        windowHeight:state.homePage.windowHeight,
-        inspectVal:state.inspect.inspectVal
-    }
+import {
+  getSearchList,
+  getSublableList
+} from '@store/async-actions/inspect';
+import {
+  setLabel,
+  fillActived,
+  fillActiveDetail,
+  checkValueIsChange,
+  delExcelLis,
+  clearLabel,
+  delPartItem
+} from '@store/actions/inspect';
+import {
+  billing,
+  getConceptDetail
+} from '@store/async-actions/pushMessage';
+
+function mapStateToProps(state) { //console.log(state)
+  return {
+    list: state.inspect.list,
+    labelList: state.inspect.labelList,
+    fillActive: state.inspect.fillActive,
+    getExcelDataList: state.inspect.getExcelDataList,
+    labelListActive: state.inspect.labelListActive,
+    inspectList: state.homePage.inspectList,
+    windowHeight: state.homePage.windowHeight,
+    inspectVal: state.inspect.inspectVal
+  }
 }
 
 function mapDispatchToProps(dispatch, store) {
-    return {
-        handleChangeValue(val){
-            dispatch(getSearchList(val))
-        },
-        getInfomation(item){
-            dispatch(getConceptDetail(item))
-        },
-        handleSign(id,idx,type){
-            dispatch(setLabel(idx,type))
-            dispatch(getSublableList(id))
-        },
-        handleLabelSub(e,id,idx){
-            dispatch(fillActived(id,idx))
-            // e.stopPropagation()
-        },
-        handleClear(e,idx){
-            e.stopPropagation();
-            dispatch(clearLabel(idx))
-        },
-        handleConfirm(e,idx,time,arr){
-            e.stopPropagation();
-            dispatch(checkValueIsChange(idx,time,arr))
-        },
-        changeActivePart(idx,value){
-            dispatch(fillActiveDetail(idx,value))
-        },
-        handleCloseExcel(idx){
-            dispatch(delExcelLis(idx));
-        },
-        delPartItem(idx){
-            dispatch(delPartItem(idx))
-        },
-        //右侧推送
-        fetchPushInfos(){
-          //调右侧推送
-          dispatch(billing());
-        }
+  return {
+    handleSearch(data) {
+      console.log(data)
+    },
+    handleChangeValue(val) {
+      dispatch(getSearchList(val))
+    },
+    getInfomation(item) {
+      dispatch(getConceptDetail(item))
+    },
+    handleSign(id, idx, type) {
+      dispatch(setLabel(idx, type))
+      dispatch(getSublableList(id))
+    },
+    handleLabelSub(e, id, idx) {
+      dispatch(fillActived(id, idx))
+      // e.stopPropagation()
+    },
+    handleClear(e, idx) {
+      e.stopPropagation();
+      dispatch(clearLabel(idx))
+    },
+    handleConfirm(e, idx, time, arr) {
+      e.stopPropagation();
+      dispatch(checkValueIsChange(idx, time, arr))
+    },
+    changeActivePart(idx, value) {
+      dispatch(fillActiveDetail(idx, value))
+    },
+    handleCloseExcel(idx) {
+      dispatch(delExcelLis(idx));
+    },
+    delPartItem(idx) {
+      dispatch(delPartItem(idx))
+    },
+    //右侧推送
+    fetchPushInfos() {
+      //调右侧推送
+      dispatch(billing());
     }
+  }
 }
 
 const InspectAction = connect(mapStateToProps, mapDispatchToProps)(Inspect);

+ 2 - 0
src/store/types/inspect.js

@@ -11,3 +11,5 @@ export const CLEAR_ALL_LABEL = 'CLEAR_ALL_LABEL';
 export const DEL_PART_ITEM = 'DEL_PART_ITEM';
 export const DEL_EXCEL_LIST = 'DEL_EXCEL_LIST';
 export const ADD_LABEL = 'ADD_LABEL';
+export const GET_IMPORT_LIST = 'GET_IMPORT_LIST';
+export const GET_IMPORT_LIST_SON = 'GET_IMPORT_LIST_SON';

+ 49 - 18
src/utils/tools.js

@@ -143,21 +143,22 @@ const deepClone = (data)=>{
 };
 
 const getUrlArgObject = (parm) => {  
-    /*let args=new Object();  
-    let query=window.location.href;//获取查询串  
-    let pairs,arr;
-    if(query.indexOf("?") != -1){
-      pairs=query.split("?")[1].split("&");
-      for(let i=0;i<pairs.length;i++){  
-         let pos=pairs[i].indexOf('=');//查找name=value  
-         if(pos==-1){//如果没有找到就跳过  
-             continue;  
-         }  
-         let argname=pairs[i].substring(0,pos);//提取name  
-         let value=decodeURIComponent(pairs[i].substring(pos+1));//提取value  
-         args[argname]=unescape(value);//存为属性  
-     }  
-    }*/
+    // let args=new Object();  
+    // let query=window.location.href;//获取查询串  
+    // console.log(query.split("?")[1].split("&"))
+    // let pairs,arr;
+    // if(query.indexOf("?") != -1){
+    //   pairs=query.split("?")[1].split("&");
+    //   for(let i=0;i<pairs.length;i++){  
+    //      let pos=pairs[i].indexOf('=');//查找name=value  
+    //      if(pos==-1){//如果没有找到就跳过  
+    //          continue;  
+    //      }  
+    //      let argname=pairs[i].substring(0,pos);//提取name  
+    //      let value=decodeURIComponent(pairs[i].substring(pos+1));//提取value  
+    //      args[argname]=unescape(value);//存为属性  
+    //  }  
+    // }
     let query = window.location.search;
     let args = qs.parse(query.substr(1));
     return args[parm];//返回对象  
@@ -766,13 +767,25 @@ function timestampToTime(timestamp) {     //excel导入2019年5月1日会转换
   return Y+M+D+h+m+s;
 }
 
-
-function getCurrentDate(){
+/**
+ * 
+ * @param {需要年月日传个true,不需要不传或者false} flg 
+ */
+function getCurrentDate(flg,con){
+  let link = con?con:'-'
   let myDate = new Date();
   let year = myDate.getFullYear();       //获取完整的年份(4位,1970-????)
   let mon = myDate.getMonth()-0+1;       //获取当前月份(0-11,0代表1月)
   let day = myDate.getDate();            //获取当前日(1-31)
-  let date = year+'-'+(mon<10?'0'+mon:mon)+'-'+(day<10?'0'+day:day);
+  let date = '';           
+  if(flg){
+    var h = date.getHours();
+    var m = date.getMinutes();
+    var s = date.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');
+  }else{
+    date = year+link+mon.toString().padStart(2,'0')+link+day.toString().padStart(2,'0');
+  }
   return date;
 }
 function inspectAndAssist(){
@@ -1052,6 +1065,23 @@ function getIds(data){
   })
   return ids;
 }
+/**
+ * 
+ * @param {日期相关} info 
+ * @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);
+  }
+  return date;
+}
 module.exports = {
     checkType: Type.checkType,
     getIds,
@@ -1095,4 +1125,5 @@ module.exports = {
     ifOtherClear,
     readyKeepHistory,
     parseChartData,
+    getCalendarDate
 };