Procházet zdrojové kódy

Merge remote-tracking branch 'origin/groupTypeStyle' into testedMerge

# Conflicts:
#	src/utils/config.js
zhouna před 5 roky
rodič
revize
d7efc250ad
50 změnil soubory, kde provedl 2734 přidání a 342 odebrání
  1. 1 0
      src/common/components/ConfirmModal/index.less
  2. binární
      src/common/images/diagDown.png
  3. binární
      src/common/images/diagUp.png
  4. binární
      src/common/images/folderDown.png
  5. binární
      src/common/images/folderDownSelect.png
  6. binární
      src/common/images/folderUp.png
  7. binární
      src/common/images/folderUpSelect.png
  8. binární
      src/common/images/slideDown.png
  9. 5 0
      src/components/Advice/Textarea/index.jsx
  10. binární
      src/components/FolderName/img/close.png
  11. 67 0
      src/components/FolderName/index.jsx
  12. 83 0
      src/components/FolderName/index.less
  13. 22 0
      src/components/FolderOrder/NewPortal/index.jsx
  14. binární
      src/components/FolderOrder/img/close.png
  15. binární
      src/components/FolderOrder/img/floderD.png
  16. binární
      src/components/FolderOrder/img/floderR.png
  17. 199 0
      src/components/FolderOrder/index.jsx
  18. 172 0
      src/components/FolderOrder/index.less
  19. 5 4
      src/components/Operation/Search/index.jsx
  20. 186 35
      src/components/Operation/index.jsx
  21. 137 9
      src/components/Operation/index.less
  22. binární
      src/components/PushContainer/Search/imgs/clear.png
  23. binární
      src/components/PushContainer/Search/imgs/search.png
  24. 116 0
      src/components/PushContainer/Search/index.jsx
  25. 38 0
      src/components/PushContainer/Search/index.less
  26. binární
      src/components/PushContainer/img/check-circle.png
  27. binární
      src/components/PushContainer/img/check-right.png
  28. 433 51
      src/components/PushContainer/index.jsx
  29. 254 4
      src/components/PushContainer/index.less
  30. binární
      src/components/TemplateItems/TemplateItem/img/check-circle.png
  31. binární
      src/components/TemplateItems/TemplateItem/img/check-right.png
  32. binární
      src/components/TemplateItems/TemplateItem/img/floderD.png
  33. binární
      src/components/TemplateItems/TemplateItem/img/floderR.png
  34. binární
      src/components/TemplateItems/TemplateItem/img/floderT.png
  35. binární
      src/components/TemplateItems/TemplateItem/img/floderTb.png
  36. binární
      src/components/TemplateItems/TemplateItem/img/tempTip.png
  37. binární
      src/components/TemplateItems/TemplateItem/img/tempTrd.png
  38. binární
      src/components/TemplateItems/TemplateItem/img/tmpAllCircle.png
  39. binární
      src/components/TemplateItems/TemplateItem/img/tmpAllRight.png
  40. 19 15
      src/components/TemplateItems/TemplateItem/index.jsx
  41. 5 3
      src/components/TemplateItems/TemplateItem/index.less
  42. 250 37
      src/components/TemplateItems/index.jsx
  43. 123 5
      src/components/TemplateItems/index.less
  44. 132 112
      src/containers/OperationContainer.js
  45. 1 1
      src/store/actions/pushMessage.js
  46. 46 6
      src/store/actions/tabTemplate.js
  47. 196 40
      src/store/async-actions/tabTemplate.js
  48. 111 20
      src/store/reducers/tabTemplate.js
  49. 8 0
      src/store/types/tabTemplate.js
  50. 125 0
      src/utils/Convert_Pinyin.js

+ 1 - 0
src/common/components/ConfirmModal/index.less

@@ -58,6 +58,7 @@
     line-height: 32px;
     opacity: 1;
     color: #fff;
+    margin-top: 6px;
     border: 1px solid #78bddd;
 }
 .modal-operator-confirm {

binární
src/common/images/diagDown.png


binární
src/common/images/diagUp.png


binární
src/common/images/folderDown.png


binární
src/common/images/folderDownSelect.png


binární
src/common/images/folderUp.png


binární
src/common/images/folderUpSelect.png


binární
src/common/images/slideDown.png


+ 5 - 0
src/components/Advice/Textarea/index.jsx

@@ -23,6 +23,10 @@ class Textarea extends Component {
     handleChangeAssistValue&&handleChangeAssistValue(text);
    
   }
+  handleFocus() {
+    const {handleFocus} = this.props
+    handleFocus&&handleFocus()
+  }
   shouldComponentUpdate(next){
     if(JSON.stringify(next) == JSON.stringify(this.props)){
       return false;
@@ -70,6 +74,7 @@ class Textarea extends Component {
             className={`${style['text']} ${setFontColorSize(2)}`}
             contenteditable={true}
             ref={this.$dom}
+            onFocus={this.handleFocus}
             onInput={this.handleInput}
             onKeyUp={this.handleInput}
             onkeydown={(e) => {e.stopPropagation()}}

binární
src/components/FolderName/img/close.png


+ 67 - 0
src/components/FolderName/index.jsx

@@ -0,0 +1,67 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import style from './index.less';
+import close from './img/close.png';
+import { Notify } from '@commonComp';
+class FolderName extends React.Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            folderModal:false
+        }
+        this.textInput = React.createRef();
+        this.saveNewFolder = this.saveNewFolder.bind(this)
+    }
+    componentDidMount(){
+    //   this.textInput.current.focus();
+    }
+    saveNewFolder(){
+        const {saveNewFolder} = this.props
+        let val = this.textInput.current.value
+        if(val.trim() == ''){
+            Notify.info('请输入文件夹名称');
+        }
+        saveNewFolder(val)
+    }
+    onKeyPress(event){
+        let e = event?event:window.event;
+        if (e.keyCode == 13) {
+          this.saveNewFolder()
+        }
+    }
+    render() {
+        const { folderModalShow,title,newFolder } = this.props;
+        const domNode = document.getElementById('root');
+        return folderModalShow&&ReactDOM.createPortal(
+            <div className={style.newFolderWrap}>
+                <div className={style.folderModal} onClick={()=>newFolder(false)}></div>
+                <div className={style.nameWrap}>
+                    <div className={style.title}>
+                        {
+                            title?<div className={style.titleCon}>{title}</div>:null
+                        }
+                        <img src={close} alt="关闭" onClick={()=>newFolder(false)}/>
+                    </div>
+                    <div className={style.mainWrap}>
+                        <span className={style.leftName}>名称:</span>
+                        <input className={style['ipt']}
+                            placeholder="请输入文件夹名称"
+                            type="text"
+                            maxLength='20'
+                            ref={this.textInput}
+                            onKeyPress={e => this.onKeyPress(e)}
+                        />
+                    </div>
+                    <div className={style['delFoot']}>
+                        <div className={style.halfBtn}>
+                            <span className={`${style['delBtn']} ${style['delDel']}`} onClick={this.saveNewFolder}>保存</span>
+                        </div>
+                        <div className={style.halfBtn}>
+                            <span className={`${style['delBtn']} ${style['delCancel']}`} onClick={()=>newFolder(false)}>取消</span>
+                        </div>
+                    </div>
+                </div> 
+            </div>,domNode)
+    }
+}
+export default FolderName;

+ 83 - 0
src/components/FolderName/index.less

@@ -0,0 +1,83 @@
+@import "~@less/variables.less";
+
+.newFolderWrap {
+    .folderModal {
+        z-index: 120;
+        position: fixed;
+        width: 100%;
+        height: 100%;
+        top: 0;
+        left: 0;
+        background: #000;
+        opacity: .3;
+        filter: alpha(opacity=60);
+        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=60);";
+    }
+    .nameWrap{
+        z-index: 130;
+        position: fixed;
+        top: 50%;
+        left: 50%;
+        margin: auto;
+        border-radius: 5px;
+        background: #fff;
+        width: 500px;
+        margin-left: -250px;
+        margin-top: -115px;
+        .mainWrap {
+            padding: 50px 10px;
+        }
+        .title {
+            height: 40px;
+            line-height: 40px;
+            border-bottom: 1px solid #ccc;
+            img{
+                float: right;
+            }
+        }
+        .leftName {
+            width: 135px;
+            text-align: right;
+            padding-right: 16px;
+            display: inline-block;
+        }
+        .titleCon {
+            float: left;
+            height: 40px;
+            line-height: 40px;
+            margin-left: 10px;
+        }
+        input {
+            border: 1px solid #CCCCCC;
+            padding: 5px 10px;
+            width: 240px;
+        }
+    }
+    .delFoot{
+        .halfBtn {
+            width: 50%;
+            display: inline-block;
+            text-align: center;
+            height: 65px;
+        }
+        .delBtn{
+          display: inline-block;
+          width: 100px; 
+          height: 34px;
+          line-height: 32px;
+          border-radius: 5px;
+          margin: 0 auto;
+          cursor: pointer;
+        }
+        .delDel{
+          color: #fff;
+          background: #3B9ED0;
+        }
+        .delCancel{
+          color:#000;
+          background: #fff;
+          border: 1px solid #1E1E1E;
+          color: #1E1E1E;
+        }
+    }
+}

+ 22 - 0
src/components/FolderOrder/NewPortal/index.jsx

@@ -0,0 +1,22 @@
+import React, { Component } from 'react';
+import ReactDOM from 'react-dom';
+
+//传送门,将dom渲染到body节点
+class NewPortal extends Component {
+    constructor(props) {
+        super(props)
+        // 初始化创建渲染的父元素并添加到body下
+        this.node = document.createElement('div');
+        document.body.appendChild(this.node);
+    }
+    render() {
+        const { visible,children } = this.props;
+        
+        return visible && ReactDOM.createPortal(
+            children,
+            this.node
+        )
+    }
+}
+
+export default NewPortal;

binární
src/components/FolderOrder/img/close.png


binární
src/components/FolderOrder/img/floderD.png


binární
src/components/FolderOrder/img/floderR.png


+ 199 - 0
src/components/FolderOrder/index.jsx

@@ -0,0 +1,199 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import style from './index.less';
+import close from './img/close.png';
+import { Notify } from '@commonComp';
+import floderR from './img/floderR.png';
+import floderD from './img/floderD.png';
+import diagUp from '@common/images/diagUp.png';
+import diagDown from '@common/images/diagDown.png';
+import NewPortal from './NewPortal';
+class FolderOrder extends React.Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            folderModal:false,
+            selectIndex: -1,
+            folderList: null,
+        }
+        this.textInput = React.createRef();
+        this.orderFolder = this.orderFolder.bind(this)
+        this.saveOrderFolder = this.saveOrderFolder.bind(this)
+    }
+    componentWillReceiveProps(props) {
+        this.setState({
+            folderList: JSON.parse(JSON.stringify(props.adminItems)),
+            selectIndex: -1
+        })
+    }
+    floderSlide(e,i) {
+        const selectIndex = this.state.selectIndex
+        if(selectIndex === i) {
+            this.setState({
+                selectIndex: -1
+            })
+        } else {
+            this.setState({
+                selectIndex: i
+            })
+        }
+        
+    }
+    saveOrderFolder(){
+        const {saveOrderFolder,patInfo,folderManage} = this.props
+        const {folderList} = this.state
+        let folderListFilter = []
+        for(let i = 0; i < folderList.length; i++) {
+            let templateList = []
+            if(folderList[i].templateInfo) {
+                for(let j = 0; j < folderList[i].templateInfo.length;j++) {
+                    const templateItem = folderList[i].templateInfo[j]
+                    templateList.push({
+                            "folderId": templateItem.folderId,
+                            "id": templateItem.folderMappingId,
+                            "isDeleted": "N",
+                            "orderNo": j,
+                            "templateId": templateItem.id
+                          }) 
+                }
+            }
+            
+            const item = 
+            {
+                "doctorId": patInfo.doctorId,
+                "hospitalId": patInfo.hospitalId,
+                "id": folderList[i].id,
+                "isDeleted": "N",
+                "name": folderList[i].name,
+                "orderNo": i,
+                "templateSortVOList": templateList
+                }
+                folderListFilter.push(item)
+        }
+        saveOrderFolder(folderListFilter)
+        folderManage(false)
+    }
+    orderFolder(index,e) {
+        e.stopPropagation();
+        const {selectIndex, folderList} =   this.state
+        const folderListCopy = JSON.parse(JSON.stringify(folderList))
+        const item = folderListCopy[index]
+        if(index > 0) {
+            folderListCopy.splice(index, 1)
+            folderListCopy.splice(index-1, 0 , item)
+            if(index === selectIndex) {
+                this.setState({
+                    selectIndex: selectIndex-1
+                })
+            }else if(index === selectIndex+1){
+                this.setState({
+                    selectIndex: selectIndex+1
+                })
+            }
+        } else {
+            folderListCopy.splice(index, 1)
+            folderListCopy.splice(index+1, 0 , item)
+            if(selectIndex === index + 1) {
+                this.setState({
+                    selectIndex: selectIndex - 1
+                })
+            }else if(selectIndex == 0 ) {
+                this.setState({
+                    selectIndex: selectIndex+1
+                })
+            }
+            
+        }
+        this.setState({
+            folderList: folderListCopy
+        })
+    }
+    orderTemplate(i,index, e) {
+        e.stopPropagation();
+        const folderListCopy = JSON.parse(JSON.stringify(this.state.folderList))
+        const olderItem = folderListCopy[i]
+        const templateList = olderItem.templateInfo
+        const templateItem = templateList[index]
+        if(index > 0) {
+            templateList.splice(index, 1)
+            templateList.splice(index-1, 0 , templateItem)
+        } else {
+            templateList.splice(index, 1)
+            templateList.splice(index+1, 0 , templateItem)
+        }
+        this.setState({
+            folderList: folderListCopy
+        })
+    }
+    genAdminItems(items,flg) {
+        const Floder=[],Items = [];
+        const {admin,checkItemsAdmin} = this.props;
+       
+        const { selectIndex } = this.state;
+        for(let i = 0;i < items.length;i++){
+            let tmpItm = items[i]
+            Floder.push(
+                <div className={style.floderBox}>
+                    <div className={style.floderItem} onClick={(e)=>{tmpItm.templateInfo&&tmpItm.templateInfo.length>0 ?this.floderSlide(e,i) :''}}>
+                        <img src={selectIndex == i?floderD:floderR} className={style.floderRD}/>
+                        {tmpItm.name}({tmpItm.templateInfoCount})
+                        <span class={`${i ===0 ? style.arrowDown : style.arrowUp}`} onClick={this.orderFolder.bind(this, i)}></span>
+                        {/* <img  class={style.orderIcon} src={i===0?diagDown:diagUp} alt="排序" onClick={this.orderFolder.bind(this, i)}/> */}
+                        {/* <span className={`${style.floderPartAction}`} id="floderActionBtn" onClick={(e)=>{this.floderAction(e,i)}}>...</span> */}
+                    </div>
+                    {
+                        i==selectIndex&&tmpItm.templateInfo&&tmpItm.templateInfo.length>0&&<div className={style.floderPartFr}>
+                           { tmpItm.templateInfo.map((templateItem, index) => {
+                               return (<div class={style.templateItem}>
+                                   {templateItem.name}
+                                   <span class={`${index===0 ? style.arrowDown : style.arrowUp}`} onClick={this.orderTemplate.bind(this, i, index)}></span>
+                                   {/* <img class={style.orderIcon} src={index===0?diagDown:diagUp} alt="排序" onClick={this.orderTemplate.bind(this, i, index)}/> */}
+                               </div>)
+                            })}
+                        </div>
+                    }
+                </div>
+            )
+        }
+        return Floder
+    }
+    onKeyPress(event){
+        let e = event?event:window.event;
+        if (e.keyCode == 13) {
+          this.saveNewFolder()
+        }
+    }
+    render() {
+        const { folderOrderShow,title,folderManage,adminItems,  } = this.props;
+        const domNode = document.getElementById('root');
+        const items = this.state.folderList
+        // return folderOrderShow&&ReactDOM.createPortal(
+
+        return <NewPortal visible={folderOrderShow}>
+            <div className={style.newFolderWrap}>
+                <div className={style.folderModal} onClick={()=>folderManage(false)}></div>
+                <div className={style.nameWrap}>
+                    <div className={style.title}>
+                        {
+                            title?<div className={style.titleCon}>{title}</div>:null
+                        }
+                        <img src={close} alt="关闭" onClick={()=>folderManage(false)}/>
+                    </div>
+                    <div className={style['delContent']}>
+                        {items&&items.length > 0 &&this.genAdminItems(items,true)}
+                    </div>
+                    <div className={style['delFoot']}>
+                        <div className={style.halfBtn}>
+                            <span className={`${style['delBtn']} ${style['delDel']}`} onClick={this.saveOrderFolder}>保存</span>
+                        </div>
+                        <div className={style.halfBtn}>
+                            <span className={`${style['delBtn']} ${style['delCancel']}`} onClick={()=>folderManage(false)}>取消</span>
+                        </div>
+                    </div>
+                </div> 
+            </div>
+            </NewPortal>
+            // ,domNode)
+    }
+}
+export default FolderOrder;

+ 172 - 0
src/components/FolderOrder/index.less

