Explorar el Código

文件夹模板

luolei hace 5 años
padre
commit
795bd56acd

+ 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
src/common/images/slideDown.png


BIN
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='30'
+                            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;
+        }
+    }
+}

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

@@ -76,10 +76,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}`}

+ 83 - 48
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,11 @@ 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 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,7 +24,7 @@ class Operation extends Component {
     super(props)
     this.state = {
       title: '',
-      fstName:'',
+      fstName:'',//首拼
       okText: '',
       borderColor: '',
       okColor: '',
@@ -34,7 +37,10 @@ class Operation extends Component {
       deptId:'',//科室id
       value:'',//科室name
       folder:'',//文件夹
-      folderModal:true,//新增文件夹弹窗
+      folderName:'',
+      folderNameVal:'',//选中文件夹名称
+      folderId:'',//选中文件夹名称
+      folderListShow:false, //文件夹列表展示
     }
     this.showPrint = this.showPrint.bind(this);
     this.closePrint = this.closePrint.bind(this);
@@ -48,6 +54,7 @@ class Operation extends Component {
     this.setFolderId = this.setFolderId.bind(this);
     this.handleChangeIpt = this.handleChangeIpt.bind(this);
     this.newFolder = this.newFolder.bind(this);
+    this.saveNewFolder = this.saveNewFolder.bind(this);
   }
 
   showPrint() {
@@ -140,11 +147,11 @@ class Operation extends Component {
       this.makeSure()
     }
   }
-  newFolder(){
-    
+  newFolder(flg){
+    this.props.folderModal(flg)
   }
   saveHis(type) {
-    const { diagShowTmp } = this.props;
+    const { diagShowTmp,getFloderList,admin } = this.props;
     let baseList = store.getState();
     let jsonStr = getAllDataStringList(baseList);
     let tmpLis = [];
@@ -182,8 +189,16 @@ class Operation extends Component {
       oKBg: '#3B9ED0',
       msg: this.changeTitle()
     })
+    admin&&getFloderList()//获取文件夹列表
     diagShowTmp(true)
   }
+  spellFst(){
+    console.log(this.state.title)
+    let tmpFst = pinyin.getCamelChars(this.state.title);
+    console.log(tmpFst)
+    console.log(tmpFst.substr(0,1).toUpperCase())
+    this.setState({fstName:tmpFst})
+  }
   changeTitle() {
     return <div className={style['box']}>
       <div className={style['iptWrap']}>
@@ -205,9 +220,11 @@ class Operation extends Component {
         <div className={`${style.name} ${style.firstname}`}>
           <span className={style.leftName}>模板名首拼:</span>
           <input className={style['ipt']}
-            placeholder="请输入模板名称首字母"
+            placeholder=""
             type="text"
             maxLength='30'
+            value={this.state.fstName}
+            onFocus={()=>this.spellFst()}
             onInput={(e) => {
               this.handleInputFst(e)
             }}
@@ -257,7 +274,7 @@ class Operation extends Component {
   }
   makeSure() {
     const { save, clear, saveDataAll,saveDataAlls,diagShowTmp ,chronicMagItem,chronicDesease,admin} = this.props;
-    const { type,deptId,sex,title,fstName } = this.state;
+    const { type,deptId,sex,title,fstName,folderId,folderNameVal } = this.state;
     if (type == 1) {
       diagShowTmp(false)
       this.setState({ title: '' })
@@ -277,13 +294,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;
@@ -302,7 +327,11 @@ class Operation extends Component {
             return false;
           }
         }
-        saveDataAlls(title,sex,deptId);
+        this.setState({
+          folderNameVal:'',
+          folderId:''
+        })
+        saveDataAlls(title,sex,deptId,fstName,folderId,folderNameVal);
       }else{
         saveDataAll(title,sex,fstName);
       }
@@ -313,7 +342,7 @@ class Operation extends Component {
     const { type } = this.state;
     if (type == 3){
       diagShowTmp(false)
-      this.setState({ title: '',deptId:"",value:"" })
+      this.setState({ title: '',deptId:"",value:"",folderListShow:false })
     }
   }
   setDeptId(id,name){
@@ -326,8 +355,9 @@ class Operation extends Component {
   setFolderId(id,name){//文件夹
     this.props.handleClearValue()
     this.setState({
-      deptId :id,
-      value:name
+      folderId :id,
+      folderNameVal:name,
+      folderListShow:false
     })
   }
   componentWillReceiveProps(next){//监听滚动事件
@@ -342,16 +372,26 @@ class Operation extends Component {
       })
     }
   }
-  handleChangeIpt(val){
+  handleChangeIpt(val){//搜索科室
     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,newFolder,folderModal } = this;
+    const { showPrint, closePrint, showPreview, closePreview,handleChangeIpt,newFolder } = this;
     const { visible, preVisible,diagShow } = this.props.print;
-    const {winWidth,cancelDelTag,departLis,handleChangeValue,admin} = this.props;
-    const {zIndex,type,le,value,folder} = this.state;
+    const {winWidth,cancelDelTag,departLis,handleChangeValue,admin,floderListAdmin,folderModalShow,floderModal} = 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>
@@ -361,19 +401,18 @@ 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
         visible={diagShow}        //改为全局控制
         confirm={() => { this.makeSure() }}
         close={() => { this.closeDiagBox()}}
         cancel={() => {this.closeDiagBox()}}
         okText={this.state.okText}
-        height={type==3?275: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}
+        borderBtm={type==3?'1px solid #ccc':null}
         title={type==3?'保存病历模板':type==4?"新建文件夹":null}
       >
         {this.state.msg}
@@ -381,7 +420,7 @@ class Operation extends Component {
           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}>
+                <Search handleChangeValue={handleChangeValue} handleChangeIpt={handleChangeIpt} value={value} visible={true} zIndex={11}>
                 {
                   departLis.length>0&&value&&<ul className={style.departLis}>
                     {
@@ -398,45 +437,41 @@ class Operation extends Component {
           </div>
             <div className={style.department}>
               <span className={style.leftName}>存储为:</span>
-                <Search handleChangeValue={handleChangeValue} handleChangeIpt={handleChangeIpt} value={folder} visible={true}>
+                <div  className={style.selectFolder}>
+                  <input className={style.selectFolderIpt}
+                    type="text"
+                    maxLength='30'
+                    readOnly
+                    value={this.state.folderNameVal}
+                    onClick={(e) => {
+                      this.handleFolderShow(e)
+                    }}
+                  />
+                  <img src={slideDown} alt=""/>
+                </div>
                 {
-                  departLis.length>0&&value&&<ul className={style.departLis}>
+                  floderListAdmin.length>0&&folderListShow&&<ul className={`${style.departLis} ${style.departLisFolder}`}>
                     {
-                      departLis.map((item,idx)=>{
-                        return <li onClick={()=>this.setFolderId(item.id,item.conceptDeptName)}>
-                          {item.conceptDeptName}
+                      floderListAdmin.map((item,idx)=>{
+                        return <li onClick={()=>this.setFolderId(item.id,item.name)}>
+                          {item.name}
                         </li>
                       })
                     }
                   </ul>
                 }
-                </Search>
-              <span className={style.newFolder} onClick={newFolder}>新建文件夹</span>
+              <span className={style.newFolder} onClick={()=>newFolder(true)}>新建文件夹</span>
               <span className={style.mangerFolder}>管理文件夹</span>
           </div>
           </div>:null
         }
       </ConfirmModal>
-      {
-        folderModal?<div className={style.newFolderWrap}>
-          <div className={style.folderModal}></div>
-          <div className={style.name}>
-            <span className={style.leftName}>模板名称:</span>
-            <input className={style['ipt']}
-              placeholder="请输入文件夹名称"
-              type="text"
-              maxLength='30'
-              onInput={(e) => {
-                this.handleInput(e)
-              }}
-              onPropertyChange={(e) => {  // 兼容ie
-                this.handleInput(e)
-              }}
-              onKeyPress={e => this.keypress(e)}
-            />
-          </div>
-        </div>:null
-      }
+      <FolderName 
+        folderModalShow={folderModalShow}
+        floderModal={floderModal}
+        newFolder={newFolder}
+        saveNewFolder={this.saveNewFolder}
+        title='新建文件夹'></FolderName>
     </div>;
   }
 }

+ 114 - 3
src/components/Operation/index.less

@@ -126,6 +126,7 @@
       input {
           border: 1px solid #CCCCCC;
           padding: 5px 10px;
+          display: inline-block;
           width: 240px;
       }
   }
@@ -167,6 +168,23 @@
     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;
+        }
+    }
 }
 .male {
     padding-top: 15px;
@@ -195,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;
@@ -211,6 +230,9 @@
         border: 1px solid #3B9ED0;
     }
 }
+.departLisFolder {
+    left: 116px;
+}
 .leftName {
     width: 100px;
     text-align: right;
@@ -221,6 +243,95 @@
     position: relative;
     top: -6px;
 }
+.newFolder {
+    margin-right: 15px;
+    color: #3B9ED0;
+}
+.mangerFolder {
+    color: #3B9ED0;
+}
 .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;
+  }

+ 170 - 53
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,whichTemp,floderSlide,floderAction } from '@store/actions/tabTemplate';
-import { initItemList,initAdminItemList, 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 } from '@store/actions/tabTemplate';
+import { initItemList,initAdminItemList, delItem,delItemAdmin, delBatchItem, delBatchItemAdmin,changeTitleAsync, setPageView,changeTitleAsyncAdmin,setPageViewAdmin,getFloderList } from '@store/async-actions/tabTemplate';
 import { connect } from "react-redux";
 import store from '@store';
 import { billing } from '@store/async-actions/pushMessage';
@@ -12,6 +12,8 @@ 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 slideDown from '@common/images/slideDown.png';
 import CaseQuailty from "../CaseQuailty";
 
 class PushContainer extends Component {
@@ -44,7 +46,14 @@ class PushContainer extends Component {
       okColor: 'red',
       num: 0,          //计数
       deptId:'',       //科室id
+      
       floderName:'',   //文件夹名称
+      folderListShow:false,
+      folderNameVal:'',
+      folderId:'',
+      spell:'',
+      fstName:'',
+      tmpFolder:''
     }
     this.$cont = React.createRef();
     this.itemList = null;
@@ -63,6 +72,8 @@ class PushContainer extends Component {
     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);
   }
   componentDidMount() {
     // const height = getWindowInnerHeight()-160;
@@ -112,10 +123,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',
@@ -147,46 +159,87 @@ class PushContainer extends Component {
     let val = (e.target.value).substring(0, 30)
     this.onchange(val)
   }
-  handleInputFst(e){
+  handleInputFloder(e){
     let val = (e.target.value).substring(0,30)
     this.setState({
       floderName: val
+    },()=>{
+      this.setState({
+        message:this.changeFloderTitle()
+      })
     })
   }
-  changeTitle() {
+  handleInputFst(e){
+    let val = (e.target.value).substring(0,30)
+    console.log(val)
+    this.setState({
+      fstName: val
+    }, () => {
+      this.setState({
+        message: this.changeTitle(),
+      })
+    })
+  }
+  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']}
+              placeholder="请输入模板名称"
+              type="text"
+              maxLength='30'
+              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']}
+              placeholder=""
+              type="text"
+              maxLength='30'
+              value={this.state.fstName}
+              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) {
     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,
+      spell:spell,
+      folderNameVal:folderName,
+      tmpFolder:folderName,
     }, () => {
       this.setState({
         message: this.changeTitle(),
@@ -196,9 +249,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))
@@ -240,37 +293,43 @@ class PushContainer extends Component {
     let tmpPage = ++page
     store.dispatch(initItemList(tmpPage,true))
   }
-  floderRename(){//文件夹重命名
+  floderRename(name,id){//文件夹重命名
     this.setState({
       type: 5,
-      message:'文件夹重命名', 
-      title: '文件夹重命名',
-      text: 'text',
+      title: '重命名文件夹',
       okText: '保存',
+      floderName:name,
+      folderId:id,
       okBorderColor: '#3B9ED0',
       okColor: '#fff',
-      oKBg: '#3B9ED0'
+      oKBg: '#3B9ED0',
+    },()=>{
+      this.setState({
+        message:this.changeFloderTitle()
+      })
     })
     store.dispatch(changeVisible(true))
   }
-  changeTitle() {
+  changeFloderTitle() {
     return <div className={style['box']}>
       <div className={style['iptWrap']}>
         <div className={style.name}>
-          <span className={style.leftName}>文件夹名称:</span>
-          <input className={style['ipt']}
+          <span className={style.leftName}>名称:</span>
+          <input
             placeholder="请输入文件夹名称"
             type="text"
             maxLength='30'
+            value={this.state.floderName}
             onInput={(e) => {
-              this.handleInput(e)
+              this.handleInputFloder(e)
             }}
             onPropertyChange={(e) => {  // 兼容ie
-              this.handleInput(e)
+              this.handleInputFloder(e)
             }}
             onKeyPress={e => this.keypress(e)}
           />
         </div>
+      </div>
     </div>
   }
   floderDelete(){//文件夹删除
@@ -278,45 +337,49 @@ class PushContainer extends Component {
   }
 
   makeSure() {
-    if (this.state.type == 1) {
+    const {type,id,title,tmpFolder,folderNameVal,text,fstName,spell,currId,deptId,folderId} = 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) {
+    } else if (type == 3) {
+      if (title == text &&tmpFolder==folderNameVal&&fstName==spell) {
         store.dispatch(changeVisible(false))
         Notify.success('标题修改成功');
         return;
       }
-      if ((this.state.title).trim() == '') {
+      if (title.trim() == '') {
         Notify.info('请输入模板名称');
         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
       }
       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))
       }
       store.dispatch(changeVisible(false))
     }
@@ -334,8 +397,25 @@ class PushContainer extends Component {
   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))
+  }
   render() {
-    const { activeId, checkItems,selectTemp, 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 } = this.props;
+    const { type,okBorderColor,okColor,oKBg,okText,message,folderListShow } = this.state
     return <div className={style["container"]} ref={this.$cont} >
       <Tab tabs={this.state.tabs}
         activeId={activeId}
@@ -371,6 +451,7 @@ class PushContainer extends Component {
             floderAction={this.floderActionDo}
             floderDelete={this.floderDelete}
             floderRename={this.floderRename}
+            folderListContentArr={folderListContentArr}
           ></TemplateItems>
           <MedicalInfoContainer></MedicalInfoContainer>
         </TemplateContainer>
@@ -379,14 +460,47 @@ class PushContainer extends Component {
         visible={visible}
         confirm={this.makeSure}
         close={this.handleClose}
-        title={this.state.title}
+        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||type==3?500: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 className={style.department}>
+            <span className={style.leftName}>存储为:</span>
+              <div  className={style.selectFolder}>
+                <input className={style.selectFolderIpt}
+                  type="text"
+                  maxLength='30'
+                  readOnly
+                  value={this.state.folderNameVal}
+                  onClick={(e) => {
+                    this.handleFolderShow(e)
+                  }}
+                />
+                <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={()=>this.newFolder(true)}>新建文件夹</span>
+              {/* <span className={style.mangerFolder}>管理文件夹</span> */}
+          </div>:null
+        }
       </ConfirmModal>
       <CopyRightContainer />
     </div>
@@ -413,6 +527,9 @@ const mapStateToProps = (state) => {//console.log(state)
     clearSearch:state.print.clearSearch,
     
     selectTemp:state.tabTemplate.selectTemp,
+    floderListAdmin:state.tabTemplate.floderListAdmin,
+    folderListContentArr:state.tabTemplate.folderListContentArr,
+    
   }
 }
 

+ 146 - 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,147 @@
     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;
+}
+
+.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;
 }

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

@@ -39,7 +39,7 @@ class TemplateItem extends React.Component {
     this.props.handleContentClick(this.props.id, sex);
   }
 
-  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) {
     e.stopPropagation();
     let currId = this.props.id
-    this.props.handleTitleChange(currId, name,deptId);
+    this.props.handleTitleChange(currId, name,deptId,folderId,spell,folderName);
   }
 
   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,7 +211,7 @@ 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 } = this.props;
     let previewJson = JSON.parse(preview);
     let sexStr = sex == 2 ? ' (女'+(conceptDeptName&&'-'+conceptDeptName)+')' : sex == 1 ? ' (男'+(conceptDeptName&&'-'+conceptDeptName)+')' : ' (通用'+(conceptDeptName&&'-'+conceptDeptName)+')';
     return (
@@ -235,7 +235,7 @@ 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>
           {!admin&&adminflg?null:<img title={'修改模板标题'}
@@ -243,7 +243,7 @@ class TemplateItem extends React.Component {
             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)}
           />}
         </div>
         <div

+ 1 - 1
src/components/TemplateItems/TemplateItem/index.less

@@ -61,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;

+ 11 - 10
src/components/TemplateItems/index.jsx

@@ -107,10 +107,10 @@ class TemplateItems extends React.Component {
         });
         return Items;
     }
-    floderRename(e){
+    floderRename(e,name,id){
         e.stopPropagation()
         this.props.floderAction(false,'none')
-        this.props.floderRename()
+        this.props.floderRename(name,id)
     }
     floderDelete(e){
         e.stopPropagation()
@@ -129,14 +129,14 @@ class TemplateItems extends React.Component {
                         {tmpItm.name}
                         <span className={`${style.floderPartAction}`} id="floderActionBtn" onClick={(e)=>{this.floderAction(e,tmpItm.id)}}>...</span>
                         {tmpItm.action == 1&&<div className={style.floderAction} id="floderAction">
-                            <p onClick={(e)=>{this.floderRename(e)}}>重命名文件夹</p>
+                            <p onClick={(e)=>{this.floderRename(e,tmpItm.name,tmpItm.id)}}>重命名文件夹</p>
                             <p onClick={(e)=>{this.floderDelete(e)}}>删除文件夹</p>
                         </div>}
                     </div>
                     {
                         tmpItm.templateInfo&&tmpItm.templateInfo.length>0&&<div className={style.floderPartFr}>
                             {
-                                this.getFloderLis(tmpItm.templateInfo,flg)
+                                this.getFloderLis(tmpItm.templateInfo,flg,tmpItm.name,tmpItm.id)
                             }
                         </div>
                     }
@@ -145,15 +145,16 @@ class TemplateItems extends React.Component {
         }
         return Floder
     }
-    getFloderLis(items,flg){//文件夹内的模板明细
+    getFloderLis(items,flg,folderName){//文件夹内的模板明细
         const Items = [];
-        const {admin,checkItemsAdmin} = this.props;
+        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}
@@ -163,16 +164,16 @@ 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;
@@ -261,7 +262,7 @@ 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}/>

+ 1 - 1
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;

+ 123 - 112
src/containers/OperationContainer.js

@@ -1,129 +1,140 @@
 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 } from '@store/async-actions/tabTemplate';
+import { getDptLis,folderModal } 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,
+  });
 }
 
 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,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);
+  return {
+    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;

+ 16 - 4
src/store/actions/tabTemplate.js

@@ -21,8 +21,18 @@ import {
     WHICH_TEMP,
     FLODER_SLIDE,
     FLODER_ACTION,
+    FOLDER_LIST_ADMIN,
+    FOLDER_MODAL,
 } from '@store/types/tabTemplate';
 
+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
@@ -39,9 +49,10 @@ 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,
@@ -59,9 +70,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,

+ 109 - 11
src/store/async-actions/tabTemplate.js

@@ -11,6 +11,8 @@ import {
   delItemsAdmin,
   batchDelItemsAdmin,
   changeTitleAdmin,
+  floderListAdmin,
+  folderModal
 } from '@store/actions/tabTemplate';
 import {DIAG_SHOW} from "@store/types/print";
 import Notify from '@commonComp/Notify';
@@ -23,6 +25,7 @@ import {
   didPushParamChange
 } from '@utils/tools';
 import { billing } from '@store/async-actions/pushMessage';
+import { func } from 'prop-types';
 
 export const initItemList = (current,name) => {
   let admin = store.getState().homePage.admin;
@@ -138,7 +141,7 @@ export const saveTemplateDetail = (val,sex,spell) => { //保存为模板
     })
   }
 };
-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);
@@ -167,12 +170,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('模板保存成功');
@@ -200,6 +205,95 @@ 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) => { //新建管理员文件夹
+  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) {
+        Notify.success('新建成功');
+        dispatch(folderModal(false))
+        dispatch(getFloderList())
+      } 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) {
+        console.log(res,'管理员文件夹列表获取')
+      } else {
+        Notify.error(data.msg);
+      }
+    })
+  }
+};
+export const orderFloder = (data) => { //文件夹排序
+  let baseList = store.getState().patInfo.message;
+  return (dispatch) => {
+    axios.json('/templateFolderAdmin/sort', {
+      "doctorId": baseList.doctorId,
+      "hospitalId": baseList.hospitalId,
+      "id": id,
+      "name": name,
+      "templateType": 2  //模板类型(个人1,管理员2)
+    }).then((res) => {
+      let data = res.data;
+      if (data.code == 0) {
+        console.log(res,'管理员文件夹列表获取')
+      } else {
+        Notify.error(data.msg);
+      }
+    })
+  }
+};
 export const delItem = (id) => { //删除
   return (dispatch) => {
     axios.json('/templateInfo/cancelTemplateInfos', {
@@ -215,17 +309,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);
@@ -250,14 +345,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);
       }
@@ -270,13 +366,15 @@ 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,
       "modeName": obj.title,
-      "type": whichSign
+      "type": whichSign,
+      "folderId": obj.folderId,
+      "spell": obj.spell
     }).then((res) => {
       let data = res.data;
       if (data.code == 0) {

+ 42 - 10
src/store/reducers/tabTemplate.js

@@ -20,7 +20,9 @@ import {
   CHANGE_TITLE_ADMIN,
   WHICH_TEMP,
   FLODER_SLIDE,
-  FLODER_ACTION
+  FLODER_ACTION,
+  FOLDER_LIST_ADMIN,
+  FOLDER_MODAL,
 } from '../types/tabTemplate';
 
 
@@ -41,13 +43,26 @@ const initDataList = {
   activeItem: {}, //引用的模板
   activeItemHis: {}, //引用的历史病例
   allCheckShow: false, //全选反选是否显示
-  allCheckShowAdmin: false, //全选反选是否显示管理员
+  allCheckShowAdmin: false, //全选反选是否显示管理员管理
   current:1,//当前页
   hasMore:true,//是否显示更多
   departLis:[],//搜索的科室列表
   selectTemp:1,//默认1个人模板2标准模板
+  floderListAdmin:[],//文件夹列表
+  folderModalShow:false,//新建文件夹弹窗
+  folderListContentArr :[],//管理员文件夹内模板合并
 }
 export default (state = initDataList, action) => {
+  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;
@@ -102,10 +117,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
@@ -126,15 +149,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 = [];
@@ -159,7 +182,16 @@ export default (state = initDataList, action) => {
   if (action.type === INIT_ADMIN_ITEMS) {//标准模板数据
     const newState = Object.assign({}, state);
     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;
   }
@@ -249,7 +281,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 {

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

@@ -20,3 +20,5 @@ 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';

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 125 - 0
src/utils/Convert_Pinyin.js