Pārlūkot izejas kodu

模板文件夹修改

luolei 5 gadi atpakaļ
vecāks
revīzija
aa46e953da

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

@@ -257,7 +257,7 @@ class Operation extends Component {
   }
   makeSure() {
     const { save, clear, saveDataAll,saveDataAlls,diagShowTmp ,chronicMagItem,chronicDesease,admin} = this.props;
-    const { type,deptId,sex,title } = this.state;
+    const { type,deptId,sex,title,fstName } = this.state;
     if (type == 1) {
       diagShowTmp(false)
       this.setState({ title: '' })
@@ -304,7 +304,7 @@ class Operation extends Component {
         }
         saveDataAlls(title,sex,deptId);
       }else{
-        saveDataAll(title,sex);
+        saveDataAll(title,sex,fstName);
       }
     }
   }
@@ -423,7 +423,7 @@ class Operation extends Component {
           <div className={style.name}>
             <span className={style.leftName}>模板名称:</span>
             <input className={style['ipt']}
-              placeholder="请输入模板名称"
+              placeholder="请输入文件夹名称"
               type="text"
               maxLength='30'
               onInput={(e) => {

+ 60 - 3
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 } 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 } from '@store/actions/tabTemplate';
+import { initItemList,initAdminItemList, delItem,delItemAdmin, delBatchItem, delBatchItemAdmin,changeTitleAsync, setPageView,changeTitleAsyncAdmin,setPageViewAdmin } from '@store/async-actions/tabTemplate';
 import { connect } from "react-redux";
 import store from '@store';
 import { billing } from '@store/async-actions/pushMessage';
@@ -44,6 +44,7 @@ class PushContainer extends Component {
       okColor: 'red',
       num: 0,          //计数
       deptId:'',       //科室id
+      floderName:'',   //文件夹名称
     }
     this.$cont = React.createRef();
     this.itemList = null;
@@ -60,6 +61,8 @@ class PushContainer extends Component {
     this.handleClose = this.handleClose.bind(this);
     this.templateSearch = this.templateSearch.bind(this);
     this.whichTemp = this.whichTemp.bind(this);
+    this.floderSlideToggle = this.floderSlideToggle.bind(this);
+    this.floderRename = this.floderRename.bind(this);
   }
   componentDidMount() {
     // const height = getWindowInnerHeight()-160;
@@ -144,6 +147,12 @@ class PushContainer extends Component {
     let val = (e.target.value).substring(0, 30)
     this.onchange(val)
   }
+  handleInputFst(e){
+    let val = (e.target.value).substring(0,30)
+    this.setState({
+      floderName: val
+    })
+  }
   changeTitle() {
     return <div className={style['box']}>
       <input className={style['ipt']}
@@ -231,7 +240,43 @@ class PushContainer extends Component {
     let tmpPage = ++page
     store.dispatch(initItemList(tmpPage,true))
   }
-  
+  floderRename(){//文件夹重命名
+    this.setState({
+      type: 5,
+      message:'文件夹重命名', 
+      title: '文件夹重命名',
+      text: 'text',
+      okText: '保存',
+      okBorderColor: '#3B9ED0',
+      okColor: '#fff',
+      oKBg: '#3B9ED0'
+    })
+    store.dispatch(changeVisible(true))
+  }
+  changeTitle() {
+    return <div className={style['box']}>
+      <div className={style['iptWrap']}>
+        <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>
+  }
+  floderDelete(){//文件夹删除
+
+  }
+
   makeSure() {
     if (this.state.type == 1) {
       if(this.props.admin){
@@ -281,6 +326,13 @@ class PushContainer extends Component {
   }
   whichTemp(tab){
     store.dispatch(whichTemp(tab))
+    store.dispatch(initAdminItemList(1,true))
+  }
+  floderSlideToggle(id){
+    store.dispatch(floderSlide(id))
+  }
+  floderActionDo(id){
+    store.dispatch(floderAction(id))
   }
   render() {
     const { activeId, checkItems,selectTemp, visible, showMsg,hasMore,current, items, allCheckShow,allCheckShowAdmin,adminItems,admin,checkItemsAdmin,clearSearch } = this.props;
@@ -315,6 +367,10 @@ class PushContainer extends Component {
             templateSearch={this.templateSearch}
             whichTemp={this.whichTemp}
             selectTemp={selectTemp}
+            floderSlide={this.floderSlideToggle}
+            floderAction={this.floderActionDo}
+            floderDelete={this.floderDelete}
+            floderRename={this.floderRename}
           ></TemplateItems>
           <MedicalInfoContainer></MedicalInfoContainer>
         </TemplateContainer>
@@ -323,6 +379,7 @@ class PushContainer extends Component {
         visible={visible}
         confirm={this.makeSure}
         close={this.handleClose}
+        title={this.state.title}
         cancel={this.handleClose}
         okText={this.state.okText}
         okBorderColor={this.state.okBorderColor}

BIN
src/components/TemplateItems/TemplateItem/img/floderD.png


BIN
src/components/TemplateItems/TemplateItem/img/floderR.png


BIN
src/components/TemplateItems/TemplateItem/img/floderT.png


BIN
src/components/TemplateItems/TemplateItem/img/floderTb.png


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

@@ -9,7 +9,10 @@ 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 $ from 'jquery';
 import {windowEventHandler,getWindowInnerHeight} from '@utils/tools'
 
 class TemplateItems extends React.Component {
@@ -30,6 +33,7 @@ class TemplateItems extends React.Component {
         this.handleChange = this.handleChange.bind(this);
         this.clear = this.clear.bind(this);
         this.showTipContent = this.showTipContent.bind(this);
+        this.getFloderLis = this.getFloderLis.bind(this);
     }  
     componentDidMount(){
         const height = getWindowInnerHeight()-195;
@@ -44,6 +48,16 @@ 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
@@ -51,9 +65,89 @@ class TemplateItems extends React.Component {
             showTipContent:!show
         })
     }
+    floderSlide(e,item){
+        const {floderSlide} = this.props
+        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)
+    }
+    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){
+        e.stopPropagation()
+        this.props.floderAction(false,'none')
+        this.props.floderRename()
+    }
+    floderDelete(e){
+        e.stopPropagation()
+        this.props.floderAction(false,'none')
+        this.props.floderDelete()
+    }
+    genAdminItems(items,flg) {
+        const Floder=[],Items = [];
+        const {admin,checkItemsAdmin} = this.props;
+        for(let i = 0;i < items.length;i++){
+            let tmpItm = items[i]
+            Floder.push(
+                <div className={style.floderPart}>
+                    <div className={style.floderPartFl} onClick={(e)=>this.floderSlide(e,tmpItm)}>
+                        <img src={tmpItm.slide == 1?floderD:floderR} className={style.floderRD}/>
+                        {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.floderDelete(e)}}>删除文件夹</p>
+                        </div>}
+                    </div>
+                    {
+                        tmpItm.templateInfo&&tmpItm.templateInfo.length>0&&<div className={style.floderPartFr}>
+                            {
+                                this.getFloderLis(tmpItm.templateInfo,flg)
+                            }
+                        </div>
+                    }
+                </div>
+            )
+        }
+        return Floder
+    }
+    getFloderLis(items,flg){//文件夹内的模板明细
+        const Items = [];
+        const {admin,checkItemsAdmin} = this.props;
         items.forEach((v,idx) => {
             Items.push(
                 <TemplateItem
@@ -223,9 +317,9 @@ class TemplateItems extends React.Component {
                                 </div>
                             }
                             {
-                                <div style={{height:height-52+'px',overflow:'auto'}}>
+                                <div style={{height:height-54+'px',overflow:'auto'}}>
                                     {
-                                        selectTemp==1&&this.genItems(items).length > 0?this.genItems(items):selectTemp==2&&this.genItems(adminItems,true).length > 0?this.genItems(adminItems,true): <Empty message={this.state.msg}></Empty>
+                                        selectTemp==1&&this.genItems(items).length > 0?this.genItems(items):selectTemp==2&&this.genAdminItems(adminItems,true).length > 0?this.genAdminItems(adminItems,true): <Empty message={this.state.msg}></Empty>
                                     }
                                 </div>
                             }
@@ -233,7 +327,7 @@ class TemplateItems extends React.Component {
                         {
                             admin&&<div className={style.tempLists} ref={this.$conts} style={{border:admin?'0':'1px solid #EAEDF1'}}>
                                 <div style={{height:height+'px',overflow:'auto'}}>
-                                    {this.genItems(adminItems,true).length > 0?this.genItems(adminItems,true): <Empty message={this.state.msg}></Empty>}
+                                    {this.genAdminItems(adminItems,true).length > 0?this.genAdminItems(adminItems,true): <Empty message={this.state.msg}></Empty>}
                                 </div>
                             </div>
                         }

+ 61 - 0
src/components/TemplateItems/index.less

@@ -195,4 +195,65 @@
 }
 .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;
 }

+ 2 - 2
src/containers/OperationContainer.js

@@ -78,8 +78,8 @@ function mapDispatchToProps(dispatch) {
         saveDataAlls(val,sex,id){
           dispatch(saveAdminTemplateDetail(val,sex,id))
         },
-        saveDataAll(val,sex){
-          dispatch(saveTemplateDetail(val,sex))
+        saveDataAll(val,sex,spell){
+          dispatch(saveTemplateDetail(val,sex,spell))
         },
         diagShowTmp(bool){
           dispatch({

+ 11 - 1
src/store/actions/tabTemplate.js

@@ -18,9 +18,19 @@ import {
     DEL_ITEMS_ADMIN,
     BATCH_DEL_ITEMS_ADMIN,
     CHANGE_TITLE_ADMIN,
-    WHICH_TEMP
+    WHICH_TEMP,
+    FLODER_SLIDE,
+    FLODER_ACTION,
 } from '@store/types/tabTemplate';
 
+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

+ 7 - 14
src/store/async-actions/tabTemplate.js

@@ -38,7 +38,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,
@@ -63,16 +63,8 @@ export const initAdminItemList = (current,name) => { //初始化数据
   // 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) => {
+    // axios.json('/templateAdmin/getTemplatePageAlls', {
+    axios.json('/templateAdmin/getTemplateNorms').then((res) => {
       const data = res.data;
       if (data.code == 0) {
         // data.data.flg = flg||false  //获取下一页,暂时不用
@@ -84,7 +76,7 @@ export const initAdminItemList = (current,name) => { //初始化数据
   }
 };
 
-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 +94,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 +105,8 @@ export const saveTemplateDetail = (val,sex) => { //保存为模板
       "modeName": val,
       "modeType": whichSign,
       "preview": idx ? JSON.stringify(preview):preview,
-      "sex":sex
+      "sex":sex,
+      "spell":spell
     }
     return tmpObj;
   }

+ 40 - 13
src/store/reducers/tabTemplate.js

@@ -18,7 +18,9 @@ import {
   DEL_ITEMS_ADMIN,
   BATCH_DEL_ITEMS_ADMIN,
   CHANGE_TITLE_ADMIN,
-  WHICH_TEMP
+  WHICH_TEMP,
+  FLODER_SLIDE,
+  FLODER_ACTION
 } from '../types/tabTemplate';
 
 
@@ -46,9 +48,42 @@ const initDataList = {
   selectTemp:1,//默认1个人模板2标准模板
 }
 export default (state = initDataList, action) => {
+  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);
-    console.log(action)
     newState.selectTemp = action.tab;
     return newState;
   }
@@ -116,22 +151,14 @@ 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
+    newState.adminItems = action.state
     newState.current = action.state.current;
     newState.hasMore = action.state.current<action.state.pages;
     return newState;

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

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