Bladeren bron

bug2828,2826,2823

luolei 5 jaren geleden
bovenliggende
commit
d19cb01986

+ 3 - 3
src/components/Operation/index.jsx

@@ -290,10 +290,10 @@ class Operation extends Component {
     const { type } = this.state;
     if (type == 3){
       diagShowTmp(false)
-      this.setState({ title: '',deptId:"" })
+      this.setState({ title: '',deptId:"",value:"" })
     }else{
       diagShowTmp(false)
-      this.setState({ title: '',deptId:"" }) 
+      this.setState({ title: '',deptId:"",value:"" }) 
     }
   }
   setDeptId(id,name){
@@ -355,7 +355,7 @@ class Operation extends Component {
               <span>科室归属:</span>
                 <Search handleChangeValue={handleChangeValue} handleChangeIpt={handleChangeIpt} value={value} visible={true}>
                 {
-                  departLis.length>0&&<ul className={style.departLis}>
+                  departLis.length>0&&value&&<ul className={style.departLis}>
                     {
                       departLis.map((item,idx)=>{
                         return <li onClick={()=>this.setDeptId(item.id,item.conceptDeptName)}>

+ 13 - 19
src/components/PreInIcss/RotateImg/index.jsx

@@ -39,13 +39,13 @@ class RotateImg extends Component {
     let width = currentImg.width,height = currentImg.height;
     if(width>height){
       if(width > scaleHeight){
+        height=scaleHeight/width*height
         width=scaleHeight
-        height=height*scaleHeight/width
       }
     }else{
       if(height > scaleHeight){
+        width = scaleHeight/height*width
         height = scaleHeight
-        width = width*scaleHeight/height
       }
     }
     this.setState({
@@ -57,18 +57,6 @@ class RotateImg extends Component {
       mgTop:-height/2
     })
   }
-  getStyle(){
-    const { imgDetail,idx,imgLis } = this.props;
-    let currentImg = imgLis[this.state.current];
-    let width = currentImg.width,height = currentImg.height;
-    let isLorR = width > height;
-    return {
-      width:width,
-      height:height,
-      marginLeft:-width/2,
-      marginTop:-height/2
-    }
-  }
   handleNext(){
     this.props.setMove(false)
     const { imgLis,isMove,windowHeight } = this.props;
@@ -84,13 +72,13 @@ class RotateImg extends Component {
     }
     if(width>height){
       if(width > scaleHeight){
+        height=scaleHeight/width*height
         width=scaleHeight
-        height=height*scaleHeight/width
       }
     }else{
       if(height > scaleHeight){
+        width = scaleHeight/height*width
         height = scaleHeight
-        width = width*scaleHeight/height
       }
     }
     let imgDom = this.refs.rotateImg.getDOMNode();
@@ -121,13 +109,13 @@ class RotateImg extends Component {
     }
     if(width>height){
       if(width > scaleHeight){
+        height=scaleHeight/width*height
         width=scaleHeight
-        height=height*scaleHeight/width
       }
     }else{
       if(height > scaleHeight){
+        width = scaleHeight/height*width
         height = scaleHeight
-        width = width*scaleHeight/height
       }
     }
     let imgDom = this.refs.rotateImg.getDOMNode();
@@ -179,12 +167,18 @@ class RotateImg extends Component {
   }
   handleRotate(flg){
     let deg = this.state.de;
+    let tmpWidth = this.state.imgWidth;
+    let tmpHeight = this.state.imgHeight;
     if(flg){
       deg = deg-90
     }else{
       deg = deg-0+90
     }
     this.setState({
+      // imgWidth:tmpHeight,
+      // imgHeight:tmpWidth,
+      // mgLeft:-tmpHeight/2,
+      // mgTop:-tmpWidth/2,
       de:deg
     })
   }
@@ -192,7 +186,6 @@ class RotateImg extends Component {
   render() {
     const { imgLis,handleClose,windowHeight } = this.props;
     const { current,imgWidth,imgHeight,mgLeft,mgTop,de,left,top } = this.state;
-
     const domNode = document.getElementById('root');
     return ReactDom.createPortal(<div className={style.preImgWrap}>
       <div className={style.modal} onClick={handleClose}></div>
@@ -208,6 +201,7 @@ class RotateImg extends Component {
             <img className={style.rotateImg}
               id="drugImg"
               ref="rotateImg" 
+              data-deg={de}
               src={imgLis[current].originalImage} 
               style={{
                 width:imgWidth+'px',

+ 6 - 3
src/components/PushContainer/index.jsx

@@ -43,6 +43,7 @@ class PushContainer extends Component {
       oKBg: '',
       okColor: 'red',
       num: 0,          //计数
+      deptId:'',       //科室id
     }
     this.$cont = React.createRef();
     this.itemList = null;
@@ -121,7 +122,7 @@ class PushContainer extends Component {
   delDiv() {
     return <p className={style['center']}>确认删除模板?</p>
   }
-  onchange(value) {
+  onchange(value,deptId) {
     this.setState({
       title: value
     }, () => {
@@ -162,13 +163,14 @@ class PushContainer extends Component {
    * 改变模板标题
    * @param {模板id和模板title} obj
    */
-  handleTitleChange(id, text) {
+  handleTitleChange(id, text,deptId) {
     store.dispatch(changeVisible(true))
     this.setState({
       type: 3,
       currId: id,
       title: text,
       text: text,
+      deptId: deptId,
       okText: '保存',
       okBorderColor: '#3B9ED0',
       okColor: '#fff',
@@ -254,7 +256,8 @@ class PushContainer extends Component {
       }
       let tempObj = {
         id: this.state.currId,
-        title: this.state.title
+        title: this.state.title,
+        deptId:this.state.deptId
       }
       if(this.props.admin){
         store.dispatch(changeTitleAsyncAdmin(tempObj))

+ 4 - 4
src/components/TemplateItems/TemplateItem/index.jsx

@@ -113,10 +113,10 @@ class TemplateItem extends React.Component {
     });
   }
 
-  handleEditIconClick(e, name) {
+  handleEditIconClick(e, name,deptId) {
     e.stopPropagation();
     let currId = this.props.id
-    this.props.handleTitleChange(currId, name);
+    this.props.handleTitleChange(currId, name,deptId);
   }
 
   handleTitleClick(e) {
@@ -211,7 +211,7 @@ class TemplateItem extends React.Component {
     }
   }
   render() {
-    const { allCheckShow, id, name, preview,conceptDeptName, sex,admin,checkItemsAdmin,allCheckShowAdmin,adminflg } = this.props;
+    const { allCheckShow, id, name,hospitalDeptId, preview,conceptDeptName, sex,admin,checkItemsAdmin,allCheckShowAdmin,adminflg } = this.props;
     let previewJson = JSON.parse(preview);
     let sexStr = sex == 2 ? ' (女'+(conceptDeptName&&'-'+conceptDeptName)+')' : sex == 1 ? ' (男'+(conceptDeptName&&'-'+conceptDeptName)+')' : ' (通用'+(conceptDeptName&&'-'+conceptDeptName)+')';
     return (
@@ -243,7 +243,7 @@ class TemplateItem extends React.Component {
             src={this.getEditIcon()}
             onMouseEnter={() => this.handleEditIconMouseEnter()}
             onMouseLeave={() => this.handleEditIconMouseLeave()}
-            onClick={(e) => this.handleEditIconClick(e, name)}
+            onClick={(e) => this.handleEditIconClick(e, name,hospitalDeptId)}
           />}
         </div>
         <div

+ 2 - 2
src/store/async-actions/tabTemplate.js

@@ -278,7 +278,7 @@ export const changeTitleAsyncAdmin = (obj) => { //改标题
   return (dispatch) => {
     axios.json('/templateAdmin/updateByAdminNames', {
       "doctorId": state.doctorId,
-      "hospitalDeptId": state.hospitalDeptId,
+      "hospitalDeptId": obj.deptId,
       "hospitalId": state.hospitalId,
       "id": obj.id,
       "modeName": obj.title,
@@ -303,7 +303,7 @@ export const changeTitleAsync = (obj) => { //改标题
   return (dispatch) => {
     axios.json('/templateInfo/updateByIdUsNames', {
       "doctorId": state.doctorId,
-      "hospitalDeptId": state.hospitalDeptId,
+      "hospitalDeptId": obj.deptId,
       "hospitalId": state.hospitalId,
       "id": obj.id,
       "modeName": obj.title,

+ 59 - 9
src/utils/drag.js

@@ -169,11 +169,16 @@ function handleMoves(event){
  * 预问诊预览图片可拖拽
  */
 let imgXS = 0,//鼠标距离图片左侧的位置
+    imgWXS = 0,//图片容器距离左侧的位置
+    imgDXS = 0,//图片距离左侧的位置left
     imgYS = 0,//鼠标距离图片顶部的位置
-    imgDXS = 0,//图片距离左侧的位置
-    imgDYS = 0,//图片距离顶部的位置
-    imgWXS = 0,//图片容器距离顶部的位置
     imgWYS = 0,//图片容器距离顶部的位置
+    imgDYS = 0,//图片距离顶部的位置top
+    drgLeft= 0,
+    tmpValL=0,
+    tmpNum=0,
+    tmpName='',
+    tmpValR=0,
     imgDrag = false;
 function imgDragMove(type){
   let wrap = $("#previewWrapper");
@@ -189,12 +194,27 @@ function imgDragMove(type){
       imgXS = page.boxLeft - drag.offset().left;
       imgYS = page.boxTop - drag.offset().top;       
       imgDrag = true;
-      
+
       imgDXS = drag.offset().left;
       imgDYS = drag.offset().top;
-      imgWXS = wrap.offset().left
-      imgWYS = wrap.offset().top
-        
+      imgWXS = wrap.offset().left;
+      imgWYS = wrap.offset().top;
+
+      if(tmpName){
+        if(drag.attr("src") != tmpName||drag.attr("data-deg")==0){
+          tmpNum==0
+        }
+      }else{
+        tmpName = drag.attr("src")
+      }
+      
+      if(tmpNum == 0){
+        tmpValL = imgDXS-imgWXS;
+        tmpValR = imgDYS-imgWYS;
+        tmpName = 
+        ++tmpNum
+      }
+      console.log(imgDXS,imgWXS,tmpNum,'hahaha')
       $(document).on('mousemove',handleMoveImg)
       $(document).on('mouseup',handleUpImg)
     })
@@ -209,19 +229,49 @@ function handleMoveImg(event){
   !isMove&&store.dispatch({type:SET_MOVE,isMove:true})
   let wrap = $("#previewWrapper");
   let drag = $("#drugImg");
+  let de = (Math.abs(drag.attr("data-deg")%180)==90)?true:false;
   let page = getPageCoordinate(event,'0');
   let wrapWidth = drag[0].offsetWidth;
   let wrapHeight = drag[0].offsetHeight;
   if(imgDrag){
+      
+    console.log('鼠标左:'+page.boxLeft)
+    console.log('鼠标图左:'+imgXS)
+    console.log('容器左:'+imgWXS)
+    console.log('被拖图左:'+drag.offset().left)
+    console.log('bian1:'+tmpValL)
+    console.log('bian2:'+tmpValR)
+
     imgDXS = page.boxLeft - imgXS - imgWXS;//相对于父元素定位
     imgDYS = page.boxTop - imgYS - imgWYS;
+
+    // if(wrapHeight > wrapWidth){
+    //   drag.css({
+    //     width:wrapWidth+'px',
+    //     height:wrapHeight+'px',
+    //     marginLeft:'0px',
+    //     marginTop:'0px',
+    //     left:imgDXS+(de?163:0) + 'px',
+    //     top:imgDYS-(de?163:0) + 'px'
+    //   })
+    // }
+    // else{
+    //   drag.css({
+    //     width:wrapWidth+'px',
+    //     height:wrapHeight+'px',
+    //     marginLeft:'0px',
+    //     marginTop:'0px',
+    //     left:imgDXS-(de?163:0) + 'px',
+    //     top:imgDYS+(de?163:0) + 'px'
+    //   })
+    // }
     drag.css({
       width:wrapWidth+'px',
       height:wrapHeight+'px',
       marginLeft:'0px',
       marginTop:'0px',
-      left:imgDXS + 'px',
-      top:imgDYS + 'px'
+      left:imgDXS-(de?tmpValL:0) + 'px',
+      top:imgDYS+(de?tmpValL:0) + 'px'
     })
   }
 }

+ 4 - 2
src/utils/tools.js

@@ -1219,10 +1219,12 @@ function getStringPlus(dataList){
   let strPlus = '';
   dataList && dataList.map((item)=>{
     if(item.detailName){
-      let strTmp = item.name + ','+(item.inpValue?(item.inpValue+','):'') + item.detailName + ',' + (item.otherValue ? item.otherValue : (item.value + item.units)) +';'
+      let strTmp = item.name + ','+ item.detailName + ',' + (item.otherValue ? item.otherValue : (item.value + item.units)) +';'
+      // let strTmp = item.name + ','+(item.inpValue?(item.inpValue+','):'') + item.detailName + ',' + (item.otherValue ? item.otherValue : (item.value + item.units)) +';'
       strPlus += strTmp;
     }else{
-      let strTmp = item.name+ (item.inpValue?(','+item.inpValue):';')
+      // let strTmp = item.name+ (item.inpValue?(','+item.inpValue):';')
+      let strTmp = item.name+ ';'
       strPlus += strTmp;
     }
   })