Explorar o código

个人引用标准模板增加引用次数(3105)

zhangxc %!s(int64=5) %!d(string=hai) anos
pai
achega
13918387f0

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

@@ -137,6 +137,7 @@ class FolderOrder extends React.Component {
                            { tmpItm.templateInfo.map((templateItem, index) => {
                                return (<div class={style.templateItem}>
                                    {templateItem.name}
+                                   {/* <span class={style.arrow}>11</span> */}
                                    <img class={style.orderIcon} src={index===0?diagDown:diagUp} alt="排序" onClick={this.orderTemplate.bind(this, i, index)}/>
                                </div>)
                             })}

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

@@ -125,4 +125,10 @@
     .templateItem:hover {
         border: 1px solid #3B9ED0;
     }
+    // .arrow{
+    //     display: inline-block;
+    //     width: 15px;
+    //     height: 20px;
+    //     background: url("../../common/images/diagDown.png")no-repeat center;
+    // }
 }

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

@@ -2,7 +2,7 @@ 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,folderModal,clearSearchTemplateNorms } from '@store/actions/tabTemplate';
-import { initItemList,initAdminItemList, delItem,delItemAdmin, delBatchItem, delBatchItemAdmin,changeTitleAsync, setPageView,changeTitleAsyncAdmin,setPageViewAdmin,getFloderList,delFloder } from '@store/async-actions/tabTemplate';
+import { initItemList,initAdminItemList, delItem,delItemAdmin, delBatchItem, delBatchItemAdmin,changeTitleAsync, setPageView,changeTitleAsyncAdmin,setPageViewAdmin,getFloderList,delFloder,addTemplateQuote } from '@store/async-actions/tabTemplate';
 import { connect } from "react-redux";
 import store from '@store';
 import { billing } from '@store/async-actions/pushMessage';
@@ -53,7 +53,8 @@ class PushContainer extends Component {
       folderId:'',
       spell:'',
       fstName:'',
-      tmpFolder:''
+      tmpFolder:'',
+      hasCalcIndex: false
     }
     this.$cont = React.createRef();
     this.itemList = null;
@@ -104,7 +105,7 @@ class PushContainer extends Component {
    * 引用模板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),
@@ -113,11 +114,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>
@@ -399,6 +404,13 @@ class PushContainer extends Component {
         store.dispatch(setPageViewAdmin(id))
       }else{
         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) { //删除文件夹
@@ -413,6 +425,9 @@ class PushContainer extends Component {
   }
   handleClose() {
     store.dispatch(changeVisible(false));
+    this.setState({
+      hasCalcIndex: false
+    })
   }
   whichTemp(tab){
     store.dispatch(whichTemp(tab))

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

@@ -34,9 +34,9 @@ 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,folderId) {          //点击复选框
@@ -241,7 +241,7 @@ class TemplateItem extends React.Component {
             onMouseLeave={() => this.handleDelIconMouseLeave()}
             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()}

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

@@ -507,4 +507,23 @@ export const getFloderListAll = () => {
       }
     })
   }
+}
+
+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)
+      }
+    })
+  }
 }