@@ -0,0 +1,172 @@
+@import "~@less/variables.less";
+
+.newFolderWrap {
+    .folderModal {
+        z-index: 120;
+        position: fixed;
+        width: 100%;
+        height: 100%;
+        top: 0;
+        left: 0;
+        background: #000;
+        opacity: .3;
+        filter: alpha(opacity=60);
+        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=60);";
+    }
+    .nameWrap{
+        z-index: 130;
+        position: fixed;
+        top: 10%;
+        left: 50%;
+        margin: auto;
+        border-radius: 5px;
+        background: #fff;
+        width: 500px;
+        height: 80%;
+        margin-left: -250px;
+        padding: 40px 0 65px 0;
+        // margin-top: -115px;
+        .mainWrap {
+            padding: 50px 10px;
+        }
+        .title {
+            position: absolute;
+            width: 100%;
+            top: 0;
+            height: 40px;
+            line-height: 40px;
+            border-bottom: 1px solid #ccc;
+            img{
+                float: right;
+            }
+        }
+        .leftName {
+            width: 135px;
+            text-align: right;
+            padding-right: 16px;
+            display: inline-block;
+        }
+        .titleCon {
+            float: left;
+            height: 40px;
+            line-height: 40px;
+            margin-left: 10px;
+        }
+        input {
+            border: 1px solid #CCCCCC;
+            padding: 5px 10px;
+            width: 240px;
+        }
+    }
+    .delFoot{
+        position: absolute;
+        width: 100%;
+        bottom: 0;
+        .halfBtn {
+            width: 50%;
+            display: inline-block;
+            text-align: center;
+            height: 65px;
+        }
+        .delBtn{
+          display: inline-block;
+          width: 100px; 
+          height: 34px;
+          line-height: 32px;
+          border-radius: 5px;
+          margin: 0 auto;
+          cursor: pointer;
+        }
+        .delDel{
+          color: #fff;
+          background: #3B9ED0;
+        }
+        .delCancel{
+          color:#000;
+          background: #fff;
+          border: 1px solid #1E1E1E;
+          color: #1E1E1E;
+        }
+    }
+    .delContent{
+        height: 100%;
+        overflow-y: auto;
+    }
+    .floderBox{
+        line-height: 45px;
+    }
+    .floderItem{
+        border-bottom: 1px solid #EAEDF1;
+        padding: 0 40px 0 10px;
+        position: relative;
+        cursor: pointer;
+        line-height: 45px;
+    }
+    .floderRD{
+        width: 20px;
+        height: 20px;
+        position: relative;
+        top: 5px;
+        right: 4px;
+        pointer-events: none;
+    }
+    .orderIcon{
+        // width: 20px;
+        position: absolute;
+        top: 11px;
+        right: 25px;
+    }
+    
+    .templateItem{
+        position: relative;
+        line-height: 45px;
+        padding: 0 40px 0 10px;;
+    }
+    .arrowDown{
+        position: absolute;
+        top: 13px;
+        right: 25px;
+        display: inline-block;
+        width: 12px;
+        height: 17px;
+        background: url("../../common/images/folderDown.png") no-repeat center ;
+        background-size: 12px 17px;
+    }
+    .arrowUp{
+        position: absolute;
+        top: 13px;
+        right: 25px;
+        display: inline-block;
+        width: 12px;
+        height: 17px;
+        background: url("../../common/images/folderUp.png") no-repeat center ;
+        background-size: 12px 17px;
+    }
+    .floderItem:hover,.templateItem:hover {
+        border: 1px solid #3B9ED0;
+        .arrowDown{
+            position: absolute;
+            top: 13px;
+            right: 25px;
+            display: inline-block;
+            width: 12px;
+            height: 17px;
+            background: url("../../common/images/folderDownSelect.png") no-repeat center ;
+            background-size: 12px 17px;
+        }
+        .arrowUp{
+            position: absolute;
+            top: 13px;
+            right: 25px;
+            display: inline-block;
+            width: 12px;
+            height: 17px;
+            background: url("../../common/images/folderUpSelect.png") no-repeat center ;
+            background-size: 12px 17px;
+        }
+    }
+    // .floderItem:hover{
+    //     border: 1px solid #3B9ED0;
+    // }
+    
+}

+ 5 - 4
src/components/Operation/Search/index.jsx

