瀏覽代碼

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

Luolei 6 年之前
父節點
當前提交
7fc50f5228

+ 1 - 1
src/common/components/DelToast/index.jsx

@@ -29,7 +29,7 @@ class DelToast extends React.PureComponent{
       return <div className={style['del-box']} id="delBox">
         <div className={style['del-con']}>
           <div className={style['del-tri']}></div>
-          <div className={style['del-title']}>删除 {name} ?</div>
+          <div className={style['del-title']} id="delTit">删除 {name} ?</div>
           <div className={style['del-foot']}>
             <span className={`${style['del-btn']} ${style['del-del']}`} onClick={this.handleDel}>删除</span>
             <span className={`${style['del-btn']} ${style['del-cancel']}`} onClick={this.handleCancel}>取消</span>

+ 16 - 16
src/common/components/NumberPan/index.jsx

@@ -67,28 +67,28 @@ class NumberPan extends Component{
                 onDoubleClick={(e)=>e.stopPropagation()}>
       <table className={style['pan']} >
         <tr>
-          <td><button onClick={select}>1</button></td>
-          <td><button onClick={select}>2</button></td>
-          <td><button onClick={select}>3</button></td>
-          <td><button onClick={select}>/</button></td>
+          <td><button onMouseUp={select}>1</button></td>
+          <td><button onMouseUp={select}>2</button></td>
+          <td><button onMouseUp={select}>3</button></td>
+          <td><button onMouseUp={select}>/</button></td>
         </tr>
         <tr>
-          <td><button onClick={select}>4</button></td>
-          <td><button onClick={select}>5</button></td>
-          <td><button onClick={select}>6</button></td>
-          <td><button onClick={this.handleBack.bind(this)}><img src={backspace} onClick={this.handleBack.bind(this)} /></button></td>
+          <td><button onMouseUp={select}>4</button></td>
+          <td><button onMouseUp={select}>5</button></td>
+          <td><button onMouseUp={select}>6</button></td>
+          <td><button onMouseUp={this.handleBack.bind(this)}><img src={backspace} onClick={this.handleBack.bind(this)} /></button></td>
         </tr>
         <tr>
-          <td><button onClick={select}>7</button></td>
-          <td><button onClick={select}>8</button></td>
-          <td><button onClick={select}>9</button></td>
-          <td><button onClick={this.handleClear.bind(this)} className={style['clearN']}>清空</button></td>
+          <td><button onMouseUp={select}>7</button></td>
+          <td><button onMouseUp={select}>8</button></td>
+          <td><button onMouseUp={select}>9</button></td>
+          <td><button onMouseUp={this.handleClear.bind(this)} className={style['clearN']}>清空</button></td>
         </tr>
         <tr>
-          <td><button onClick={select}>.</button></td>
-          <td><button onClick={select}>0</button></td>
-          <td><button onClick={select}>~</button></td>
-          <td><button onClick={this.handleClose.bind(this)} className={style['confirm']}>确定</button></td>
+          <td><button onMouseUp={select}>.</button></td>
+          <td><button onMouseUp={select}>0</button></td>
+          <td><button onMouseUp={select}>~</button></td>
+          <td><button onMouseUp={this.handleClose.bind(this)} className={style['confirm']}>确定</button></td>
         </tr>
       </table>
       </div>

+ 2 - 2
src/components/AddAssistCheck/index.jsx

@@ -63,14 +63,14 @@ class AddAssistCheck extends React.Component {
       let _cons = $('#datePick');   // 设置目标区域
       let _del = $('#delBox')[0];   // 删除弹窗
       let _close = $('#assiClose')[0];   // 删除icon
-      // console.log(111,event.target,_del,_close)
+      let _closeTil = $('#delTit')[0];   // 弹窗标题
       if (_con && searchWrapAssist != event.target && !_con.is(event.target) && _con.has(event.target).length === 0) { // Mark 1
         this.setState({ show: false });
       }
       if (!_cons.is(event.target) && _cons.has(event.target).length === 0) { // Mark 1
         this.setState({ date: false });
       }
-      if(event.target != _close && event.target != _del && event.target.parentNode != _del){
+      if(!event.target.isEqualNode(_close) && !event.target.isEqualNode(_del)  && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)){
           this.setState({
             visible: false,
             id: null,

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

@@ -62,7 +62,7 @@ class SlideSelect extends Component {
     })
   }
   render() {
-    const {getInfomation,handleConfirm,changeActivePart,handleDelClick,getItemList,date,item,idx,handleFillShow,showDetails,handleLabelSub,showFill,changeShowFill,handlePush,dateTime,currentIdx,currentData,fillActive,handleShowDate,handleChangeDate} = this.props;
+    const {getInfomation,handleConfirm,changeActivePart,handleDelClick,getItemList,date,item,idx,handleFillShow,showDetails,handleLabelSub,showFill,changeShowFill,handlePush,dateTime,currentIdx,currentData,fillActive,handleShowDate,handleChangeDate,showToast} = this.props;
     const {show,activeInd,activeName} = this.state;
     let numPlus = 0,numPlus1 = 0;
     return (
@@ -181,8 +181,8 @@ class SlideSelect extends Component {
             }
         </div>
         {/*<img className={styles.partDel} src={close} alt="删除项" onClick={()=>{handleDelClick(1,idx)}}/>*/}
-        <span className={styles.partDel} onClick={this.handleDel}></span>
-        <DelToast show={activeInd?true:false}
+        <span id="addClose" className={styles.partDel} onClick={this.handleDel}></span>
+        <DelToast show={showToast&&activeInd?true:false}
                     name={activeName} 
                     cancel={this.handleCancel}
                     confirm={this.delConfirm}/>

+ 30 - 14
src/components/AddInspect/index.jsx

@@ -26,7 +26,7 @@ class Inspect extends React.Component {
       id: null,
       pageTop:'',
       // tmpIds: [],      //内层外层
-      importFlag:false   //导入数据删除标识
+      impId:null
     }
     this.handleChangeDate = this.handleChangeDate.bind(this)
     this.handleShowDate = this.handleShowDate.bind(this)
@@ -45,28 +45,32 @@ class Inspect extends React.Component {
   }
   delConfirm() {//弹窗确定
     const { delPartItem, handleCloseExcel, handlePush } = this.props;
-    const { type, id } = this.state;
+    const { type, id ,impId} = this.state;
     if (type == 1) {
       delPartItem(id)
     } else if (type == 2) {
-      handleCloseExcel(id)
+      handleCloseExcel(impId)
     }
     this.setState({
       type: null,
       id: null,
-      importFlag:false
+      impId: null
     })
     Notify.success("删除成功");
     handlePush && handlePush();       //右侧推送
   }
-  handleDelClick(type, idx) {
-    this.setState({
-      type: type,
-      id: idx
-    })
+  handleDelClick(type, idx) { 
     if (type == 2){
       this.setState({
-        importFlag: true
+        impId:idx,
+        type: type,
+        id:null
+      })
+    }else{
+      this.setState({
+        type: type,
+        id: idx,
+        impId:null
       })
     }
   }
@@ -74,7 +78,7 @@ class Inspect extends React.Component {
     this.setState({
       type: null,
       id: null,
-      importFlag:false
+      impId: null
     })
   }
   componentDidMount() {
@@ -82,6 +86,11 @@ class Inspect extends React.Component {
       let searchWrap = $('#searchWrap')[0];   // 搜索按钮
       let searchOption = $('#searchOption')[0];   // 搜索列表
       let inspectFill = $('#inspectFill')[0];         // 公共填写单
+
+      let _del = $('#delBox')[0];       // 删除弹窗  
+      let _impClose = $('#impClose')[0];         // 导入删除按钮
+      let _addClose = $('#addClose')[0];         // 添加删除按钮
+      let _closeTil = $('#delTit')[0];   // 弹窗标题
       if (searchOption) {
         if (searchOption != event.target && searchWrap != event.target && searchWrap != event.target.parentNode && !$.contains(searchOption, event.target)) { // Mark 1
           this.setState({ show: false });
@@ -92,6 +101,12 @@ class Inspect extends React.Component {
           this.setState({ showFill: false, date: false });
         }
       }
+      if(!event.target.isEqualNode(_impClose) && !event.target.isEqualNode(_addClose) && !event.target.isEqualNode(_del)  && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)){
+          this.setState({
+            id: null,
+            impId: null
+          })
+      }
     });
     this.getCurrentDate();
   }
@@ -280,7 +295,7 @@ class Inspect extends React.Component {
   }
   render() {
     const { getInfomation,handleChangeValue,inspectVal, list, labelList,windowHeight, delPartItem, handleLabelSub, handleClear, handleConfirm, fillActive, getExcelDataList, handleCloseExcel, handlePush } = this.props;
-    const { tmpId, tmpIdx,id ,importFlag,pageTop} = this.state;
+    const { tmpId, tmpIdx,id,pageTop,impId} = this.state;
 
     return (
       <div className={styles.wrapper}>
@@ -291,8 +306,8 @@ class Inspect extends React.Component {
                 {
                   items && items.lisExcelRes.length > 0 ? <ul className={styles.excelDataLists}>
                     {/*<img className={styles.close} src={close} alt="关闭导入excel数据" onClick={() => { this.handleDelClick(2, id) }} />*/}
-                    <span className={styles.close} onClick={() => { this.handleDelClick(2, ind) }}></span>
-                    <DelToast show={id==ind && importFlag?true:false}
+                    <span className={styles.close} id="impClose" onClick={() => { this.handleDelClick(2, ind) }}></span>
+                    <DelToast show={impId==ind?true:false}
                     name="该导入项" 
                     cancel={this.handleCancel}
                     confirm={this.delConfirm}/>
@@ -318,6 +333,7 @@ class Inspect extends React.Component {
                 return <SlideSelect
                   item={item}
                   idx={idx}
+                  showToast={idx==id?true:false}
                   showFill={this.state.showFill}
                   handlePush={handlePush}
                   fillActive={fillActive}

+ 15 - 1
src/components/MultSpread/index.jsx

@@ -49,9 +49,23 @@ class MultSpread extends Component{
       numDoms:doms
     });
   }
+  moveEnd(obj) {
+    if(window.getSelection){//ie11 10 9 ff safari
+      obj.focus(); //解决ff不获取焦点无法定位问题
+      var range = window.getSelection();//创建range
+      range.selectAllChildren(obj);//range 选择obj下所有子内容
+      range.collapseToEnd();//光标移至最后
+    }
+    else if (document.selection) {//ie10 9 8 7 6 5
+      var range = document.selection.createRange();//创建选择对象
+      range.moveToElementText(obj);//range定位到obj
+      range.collapse(false);//光标移至最后
+      range.select();
+    }
+  }
   setNextFocus(i){
     const doms = this.state.numDoms;
-    doms[i+1]&&doms[i+1].current.focus();
+    doms[i+1]&&this.moveEnd(doms[i+1].current)
   }
   getLabels(){
     const {data,ikey,showArr,copyId,selecteds,boxMark} = this.props;

+ 26 - 23
src/components/NumberDrop/index.jsx

@@ -21,6 +21,7 @@ class NumberDrop extends Component{
       editable:false,      //标签是否可输入
       timer:null,
       sltTimer:null,
+      blurTimer:null,
       hasSelect:false,       //是否点过下拉键盘
       boxLeft:0,
       boxTop:0,
@@ -43,8 +44,10 @@ class NumberDrop extends Component{
     this.beyondArea = this.beyondArea.bind(this);
   }
   select(text){        //选中键盘上数字事件
+    //placeholder修改后,第一次点击键盘触发blur后onClick不触发,原因未知,改为onMouseup可触发
     let timer = null;
     clearTimeout(this.state.sltTimer);
+    clearTimeout(this.state.blurTimer);
     const {handleSelect,ikey,suffix,prefix,mainSaveText,min,max} = this.props;
     const needCompare=min!=undefined&&max!=undefined;
     if(!text){
@@ -164,28 +167,31 @@ class NumberDrop extends Component{
   numInpBlur(e){        //数字框失焦,保存值到store中
     e.stopPropagation();
     const {handleSelect,ikey,suffix,prefix,mainSaveText,min,max,show} = this.props;
-    if(show){      //修改清空后第一次点击键盘不触发click事件bug
+    /*if(show){      //修改清空后第一次点击键盘不触发click事件bug--失焦placehoder消失,弃用
       return;
-    }
+    }*/
     //输入超出合理范围或输入不是数字提示且清空
     const needCompare=min!=undefined&&max!=undefined;
-    //if(needCompare){
-      const txt = e.target.innerText.trim();
-      const isFine = this.validSymbols(txt,min,max);      //有~或/时是否合理
-      const hasSymbol = /[\/|\~]/g.test(txt);           //是否有~或/
-      const singleFine = (!isNaN(+txt)&&!needCompare)||(!isNaN(+txt)&&needCompare&&parseFloat(min)<=parseFloat(txt)&&parseFloat(txt)<=parseFloat(max));   //无~或/时是否合理
-      if(txt!=''&&(!hasSymbol&&!singleFine)||(hasSymbol&&!isFine)){
-        this.beyondArea();
-        return;
-      }
-    //}
+    const txt = e.target.innerText.trim();
+    const isFine = this.validSymbols(txt,min,max);      //有~或/时是否合理
+    const hasSymbol = /[\/|\~]/g.test(txt);           //是否有~或/
+    const singleFine = (!isNaN(+txt)&&!needCompare)||(!isNaN(+txt)&&needCompare&&parseFloat(min)<=parseFloat(txt)&&parseFloat(txt)<=parseFloat(max));   //无~或/时是否合理
+    if(txt!=''&&(!hasSymbol&&!singleFine)||(hasSymbol&&!isFine)){
+      this.beyondArea();
+      return;
+    }
 
     //输入为空时显示placeholder
-    if(!e.target.innerText.trim()){
-      this.setState({
-        placeholder:this.props.placeholder
-      });
-    }
+    const timer = setTimeout(()=>{
+      if(!e.target.innerText.trim()){
+        this.setState({
+          placeholder:this.props.placeholder
+        });
+      }
+    },200);
+    this.setState({
+      blurTimer:timer
+    });
 
     const val = e.target.innerText.trim();
     const {placeholder} = this.state;
@@ -227,7 +233,6 @@ class NumberDrop extends Component{
   }
   handleBlur(e){     //双击编辑blur
     const {handleLabelChange,ikey,boxMark,value} = this.props;
-    //if(!this.state.editable) return;
     this.setState({
       editable: false
     });
@@ -239,7 +244,6 @@ class NumberDrop extends Component{
     handleLabelChange && handleLabelChange({ikey,changeVal,type:boxMark,totalVal,prefix,suffix});
   }
   getSpanClass(){       //将被替换的文字选中状态显示
-    //const {hasSelect} = this.state;
     const cls = this.props.show?style['blued']:'';
     return cls;
   }
@@ -248,14 +252,13 @@ class NumberDrop extends Component{
     const spanWidth = window.getComputedStyle(this.$span.current).width;
     this.$span.current.style.minWidth=spanWidth;
     //保存输入框dom以便聚焦
-    const {saveDoms,num} = this.props;
-    //console.log(num);
+    const {saveDoms} = this.props;
     saveDoms&&saveDoms(this.$span);
-    //console.log(this.props.inputRef)
   }
   render(){
     const {prefix,suffix,show,value,handleHide,allClick} = this.props;
-    const {numEditable,placeholder,editable,hasSelect,boxTop,boxLeft} = this.state;
+    const {placeholder,editable,hasSelect,boxTop,boxLeft} = this.state;
+    //console.log(prefix,value,placeholder+'1',this.props.placeholder)
     return <div className={this.getClasses()}
                 ref={this.$cont}
                 onDoubleClick={this.changeToEdit}