Browse Source

Merge branch 'dev/new1' into dev/zhangxc1

zhangxc 6 years ago
parent
commit
c870ce40e6

+ 18 - 10
src/common/components/SearchOption/index.jsx

@@ -18,6 +18,8 @@ class SearchOption extends React.Component {
         }
         this.textInput = React.createRef();
         this.handleClearVal = this.handleClearVal.bind(this);
+        this.handleFocus = this.handleFocus.bind(this);
+        this.handleBlur = this.handleBlur.bind(this);
     }
     
     /*componentWillReceiveProps(nextProps){
@@ -47,19 +49,31 @@ class SearchOption extends React.Component {
         handleChangeValue('');
     }
     handleInput(e){
+      const { handleChangeValue } = this.props;
       if((e.target.value).trim() != ''){
-          this.props.handleChangeValue(e.target.value);
+          handleChangeValue(e.target.value);
           this.setState({
               val:e.target.value,
               show:true
           })
       }else{
-          this.handleClearVal()
+          // this.handleClearVal()
           this.setState({
               show:false
           })
+          return;
       }
     }
+    handleFocus(){
+      if(this.state.val.trim() != ''){
+        return;
+      }else{
+          this.setState({border:true})
+      }
+    }
+    handleBlur(){
+      this.setState({border:false,val:''})
+    }
     render() {
         const { children,visible } = this.props;
         const { show } = this.state;
@@ -72,14 +86,8 @@ class SearchOption extends React.Component {
                     type="text"
                     maxLength="30"
                     ref={this.textInput}
-                    onFocus={()=>{
-                        if(this.state.val.trim() != ''){
-                            
-                        }else{
-                            this.setState({border:true})
-                        }
-                    }}
-                    onBlur={()=>{this.setState({border:false,val:''})}}
+                    onFocus={this.handleFocus}
+                    onBlur={this.handleBlur}
                     onInput={(e) => { 
                         this.handleInput(e)
                     }}

+ 24 - 9
src/common/js/func.js

@@ -65,9 +65,12 @@ export const strTrim = (str) =>{
   return str.replace(/&nbsp;|<div>|<\/div>|<br>|\s/g,'');
 };
 
-//获取已填文字填入saveText
-function getSaveText(arr){
-
+//获取组合组件已填文字填入saveText
+function getSaveText(data){console.log(data)
+  const arr = data.questionMapping.map((it)=>{
+    return it.value?(it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||''):'';
+  });
+  return arr.join('');
 }
 
 //添加自由文本标签
@@ -102,8 +105,12 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
         saveText.push('');
       }
       newArr.push(it);
-      tempText = value?it.labelPrefix+value+it.labelSuffix:'';
-      tempText = notText?tempText:it.value||it.name;
+      if(it.tagType != 3){
+        tempText = value?it.labelPrefix+value+it.labelSuffix:'';
+        tempText = notText?tempText:it.value||it.name;
+      }else{
+        tempText = getSaveText(it);
+      }
       saveText.push(tempText);
     }else{
       pre = arr[i-1];
@@ -111,7 +118,11 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
       if(notTextLabel(pre)&&notText){
           // newArr.push(textLabel,it);
           ifEmpty?newArr.push(textLabel,it):newArr.push(_textLabel,it);
-          tempText = value?it.labelPrefix+value+it.labelSuffix:'';
+          if(it.tagType != 3) {
+            tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
+          }else{
+            tempText = getSaveText(it);
+          }
           saveText.push("",tempText); 
         //最后一个非文本标签,后面添加一个文本标签
         /*if(!noEnd&&i===arr.length-1){
@@ -120,9 +131,13 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
         }*/
       }else{    //本身是或者前面是文本标签时,前面不添加文本标签
         newArr.push(it);
-        tempText = value?it.labelPrefix+value+it.labelSuffix:'';
-        // tempText = notText?tempText:it.value||it.name;
-        tempText = notText?tempText:(it.value||it.value==""?it.value:it.name);
+        if(it.tagType != 3) {
+          tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
+          // tempText = notText?tempText:it.value||it.name;
+          tempText = notText ? tempText : (it.value || it.value == "" ? it.value : it.name);
+        }else{
+          tempText = getSaveText(it);
+        }
         saveText.push(tempText);
       }
       if(notText&&!noEnd&&i===arr.length-1){//最后一个非文本标签,后面添加一个文本标签

+ 5 - 1
src/common/less/variables.less

@@ -161,4 +161,8 @@
   box-shadow: 0 10px 20px 0 #989DA3;
   filter:progid:DXImageTransform.Microsoft.Shadow(color='#989DA3',Direction=125,Strength=6);
   border: 1px solid #f3f0f0;
-}
+}
+
+.borderd{
+   border:1px #3B9ED0 solid;
+ }