@@ -29,13 +29,14 @@ class SearchList extends React.Component {
       const {windowHeight,pageTop,height,refreshScroller} = this.props;
     }
     handleClearVal(){
-        const { handleChangeValue } = this.props;
+        const { handleChangeValue,handleChangeIpt } = this.props;
         this.textInput.current.value = '';
         this.textInput.current.focus();
         this.setState({
             val:'',
             show:false
         });
+        handleChangeIpt('');
         handleChangeValue('');
     }
     handleInput(e){
@@ -43,6 +44,7 @@ class SearchList extends React.Component {
         clearTimeout(this.state.timer);
         let timer = setTimeout(()=>{
             clearTimeout(this.state.timer);
+            handleChangeIpt(e.target.value);
             if(e.target.value.trim() == ''){
                 this.setState({
                     show:false
@@ -54,7 +56,6 @@ class SearchList extends React.Component {
                 show:true
             })
             handleChangeValue(e.target.value);
-            handleChangeIpt(e.target.value);
         },config.delayTime);
         this.setState({
             timer
@@ -76,10 +77,10 @@ class SearchList extends React.Component {
         }
     }
     render() {
-        const { children,visible } = this.props;
+        const { children,visible,zIndex } = this.props;
         const { show } = this.state;
         return (
-            <div id="searchOption" className={styles.search}>
+            <div id="searchOption" className={styles.search} style={{zIndex:zIndex?zIndex:10}}>
                 <img style={{display:show?'block':'none'}} className={styles.clearVal} src={clear} onClick={this.handleClearVal} alt="清空" />
                 <input
                     className={this.state.border ?`${styles.border}`:`${styles.borderNone}`}

+ 186 - 35
src/components/Operation/index.jsx

@@ -1,6 +1,7 @@
 import React, { Component } from "react";
 import style from "./index.less";
 import printImg from '@common/images/icon_print_blue.png';
+import slideDown from '@common/images/slideDown.png';
 import preview from '@common/images/preview.png';
 import saveHistory from '@common/images/saveHistory.png';
 import cancelTag from '@common/images/icon_back.png';
@@ -8,9 +9,12 @@ import PrintPreviewContainer from '@containers/PrintPreviewContainer';
 import PreviewContainer from '@containers/PreviewContainer';
 import { ConfirmModal, Notify } from '@commonComp';
 import Search from './Search';
+import FolderName from '@components/FolderName';
+import FolderOrder from '@components/FolderOrder';
 import check_circle from './img/check-circle.png';
 import check_right from './img/check-right.png';
 import {getAllDataList,getAllDataStringList,isAllPartClear,isAllClear,filterDataArr,readyKeepHistory,checkDeptContent} from '@utils/tools';
+import pinyin from '@utils/Convert_Pinyin.js';
 
 import {dragBox} from '@utils/drag';
 import store from '@store';
@@ -21,6 +25,7 @@ class Operation extends Component {
     super(props)
     this.state = {
       title: '',
+      fstName:'',//首拼
       okText: '',
       borderColor: '',
       okColor: '',
@@ -31,7 +36,12 @@ class Operation extends Component {
       sex:'3',
       le:'',
       deptId:'',//科室id
-      value:''
+      value:'',//科室name
+      folder:'',//文件夹
+      folderName:'',
+      folderNameVal:'未分类文件夹',//选中文件夹名称
+      folderId:'',//选中文件夹名称
+      folderListShow:false, //文件夹列表展示
     }
     this.showPrint = this.showPrint.bind(this);
     this.closePrint = this.closePrint.bind(this);
@@ -42,7 +52,15 @@ class Operation extends Component {
     this.saveHis = this.saveHis.bind(this);
     this.keypress = this.keypress.bind(this);
     this.setDeptId = this.setDeptId.bind(this);
+    this.setFolderId = this.setFolderId.bind(this);
     this.handleChangeIpt = this.handleChangeIpt.bind(this);
+    this.newFolder = this.newFolder.bind(this);
+    this.saveNewFolder = this.saveNewFolder.bind(this);
+    this.folderManage = this.folderManage.bind(this);
+    this.changeTitle = this.changeTitle.bind(this);
+    this.closeDiagBox = this.closeDiagBox.bind(this);
+    this.spellFst = this.spellFst.bind(this);
+    this.$inp = React.createRef()
   }
 
   showPrint() {
@@ -60,7 +78,6 @@ class Operation extends Component {
     dragBox('previewPrintWrapper','previewPrintStatic','del')
   }
 
-
   showPreview() {
     this.setState({
       zIndex:240
@@ -118,15 +135,18 @@ class Operation extends Component {
       Notify.info('当前页面数据已清空');
     }
   }
-  
-  onchange(val) {
+  handleInput(e){
+    let val = (e.target.value).substring(0,20)
     this.setState({
       title: val
     })
   }
-  handleInput(e){
-    let val = (e.target.value).substring(0,30)
-    this.onchange(val)
+  handleInputFst(e){
+    let val = (e.target.value).substring(0,20).replace(/[^a-zA-Z]/g,'')
+    $(e.target).val(val)
+    this.setState({
+      fstName: val
+    })
   }
   keypress(event) {
     let e = event?event:window.event;
@@ -134,8 +154,14 @@ class Operation extends Component {
       this.makeSure()
     }
   }
+  newFolder(flg){
+    this.props.folderModal(flg)
+  }
+  folderManage(flg) {
+    this.props.folderOrder(flg)
+  }
   saveHis(type) {
-    const { diagShowTmp } = this.props;
+    const { diagShowTmp,getFloderList,admin } = this.props;
     let baseList = store.getState();
     let jsonStr = getAllDataStringList(baseList);
     let tmpLis = [];
@@ -163,6 +189,7 @@ class Operation extends Component {
         }
       }
     }
+    
     this.setState({
       title: '',
       sex:'3',
@@ -173,18 +200,36 @@ class Operation extends Component {
       oKBg: '#3B9ED0',
       msg: this.changeTitle()
     })
+    admin&&getFloderList()//获取文件夹列表
     diagShowTmp(true)
   }
+  spellFst(){
+    const {diagShowTmp} = this.props
+    let tmpFst = pinyin.getCamelChars(this.state.title);
+    // console.log(tmpFst.substr(0,1).toUpperCase())
+    this.setState({fstName:tmpFst.toUpperCase()})
+      // this.$inp.current.vaule = tmpFst
+    document.getElementById ('FstInp').value=tmpFst.toUpperCase()
+    
+  }
+  closeSaveModule() {
+    const {diagShowTmp} = this.props
+    const { type } = this.state;
+    if (type == 3){
+      diagShowTmp(false)
+      this.setState({ title: '',deptId:"",value:"",folderListShow:false,folderNameVal:'未分类文件夹',folderId:'',fstName:'' })
+    }
+  }
   changeTitle() {
     return <div className={style['box']}>
-      {/* <div className={style.titleTip}></div> */}
       <div className={style['iptWrap']}>
         <div className={style.name}>
-          <span>模板名称:</span>
+          <span className={style.leftName}>模板名称:</span>
           <input className={style['ipt']}
+            autocomplete="off"
             placeholder="请输入模板名称"
             type="text"
-            maxLength='30'
+            maxLength='20'
             onInput={(e) => {
               this.handleInput(e)
             }}
@@ -194,8 +239,28 @@ class Operation extends Component {
             onKeyPress={e => this.keypress(e)}
           />
         </div>
+        <div className={`${style.name} ${style.firstname}`}>
+          <span className={style.leftName}>模板名首拼:</span>
+          <input className={style['ipt']}
+            autocomplete="off"
+            ref = {this.$inp}
+            // value={value}
+            id='FstInp'
+            placeholder='请输入模板名称首拼'
+            type="text"
+            maxLength='20'
+            onFocus={() =>this.spellFst()}
+            onInput={(e) => {
+              this.handleInputFst(e)
+            }}
+            onPropertyChange={(e) => {  // 兼容ie
+              this.handleInputFst(e)
+            }}
+            onKeyPress={e => this.keypress(e)}
+          />
+        </div>
         <div className={style.male}>
-          <span>性别归属:</span>
+          <span className={style.leftName}>性别归属:</span>
           <span className={style['commonSex']} id="commonSex" onClick={this.changeRadio.bind(this,1)}><img src={check_right} alt=""/><i style={{color:'#000'}}>通用</i></span>
           <span id="maleSex" onClick={this.changeRadio.bind(this,2)}><img src={check_circle} alt=""/><i>男</i></span>
           <span id="femaleSex" onClick={this.changeRadio.bind(this,3)}><img src={check_circle} alt=""/><i>女</i></span>
@@ -233,8 +298,8 @@ class Operation extends Component {
     }
   }
   makeSure() {
-    const { save, clear, saveDataAll,saveDataAlls,diagShowTmp ,chronicMagItem,chronicDesease,admin} = this.props;
-    const { type,deptId,sex,title } = this.state;
+    const { save, clear, saveDataAll,saveDataAlls,diagShowTmp ,chronicMagItem,chronicDesease,admin,floderListAdmin} = this.props;
+    const { type,deptId,sex,title,fstName,folderId,folderNameVal } = this.state;
     if (type == 1) {
       diagShowTmp(false)
       this.setState({ title: '' })
@@ -254,13 +319,21 @@ class Operation extends Component {
       if (this.state.title.trim() == '') {
         Notify.error('请输入模板名称')
         return;
+      }else if(this.state.fstName == ''){
+        Notify.error('请输入模板名首拼')
+        return;
       }else if(admin&&deptId == ''){
         Notify.error('请选择科室')
         return;
       }
       if(admin){
         let baseList = store.getState();
-        let tmpLis = baseList.tabTemplate.adminItems||[];
+        let tmpFolder = baseList.tabTemplate.adminItems||[];
+        let tmpLis = [];
+        for(let k = 0;k < tmpFolder.length;k++){
+          let tmpData = tmpFolder[k].templateInfo||[]
+          tmpLis = tmpLis.concat(tmpData)
+        }
         let jsonStr = getAllDataStringList(baseList);
         for(let i = 0;i <tmpLis.length;i++){
           let dataStr = tmpLis[i].preview;
@@ -279,9 +352,21 @@ class Operation extends Component {
             return false;
           }
         }
-        saveDataAlls(title,sex,deptId);
+        
+        if(folderNameVal=="未分类文件夹") {
+          let folderIdNull =  floderListAdmin.find(item =>item.name == "未分类文件夹").id
+          saveDataAlls(title,sex,deptId,fstName,folderIdNull,folderNameVal);
+        }else {
+          saveDataAlls(title,sex,deptId,fstName,folderId,folderNameVal);
+        }
+        this.setState({
+          folderNameVal:'未分类文件夹',
+          folderId:'',
+          fstName:'',
+          deptId:''
+        })
       }else{
-        saveDataAll(title,sex);
+        saveDataAll(title,sex,fstName);
       }
     }
   }
@@ -290,10 +375,7 @@ class Operation extends Component {
     const { type } = this.state;
     if (type == 3){
       diagShowTmp(false)
-      this.setState({ title: '',deptId:"",value:"" })
-    }else{
-      diagShowTmp(false)
-      this.setState({ title: '',deptId:"",value:"" }) 
+      this.setState({ title: '',deptId:"",value:"",folderListShow:false,folderNameVal:'未分类文件夹',folderId:'',fstName:''})
     }
   }
   setDeptId(id,name){
@@ -303,6 +385,14 @@ class Operation extends Component {
       value:name
     })
   }
+  setFolderId(id,name){//文件夹
+    this.props.handleClearValue()
+    this.setState({
+      folderId :id,
+      folderNameVal:name,
+      folderListShow:false
+    })
+  }
   componentWillReceiveProps(next){//监听滚动事件
     const that = this;
     if(next.winWidth <= 1024){
@@ -315,16 +405,32 @@ class Operation extends Component {
       })
     }
   }
-  handleChangeIpt(val){
+  handleChangeIpt(val){//搜索科室
+    if(val == ''){
+      this.setState({
+        deptId:'',
+      })
+      return
+    }
     this.setState({
       value:val
     })
   }
+  handleFolderShow(){
+    const {folderListShow} = this.state
+    this.setState({
+      folderListShow:!folderListShow
+    })
+  }
+  saveNewFolder(val){//保存文件夹
+    const {newFloder} = this.props
+    newFloder(val)
+  }
   render() {
-    const { showPrint, closePrint, showPreview, closePreview,handleChangeIpt } = this;
+    const { showPrint, closePrint, showPreview, closePreview,handleChangeIpt,newFolder,folderManage } = this;
     const { visible, preVisible,diagShow } = this.props.print;
-    const {winWidth,cancelDelTag,departLis,handleChangeValue,admin} = this.props;
-    const {zIndex,type,le,value} = this.state;
+    const {winWidth,cancelDelTag,departLis,handleChangeValue,admin,floderListAdmin,folderModalShow,floderModal,folderOrderShow,folderOrder,adminItems,patInfo,saveOrderFolder} = this.props;
+    const {zIndex,type,le,value,folder,folderListShow} = this.state;
     return <div className={style['container']} style={{left:le}}>
       <span className={style['button']} onClick={showPrint}><img src={printImg} /> 打印病历</span>
       <span className={style['preButton']} onClick={showPreview}><img src={preview} /> 预览</span>
@@ -334,26 +440,26 @@ class Operation extends Component {
       <span className={winWidth<=1082?`${style['clearButton']} ${style['saveButton']} ${style['minstyle']}`:`${style['clearButton']} ${style['saveButton']}`} onClick={() => { this.clearAll(2) }}>清除</span>
       {visible?<PrintPreviewContainer visible={visible} onClose={closePrint} />:null}
       {preVisible?<PreviewContainer visible={preVisible} onClose={closePreview} />:null}
-      
-      <ConfirmModal
+      {<ConfirmModal
         visible={diagShow}        //改为全局控制
         confirm={() => { this.makeSure() }}
         close={() => { this.closeDiagBox()}}
         cancel={() => {this.closeDiagBox()}}
         okText={this.state.okText}
-        height={type==3?228:200}
-        width={type==3?545:300}
+        height={type==3&admin?365:type==3&!admin?275:200}
+        width={type==3?585:300}
         okBorderColor={this.state.borderColor}
         okColor={this.state.okColor}
         oKBg={this.state.oKBg}
-        borderBtm={type==3?'1px solid #f5f5f5':null}
-        title={type==3?'保存病历模板':null}
+        borderBtm={type==3?'1px solid #ccc':null}
+        title={type==3?'保存病历模板':type==4?"新建文件夹":null}
       >
         {this.state.msg}
         {
-          admin&&type==3?<div className={style.department}>
-              <span>科室归属:</span>
-                <Search handleChangeValue={handleChangeValue} handleChangeIpt={handleChangeIpt} value={value} visible={true}>
+          admin&&type==3?<div className={style.addList}>
+            <div className={style.department}>
+              <span className={style.leftName}>科室归属:</span>
+                <Search handleChangeValue={handleChangeValue} handleChangeIpt={handleChangeIpt} value={value} visible={true} zIndex={11}>
                 {
                   departLis.length>0&&value&&<ul className={style.departLis}>
                     {
@@ -367,9 +473,54 @@ class Operation extends Component {
                 }
                 </Search>
               <span style={{paddingRight:0,color:'#777777'}}>(支持汉字关键字搜索)</span>
+          </div>
+            <div className={style.department}>
+              <span className={style.leftName}>存储为:</span>
+                <div  className={style.selectFolder} onClick={(e) => {
+                      this.handleFolderShow(e)
+                    }}>
+                  <input className={style.selectFolderIpt}
+                    autocomplete="off"
+                    type="text"
+                    maxLength='20'
+                    readOnly
+                    value={this.state.folderNameVal}
+                    
+                  />
+                  <img src={slideDown} alt=""/>
+                </div>
+                {
+                  floderListAdmin.length>0&&folderListShow&&<ul className={`${style.departLis} ${style.departLisFolder}`}>
+                    {
+                      floderListAdmin.map((item,idx)=>{
+                        return <li onClick={()=>this.setFolderId(item.id,item.name)}>
+                          {item.name}
+                        </li>
+                      })
+                    }
+                  </ul>
+                }
+              <span className={style.newFolder} onClick={()=>newFolder(true)}>新建文件夹</span>
+              <span className={style.mangerFolder} onClick={()=>folderManage(true)}>管理文件夹</span>
+          </div>
           </div>:null
         }
-      </ConfirmModal>
+      </ConfirmModal>}
+      <FolderName 
+        folderModalShow={folderModalShow}
+        floderModal={floderModal}
+        newFolder={newFolder}
+        saveNewFolder={this.saveNewFolder}
+        title='新建文件夹'></FolderName>
+        <FolderOrder
+        folderOrderShow = {folderOrderShow}
+        folderOrder = {folderOrder}
+        folderManage={folderManage}
+        adminItems = {adminItems}
+        saveOrderFolder = {saveOrderFolder}
+        patInfo={patInfo}
+        title = '管理文件夹'>
+        </FolderOrder>
     </div>;
   }
 }

+ 137 - 9
src/components/Operation/index.less

@@ -117,7 +117,7 @@
     }
 }
 .iptWrap {
-   padding: 0 15px;
+  padding: 0 15px;
   line-height: 18px;
   margin: 18px auto;
   text-align: left;
@@ -126,9 +126,13 @@
       input {
           border: 1px solid #CCCCCC;
           padding: 5px 10px;
+          display: inline-block;
           width: 240px;
       }
   }
+  .firstname {
+      margin-top: 15px;
+  }
   p {
     text-align: left;
     font-size: 12px;
@@ -138,7 +142,6 @@
   span {
     display: inline-block;
     cursor: pointer;
-    padding-right: 20px;
     font-size: 14px;
     i {
       color: #6b6969;
@@ -158,19 +161,36 @@
 }
 .box {
     box-sizing: border-box;
-    height: 88px;
+    // height: 88px;
 }
 
 .department {
     position: relative;
     text-align: left;
-    padding: 0 0 30px 16px;
-    span {
-        padding-right: 20px;
+    padding: 0 0 15px 16px;
+    .selectFolder {
+        position: relative;
+        display: inline-block;
+        input {
+            border: 1px solid #CCCCCC;
+            padding: 5px 10px;
+            width: 240px;
+            margin-right: 20px;
+        }
+        img {
+            position: absolute;
+            right: 20px;
+            top: 0;
+            width: 30px;
+            height: 30px;
+        }
     }
 }
 .male {
-    padding: 15px 0;
+    padding-top: 15px;
+    span {
+        padding-right: 16px;
+    }
 }
 .line {
     height: 1px;
@@ -193,10 +213,11 @@
     width: 240px;
     // box-shadow: 0 10px 20px 0 #989DA3;
     border: 1px solid #dedede;
+    z-index: 101;
     li {
         height: 36px;
         line-height: 36px;
-        padding: 0 30px;
+        padding: 0 10px;
         padding-top: 0;
         box-sizing: border-box;
         overflow: hidden;
@@ -208,4 +229,111 @@
     li:hover {
         border: 1px solid #3B9ED0;
     }
-}
+}
+.departLisFolder {
+    left: 116px;
+}
+.leftName {
+    width: 100px;
+    text-align: right;
+    padding-right: 16px;
+    display: inline-block;
+}
+.addList {
+    position: relative;
+    top: -6px;
+}
+.newFolder {
+    margin-right: 15px;
+    color: #3B9ED0;
+    cursor: pointer;
+}
+.mangerFolder {
+    color: #3B9ED0;
+    cursor: pointer;    
+}
+.newFolderWrap {
+    .folderModal {
+        z-index: 120;
+        position: fixed;
+        width: 100%;
+        height: 100%;
+        top: 0;
+        left: 0;
+        background: #000;
+        opacity: .3;
+        filter: alpha(opacity=60);
+        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=60);";
+    }
+    .nameWrap{
+        z-index: 130;
+        position: fixed;
+        top: 50%;
+        left: 50%;
+        margin: auto;
+        border-radius: 5px;
+        background: #fff;
+        width: 500px;
+        margin-left: -250px;
+        margin-top: -115px;
+        .mainWrap {
+            padding: 50px 10px;
+        }
+        .title {
+            height: 40px;
+            line-height: 40px;
+            border-bottom: 1px solid #979797;
+            img{
+                float: right;
+            }
+        }
+        .leftName {
+            width: 135px;
+            text-align: right;
+            padding-right: 16px;
+            display: inline-block;
+        }
+        .titleCon {
+            float: left;
+            height: 40px;
+            line-height: 40px;
+            margin-left: 10px;
+        }
+        input {
+            border: 1px solid #CCCCCC;
+            padding: 5px 10px;
+            width: 240px;
+        }
+    }
+    .delFoot{
+        .halfBtn {
+            width: 50%;
+            display: inline-block;
+            text-align: center;
+            height: 65px;
+        }
+        .delBtn{
+          display: inline-block;
+          width: 100px; 
+          height: 34px;
+          line-height: 32px;
+          border-radius: 5px;
+          margin: 0 auto;
+          cursor: pointer;
+        }
+        .delDel{
+          color: #fff;
+          background: #3B9ED0;
+        }
+        .delCancel{
+          color:#000;
+          background: #fff;
+          border: 1px solid #1E1E1E;
+          color: #1E1E1E;
+        }
+    }
+}
+
+.selectFolderIpt {
+    cursor: pointer;
+  }

binární
src/components/PushContainer/Search/imgs/clear.png


binární
src/components/PushContainer/Search/imgs/search.png


+ 116 - 0
src/components/PushContainer/Search/index.jsx

@@ -0,0 +1,116 @@
+import React from 'react';
+import styles from './index.less';
+import clear from './imgs/clear.png';
+import search from './imgs/search.png';
+import config from '@config/index';
+import $ from 'jquery';
+/**
+ * 前提条件父元素有定位
+ * visible  搜索显示隐藏
+ * handleChangeValue  函数参数为输入框的value值
+ */
+class SearchList extends React.Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            val:'',
+            border:'',
+            show:false,
+            timer:null
+        }
+        this.textInput = React.createRef();
+        this.handleClearVal = this.handleClearVal.bind(this);
+        this.handleFocus = this.handleFocus.bind(this);
+        this.handleBlur = this.handleBlur.bind(this);
+    }
+    componentDidMount(){
+      this.props.handleChangeValue('');
+    //   this.textInput.current.focus();
+      const {windowHeight,pageTop,height,refreshScroller} = this.props;
+      const {value} = this.props;
+        if(value && value.trim()){
+            this.textInput.current.value = value;
+            this.setState({
+                val:value,
+                show:true
+            });
+        }
+    }
+    handleClearVal(){
+        const { handleChangeValue,handleChangeIpt } = this.props;
+        this.textInput.current.value = '';
+        this.textInput.current.focus();
+        this.setState({
+            val:'',
+            show:false
+        });
+        handleChangeIpt('');
+        handleChangeValue('');
+    }
+    handleInput(e){
+      const { handleChangeValue,handleChangeIpt } = this.props;
+        clearTimeout(this.state.timer);
+        let timer = setTimeout(()=>{
+            clearTimeout(this.state.timer);
+            handleChangeIpt(e.target.value);
+            if(e.target.value.trim() == ''){
+                this.setState({
+                    show:false
+                })
+                return  handleChangeValue('');
+            }
+            this.setState({
+                val:e.target.value,
+                show:true
+            })
+            handleChangeValue(e.target.value);
+        },config.delayTime);
+        this.setState({
+            timer
+        });
+    }
+    handleFocus(){
+      if(this.state.val.trim() != ''){
+        return;
+      }else{
+          this.setState({border:true})
+      }
+    }
+    handleBlur(){
+      this.setState({border:false,val:''})
+    }
+    componentWillReceiveProps(next){
+
+        if(next.value&&(next.value != this.props.value)){
+            this.textInput.current.value = next.value;
+        }
+    }
+    render() {
+        const { children,visible,zIndex } = this.props;
+        const { show } = this.state;
+        return (
+            <div id="searchOption" className={styles.search} style={{zIndex:zIndex?zIndex:10}}>
+                <img style={{display:show?'block':'none'}} className={styles.clearVal} src={clear} onClick={this.handleClearVal} alt="清空" />
+                <input
+                    className={this.state.border ?`${styles.border}`:`${styles.borderNone}`}
+                    type="text"
+                    maxLength="30"
+                    ref={this.textInput}
+                    onFocus={this.handleFocus}
+                    onBlur={this.handleBlur}
+                    onInput={(e) => { 
+                        this.handleInput(e)
+                    }}
+                    onPropertyChange={(e) => {  // 兼容ie
+                        this.handleInput(e)
+                    }}
+                    placeholder="搜索"
+                />
+                <div className={styles.autoList}>
+                    {children}
+                </div>
+            </div>
+        )
+    }
+}
+export default SearchList;

+ 38 - 0
src/components/PushContainer/Search/index.less

@@ -0,0 +1,38 @@
+@import "~@less/variables.less";
+
+.search {
+    .contentZIndex1;
+    width: 240px;
+    box-sizing: border-box;
+    position: relative;
+    background-color: #fff;
+    display: inline-block !important;
+    margin-right: 20px;
+
+    input {
+        width: 100%;
+        height: 30px;
+        line-height: 30px;
+        padding: 0 30px 0 10px;
+        box-sizing: border-box;
+        border: 1px solid #ccc;
+    }
+    .border {
+        // border: 1px solid @blue;
+    }
+    .borderNone {
+        border: 1px solid #ccc;
+    }
+    img {
+        position: absolute;
+        top: 5px;
+    }
+    .clearVal{
+        cursor: pointer;
+        right: 5px;
+    }
+}
+
+.hide {
+    display: none;
+}

binární
src/components/PushContainer/img/check-circle.png


binární
src/components/PushContainer/img/check-right.png


+ 433 - 51
src/components/PushContainer/index.jsx

@@ -1,8 +1,8 @@
 import React, { Component } from 'react';
 import style from './index.less';
 import { Tab, ConfirmModal, Notify } from '@commonComp';
-import { tabChange, allChecked, changeVisible, keepPushData, allCheckedShow,allCheckedAdmin,allCheckedShowAdmin } from '@store/actions/tabTemplate';
-import { initItemList, delItem,delItemAdmin, delBatchItem, delBatchItemAdmin,changeTitleAsync, setPageView,changeTitleAsyncAdmin,setPageViewAdmin } from '@store/async-actions/tabTemplate';
+import { tabChange, allChecked, changeVisible, keepPushData, allCheckedShow,allCheckedAdmin,allCheckedShowAdmin,whichTemp,floderSlide,floderAction,folderModal,clearSearchTemplateNorms,folderOrder,getDptLis } from '@store/actions/tabTemplate';
+import { initItemList,initAdminItemList, delItem,delItemAdmin, delBatchItem, delBatchItemAdmin,changeTitleAsync, setPageView,changeTitleAsyncAdmin,setPageViewAdmin,getFloderList,delFloder,addTemplateQuote,newFloder,findTemplateNorms,getFloderListAll,getDepartments } from '@store/async-actions/tabTemplate';
 import { connect } from "react-redux";
 import store from '@store';
 import { billing } from '@store/async-actions/pushMessage';
@@ -12,7 +12,15 @@ import PushItemsContainer from '@containers/PushItemsContainer';
 import { pushAllDataList, getWindowInnerHeight, didPushParamChange } from '@utils/tools';
 import CopyRightContainer from "@containers/CopyRightContainer";
 import MedicalInfoContainer from '@containers/MedicalInfoContainer';
+import FolderName from '@components/FolderName';
+// import Search from './../Operation/Search';
+import Search from './Search';
+import slideDown from '@common/images/slideDown.png';
 import CaseQuailty from "../CaseQuailty";
+import check_circle from './img/check-circle.png';
+import check_right from './img/check-right.png';
+import pinyin from '@utils/Convert_Pinyin.js';
+import $ from "jquery";
 
 class PushContainer extends Component {
   constructor(props) {
@@ -44,6 +52,18 @@ class PushContainer extends Component {
       okColor: 'red',
       num: 0,          //计数
       deptId:'',       //科室id
+      value:'',//科室name
+      sex:'3',
+      floderName:'',   //文件夹名称
+      folderListShow:false,
+      folderNameVal:'',
+      folderId:'',
+      spell:'',
+      fstName:'',
+      tmpFolder:'',
+      hasCalcIndex: false,
+      hospitalDeptName:'',
+      reset: false
     }
     this.$cont = React.createRef();
     this.itemList = null;
@@ -59,13 +79,30 @@ class PushContainer extends Component {
     this.makeSure = this.makeSure.bind(this)
     this.handleClose = this.handleClose.bind(this);
     this.templateSearch = this.templateSearch.bind(this);
+    this.clearTemplateSearch = this.clearTemplateSearch.bind(this)
+    this.whichTemp = this.whichTemp.bind(this);
+    this.floderSlideToggle = this.floderSlideToggle.bind(this);
+    this.floderRename = this.floderRename.bind(this);
+    this.handleInputFloder = this.handleInputFloder.bind(this);
+    this.setFolderId = this.setFolderId.bind(this);
+    this.floderDelete = this.floderDelete.bind(this);
+    this.folderManage = this.folderManage.bind(this);
+    this.changeRadio = this.changeRadio.bind(this);
+    this.handleChangeIpt = this.handleChangeIpt.bind(this);
+    this.setDeptId = this.setDeptId.bind(this);
+    this.handleClearValue = this.handleClearValue.bind(this);
+    this.clearReset = this.clearReset.bind(this);
   }
   componentDidMount() {
     // const height = getWindowInnerHeight()-160;
     // this.$cont.current.style.height = height+"px";
   }
-  templateSearch(name){
-    store.dispatch(initItemList(1,name));
+
+  templateSearch(name,selectTemp){
+    store.dispatch(initItemList(1,name,selectTemp));
+  }
+  clearTemplateSearch(){
+    store.dispatch(clearSearchTemplateNorms());
   }
   /**
    * 
@@ -76,14 +113,25 @@ class PushContainer extends Component {
       document.getElementById("searchTmp").value = ""
       // let searchVal = document.getElementById("searchTmp").value
       store.dispatch(initItemList(1,0));
+      store.dispatch(getFloderListAll())
+      this.setState({
+        reset: true
+      })
+      $(".floderSlideLis").eq(0).next().slideDown()
+      store.dispatch(whichTemp(1))
     }
     store.dispatch(tabChange(id))
   }
+  clearReset() {
+    this.setState({
+      reset: false
+    })
+  }
   /**
    * 引用模板id
    * @param {模板id} id 
    */
-  handleContentClick(id, sex) {
+  handleContentClick(id, sex,hasCalcIndex) {
     let baseSex = store.getState().patInfo.message.sex
     this.setState({
       message: this.content(sex, baseSex),
@@ -92,11 +140,15 @@ class PushContainer extends Component {
       okText: '引用',
       okBorderColor: '#3B9ED0',
       okColor: '#fff',
-      oKBg: '#3B9ED0'
+      oKBg: '#3B9ED0',
     }, () => {
       store.dispatch(changeVisible(true))
     })
+    this.setState({
+      hasCalcIndex: hasCalcIndex
+    })
   }
+ 
   content(sex, baseSex) {
     if (sex != 3 && sex != baseSex) {
       return <p className={style['center']}>确认引用该模板?<p style={{ fontSize: '12px', color: '#6b6969', marginTop: '10px' }}>引用该模版可能显示有误</p></p>
@@ -108,10 +160,11 @@ class PushContainer extends Component {
    * 删除模板
    * @param {模板id} id 
    */
-  handleTemplateDel(id) {
+  handleTemplateDel(id,folderId) {
     this.setState({
       message: this.delDiv(),
       type: 1,
+      folderId:folderId,
       id: id,
       okText: '删除',
       okBorderColor: 'red',
@@ -140,43 +193,107 @@ class PushContainer extends Component {
     }
   }
   handleInput(e) {
-    let val = (e.target.value).substring(0, 30)
+    let val = (e.target.value).substring(0, 20)
     this.onchange(val)
   }
-  changeTitle() {
+  handleInputFloder(e){
+    let val = (e.target.value).substring(0,20)
+    this.setState({
+      floderName: val
+    },()=>{
+      this.setState({
+        message:this.changeFloderTitle()
+      })
+    })
+  }
+  handleInputFst(e){
+    let val = (e.target.value).substring(0,20).replace(/[^a-zA-Z]/g,'')
+    // console.log(val)
+    $(e.target).val(val)
+    this.setState({
+      fstName: val
+    }, () => {
+      this.setState({
+        message: this.changeTitle(),
+      })
+    })
+  }
+
+  spellFst(){
+    let tmpFst = pinyin.getCamelChars(this.state.title);
+    // console.log(tmpFst.substr(0,1).toUpperCase())
+    this.setState({fstName:tmpFst.toUpperCase()})
+      // this.$inp.current.vaule = tmpFst
+    document.getElementById ('FstInp').value=tmpFst.toUpperCase()
+    
+  }
+  changeTitle() {//模板名称修改
     return <div className={style['box']}>
-      <input className={style['ipt']}
-        placeholder="请输入模板名称"
-        type="text"
-        value={this.state.title}
-        maxLength='30'
-        onInput={(e) => {
-          this.handleInput(e)
-        }}
-        onPropertyChange={(e) => {  // 兼容ie
-          this.handleInput(e)
-        }}
-        onKeyPress={e => this.keypress(e)}
-      />
-      <div className={style['line']}></div>
+        <div className={style['iptWrap']}>
+          <div className={style.name}>
+            <span className={style.leftName}>模板名称:</span>
+            <input className={style['ipt']}
+              autocomplete="off"
+              placeholder="请输入模板名称"
+              type="text"
+              maxLength='20'
+              value={this.state.title}
+              onInput={(e) => {
+                this.handleInput(e)
+              }}
+              onPropertyChange={(e) => {  // 兼容ie
+                this.handleInput(e)
+              }}
+              onKeyPress={e => this.keypress(e)}
+            />
+          </div>
+          <div className={`${style.name} ${style.firstname}`}>
+            <span className={style.leftName}>模板名首拼:</span>
+            <input className={style['ipt']}
+              autocomplete="off"
+              placeholder=""
+              type="text"
+              maxLength='20'
+              id="FstInp"
+              value={this.state.fstName}
+              onFocus={() =>this.spellFst()}
+              onInput={(e) => {
+                this.handleInputFst(e)
+              }}
+              onPropertyChange={(e) => {  // 兼容ie
+                this.handleInputFst(e)
+              }}
+              onKeyPress={e => this.keypress(e)}
+            />
+          </div>
+        </div>
     </div>
   }
   /**
    * 改变模板标题
    * @param {模板id和模板title} obj
    */
-  handleTitleChange(id, text,deptId) {
+  handleTitleChange(id, text,deptId,folderId,spell,folderName,sex,hospitalDeptName) {
     store.dispatch(changeVisible(true))
+    this.props.admin&&store.dispatch(getFloderList())
     this.setState({
       type: 3,
       currId: id,
       title: text,
       text: text,
       deptId: deptId,
+      fstName:spell,
       okText: '保存',
       okBorderColor: '#3B9ED0',
       okColor: '#fff',
-      oKBg: '#3B9ED0'
+      oKBg: '#3B9ED0',
+      folderId:folderId,
+      sex: sex,
+      spell:spell,
+      folderNameVal:folderName,
+      tmpFolder:folderName,
+      value:hospitalDeptName
+
     }, () => {
       this.setState({
         message: this.changeTitle(),
@@ -186,9 +303,9 @@ class PushContainer extends Component {
 
   handleAllCheckboxAdmin() {        //全.反选
     let tmpFlg = this.props.allCheckedAdmin;
-    if (this.props.checkItemsAdmin.length < this.props.adminItems.length && this.props.allCheckedAdmin) {
+    if (this.props.checkItemsAdmin.length < this.props.folderListContentArr.length && this.props.allCheckedAdmin) {
       tmpFlg = false;
-    } else if (this.props.checkItemsAdmin.length == this.props.adminItems.length && !this.props.allCheckedAdmin) {
+    } else if (this.props.checkItemsAdmin.length == this.props.folderListContentArr.length && !this.props.allCheckedAdmin) {
       tmpFlg = true;
     }  //两种特殊情况处理
     store.dispatch(allCheckedAdmin(!tmpFlg))
@@ -230,56 +347,239 @@ class PushContainer extends Component {
     let tmpPage = ++page
     store.dispatch(initItemList(tmpPage,true))
   }
-  
+  floderRename(name,id){//文件夹重命名
+    this.setState({
+      type: 5,
+      title: '重命名文件夹',
+      okText: '保存',
+      floderName:name,
+      folderId:id,
+      okBorderColor: '#3B9ED0',
+      okColor: '#fff',
+      oKBg: '#3B9ED0',
+    },()=>{
+      this.setState({
+        message:this.changeFloderTitle()
+      })
+    })
+    store.dispatch(changeVisible(true))
+  }
+  changeFloderTitle() {
+    return <div className={style['box']}>
+      <div className={style['iptWrap']}>
+        <div className={style.name}>
+          <span className={style.leftName}>名称:</span>
+          <input
+            autocomplete="off"
+            placeholder="请输入文件夹名称"
+            type="text"
+            maxLength='20'
+            value={this.state.floderName}
+            onInput={(e) => {
+              this.handleInputFloder(e)
+            }}
+            onPropertyChange={(e) => {  // 兼容ie
+              this.handleInputFloder(e)
+            }}
+            onKeyPress={e => this.keypress(e)}
+          />
+        </div>
+      </div>
+    </div>
+  }
+  floderDelete(folderId){//文件夹删除
+    this.setState({
+      message: <p className={style['center']}>确认删除文件夹?</p>,
+      type: 6,
+      folderId:folderId,
+      okText: '删除',
+      okBorderColor: 'red',
+      okColor: 'red',
+      oKBg: '#fff'
+    }, () => {
+      store.dispatch(changeVisible(true))
+    })
+    // store.dispatch(delFloder(id))
+    
+  }
+  changeRadio(sex){
+    if(sex == 1){
+      $('#commonSex img').attr('src',check_right)
+      $('#maleSex img').attr('src',check_circle)
+      $('#femaleSex img').attr('src',check_circle)
+      $('#commonSex i').css('color','#000')
+      $('#maleSex i').css('color','#6b6969')
+      $('#femaleSex i').css('color','#6b6969')
+      this.setState({sex:'3'})
+    }else if(sex == 2){
+      $('#commonSex img').attr('src',check_circle)
+      $('#maleSex img').attr('src',check_right)
+      $('#femaleSex img').attr('src',check_circle)
+      $('#commonSex i').css('color','#6b6969')
+      $('#maleSex i').css('color','#000')
+      $('#femaleSex i').css('color','#6b6969')
+      this.setState({sex:'1'})
+    }else if(sex == 3){
+      $('#commonSex img').attr('src',check_circle)
+      $('#maleSex img').attr('src',check_circle)
+      $('#femaleSex img').attr('src',check_right)
+      $('#commonSex i').css('color','#6b6969')
+      $('#maleSex i').css('color','#6b6969')
+      $('#femaleSex i').css('color','#000')
+      this.setState({sex:'2'})
+    }
+  }
+
   makeSure() {
-    if (this.state.type == 1) {
+    const {type,id,title,tmpFolder,folderNameVal,text,fstName,spell,currId,deptId,folderId,floderName,sex,hospitalDeptName} = this.state
+    if (type == 1) {
       if(this.props.admin){
-        store.dispatch(delItemAdmin(this.state.id))
+        store.dispatch(delItemAdmin(id,folderId))
       }else{
-        store.dispatch(delItem(this.state.id))
+        store.dispatch(delItem(id))
       }
       store.dispatch(changeVisible(false))
-    } else if (this.state.type == 2) {
+    } else if (type == 2) {
       if(this.props.admin){
         store.dispatch(delBatchItemAdmin(this.props.checkItemsAdmin))
       }else{
         store.dispatch(delBatchItem(this.props.checkItems))
       }
       store.dispatch(changeVisible(false))
-    } else if (this.state.type == 3) {
-      if (this.state.title == this.state.text) {
-        store.dispatch(changeVisible(false))
-        Notify.success('标题修改成功');
-        return;
-      }
-      if ((this.state.title).trim() == '') {
+    } else if (type == 3) {
+      // if (title == text &&tmpFolder==folderNameVal&&fstName==spell&&deptId) {
+      //   store.dispatch(changeVisible(false))
+      //   Notify.success('标题修改成功');
+      //   return;
+      // }
+      if (title.trim() == '') {
         Notify.info('请输入模板名称');
         return;
+      }else if(fstName.trim() == ''){
+        Notify.error('请输入模板名首拼')
+        return;
+      }else if(this.props.admin&&deptId  == ''){
+        Notify.error('请选择科室')
+        return;
       }
       let tempObj = {
-        id: this.state.currId,
-        title: this.state.title,
-        deptId:this.state.deptId
+        id: currId,
+        title: title,
+        deptId:deptId,
+        folderId:folderId,
+        folderName:folderNameVal,
+        spell:fstName,
+        sex: sex,
+        hospitalDeptName:hospitalDeptName
       }
       if(this.props.admin){
         store.dispatch(changeTitleAsyncAdmin(tempObj))
       }else{
         store.dispatch(changeTitleAsync(tempObj))
       }
-    } else if (this.state.type == 4) {        //模板引入
+    } else if (type == 4) {        //模板引入
       if(this.props.admin){
-        store.dispatch(setPageViewAdmin(this.state.id))
+        store.dispatch(setPageViewAdmin(id))
       }else{
-        store.dispatch(setPageView(this.state.id))
+        store.dispatch(setPageView(id))
+        const hasCalcIndex = this.state.hasCalcIndex
+        if(hasCalcIndex) {
+          store.dispatch(addTemplateQuote(id))
+        }
+        this.setState({
+          hasCalcIndex: false
+        })
       }
       store.dispatch(changeVisible(false))
+    } else if(type == 6) { //删除文件夹
+      if(this.props.admin){
+        store.dispatch(delFloder(folderId))
+        store.dispatch(changeVisible(false))
+      }else{
+        // store.dispatch(delFloder(folderId))
+        // store.dispatch(delBatchItem(this.props.checkItems))
+      }
+    } else if(type == 5) {
+      if(this.props.admin){
+        store.dispatch(newFloder(floderName,folderId,'modify'))
+        // store.dispatch(changeVisible(false))
+      }else{
+      }
     }
   }
   handleClose() {
     store.dispatch(changeVisible(false));
+    this.setState({
+      hasCalcIndex: false,
+      folderListShow: false
+    })
+  }
+  whichTemp(tab,name,hasSearch){
+    if(tab!=2||!name){
+      if(tab == 1 && name&&hasSearch) {
+        this.templateSearch(name,1)
+      } else {
+        store.dispatch(initAdminItemList(1,true))
+      }
+      
+    }else{
+      this.templateSearch(name,2)
+    }
+    store.dispatch(whichTemp(tab))
+  }
+  floderSlideToggle(id){
+    store.dispatch(floderSlide(id))
+  }
+  floderActionDo(id){
+    store.dispatch(floderAction(id))
+  }
+  handleFolderShow(){
+    const {folderListShow} = this.state
+    this.setState({
+      folderListShow:!folderListShow
+    })
+  }
+  setFolderId(id,name){//文件夹
+    this.setState({
+      folderId :id,
+      folderNameVal:name,
+      folderListShow:false
+    })
+  }
+  newFolder(flg){
+    store.dispatch(folderModal(flg))
+  }
+  folderManage(flg) {
+    store.dispatch(folderOrder(flg))
+  }
+  handleChangeValue(val)  {
+    val && store.dispatch(getDepartments(val))
+  }
+  handleChangeIpt(val){//搜索科室
+    if(val == ''){
+      this.setState({
+        deptId:'',
+      })
+      return
+    }
+    this.setState({
+      value:val
+    })
+  }
+  setDeptId(id,name){
+    this.handleClearValue()
+    this.setState({
+      deptId :id,
+      value:name
+    })
+  }
+  handleClearValue () {
+    store.dispatch(getDptLis([]))
   }
   render() {
-    const { activeId, checkItems, visible, showMsg,hasMore,current, items, allCheckShow,allCheckShowAdmin,adminItems,admin,checkItemsAdmin,clearSearch } = this.props;
+    const { activeId, checkItems,selectTemp,folderListContentArr, visible, showMsg,hasMore,current,floderListAdmin, items, allCheckShow,allCheckShowAdmin,adminItems,admin,checkItemsAdmin,clearSearch, templateNormsSearchList, departLis} = this.props;
+    const { type,okBorderColor,okColor,oKBg,okText,message,folderListShow,value,reset } = this.state
+    const { handleChangeValue, handleChangeIpt} = this
     return <div className={style["container"]} ref={this.$cont} >
       <Tab tabs={this.state.tabs}
         activeId={activeId}
@@ -309,6 +609,17 @@ class PushContainer extends Component {
             handleAllCheckbox={this.handleAllCheckbox}
             handleClickGetMore={this.handleClickGetMore}
             templateSearch={this.templateSearch}
+            whichTemp={this.whichTemp}
+            selectTemp={selectTemp}
+            floderSlide={this.floderSlideToggle}
+            floderAction={this.floderActionDo}
+            floderDelete={this.floderDelete}
+            floderRename={this.floderRename}
+            folderListContentArr={folderListContentArr}
+            templateNormsSearchList={templateNormsSearchList}
+            clearTemplateSearch={this.clearTemplateSearch}
+            reset = {reset}
+            clearReset = {this.clearReset}
           ></TemplateItems>
           <MedicalInfoContainer></MedicalInfoContainer>
         </TemplateContainer>
@@ -317,13 +628,79 @@ class PushContainer extends Component {
         visible={visible}
         confirm={this.makeSure}
         close={this.handleClose}
+        title={type==5?'重命名文件夹':type==3?'修改模板':null}
         cancel={this.handleClose}
-        okText={this.state.okText}
-        okBorderColor={this.state.okBorderColor}
-        okColor={this.state.okColor}
-        oKBg={this.state.oKBg}
+        okText={okText}
+        width={type==5 ? 500: type==3?580:300}
+        height={type==3&&admin?280:200}
+        okBorderColor={okBorderColor}
+        okColor={okColor}
+        oKBg={oKBg}
+        borderBtm={type==5||type==3?'1px solid #ccc':null}
       >
-        {this.state.message}
+        {message}
+        {
+          admin&&type==3?<div>
+            <div  className={style.iptWrap}>
+              <div className={style.male}>
+                <span className={style.leftName}>性别归属:</span>
+                <span className={style['commonSex']} id="commonSex" onClick={this.changeRadio.bind(this,1)}><img src={check_right} alt=""/><i style={{color:'#000'}}>通用</i></span>
+                <span id="maleSex" onClick={this.changeRadio.bind(this,2)}><img src={check_circle} alt=""/><i>男</i></span>
+                <span id="femaleSex" onClick={this.changeRadio.bind(this,3)}><img src={check_circle} alt=""/><i>女</i></span>
+                <span style={{paddingRight:0,color:'#777777'}}>(注:错误引用,显示可能有误)</span>
+              </div>
+            </div>
+            <div className={style.department}>
+              <span className={style.leftName}>科室归属:</span>
+                <Search handleChangeValue={handleChangeValue} handleChangeIpt={handleChangeIpt} value={value} visible={true} zIndex={11}>
+                {
+                  departLis.length>0&&value&&<ul className={style.departLis}>
+                    {
+                      departLis.map((item,idx)=>{
+                        return <li onClick={()=>this.setDeptId(item.id,item.conceptDeptName)}>
+                          {item.conceptDeptName}
+                        </li>
+                      })
+                    }
+                  </ul>
+                }
+                </Search>
+              <span style={{paddingRight:0,color:'#777777'}}>(支持汉字关键字搜索)</span>
+          </div>
+
+
+            <div className={style.department}>
+              <span className={style.leftName}>存储为:</span>
+                <div  className={style.selectFolder} onClick={(e) => {
+                      this.handleFolderShow(e)
+                    }}>
+                  <input className={style.selectFolderIpt}
+                    autocomplete="off"
+                    type="text"
+                    maxLength='20'
+                    readOnly
+                    value={this.state.folderNameVal}
+                    
+                  />
+                  <img src={slideDown} alt=""/>
+                {
+                  floderListAdmin.length>0&&folderListShow&&<ul className={`${style.departLis} ${style.departLisFolder}`}>
+                    {
+                      floderListAdmin.map((item,idx)=>{
+                        return <li onClick={()=>this.setFolderId(item.id,item.name)}>
+                          {item.name}
+                        </li>
+                      })
+                    }
+                  </ul>
+                }
+                </div>
+
+                <span className={style.newFolder} onClick={()=>this.newFolder(true)}>新建文件夹</span>
+                <span className={style.mangerFolder} onClick={()=>this.folderManage(true)}>管理文件夹</span>  
+            </div>
+          </div>:null
+        }
       </ConfirmModal>
       <CopyRightContainer />
     </div>
@@ -348,6 +725,11 @@ const mapStateToProps = (state) => {//console.log(state)
     allCheckShowAdmin: state.tabTemplate.allCheckShowAdmin,
     checkItemsAdmin: state.tabTemplate.checkItemsAdmin,
     clearSearch:state.print.clearSearch,
+    departLis: state.tabTemplate.departLis,
+    selectTemp:state.tabTemplate.selectTemp,
+    floderListAdmin:state.tabTemplate.floderListAdmin,
+    folderListContentArr:state.tabTemplate.folderListContentArr,
+    templateNormsSearchList: state.tabTemplate.templateNormsSearchList
   }
 }
 

+ 254 - 4
src/components/PushContainer/index.less

@@ -28,19 +28,18 @@
 }
 .center {
     text-align: center;
-    font-size: 16px;
+    font-size: 14px;
     padding-top: 10px;
     padding-bottom: 50px;
 }
 .box {
     padding-top: 10px;
     box-sizing: border-box;
-    height: 80px;
 }
 .ipt {
-    font-size: 16px;
+    font-size: 14px;
     width: 170px;
-    height: 20px;
+    // height: 20px;
     line-height: 18px;
     display: block;
     margin: 0 auto;
@@ -51,4 +50,255 @@
     height: 1px;
     margin: 8px auto 0 auto;
     background: #D8D8D8;
+}
+.leftName {
+  width: 118px;
+  text-align: right;
+  padding-right: 16px;
+  display: inline-block;
+}
+.iptWrap {
+  padding: 0 15px;
+  line-height: 18px;
+  margin: 18px auto;
+  text-align: left;
+  .name {
+      text-align: left;
+      input {
+          border: 1px solid #CCCCCC;
+          padding: 5px 10px;
+          width: 240px;
+      }
+  }
+  .firstname {
+      margin-top: 15px;
+  }
+  p {
+    text-align: left;
+    font-size: 12px;
+    color: #6b6969;
+    margin-bottom: 5px;
+  }
+  span {
+    display: inline-block;
+    cursor: pointer;
+    font-size: 14px;
+    i {
+      color: #6b6969;
+    }
+    img {
+      vertical-align: middle;
+      position: relative;
+      top: -1px;
+    }
+  }
+}
+
+.box {
+  box-sizing: border-box;
+  // height: 88px;
+}
+
+.department {
+  position: relative;
+  text-align: left;
+  padding: 0 0 15px 16px;
+  .selectFolder {
+      position: relative;
+      display: inline-block;
+      input {
+          border: 1px solid #CCCCCC;
+          padding: 5px 10px;
+          width: 240px;
+          margin-right: 20px;
+      }
+      img {
+          position: absolute;
+          right: 20px;
+          top: 0;
+          width: 30px;
+          height: 30px;
+      }
+  }
+}
+
+.departLis {
+  position: absolute;
+  top: 29px;
+  left: 134px;
+  max-height: 200px;
+  overflow: auto;
+  background-color: #fff;
+  width: 240px;
+  // box-shadow: 0 10px 20px 0 #989DA3;
+  border: 1px solid #dedede;
+  z-index: 101;
+  li {
+      height: 36px;
+      line-height: 36px;
+      padding: 0 10px;
+      padding-top: 0;
+      box-sizing: border-box;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+      border: 1px solid transparent;
+      cursor: pointer;
+  }
+  li:hover {
+      border: 1px solid #3B9ED0;
+  }
+}
+.newFolder {
+  margin-right: 15px;
+  color: #3B9ED0;
+  cursor: pointer;
+}
+.mangerFolder{
+  color: #3B9ED0;
+  cursor: pointer;
+}
+
+.iptWrap {
+  padding: 0 15px;
+  line-height: 18px;
+  margin: 18px auto;
+  text-align: left;
+  .name {
+      text-align: left;
+      input {
+          border: 1px solid #CCCCCC;
+          padding: 5px 10px;
+          display: inline-block;
+          width: 240px;
+      }
+  }
+  .firstname {
+      margin-top: 15px;
+  }
+  p {
+    text-align: left;
+    font-size: 12px;
+    color: #6b6969;
+    margin-bottom: 5px;
+  }
+  span {
+    display: inline-block;
+    cursor: pointer;
+    font-size: 14px;
+    i {
+      color: #6b6969;
+    }
+    img {
+      vertical-align: middle;
+      position: relative;
+      top: -1px;
+    }
+  }
+}
+.selectFolderIpt {
+  cursor: pointer;
+}
+.department {
+  position: relative;
+  text-align: left;
+  padding: 0 0 15px 16px;
+  .selectFolder {
+      position: relative;
+      display: inline-block;
+      input {
+          border: 1px solid #CCCCCC;
+          padding: 5px 10px;
+          width: 240px;
+          margin-right: 20px;
+      }
+      img {
+          position: absolute;
+          right: 20px;
+          top: 0;
+          width: 30px;
+          height: 30px;
+      }
+  }
+}
+.leftName {
+  width: 100px;
+  text-align: right;
+  padding-right: 16px;
+  display: inline-block;
+}
+.departLis {
+  position: absolute;
+  top: 29px;
+  left: 0;
+  max-height: 200px;
+  overflow: auto;
+  background-color: #fff;
+  width: 240px;
+  // box-shadow: 0 10px 20px 0 #989DA3;
+  border: 1px solid #dedede;
+  z-index: 101;
+  li {
+      height: 36px;
+      line-height: 36px;
+      padding: 0 10px;
+      padding-top: 0;
+      box-sizing: border-box;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+      border: 1px solid transparent;
+      cursor: pointer;
+  }
+  li:hover {
+      border: 1px solid #3B9ED0;
+  }
+}
+.male {
+  span {
+      padding-right: 16px;
+  }
+}
+.line {
+  height: 1px;
+  background-color: #979797;
+  position: relative;
+  top: -2px;
+}
+.iptWrap {
+  padding: 0 15px;
+  line-height: 18px;
+  margin: 18px auto;
+  text-align: left;
+  .name {
+      text-align: left;
+      input {
+          border: 1px solid #CCCCCC;
+          padding: 5px 10px;
+          display: inline-block;
+          width: 240px;
+      }
+  }
+  .firstname {
+      margin-top: 15px;
+  }
+  p {
+    text-align: left;
+    font-size: 12px;
+    color: #6b6969;
+    margin-bottom: 5px;
+  }
+  span {
+    display: inline-block;
+    cursor: pointer;
+    font-size: 14px;
+    i {
+      color: #6b6969;
+    }
+    img {
+      vertical-align: middle;
+      position: relative;
+      top: -1px;
+    }
+  }
 }

binární
src/components/TemplateItems/TemplateItem/img/check-circle.png


binární
src/components/TemplateItems/TemplateItem/img/check-right.png


binární
src/components/TemplateItems/TemplateItem/img/floderD.png


binární
src/components/TemplateItems/TemplateItem/img/floderR.png


binární
src/components/TemplateItems/TemplateItem/img/floderT.png


binární
src/components/TemplateItems/TemplateItem/img/floderTb.png


binární
src/components/TemplateItems/TemplateItem/img/tempTip.png


binární
src/components/TemplateItems/TemplateItem/img/tempTrd.png


binární
src/components/TemplateItems/TemplateItem/img/tmpAllCircle.png


binární
src/components/TemplateItems/TemplateItem/img/tmpAllRight.png


+ 19 - 15
src/components/TemplateItems/TemplateItem/index.jsx

@@ -34,12 +34,12 @@ class TemplateItem extends React.Component {
     return this.state.isOpen ? arrow_down_icon : arrow_icon;
   }
 
-  handleContentClick(e, sex) {
+  handleContentClick(e, sex,hasCalcIndex) {
     e.stopPropagation();
-    this.props.handleContentClick(this.props.id, sex);
+    this.props.handleContentClick(this.props.id, sex,hasCalcIndex);
   }
 
-  handleCheckboxClick(e, id) {          //点击复选框
+  handleCheckboxClick(e, id,folderId) {          //点击复选框
     e.stopPropagation();
     let tempCheck = this.state.checkBox;
     let sign = this.props.admin;
@@ -47,7 +47,7 @@ class TemplateItem extends React.Component {
     //   checkBox: !tempCheck
     // })
     if(sign){
-      store.dispatch(checkItemsAdmin(id))
+      store.dispatch(checkItemsAdmin(id,folderId))
     }else{
       store.dispatch(checkItems(id))
     }
@@ -92,9 +92,9 @@ class TemplateItem extends React.Component {
     });
   }
 
-  handleTemplateDel(e) {
+  handleTemplateDel(e,folderId) {
     e.stopPropagation();
-    this.props.handleTemplateDel(this.props.id);
+    this.props.handleTemplateDel(this.props.id,folderId);
   }
 
   getEditIcon() {
@@ -113,10 +113,10 @@ class TemplateItem extends React.Component {
     });
   }
 
-  handleEditIconClick(e, name,deptId) {
+  handleEditIconClick(e, name,deptId,folderId,spell,folderName,sex,hospitalDeptName) {
     e.stopPropagation();
     let currId = this.props.id
-    this.props.handleTitleChange(currId, name,deptId);
+    this.props.handleTitleChange(currId, name,deptId,folderId,spell,folderName,sex,hospitalDeptName);
   }
 
   handleTitleClick(e) {
@@ -182,10 +182,10 @@ class TemplateItem extends React.Component {
     }
   }
   getStyleSec(){
-    const { allCheckShow, id, name, preview, sex,admin,checkItemsAdmin,allCheckShowAdmin,adminflg } = this.props;
+    const { allCheckShow, id, name, preview, sex,admin,checkItemsAdmin,allCheckShowAdmin,adminflg,folderId } = this.props;
     if(admin) {
       if(allCheckShowAdmin){
-        return <div className={style['check-wrap']} onClick={(e) => { this.handleCheckboxClick(e, id) }}>
+        return <div className={style['check-wrap']} onClick={(e) => { this.handleCheckboxClick(e, id,folderId) }}>
         <img className={`${style['fl-element']} ${style['check-box']}`}
           src={this.getCheckIcon()[0]}
         /></div>
@@ -211,9 +211,13 @@ class TemplateItem extends React.Component {
     }
   }
   render() {
-    const { allCheckShow, id, name,hospitalDeptId, preview,conceptDeptName, sex,admin,checkItemsAdmin,allCheckShowAdmin,adminflg } = this.props;
+    const { allCheckShow, id, name,hospitalDeptId,folderId,spell,preview,conceptDeptName, sex,admin,checkItemsAdmin,allCheckShowAdmin,adminflg,folderName,hospitalDeptName } = this.props;
     let previewJson = JSON.parse(preview);
-    let sexStr = sex == 2 ? ' (女'+(conceptDeptName&&'-'+conceptDeptName)+')' : sex == 1 ? ' (男'+(conceptDeptName&&'-'+conceptDeptName)+')' : ' (通用'+(conceptDeptName&&'-'+conceptDeptName)+')';
+    let sexStr = sex == 2 ? ' (女' : sex == 1 ? ' (男': ' (通用';
+    if(conceptDeptName) {
+      sexStr += '-' + conceptDeptName
+    }
+    sexStr += ')'
     return (
       <div className={style.wrapper}>
         <div className={this.getStyleFst()}
@@ -235,15 +239,15 @@ class TemplateItem extends React.Component {
             src={this.getDelIcon()}
             onMouseEnter={() => this.handleDelIconMouseEnter()}
             onMouseLeave={() => this.handleDelIconMouseLeave()}
-            onClick={(e) => this.handleTemplateDel(e)}
+            onClick={(e) => this.handleTemplateDel(e,folderId)}
           />}
-          <span className={style.quote} onClick={(e) => this.handleContentClick(e, sex)}>引用</span>
+          <span className={style.quote} onClick={(e) => !admin&&adminflg? this.handleContentClick(e, sex,true): this.handleContentClick(e, sex)}>引用</span>
           {!admin&&adminflg?null:<img title={'修改模板标题'}
             className={style.edit}
             src={this.getEditIcon()}
             onMouseEnter={() => this.handleEditIconMouseEnter()}
             onMouseLeave={() => this.handleEditIconMouseLeave()}
-            onClick={(e) => this.handleEditIconClick(e, name,hospitalDeptId)}
+            onClick={(e) => this.handleEditIconClick(e, name,hospitalDeptId,folderId,spell,folderName,sex,hospitalDeptName)}
           />}
         </div>
         <div

+ 5 - 3
src/components/TemplateItems/TemplateItem/index.less

@@ -48,9 +48,11 @@
         float: left;
     }
     .check-box {
-        height: 18px;
-        width: 18px;
+        height: 14px;
+        width: 14px;
         margin-top: 14px;
+        position: relative;
+        top: 1px;
     }
     .title{
       display: inline-block;
@@ -59,7 +61,7 @@
       vertical-align: top;
     //   margin-top: 3px;
     // padding: 0 5px;
-      max-width: 200px;
+      max-width: 180px;
       overflow: hidden;
       text-overflow: ellipsis;
       white-space: nowrap;

+ 250 - 37
src/components/TemplateItems/index.jsx

@@ -5,9 +5,17 @@ import TemplateItem from './TemplateItem'
 import check_circle from './TemplateItem/img/check-circle.png';
 import delIcon from '@common/images/del_nor.png';
 import check_right from './TemplateItem/img/check-right.png';
+import tempTip from './TemplateItem/img/tempTip.png';
+import tempTrd from './TemplateItem/img/tempTrd.png';
+import tmpAllCircle from './TemplateItem/img/tmpAllCircle.png';
+import tmpAllRight from './TemplateItem/img/tmpAllRight.png';
+import floderR from './TemplateItem/img/floderR.png';
+import floderD from './TemplateItem/img/floderD.png';
 import Empty from '@components/Empty';
-import {windowEventHandler,getWindowInnerHeight} from '@utils/tools'
-
+import $ from 'jquery';
+import store from '@store';
+import { initCommonItemList,findTemplateNorms,getFloderListAll } from '@store/async-actions/tabTemplate';
+import { windowEventHandler,getWindowInnerHeight } from '@utils/tools'
 
 class TemplateItems extends React.Component {
     constructor(props) {
@@ -15,7 +23,10 @@ class TemplateItems extends React.Component {
         this.state = {
             msg:'还没有保存模板',
             val:'',
-            height:''
+            height:'',
+            showTipContent:false,
+            hasSearch: false,
+            showIndex: 0
         }
         this.$cont = React.createRef();
         this.$conts = React.createRef();
@@ -25,6 +36,9 @@ class TemplateItems extends React.Component {
         this.handleEnter = this.handleEnter.bind(this);
         this.handleChange = this.handleChange.bind(this);
         this.clear = this.clear.bind(this);
+        this.showTipContent = this.showTipContent.bind(this);
+        this.getFloderLis = this.getFloderLis.bind(this);
+        this.whichTemp = this.whichTemp.bind(this);
     }  
     componentDidMount(){
         const height = getWindowInnerHeight()-195;
@@ -39,16 +53,132 @@ class TemplateItems extends React.Component {
                 })
             }
         });
+        $(document).click((event) => {
+            let _del = $('#floderAction')[0];       // 弹窗  
+            let _dels = $(event.target).attr("id");       // 触发弹窗列表  
+            if (_del) {//onMousedown的目标为滚动条时,删除弹窗不关闭
+                if (!event.target.isEqualNode(_del) && event.target.parentNode != _del &&_dels != 'floderActionBtn') {
+                  this.floderAction(false,'none')
+                }
+              }
+        })
+        
+    }
+    showTipContent(){
+        let show = this.state.showTipContent
+        this.setState({
+            showTipContent:!show
+        })
+    }
+    floderSlide(e,item,i){
+        e.stopPropagation()
+        const {floderSlide,admin,clearReset,selectTemp} = this.props
+        const {showIndex} = this.state
+        if(!item.templateInfo){
+            return;
+        }
+        $(e.target).next().slideToggle()
+        let domLis = $(e.target).parent().siblings()
+        for(let i = 0;i < domLis.length;i++){
+            let tmpD = domLis[i]
+            $(tmpD).children().eq(1).slideUp()
+        }
+        // floderSlide(item.id)
+        clearReset&&clearReset()
+        if(admin ||!admin&&selectTemp) {
+            if(showIndex === i) {
+                this.setState({
+                    showIndex: -1
+                })
+            } else {
+                this.setState({
+                    showIndex: i
+                })
+            }
+        }
+    }
+    floderAction(e,id){
+        e&&e.stopPropagation()
+        const {floderAction} = this.props;
+        floderAction(id)
     }
     genItems(items,flg) {
         const Items = [];
-        const {admin,adminItems,checkItemsAdmin} = this.props;
+        const {admin,checkItems,allCheckShow,handleContentClick,handleTemplateDel,handleTitleChange,checkItemsAdmin,allCheckShowAdmin} = this.props;
         items.forEach((v,idx) => {
             Items.push(
                 <TemplateItem
                     {...v}
                     key={v.id}
                     idx={idx}
+                    checkItems={checkItems}
+                    allCheckShow={allCheckShow}
+                    handleContentClick={handleContentClick}
+                    handleTemplateDel={handleTemplateDel}
+                    handleTitleChange={handleTitleChange}
+
+                    admin={admin}
+                    adminflg={flg}
+                    checkItemsAdmin={checkItemsAdmin}
+                    allCheckShowAdmin={allCheckShowAdmin}
+                />
+            );
+        });
+        return Items;
+    }
+    floderRename(e,name,id){
+        e.stopPropagation()
+        this.props.floderAction(false,'none')
+        this.props.floderRename(name,id)
+    }
+    floderDelete(e,id){
+        e.stopPropagation()
+        this.props.floderAction(false,'none')
+        this.props.floderDelete(id)
+    }
+    genAdminItems(items,flg) {
+        const Floder=[],Items = [];
+        const {admin,checkItemsAdmin} = this.props;
+        let {showIndex}=this.state
+        if(items.length>0&&!items[0].templateInfo){
+            showIndex = -1
+        }
+        for(let i = 0;i < items.length;i++){
+            let tmpItm = items[i]
+            Floder.push(
+                <div className={style.floderPart}>
+                    <div className={`${style.floderPartFl} floderSlideLis`} onClick={(e)=>this.floderSlide(e,tmpItm,i)}>
+                        {<img src={showIndex== i?floderD:floderR} className={style.floderRD}/>}
+                        {/* {!admin&&<img src={tmpItm.slide == 1?floderD:floderR} className={style.floderRD}/>} */}
+                        {tmpItm.name}({tmpItm.templateInfoCount})
+                        {admin&&tmpItm.name!='未分类文件夹'&&<span className={`${style.floderPartAction}`} id="floderActionBtn" onClick={(e)=>{this.floderAction(e,tmpItm.id)}}>...</span>}
+                        {tmpItm.action == 1&&tmpItm.name!='未分类文件夹'&&<div className={style.floderAction} id="floderAction">
+                            <p onClick={(e)=>{this.floderRename(e,tmpItm.name,tmpItm.id)}}>重命名文件夹</p>
+                            <p onClick={(e)=>{this.floderDelete(e,tmpItm.id)}}>删除文件夹</p>
+                        </div>}
+                    </div>
+                    {
+                        tmpItm.templateInfo&&tmpItm.templateInfo.length>0&&<div className={style.floderPartFr}>
+                            {
+                                this.getFloderLis(tmpItm.templateInfo,flg,tmpItm.name,tmpItm.id)
+                            }
+                        </div>
+                    }
+                </div>
+            )
+        }
+        return Floder
+    }
+    getFloderLis(items,flg,folderName){//文件夹内的模板明细
+        const Items = [];
+        const {admin,checkItemsAdmin,allCheckShowAdmin} = this.props;
+        items.forEach((v,idx) => {
+            Items.push(
+                <TemplateItem
+                    {...v}
+                    key={v.id}
+                    idx={idx}
+                    folderName={folderName}
                     checkItems={this.props.checkItems}
                     allCheckShow={this.props.allCheckShow}
                     handleContentClick={this.props.handleContentClick}
@@ -58,30 +188,38 @@ class TemplateItems extends React.Component {
                     admin={this.props.admin}
                     adminflg={flg}
                     checkItemsAdmin={checkItemsAdmin}
-                    allCheckShowAdmin={this.props.allCheckShowAdmin}
+                    allCheckShowAdmin={allCheckShowAdmin}
                 />
             );
         });
         return Items;
     }
     getCheckIcon() {
-        const {admin,checkItems,items,checkItemsAdmin,adminItems} = this.props;
+        const {admin,checkItems,items,checkItemsAdmin,adminItems,folderListContentArr} = this.props;
         if(admin){
-            if (adminItems.length == checkItemsAdmin.length && checkItemsAdmin.length != 0) {
+            if (folderListContentArr.length == checkItemsAdmin.length && checkItemsAdmin.length != 0) {
                 return check_right;
             } else {
                 return check_circle;
             }
         }
         if (items.length == checkItems.length && checkItems.length != 0) {
-            return check_right;
+            return tmpAllRight;
         } else {
-            return check_circle;
+            return tmpAllCircle;
         }
     }
     templateSearch(){
-        const {templateSearch} = this.props
-        templateSearch((this.$search.current.value).trim())
+        const {templateSearch,selectTemp,admin} = this.props
+        if(!(this.$search.current.value).trim()) {
+            return
+        }
+        if(admin) {
+            templateSearch((this.$search.current.value).trim(),2)
+        } else {
+            templateSearch((this.$search.current.value).trim(),selectTemp)
+
+        }
         if(this.$search.current.value.trim()){
             this.setState({
                 msg:'暂无模板信息'
@@ -91,6 +229,9 @@ class TemplateItems extends React.Component {
                 msg:'还没有保存模板'
             })
         }
+        this.setState({
+            hasSearch: true
+        })
     }
     
     handleEnter(e){
@@ -100,8 +241,22 @@ class TemplateItems extends React.Component {
     }
     
     handleChange(){
+        const {admin,selectTemp} = this.props;
         const value = (this.$search.current.value).substring(0,30);
         // this.$search.current.value = value
+        if(!admin&&selectTemp==1&&value == ''){
+            store.dispatch(initCommonItemList(1,""))
+        }else if(!admin&&selectTemp==2&&value == ''){
+            this.setState({
+                hasSearch:false
+            })
+            store.dispatch(findTemplateNorms(''))
+        }else if(admin){
+            this.setState({
+                hasSearch:false
+            })
+            store.dispatch(getFloderListAll(''))
+        }
         setTimeout(() => {
             this.setState({
                 val: value
@@ -110,25 +265,65 @@ class TemplateItems extends React.Component {
     }
 
     clear(){
+        const {clearTemplateSearch,selectTemp,admin} = this.props
         this.$search.current.value = '';
         this.setState({
             val:''
         });
         this.$search.current.focus();
         this.templateSearch();
+        this.setState({
+            hasSearch: false
+        })
+        clearTemplateSearch&&clearTemplateSearch()
+        setTimeout(()=>{
+            $(".floderSlideLis").eq(0).next().slideDown()
+        },0)
+        if(!admin){
+            store.dispatch(initCommonItemList(1,""))
+        }
+    }
+    clickTabChange(){
+
     }
-  componentWillReceiveProps(next){
+    componentWillReceiveProps(next){
         //点清空恢复初始状态
-      if(this.props.clearSearch!==next.clearSearch){
+      if(this.props.clearSearch!==next.clearSearch || next.reset){
         this.clear();
+        this.props.clearReset()
+      }
+      const oldIndex = this.state.showIndex
+    //   if(next.reset) {
+    //     this.clear()
+    //   }
+      if(next.reset && oldIndex != 0) {
+        $(".floderSlideLis").eq(oldIndex).next().slideUp()
+          this.setState({
+            showIndex: 0,
+            hasSearch: false
+          })
       }
+
+    }
+    whichTemp(num,val){
+        setTimeout(()=>{
+            $(".floderSlideLis").eq(0).next().slideDown()
+        },0)
+
+        this.props.whichTemp(num,val)
+        // if(val){
+        //     this.setState({
+        //         hasSearch:true
+        //     })
+        // }
     }
     render() {
-        const { checkItemsAdmin,handleAllCheckboxAdmin,handleMangerTemplateAdmin,allCheckShowAdmin,admin,adminItems,allCheckShow, handleMangerTemplate,handleClickGetMore, handleDelList, handleAllCheckbox, items,checkItems,current,hasMore } = this.props;
-        const {height} = this.state
+        const {selectTemp,whichTemp, checkItemsAdmin,handleAllCheckboxAdmin,handleMangerTemplateAdmin,allCheckShowAdmin,admin,adminItems,allCheckShow, handleMangerTemplate,handleClickGetMore, handleDelList, handleAllCheckbox, items,checkItems,current,hasMore,templateNormsSearchList } = this.props;
+
+        const {height,showTipContent,hasSearch} = this.state
         return (
             <div className={style.wrapper} >
-                {//管理员操作
+                {//管理员操作      
                     adminItems&&admin ? (allCheckShowAdmin ?
                         <div className={style.wrapperTop}>
                             <div className={style['check-wrap']} onClick={handleAllCheckboxAdmin} style={{paddingLeft:'10px'}}>
@@ -143,7 +338,7 @@ class TemplateItems extends React.Component {
                         </div> :
                         <div className={style.wrapperTop}>
                             <div className={style.templateSearch}>
-                                <input placeholder="模板搜索" id="searchTmp" maxLength="30" ref={this.$search} type="text" onInput={this.handleChange} onPropertyChange={this.handleChange} onKeyUp={this.handleEnter}/>
+                                <input  autocomplete="off" placeholder="模板搜索" id="searchTmp" maxLength="30" ref={this.$search} type="text" onInput={this.handleChange} onPropertyChange={this.handleChange} onKeyUp={this.handleEnter}/>
                                 {this.state.val?<img src={delIcon} id='clearTemplateSearch' alt="清空" onClick={this.clear}/>:''}
                                 <div className={style.search} onClick={this.templateSearch}>搜索</div>
                             </div>
@@ -153,10 +348,10 @@ class TemplateItems extends React.Component {
                     </div>) : null
                 }
                 {//个人
-                    items&&!admin ? 
+                    items&&!admin?
                         <div className={style.wrapperTop}>
                             <div className={style.templateSearch}>
-                                <input placeholder="模板搜索" id="searchTmp" maxLength="30" ref={this.$search} type="text" onInput={this.handleChange} onPropertyChange={this.handleChange} onKeyUp={this.handleEnter}/>
+                                <input  autocomplete="off" placeholder="模板搜索" id="searchTmp" maxLength="30" ref={this.$search} type="text" onInput={this.handleChange} onPropertyChange={this.handleChange} onKeyUp={this.handleEnter}/>
                                 {this.state.val?<img src={delIcon} alt="清空" onClick={this.clear}/>:''}
                                 <div className={style.search} onClick={this.templateSearch}>搜索</div>
                             </div>
@@ -166,7 +361,7 @@ class TemplateItems extends React.Component {
                     <div className={style.comAdminWrp}>
                         <div className={`${style.tempLists} ${style.tempListsP}`} ref={this.$cont} style={{display:admin?'none':'block',border:'1px solid #EAEDF1'}}>
                             {//个人
-                                allCheckShow&&!admin ?<div className={`${style.wrapperTop} ${style.wrapperTopM} ${style.personalTmp}`}>
+                                allCheckShow ?<div className={`${style.wrapperTop} ${style.wrapperTopM} ${style.personalTmp} ${selectTemp==1?style.personalTmpOwn:null}`} onClick={()=>whichTemp(1)}>
                                     <i></i>
                                     <i></i>
                                     <div className={style['check-wrap']} onClick={handleAllCheckbox}>
@@ -174,37 +369,55 @@ class TemplateItems extends React.Component {
                                     </div>
                                     <span onClick={handleAllCheckbox}>全选</span>
                                     <span className={`${style['fr-element']} ${style['done']}`} onClick={handleMangerTemplate}>完成</span>
-                                    {
+                                    {checkItems.length>0&&<span className={`${style['fr-element']} ${style['del-items']}`} onClick={handleDelList}>删除</span>}
+                                    {/* {
                                         checkItems.length>0?<span className={`${style['fr-element']} ${style['del-items']}`} onClick={handleDelList}>删除</span>:
                                         <span className={`${style['fr-element']} ${style['del-items-gray']}`}>删除</span>
-                                    }
+                                    } */}
                                 </div>:null
                             }
                             {
-                                !allCheckShow&&<div className={`${style.personalTmp} clearfix`}>
-                                    <span className={style.tip}>个人模板</span>
-                                    <i></i>
+                                <div className={`${style.topBorder} clearfix`}>
                                     {
-                                        items.length > 0&&<span className={`${style['fr-element']} ${style['manger']}`} onClick={handleMangerTemplate}>管理</span>
+                                        !allCheckShow&&<div className={`${style.personalTmp} ${selectTemp==1?style.personalTmpOwn:''} clearfix`} onClick={()=>whichTemp(1,(this.state.val).trim(),hasSearch)}>
+                                            <span className={style.tip}>个人模板</span>
+                                            <i></i>
+                                            {
+                                                items.length > 0&&<span className={`${style['fr-element']} ${style['manger']}`} onClick={handleMangerTemplate}>管理</span>
+                                            }
+                                        </div>
+                                    }
+                                    {
+                                        !admin?!allCheckShowAdmin&&<div 
+                                            className={`${style.personalTmp} ${style.personalTmpStatand} ${selectTemp==2?style.personalTmpOwn:''}`} 
+                                            onClick={()=>{this.whichTemp(2,(this.state.val).trim(),hasSearch);allCheckShow&&handleMangerTemplate(2)}}
+                                            >标准模板 {selectTemp==2&&<img src={tempTip} className={style.tempTip} alt="" onMouseEnter={this.showTipContent} onMouseLeave={this.showTipContent}/>}
+                                            {
+                                                showTipContent&&<div className={style.tempTipContent}>
+                                                    <img src={tempTrd} alt=""/>
+                                                    <p>1. 标准模板中的科室,对应的是经朗通医疗团队整理的,符合临床医学意义的科室;</p>
+                                                    <p>2.只有特定的“管理员”账号,可对“标准模板”进行修改,普通账号仅可进行“引用”。</p>
+                                                </div>  
+                                            }  
+                                        </div>:''
                                     }
                                 </div>
                             }
                             {
-                                <div style={{height:height/2-42+'px',overflow:'auto'}}>
-                                    {this.genItems(items).length > 0?this.genItems(items): <Empty message={this.state.msg}></Empty>}
+                                <div style={{height:height-54+'px',overflow:'auto'}}>
+                                    {
+                                        selectTemp==1&&this.genItems(items).length > 0?this.genItems(items):selectTemp==2&&this.genAdminItems(adminItems,true).length > 0?hasSearch ? this.genItems(templateNormsSearchList,true):this.genAdminItems(adminItems,true): <Empty message={this.state.msg}></Empty>
+                                    }
                                 </div>
                             }
                         </div>
-                        <div className={style.tempLists} ref={this.$conts} style={{border:admin?'0':'1px solid #EAEDF1'}}>
-                            {
-                                !admin?!allCheckShowAdmin&&<div className={`${style.personalTmp}`}>标准模板</div>:''
-                            }
-                            {
-                                <div style={{height:admin?height+'px':(height-20)/2-42+'px',overflow:'auto'}}>
-                                    {this.genItems(adminItems,true).length > 0?this.genItems(adminItems,true): <Empty message={this.state.msg}></Empty>}
+                        {
+                            admin&&<div className={style.tempLists} ref={this.$conts} style={{border:admin?'0':'1px solid #EAEDF1'}}>
+                                <div style={{height:height+'px',overflow:'auto'}}>
+                                    {this.genAdminItems(adminItems,true).length > 0?hasSearch ?this.genItems(templateNormsSearchList):this.genAdminItems(adminItems,true): <Empty message={this.state.msg}></Empty>}
                                 </div>
-                            }
-                        </div>
+                            </div>
+                        }
                     </div>
                 }
                 {/* <div className={style.tempLists} ref={this.$cont}>

+ 123 - 5
src/components/TemplateItems/index.less

@@ -33,7 +33,7 @@
         // background-color: #EAEDF1;
         cursor: pointer;
         .check-box {
-            height: 18px;
+            height: 14px;
             // width: 18px;
             margin-top: 10px;
             padding-right: 10px;
@@ -56,6 +56,12 @@
         .del-items {
             margin-right: 20px;
             color: #FF0000;
+            border: 1px solid #fff;
+            height: 22px;
+            line-height: 20px;
+            border-radius: 11px;
+            padding: 0 5px;
+            margin-top: 8px;
         }
         .del-items-gray {
             margin-right: 20px;
@@ -69,7 +75,16 @@
         }
     }
     .wrapperTopM {
-        padding: 0 10px;
+        padding: 0 11px;
+        position: relative;
+        top: 1px;
+        padding-top: 1px;
+        .check-box {
+            width: 14px;
+            height: 14px;
+            position: relative;
+            top: 1px;
+        }
     }
     .loadMore {
       text-align: center;
@@ -120,18 +135,21 @@
 
 .fr-element {
     // float: right;
-    color: #3B9ED0;
+    color: #777777;
     display: inline-block;
     height: 36px;
     line-height: 36px;
 }
 .personalTmp {
-    width: 100%;
+    width: 50%;
+    float: left;
     height: 40px !important;
     line-height: 40px !important;
-    background-color: #EDF8FF;
+    // background-color: #EDF8FF;
     padding: 0 10px;
     box-sizing: border-box;
+    cursor: pointer;
+    color: #777777;
     .tip {
 
     }
@@ -139,3 +157,103 @@
         float: right;
     }
 }
+.personalTmpOwn {
+    background-color: #2A9BD5;
+    color: #fff;
+    .fr-element,.done {
+        color: #fff !important;
+    }
+}
+.tempTip {
+    width: 14px;
+    height: 14px;
+    position: relative;
+    top: 2px;
+}
+.personalTmpStatand {
+    position: relative;
+    .tempTipContent {
+        position: absolute;
+        left: -61px;
+        top: 40px;
+        width: 270px;
+        padding: 15px;
+        z-index: 100;
+        background-color: #fff;
+        color: #1E1E1E;
+        font-size: 12px;
+        line-height: 16px;
+        box-shadow:0px 2px 20px -3px rgba(59,89,126,0.2);
+        img {
+            width: 16px;
+            height: 14px;
+            position: absolute;
+            top: -10px;
+            left: 113px;
+        }
+    }
+}
+.topBorder {
+    border: 1px solid #3B9ED0;
+}
+.floderPart {
+    background-color: #fff;
+    position: relative;
+    line-height: 45px;
+    cursor: pointer;
+    .floderPartFl {
+        border-bottom: 1px solid #EAEDF1;
+        padding: 0 10px;
+        position: relative;
+        .floderRD {
+            width: 20px;
+            height: 20px;
+            position: relative;
+            top: 5px;
+            right: 4px;
+            pointer-events: none;
+        }
+        .floderPartAction {
+            float: right;
+            font-size: 22px;
+            height: 30px;
+            width: 30px;
+            line-height: 15px;
+            color: #ccc;
+            text-align: center;
+            position: relative;
+            top: 9px;
+            &:hover {
+                background-color: #F7F8FA;
+                color: #3B9ED0;
+            }
+        }
+        .floderAction {
+            position: absolute;
+            right: 10px;
+            top: 40px;
+            z-index: 99;
+            background-color: #fff;
+            color: #777777;
+            border-radius:2px;
+            box-shadow:0px 2px 20px -3px rgba(59,89,126,0.2);
+            p {
+                height: 36px;
+                line-height: 36px;
+                padding: 0 10px;
+                pointer-events: all;
+            }
+            p:hover {
+                background-color: #F7F8FA;
+                color: #3B9ED0;
+            }
+        }
+    }
+    .floderPartFr {
+        border-bottom: 1px solid #EAEDF1;
+        display: none;
+    }
+}
+.floderPart:hover {
+    // border: 1px solid #66afe9;
+}

+ 132 - 112
src/containers/OperationContainer.js

@@ -1,129 +1,149 @@
 import React from "react";
-import {connect} from "react-redux";
+import { connect } from "react-redux";
 import Operation from "../components/Operation";
 import {
-    SHOW_PRINT_PREVIEW,
-    CLOSE_PRINT_PREVIEW,
-    SHOW_PREVIEW,
-    CLOSE_PREVIEW,
-    DIAG_SHOW
+  SHOW_PRINT_PREVIEW,
+  CLOSE_PRINT_PREVIEW,
+  SHOW_PREVIEW,
+  CLOSE_PREVIEW,
+  DIAG_SHOW
 } from "../store/types/print";
-import {saveMessage,clearMessages} from "../store/async-actions/print";
-import {saveTemplateDetail,getDepartments,saveAdminTemplateDetail } from '@store/async-actions/tabTemplate';
-import {getDptLis} from '@store/actions/tabTemplate';
-import {saveClickNum,getInitModules} from '@store/async-actions/homePage';
-import {getOtherHisRecord} from '@store/async-actions/fetchModules';
-import {RECOVER_TAG_MAIN} from '@store/types/mainSuit';
-import {RECOVER_TAG_CURRENT} from '@store/types/currentIll';
-import {RECOVER_TAG_OTHER} from '@store/types/otherHistory';
-import {RECOVER_TAG_CHECK} from '@store/types/checkBody';
-import {Notify} from '@commonComp';
-import {didPushParamChange} from '@utils/tools.js';
-import {billing} from '@store/async-actions/pushMessage';
-import {ISREAD} from '@store/types/homePage';
+import { saveMessage, clearMessages } from "../store/async-actions/print";
+import { saveTemplateDetail, getDepartments, saveAdminTemplateDetail, getFloderList,newFloder,orderFloder } from '@store/async-actions/tabTemplate';
+import { getDptLis,folderModal,folderOrder } from '@store/actions/tabTemplate';
+import { saveClickNum, getInitModules } from '@store/async-actions/homePage';
+import { getOtherHisRecord } from '@store/async-actions/fetchModules';
+import { RECOVER_TAG_MAIN } from '@store/types/mainSuit';
+import { RECOVER_TAG_CURRENT } from '@store/types/currentIll';
+import { RECOVER_TAG_OTHER } from '@store/types/otherHistory';
+import { RECOVER_TAG_CHECK } from '@store/types/checkBody';
+import { Notify } from '@commonComp';
+import { didPushParamChange } from '@utils/tools.js';
+import { billing } from '@store/async-actions/pushMessage';
+import { ISREAD } from '@store/types/homePage';
 
 // function mapStateToProps({print}) {
 function mapStateToProps(state) {
-    const {print,homePage} = state;
-    return ({
-        print,
-        winWidth:homePage.windowWidth,
-        admin:homePage.admin,
-        chronicMagItem: state.diagnosticList.chronicMagItem,//慢病疾病
-        chronicDesease:state.mainSuit.chronicDesease,//主诉存的慢病
-        departLis:state.tabTemplate.departLis,
-    });
+  const { print, homePage } = state;
+  return ({
+    print,
+    winWidth: homePage.windowWidth,
+    admin: homePage.admin,
+    chronicMagItem: state.diagnosticList.chronicMagItem,//慢病疾病
+    chronicDesease: state.mainSuit.chronicDesease,//主诉存的慢病
+    departLis: state.tabTemplate.departLis,
+    floderListAdmin:state.tabTemplate.floderListAdmin,
+    folderModalShow:state.tabTemplate.folderModalShow,
+    folderOrderShow:state.tabTemplate.folderOrderShow,
+    adminItems: state.tabTemplate.adminItems,
+    patInfo: state.patInfo.message,
+  });
 }
 
 function mapDispatchToProps(dispatch) {
-    return {
-        handleClearValue:()=> {
-          dispatch(dispatch(getDptLis([])))
-        },
-        handleChangeValue:(val)=> {
-          val&&dispatch(getDepartments(val))
-        },
-        showPrintPreview: () => {
-            dispatch({
-                type: SHOW_PRINT_PREVIEW
-            });
-        },
-        closePrintPreview: () => {
-            dispatch({
-                type: CLOSE_PRINT_PREVIEW
-            });
-        },
-        showPreview: () => {
-            dispatch({
-                type: SHOW_PREVIEW
-            });
-        },
-        closePreview: () => {
-            dispatch({
-                type: CLOSE_PREVIEW
-            });
-        },
-        save: () => {
-            dispatch(saveClickNum);
-            dispatch(() => saveMessage())
-        },
-        clear: (flag) => {
-            clearMessages();
-            dispatch(getOtherHisRecord());      //清除后重新获取其他史记录
-            // 清除时如果是慢病模板则重新获取模板
-            if(flag){
-                dispatch(getInitModules);
-            }
-        },
-        saveDataAlls(val,sex,id){
-          dispatch(saveAdminTemplateDetail(val,sex,id))
-        },
-        saveDataAll(val,sex){
-          dispatch(saveTemplateDetail(val,sex))
-        },
-        diagShowTmp(bool){
-          dispatch({
-            type: DIAG_SHOW,
-            data:bool
-          });
-        },
-        cancelDelTag(){
-            const maps = {
-               '1':RECOVER_TAG_MAIN,
-               '2':RECOVER_TAG_CURRENT,
-               '3':RECOVER_TAG_OTHER,
-               '4':RECOVER_TAG_CHECK
-            };
-            const deledTags = localStorage.getItem('deletedTags')?JSON.parse(localStorage.getItem('deletedTags')):[];
-            if(deledTags.length===0){
-              Notify.info('暂无标签可还原');
-              return ;
-            }
-            const arr = deledTags[0].delIndex.split("-");
-            const item = deledTags[0];
-            dispatch({
-              type:maps[arr[0]],
-              data:item.tagType?item:item.tags,
-              index:arr[1]
-            });
-          dispatch({
-            type:ISREAD
-          });
-          //删除文字选中状态
-          window.getSelection().empty();
-          //右侧推送
-          setTimeout(function(){      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
-            if(didPushParamChange()){     //操作后内容有变化才推送
-              dispatch(billing());
-            }
-          },200);
+  return {
+    folderOrder(show){ 
+      dispatch(folderOrder(show))
+    },
+    saveOrderFolder(folderList){
+      dispatch(orderFloder(folderList))
+    },
+    folderModal(show){
+      dispatch(folderModal(show))
+    },
+    newFloder(name){
+      dispatch(newFloder(name))
+    },
+    getFloderList() {
+      dispatch(getFloderList())
+    },
+    handleClearValue: () => {
+      dispatch(dispatch(getDptLis([])))
+    },
+    handleChangeValue: (val) => {
+      val && dispatch(getDepartments(val))
+    },
+    showPrintPreview: () => {
+      dispatch({
+        type: SHOW_PRINT_PREVIEW
+      });
+    },
+    closePrintPreview: () => {
+      dispatch({
+        type: CLOSE_PRINT_PREVIEW
+      });
+    },
+    showPreview: () => {
+      dispatch({
+        type: SHOW_PREVIEW
+      });
+    },
+    closePreview: () => {
+      dispatch({
+        type: CLOSE_PREVIEW
+      });
+    },
+    save: () => {
+      dispatch(saveClickNum);
+      dispatch(() => saveMessage())
+    },
+    clear: (flag) => {
+      clearMessages();
+      dispatch(getOtherHisRecord());      //清除后重新获取其他史记录
+      // 清除时如果是慢病模板则重新获取模板
+      if (flag) {
+        dispatch(getInitModules);
+      }
+    },
+    saveDataAlls(val, sex, id,fstName,folderId,folderName) {
+      dispatch(saveAdminTemplateDetail(val, sex, id,fstName,folderId,folderName))
+    },
+    saveDataAll(val, sex, spell) {
+      dispatch(saveTemplateDetail(val, sex, spell))
+    },
+    diagShowTmp(bool) {
+      dispatch({
+        type: DIAG_SHOW,
+        data: bool
+      });
+    },
+    cancelDelTag() {
+      const maps = {
+        '1': RECOVER_TAG_MAIN,
+        '2': RECOVER_TAG_CURRENT,
+        '3': RECOVER_TAG_OTHER,
+        '4': RECOVER_TAG_CHECK
+      };
+      const deledTags = localStorage.getItem('deletedTags') ? JSON.parse(localStorage.getItem('deletedTags')) : [];
+      if (deledTags.length === 0) {
+        Notify.info('暂无标签可还原');
+        return;
+      }
+      const arr = deledTags[0].delIndex.split("-");
+      const item = deledTags[0];
+      dispatch({
+        type: maps[arr[0]],
+        data: item.tagType ? item : item.tags,
+        index: arr[1]
+      });
+      dispatch({
+        type: ISREAD
+      });
+      //删除文字选中状态
+      window.getSelection().empty();
+      //右侧推送
+      setTimeout(function () {      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
+        if (didPushParamChange()) {     //操作后内容有变化才推送
+          dispatch(billing());
         }
-    };
+      }, 200);
+    }
+  };
 }
 
 const OperationComtainer = connect(
-    mapStateToProps,
-    mapDispatchToProps
+  mapStateToProps,
+  mapDispatchToProps
 )(Operation);
 
 export default OperationComtainer;

+ 1 - 1
src/store/actions/pushMessage.js

@@ -23,7 +23,7 @@ export const changeCheck=(state,action)=>{
 //获取右侧推送信息
 export const setAdvice=(state,action)=>{
 	const res=Object.assign({},state);  
-	// res.determine = action.determine
+	// res.determine = action.determine`
 	//不展示确诊,将确诊跟疑似诊断放在一起展示
   res.doubt = action.determine.concat(action.doubt);
   res.possible = action.possible;

+ 46 - 6
src/store/actions/tabTemplate.js

@@ -17,16 +17,55 @@ import {
     CKECK_ITEMS_ADMIN,
     DEL_ITEMS_ADMIN,
     BATCH_DEL_ITEMS_ADMIN,
-    CHANGE_TITLE_ADMIN
+    CHANGE_TITLE_ADMIN,
+    WHICH_TEMP,
+    FLODER_SLIDE,
+    FLODER_ACTION,
+    FOLDER_LIST_ADMIN,
+    FOLDER_MODAL,
+    FOLDER_ORDER_SHOW,
+    NORMS_TEMPLATE_SEARCH,
+    CLEAR_NORMS_TEMPLATE_SEARCH
 } from '@store/types/tabTemplate';
-
+export const clearSearchTemplateNorms = () => ({ //清除模板文件夹搜索
+    type: CLEAR_NORMS_TEMPLATE_SEARCH
+});
+export const setSearchTemplateNorms = (templateNormsSearchList) => ({
+    type: NORMS_TEMPLATE_SEARCH,
+    templateNormsSearchList
+});
+export const folderOrder = (show) => ({ //文件夹展开
+    type: FOLDER_ORDER_SHOW,
+    show
+});
+export const folderModal = (show) => ({ //文件夹展开
+    type: FOLDER_MODAL,
+    show
+});
+export const floderListAdmin = (data) => ({ //文件夹展开
+    type: FOLDER_LIST_ADMIN,
+    data
+});
+export const floderAction = (id) => ({ //文件夹展开
+    type: FLODER_ACTION,
+    id
+});
+export const floderSlide = (id) => ({ //文件夹展开
+    type: FLODER_SLIDE,
+    id
+});
+export const whichTemp = (tab) => ({ //模板tab切换
+    type: WHICH_TEMP,
+    tab
+});
 export const delItems = (id) => ({ //删除模板
     type: DEL_ITEMS,
     id
 });
-export const delItemsAdmin = (id) => ({ //删除模板
+export const delItemsAdmin = (id,folderId) => ({ //删除模板
     type: DEL_ITEMS_ADMIN,
-    id
+    id,
+    folderId
 });
 export const tabChange = (idx) => ({ //tab切换
     type: TAB_CHANGE,
@@ -44,9 +83,10 @@ export const checkItems = (id) => ({ //选中的模板
     type: CKECK_ITEMS,
     id
 });
-export const checkItemsAdmin = (id) => ({ //选中的模板
+export const checkItemsAdmin = (id,folderId) => ({ //选中的模板
     type: CKECK_ITEMS_ADMIN,
-    id
+    id,
+    folderId
 });
 export const batchDelItems = (ids) => ({ //删除选中的模板
     type: BATCH_DEL_ITEMS,

+ 196 - 40
src/store/async-actions/tabTemplate.js

@@ -11,6 +11,9 @@ import {
   delItemsAdmin,
   batchDelItemsAdmin,
   changeTitleAdmin,
+  floderListAdmin,
+  folderModal,
+  setSearchTemplateNorms,
 } from '@store/actions/tabTemplate';
 import {DIAG_SHOW} from "@store/types/print";
 import Notify from '@commonComp/Notify';
@@ -24,12 +27,13 @@ import {
 } from '@utils/tools';
 import { billing, getMRAnalyse } from '@store/async-actions/pushMessage';
 
-export const initItemList = (current,name) => {
+
+export const initItemList = (current,name,selectTemp) => {
   let admin = store.getState().homePage.admin;
-  if(admin){
-    return initAdminItemList(current,name)
+  if(admin || selectTemp==2){
+    return initAdminItemList(current,name,selectTemp)
   }else{
-    return initCommonItemList(current,name)
+    return initCommonItemList(current,name,selectTemp)
   }
 }
 
@@ -38,7 +42,7 @@ export const initCommonItemList = (current,name) => { //初始化数据
   let state = baseList.patInfo.message;
   // let searchVal = document.getElementById("searchTmp").value
   return (dispatch) => {
-    axios.json('/templateInfo/getTemplatePageAlls', {
+    axios.json('/templateInfo/getTemplateAlls', {
       "doctorId": state.doctorId,
       "hospitalDeptId": (name == '')?state.hospitalDeptId:null,
       "hospitalId": state.hospitalId,
@@ -58,33 +62,20 @@ export const initCommonItemList = (current,name) => { //初始化数据
     })
   }
 };
-export const initAdminItemList = (current,name) => { //初始化数据
+export const initAdminItemList = (current,name,selectTemp) => { //初始化数据
   let baseList = store.getState();
   // let searchVal = document.getElementById("searchTmp").value
   let state = baseList.patInfo.message;
   return (dispatch) => {
-    axios.json('/templateAdmin/getTemplatePageAlls', {
-      "doctorId": state.doctorId,
-      "hospitalDeptId": '',
-      "hospitalId": state.hospitalId,
-      "hospitalCode": state.hospitalCode,
-      "current": current,
-      "sex":[1,2,3],
-      "size": 9999,
-      "name":name||''
-    }).then((res) => {
-      const data = res.data;
-      if (data.code == 0) {
-        // data.data.flg = flg||false  //获取下一页,暂时不用
-        dispatch(initAdminItems(data.data));
-      } else {
-        Notify.error(data.msg)
-      }
-    })
+    if(selectTemp == 2) {
+      dispatch(findTemplateNorms(name))
+    }else {
+      dispatch(getFloderListAll())
+    }
   }
 };
 
-export const saveTemplateDetail = (val,sex) => { //保存为模板
+export const saveTemplateDetail = (val,sex,spell) => { //保存为模板
   let baseList = store.getState();
   let jsonData = getAllDataList(baseList);
   let jsonStr = getAllDataStringList(baseList);
@@ -102,7 +93,7 @@ export const saveTemplateDetail = (val,sex) => { //保存为模板
     "lis": jsonStr.lis,
     "pacs": jsonStr.pacs,
     "diag": jsonStr.diag,
-    "advice": jsonStr.advice,
+    "advice": jsonStr.advice
   }
   function getdata(idx){
     let tmpObj = {
@@ -113,7 +104,8 @@ export const saveTemplateDetail = (val,sex) => { //保存为模板
       "modeName": val,
       "modeType": whichSign,
       "preview": idx ? JSON.stringify(preview):preview,
-      "sex":sex
+      "sex":sex,
+      "spell":spell
     }
     return tmpObj;
   }
@@ -145,7 +137,7 @@ export const saveTemplateDetail = (val,sex) => { //保存为模板
     })
   }
 };
-export const saveAdminTemplateDetail = (val,sex,id) => { //保存为模板
+export const saveAdminTemplateDetail = (val,sex,id,fstName,folderId,folderName) => { //保存为模板
   let baseList = store.getState();
   let jsonData = getAllDataList(baseList);
   let jsonStr = getAllDataStringList(baseList);
@@ -174,12 +166,14 @@ export const saveAdminTemplateDetail = (val,sex,id) => { //保存为模板
       "modeName": val,
       "modeType": whichSign,
       "preview": idx ? JSON.stringify(preview):preview,
-      "sex":sex
+      "sex":sex,
+      "modeSpell":fstName,
+      "folderId": folderId,
     }
     return tmpObj;
   }
   return (dispatch) => {
-    axios.json('/templateAdmin/saveTemplateAdmin', getdata()).then((res) => {
+    axios.json('/templateAdmin/saveTemplateNorms', getdata()).then((res) => {
       const data = res.data;
       if (data.code == 0) {
         Notify.success('模板保存成功');
@@ -207,6 +201,106 @@ export const saveAdminTemplateDetail = (val,sex,id) => { //保存为模板
   }
 };
 
+export const getFloderList = () => { //管理员文件夹列表获取
+  let baseList = store.getState().patInfo.message;
+  return (dispatch) => {
+    axios.json('/templateFolderAdmin/list', {
+      "doctorId": baseList.doctorId,
+      "hospitalId": baseList.hospitalId,
+    }).then((res) => {
+      let data = res.data;
+      if (data.code == 0) {
+        dispatch(floderListAdmin(data.data))
+      } else {
+        Notify.error(data.msg);
+      }
+    })
+  }
+};
+function getFloderLis(dispatch){
+  let baseList = store.getState().patInfo.message;
+  return (dispatch) => {
+    axios.json('/templateFolderAdmin/list', {
+      "doctorId": baseList.doctorId,
+      "hospitalId": baseList.hospitalId,
+    }).then((res) => {
+      let data = res.data;
+      if (data.code == 0) {
+        dispatch(floderListAdmin(data.data))
+      } else {
+        Notify.error(data.msg);
+      }
+    })
+  }
+}
+export const newFloder = (name,id,type) => { //新建管理员文件夹
+  let baseList = store.getState().patInfo.message;
+  return (dispatch) => {
+    axios.json('/templateFolderAdmin/saveOrUpdate', {
+      "doctorId": baseList.doctorId,
+      "hospitalId": baseList.hospitalId,
+      "id": id||'',
+      "name": name,
+      "templateType": 2  //模板类型(个人1,管理员2)
+    }).then((res) => {
+      let data = res.data;
+      if (data.code == 0) {
+        if(type=='modify') {
+          Notify.success('修改成功');
+        } else {
+          Notify.success('新建成功');
+        }
+        dispatch(folderModal(false))
+        dispatch(getFloderList())
+        dispatch(getFloderListAll())
+        dispatch(changeVisible(false))
+      } else {
+        Notify.error(data.msg);
+      }
+    })
+  }
+};
+export const delFloder = (id) => { //文件夹删除
+  let baseList = store.getState().patInfo.message;
+  return (dispatch) => {
+    axios.json('/templateFolderAdmin/delete', {
+      "doctorId": baseList.doctorId,
+      "hospitalId": baseList.hospitalId,
+      "folderId": id,
+    }).then((res) => {
+      let data = res.data;
+      if (data.code == 0) {
+        Notify.success('文件夹删除成功');
+        dispatch(getFloderListAll())
+        // axios.json('/templateAdmin/getTemplateNorms').then((res) => {
+        //   const data = res.data;
+        //   if (data.code == 0) {
+        //     // data.data.flg = flg||false  //获取下一页,暂时不用
+        //     dispatch(initAdminItems(data.data));
+        //   } else {
+        //     Notify.error(data.msg)
+        //   }
+        // })
+      } else {
+        Notify.error(data.msg);
+      }
+    })
+  }
+};
+export const orderFloder = (folderList) => { //文件夹排序
+  let baseList = store.getState().patInfo.message;
+  return (dispatch) => {
+    axios.json('/templateFolderAdmin/sort', {templateFolderSortVOList:folderList}).then((res) => {
+      let data = res.data;
+      if (data.code == 0) {
+        Notify.success('保存成功');
+        dispatch(getFloderListAll())
+      } else {
+        Notify.error(data.msg);
+      }
+    })
+  }
+};
 export const delItem = (id) => { //删除
   return (dispatch) => {
     axios.json('/templateInfo/cancelTemplateInfos', {
@@ -222,17 +316,18 @@ export const delItem = (id) => { //删除
     })
   }
 };
-export const delItemAdmin = (id) => { //删除
+export const delItemAdmin = (id,folderId) => { //删除
   let baseList = store.getState().patInfo.message;
   return (dispatch) => {
-    axios.json('/templateAdmin/cancelTemplateAdminb', {
+    axios.json('/templateAdmin/cancelTemplateNorms', {
       "ids": id, 
       "doctorId": baseList.doctorId,
       "hospitalId": baseList.hospitalId,
     }).then((res) => {
       let data = res.data;
       if (data.code == 0) {
-        dispatch(delItemsAdmin(id));
+        // dispatch(delItemsAdmin(id,folderId));
+        dispatch(initAdminItemList())
         Notify.success('模板删除成功');
       } else {
         Notify.error(data.msg);
@@ -257,14 +352,15 @@ export const delBatchItem = (ids) => { //批量删除
 export const delBatchItemAdmin = (ids) => { //批量删除
   let baseList = store.getState().patInfo.message;
   return (dispatch) => {
-    axios.json('/templateAdmin/cancelTemplateAdminb', {
-      "ids": ids.join(","), 
+    axios.json('/templateAdmin/cancelTemplateNorms', {
+      "ids": ids.join(","),
       "doctorId": baseList.doctorId,
       "hospitalId": baseList.hospitalId,
     }).then((res) => {
       let data = res.data;
       if (data.code == 0) {
-        dispatch(batchDelItemsAdmin(ids));
+        // dispatch(batchDelItemsAdmin(ids));
+        dispatch(initAdminItemList())
       } else {
         Notify.error(data.msg);
       }
@@ -277,19 +373,23 @@ export const changeTitleAsyncAdmin = (obj) => { //改标题
   let whichSign = baseList.typeConfig.mode;
   let state = baseList.patInfo.message;
   return (dispatch) => {
-    axios.json('/templateAdmin/updateByAdminNames', {
+    axios.json('/templateAdmin/updateTemplateNorms', {
       "doctorId": state.doctorId,
       "hospitalDeptId": obj.deptId,
       "hospitalId": state.hospitalId,
       "id": obj.id,
+      "sex": obj.sex,
       "modeName": obj.title,
-      "type": whichSign
+      "type": whichSign,
+      "folderId": obj.folderId,
+      "spell": obj.spell
     }).then((res) => {
       let data = res.data;
       if (data.code == 0) {
         dispatch(changeTitleAdmin(obj));
         Notify.success('标题修改成功');
         store.dispatch(changeVisible(false))
+        dispatch(getFloderListAll())
       } else {
         // console.log(data)
         Notify.error(data.msg)
@@ -308,13 +408,15 @@ export const changeTitleAsync = (obj) => { //改标题
       "hospitalId": state.hospitalId,
       "id": obj.id,
       "modeName": obj.title,
-      "type": whichSign
+      "type": whichSign,
+      "spell": obj.spell
     }).then((res) => {
       let data = res.data;
       if (data.code == 0) {
         dispatch(changeTitle(obj));
         Notify.success('标题修改成功');
         store.dispatch(changeVisible(false))
+        store.dispatch(initCommonItemList(1,""))
       } else {
         // console.log(data)
         Notify.error(data.msg)
@@ -376,4 +478,58 @@ export const getDepartments = (value) => { //获取模板结构化数据
       }
     })
   }
-};
+};
+export const findTemplateNorms = (name) => {//标准模板搜索
+    return (dispatch) => {
+      if(!name) {
+        dispatch(setSearchTemplateNorms([]));
+      } else {
+        axios.json('/templateInfo/findTemplateNorms',{
+          name,
+          templateType: 2
+        }).then((res) => {
+          const data = res.data;
+          if (data.code == 0) {
+            dispatch(setSearchTemplateNorms(data.data));
+          } else {
+            Notify.error(data.msg)
+          }
+        })
+      }
+      
+    }
+  
+}
+
+export const getFloderListAll = () => {
+    return (dispatch) => {
+      axios.json('/templateAdmin/getTemplateNorms').then((res) => {
+        const data = res.data;
+        if (data.code == 0) {
+          // data.data.flg = flg||false  //获取下一页,暂时不用
+          dispatch(initAdminItems(data.data));
+        } else {
+          Notify.error(data.msg)
+        }
+      })
+    }
+}
+
+export const addTemplateQuote = (templateId) => {
+  let baseList = store.getState();
+  let state = baseList.patInfo.message;
+  return (dispatch) => {
+    axios.json('/templateQuote/addTemplateQuote',{
+        "doctorId": state.doctorId,
+        "remark": "",
+        "templateId": templateId
+    }).then((res) => {
+      const data = res.data;
+      if (data.code == 0) {
+        // data.data.flg = flg||false  //获取下一页,暂时不用
+      } else {
+        // Notify.error(data.msg)
+      }
+    })
+  }
+}

+ 111 - 20
src/store/reducers/tabTemplate.js

@@ -18,6 +18,14 @@ import {
   DEL_ITEMS_ADMIN,
   BATCH_DEL_ITEMS_ADMIN,
   CHANGE_TITLE_ADMIN,
+  WHICH_TEMP,
+  FLODER_SLIDE,
+  FLODER_ACTION,
+  FOLDER_LIST_ADMIN,
+  FOLDER_MODAL,
+  FOLDER_ORDER_SHOW,
+  NORMS_TEMPLATE_SEARCH,
+  CLEAR_NORMS_TEMPLATE_SEARCH
 } from '../types/tabTemplate';
 
 
@@ -38,12 +46,83 @@ const initDataList = {
   activeItem: {}, //引用的模板
   activeItemHis: {}, //引用的历史病例
   allCheckShow: false, //全选反选是否显示
-  allCheckShowAdmin: false, //全选反选是否显示管理员
+  allCheckShowAdmin: false, //全选反选是否显示管理员管理
   current:1,//当前页
   hasMore:true,//是否显示更多
   departLis:[],//搜索的科室列表
+  selectTemp:1,//默认1个人模板2标准模板
+  floderListAdmin:[],//文件夹列表
+  folderModalShow:false,//新建文件夹弹窗
+  folderListContentArr :[],//管理员文件夹内模板合并
+  folderOrderShow: false, //文件夹管理弹窗
+  templateNormsSearchList:[] //标准模板搜索
 }
 export default (state = initDataList, action) => {
+  if(action.type === CLEAR_NORMS_TEMPLATE_SEARCH) {
+    const newState = Object.assign({}, state);
+    newState.templateNormsSearchList = [];
+    return newState;
+  }
+  if(action.type === NORMS_TEMPLATE_SEARCH) {
+    const newState = Object.assign({}, state);
+    newState.templateNormsSearchList = JSON.parse(JSON.stringify(action.templateNormsSearchList));
+    return newState;
+  }
+
+  if (action.type === FOLDER_ORDER_SHOW) {//文件夹管理员列表
+    const newState = Object.assign({}, state);
+    newState.folderOrderShow = action.show;
+    return newState;
+  }
+  if (action.type === FOLDER_MODAL) {//文件夹管理员列表
+    const newState = Object.assign({}, state);
+    newState.folderModalShow = action.show;
+    return newState;
+  }
+  if (action.type === FOLDER_LIST_ADMIN) {//文件夹管理员列表
+    const newState = Object.assign({}, state);
+    newState.floderListAdmin = action.data;
+    return newState;
+  }
+  if (action.type === FLODER_ACTION) {//文件夹操作
+    const newState = Object.assign({}, state);
+    let adminItemsTmp = newState.adminItems;
+    for(let i = 0;i<adminItemsTmp.length;i++){
+      if(adminItemsTmp[i].id == action.id){
+        if(adminItemsTmp[i].action == 1){
+          adminItemsTmp[i].action = 2
+        }else{
+          adminItemsTmp[i].action = 1
+        }
+      }else{
+        adminItemsTmp[i].action = 2
+      }
+    }
+    newState.adminItems = [...adminItemsTmp];
+    return newState;
+  }
+  if (action.type === FLODER_SLIDE) {//文件夹展开
+    const newState = Object.assign({}, state);
+    let adminItemsTmp = newState.adminItems;
+    for(let i = 0;i<adminItemsTmp.length;i++){
+      if(adminItemsTmp[i].id == action.id){
+        if(adminItemsTmp[i].slide == 1){
+          adminItemsTmp[i].slide = 2
+        }else{
+          adminItemsTmp[i].slide = 1
+        }
+      }else{
+        adminItemsTmp[i].slide = 2
+      }
+    }
+    newState.adminItems = [...adminItemsTmp];
+    return newState;
+  }
+  if (action.type === WHICH_TEMP) {//模板tab切换
+    const newState = Object.assign({}, state);
+    newState.selectTemp = action.tab;
+    return newState;
+  }
   if (action.type === GET_DPT_LIS) {
     const newState = Object.assign({}, state);
     newState.departLis = action.list;
@@ -59,10 +138,18 @@ export default (state = initDataList, action) => {
     }
     return newState;
   }
-  if (action.type === DEL_ITEMS_ADMIN) {
+  if (action.type === DEL_ITEMS_ADMIN) {//删除管理员模板
     const newState = Object.assign({}, state);
-    let tempArr = newState.adminItems;
-    tempArr.splice(tempArr.findIndex(item => item.id == action.id), 1)
+    let tempArr = newState.adminItems,tmpTmpLis = [];
+    console.log(action)
+    for(let i = 0;i < tempArr.length;i++){
+      let tmpAction = tempArr[i]
+      if(tmpAction.id == action.folderId){
+        tmpTmpLis = tmpAction.templateInfo
+        tmpTmpLis.splice(tmpTmpLis.findIndex(item => item.id == action.id), 1)
+        tempArr[i].templateInfo = tmpTmpLis
+      }
+    }
     newState.adminItems = [...tempArr];
     if(tempArr.length == 0){
       newState.allCheckShowAdmin = false
@@ -83,15 +170,15 @@ export default (state = initDataList, action) => {
     newState.checkItems = [];
     return newState;
   }
-  if (action.type === BATCH_DEL_ITEMS_ADMIN) {
+  if (action.type === BATCH_DEL_ITEMS_ADMIN) {//批量删除管理员模板
     const newState = Object.assign({}, state);
-    let tempArr = newState.adminItems;
+    let tempArr = newState.folderListContentArr;
     for (let i = 0; i < action.ids.length; i++) {
       let currentId = action.ids[i];
       tempArr.splice(tempArr.findIndex(item => item.id == currentId), 1)
     }
-    newState.adminItems = [...tempArr];
-    if(tempArr.length == 0){
+    newState.folderListContentArr = [...tempArr];
+    if(folderListContentArr.length == 0){
       newState.allCheckShowAdmin = false
     }
     newState.checkItemsAdmin = [];
@@ -108,23 +195,27 @@ export default (state = initDataList, action) => {
     //   newState.items = tmpItems.concat(action.state.records);
     // }
     newState.items = action.state.personalTemplate.records
-    newState.adminItems = action.state.adminTemplate.records
+    // newState.adminItems = action.state.adminTemplate.records
     newState.current = action.state.current;
     newState.hasMore = action.state.current<action.state.pages;
     return newState;
   }
-  if (action.type === INIT_ADMIN_ITEMS) {
+  if (action.type === INIT_ADMIN_ITEMS) {//标准模板数据
     const newState = Object.assign({}, state);
-    // let tmpItems = JSON.parse(JSON.stringify(newState.items))
-    // let tmpCurrent = JSON.parse(JSON.stringify(newState.current))
-    // console.log(action.state.flg,action.state.pages,tmpCurrent,45544)
-    // if(action.state.current == 1&&!action.state.flg){//进入页面会调取分页相关先去掉
-    //   newState.items = action.state.records
-    // }else{
-    //   newState.items = tmpItems.concat(action.state.records);
-    // }
-    newState.adminItems = action.state.records
+    if(action.state[0]&&action.state[0].templateInfo&&action.state[0].templateInfo.length>0){
+      action.state[0].slide=1
+    }
+    newState.adminItems = action.state
+    let tmpLis = [];
+    for(let k = 0;k < action.state.length;k++){
+      let tmpData = action.state[k].templateInfo||[]
+      tmpLis = tmpLis.concat(tmpData)
+    }
+    newState.folderListContentArr = [...tmpLis]
     newState.current = action.state.current;
+    if(tmpLis.length == 0){
+      newState.allCheckShowAdmin = false
+    }
     newState.hasMore = action.state.current<action.state.pages;
     return newState;
   }
@@ -214,7 +305,7 @@ export default (state = initDataList, action) => {
     const newState = Object.assign({}, state);
     let tempArr = [];
     if (action.bool) {
-      newState.adminItems.forEach((val) => {
+      newState.folderListContentArr.forEach((val) => {
         tempArr.push(val.id)
       })
     } else {

+ 8 - 0
src/store/types/tabTemplate.js

@@ -17,3 +17,11 @@ export const CKECK_ITEMS_ADMIN = 'CKECK_ITEMS_ADMIN';
 export const DEL_ITEMS_ADMIN = 'DEL_ITEMS_ADMIN';
 export const BATCH_DEL_ITEMS_ADMIN = 'BATCH_DEL_ITEMS_ADMIN';
 export const CHANGE_TITLE_ADMIN = 'CHANGE_TITLE_ADMIN';
+export const WHICH_TEMP = 'WHICH_TEMP';
+export const FLODER_SLIDE = 'FLODER_SLIDE';
+export const FLODER_ACTION = 'FLODER_ACTION';
+export const FOLDER_LIST_ADMIN = 'FOLDER_LIST_ADMIN';
+export const FOLDER_MODAL = 'FOLDER_MODAL';
+export const FOLDER_ORDER_SHOW = 'FOLDER_ORDER_SHOW';
+export const NORMS_TEMPLATE_SEARCH = 'NORMS_TEMPLATE_SEARCH';
+export const CLEAR_NORMS_TEMPLATE_SEARCH = 'CLEAR_NORMS_TEMPLATE_SEARCH';

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 125 - 0
src/utils/Convert_Pinyin.js