+ 1 - 0
src/components/AddAssistCheck/Textarea/index.jsx

@@ -15,6 +15,7 @@ class Textarea extends Component {
     const {handleChangeAssistValue,idx,handlePush} = this.props;
     const text = e.target.innerText;
     const stimer = this.state.timer;
+    console.log(text)
     handleChangeAssistValue&&handleChangeAssistValue(text,idx);
     //右侧推送--延时推送
     clearTimeout(stimer);

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

@@ -140,7 +140,7 @@ class AddAssistCheck extends React.Component {
                 </div>
                 <ConfirmModal 
                     visible={visible}
-                    confirm={()=>{this.delConfirm()}}
+                    confirm={this.delConfirm}
                     close={this.handleCancel}
                     cancel={this.handleCancel}
                     okText="删除"

+ 1 - 1
src/components/AddInspect/index.jsx

@@ -385,7 +385,7 @@ class Inspect extends React.Component {
                 </div>
                 <ConfirmModal 
                     visible={visible}
-                    confirm={()=>{this.delConfirm()}}
+                    confirm={this.delConfirm}
                     close={this.handleCancel}
                     cancel={this.handleCancel}
                     okText="删除"

+ 1 - 0
src/components/HistoryCaseContainer/HistoryList/index.less

@@ -65,6 +65,7 @@
             }
             li:hover {
                 border: 1px solid #66afe9;
+                border: 1px solid #66afe9\0;
             }
             .time {
                 float: right;

+ 8 - 4
src/components/HistoryCaseContainer/index.jsx

@@ -12,6 +12,7 @@ import { CONFIRM_TYPE } from "@store/types/typeConfig";
 class HistoryCaseContainer extends React.Component {
     constructor(props){
         super(props);
+        this.close = this.close.bind(this);
     }
     componentDidMount(){
         // store.dispatch(initItemList());
@@ -24,6 +25,9 @@ class HistoryCaseContainer extends React.Component {
         store.dispatch({type: CONFIRM_TYPE, confirmType: baseObj.sign});
         pushAllDataList(baseObj.sign,'push',baseObj,'history')       //引用
     }
+    close(){
+      store.dispatch(visibleHistory(false));
+    }
     render(){
         const { visible,showHistoryCases,showHistoryBox,items,handleCaseClick,handleQuoteClick,handleSortClick,activeHistory,preInfo } = this.props;
         const domNode = document.getElementById('root');
@@ -39,11 +43,11 @@ class HistoryCaseContainer extends React.Component {
                     handleSortClick={handleSortClick}
                     preInfo={preInfo}
                 ></HistoryList>
-                <ConfirmModal 
+                <ConfirmModal
                     visible={visible}
-                    confirm={()=>{this.makeSure()}}
-                    close={()=>{store.dispatch(visibleHistory(false))}}
-                    cancel={()=>{store.dispatch(visibleHistory(false))}}
+                    confirm={this.makeSure}
+                    close={this.close}
+                    cancel={this.close}
                     okText={"引用"}
                     okBorderColor={'#3B9ED0'}
                     okColor={'#fff'}

+ 8 - 2
src/components/NumberUnitDrop/index.jsx

@@ -29,6 +29,7 @@ class NumberUnitDrop extends Component{
       labelVal:''
     };
     this.$span = React.createRef();
+    this.$cont = React.createRef();
     this.select = this.select.bind(this);
     this.numInpBlur = this.numInpBlur.bind(this);
     this.handleSpanInp = this.handleSpanInp.bind(this);
@@ -114,10 +115,15 @@ class NumberUnitDrop extends Component{
     }
   }
   getClasses(){         //整个标签是否有值的状态
-    const {value,hideTag} = this.props;
+    const {value,hideTag,show} = this.props;
     const inpValue = this.state.value;
     const isSelected = value||inpValue?style['selected']:style['container'];
     const noTag = hideTag?style['no-tag']:'';
+    if(show){
+      $(this.$cont.current).addClass(style['borderd']);
+    }else{
+      $(this.$cont.current).removeClass(style['borderd']);
+    }
     return className(isSelected,noTag);
   }
   changeToEdit(e){        //整个标签双击编辑状态
@@ -146,7 +152,7 @@ class NumberUnitDrop extends Component{
   render(){
     const {placeholder,prefix,suffix,show,value,handleHide} = this.props;
     const {numEditable,editable,hasSelect,placeholderFlag} = this.state;
-    return <div className={this.getClasses()}>
+    return <div className={this.getClasses()} ref={this.$cont}>
       <span>{prefix}</span>
       <span onClick={this.handleNumClick}
             contentEditable={editable}

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

@@ -183,6 +183,8 @@ class Operation extends Component {
     for(let i = 0;i <tmpLis.length;i++){
       let dataStr = tmpLis[i].preview;
       let jsStr = tmpLis[i].dataJson;
+      // console.log(JSON.stringify(JSON.parse(dataStr)))
+      // console.log(JSON.stringify(jsonStr))
       if(JSON.stringify(JSON.parse(dataStr)) == JSON.stringify(jsonStr) && jsStr == JSON.stringify(jsonData)){
         Notify.info('该模板已保存');
         return false;

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

@@ -289,7 +289,9 @@ class PreviewBody extends Component {
                 background: '#3B9ED0',
                 color: '#fff',
                 borderRadius: '4px',
-                cursor: 'pointer'
+                cursor: 'pointer',
+                position:'absolute',
+                right:'40px'
             }}>打印</div>
         </div>
     }

+ 10 - 4
src/components/PushContainer/index.jsx

@@ -46,6 +46,7 @@ class PushContainer extends Component {
         this.handleAllCheckbox=this.handleAllCheckbox.bind(this)
         this.handleMangerTemplate=this.handleMangerTemplate.bind(this)
         this.handleDelList=this.handleDelList.bind(this)
+        this.handleClose = this.handleClose.bind(this);
     }
     componentDidMount(){
         // const height = getWindowInnerHeight()-160;
@@ -194,8 +195,10 @@ class PushContainer extends Component {
     makeSure(){
         if(this.state.type == 1) {
             store.dispatch(delItem(this.state.id))
+            store.dispatch(changeVisible(false))
         }else if(this.state.type == 2){
             store.dispatch(delBatchItem(this.props.checkItems))
+            store.dispatch(changeVisible(false))
         }else if(this.state.type == 3){
             if(this.state.title == this.state.obj.text){
                 store.dispatch(changeVisible(false))
@@ -216,8 +219,11 @@ class PushContainer extends Component {
                     pushAllDataList(typeConfig,'push',part,'template')       //引用
                 }
             })
+            store.dispatch(changeVisible(false))
         }
-        store.dispatch(changeVisible(false))
+    }
+    handleClose(){
+      store.dispatch(changeVisible(false));
     }
     render() {
         const {activeId,checkItems,visible,showMsg,items,allCheckShow} = this.props;
@@ -243,9 +249,9 @@ class PushContainer extends Component {
             </Tab>
             <ConfirmModal 
                 visible={visible}
-                confirm={()=>{this.makeSure()}}
-                close={()=>{store.dispatch(changeVisible(false))}}
-                cancel={()=>{store.dispatch(changeVisible(false))}}
+                confirm={this.makeSure}
+                close={this.handleClose}
+                cancel={this.handleClose}
                 okText={this.state.okText}
                 okBorderColor={this.state.okBorderColor}
                 okColor={this.state.okColor}

+ 10 - 3
src/components/RadioDrop/index.jsx

@@ -2,6 +2,7 @@ import React,{Component} from 'react';
 import {handleEnter} from '@utils/tools.js';
 import {DropList} from '@commonComp';
 import style from "./index.less";
+import $ from "jquery";
 
 /****
  * 单选下拉
@@ -23,17 +24,23 @@ class RadioDrop extends Component{
       editable:false,
       timer:null
     };
+    this.$cont = React.createRef();
     this.handleSelect = this.handleSelect.bind(this);
     this.handleShow = this.handleShow.bind(this);
     this.handledbClick = this.handledbClick.bind(this);
     this.handleEditLabel = this.handleEditLabel.bind(this);
   }
   getClass(){
-    const {value,hideTag,placeholder} = this.props;
+    const {value,hideTag,placeholder,show} = this.props;
+    if(show){
+      $(this.$cont.current).addClass(style['borderd']);
+    }else{
+      $(this.$cont.current).removeClass(style['borderd']);
+    }
     if(hideTag){
       return style['no-tag'];
     }
-    if(value&&value!=placeholder){
+    if(value){
       return style['selected-tag'];
     }
     return style['tag'];
@@ -114,7 +121,7 @@ class RadioDrop extends Component{
   }
   render(){
     const {data,prefix,suffix,placeholder,show,value} = this.props;
-    return <div className={style['container']}>
+    return <div className={style['container']} ref = {this.$cont}>
       {prefix}
       <div className={this.getClass()}
            onBlur={this.handleEditLabel}

+ 6 - 1
src/components/SpreadDrop/index.jsx

@@ -56,7 +56,7 @@ class SpreadDrop extends Component{
     let boxLeft = e.pageX -175 + 'px';
     let offsetTop = e.target.offsetTop;
     const ht = e.target.offsetHeight;   //如杂音选中文字有多行时,写死会遮挡
-    let boxTop = offsetTop + ht + 'px';
+    let boxTop = offsetTop + ht +2 + 'px';
     this.setState({
       boxLeft:boxLeft,
       boxTop:boxTop
@@ -282,6 +282,11 @@ class SpreadDrop extends Component{
     });
   }
   getClass(){
+    if(this.props.show){
+      $(this.$div.current).addClass(style['borderd']);
+    }else{
+      $(this.$div.current).removeClass(style['borderd']);
+    }
     if(this.props.value){
       return style['selected-tag'];
     }

+ 0 - 3
src/components/SpreadDrop/index.less

@@ -40,9 +40,6 @@
   cursor: pointer;
   line-height: 20px;
 }
-.tag{
-  .tag;
-}
 
 .selected-tag{
   padding: 0;

+ 1 - 1
src/containers/CurrentIll.js

@@ -12,7 +12,7 @@ import {getModule} from '@store/async-actions/fetchModules.js';
 import {didPushParamChange} from '@utils/tools.js';
 
 
-function mapStateToProps(state) {
+function mapStateToProps(state) { 
   const {homePage} = state;
     return {
         data:state.currentIll.data,//主诉模板

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

@@ -119,7 +119,6 @@ export function setCheckBoxValue(state,action) {
     showText = showText.substr(0,showText.length-1);
   }
   res.data[labelInx].value = showText;
-  res.saveText[labelInx] = showText;
   res.selecteds[labelInx] = action.data;
   res.saveText = fullfillText(res.data).saveText;
   res.update = Math.random();

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

@@ -249,6 +249,7 @@ export const insertSearch = (state,action)=>{
     // res.saveText[inserIndx] = searchData;
     res.saveText = fullfillText(res.data).saveText;
     res.mainIds.push(id);
+    res.mainSymptIds.push(id);
     res.editClear = false;//主诉框编辑状态
   }else{
     // 替换

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

@@ -5,6 +5,7 @@ import {
   batchDelItems,
   changeTitle,
   keepPushData,
+  changeVisible
 } from '@store/actions/tabTemplate';
 import {DIAG_SHOW} from "@store/types/print";
 import Notify from '@commonComp/Notify';
@@ -143,6 +144,7 @@ export const changeTitleAsync = (obj) => { //改标题
       if (data.code == 0) {
         dispatch(changeTitle(obj));
         Notify.success('标题修改成功');
+        store.dispatch(changeVisible(false))
       } else {
         console.log(data)
         Notify.error(data.msg)

+ 1 - 1
src/utils/tools.js

@@ -218,7 +218,7 @@ const getAllDataStringList =(baseList) =>{           //获取所有模块文本
       'diag' : baseList.diagnosticList.diagnosticStr,
       'advice' : baseList.pushMessage.AdviceStr
     }
-    // console.log(jsonDataString,'文本模式数据获取')
+    console.log(jsonDataString,'文本模式数据获取')
     return jsonDataString;
 }
 /**