Browse Source

通过驳回撤销审批,还有消息通知刷新

cxmo 1 year ago
parent
commit
32ca9e79ea
3 changed files with 48 additions and 38 deletions
  1. 23 16
      src/components/notificationMsg.vue
  2. 1 14
      src/views/Home.vue
  3. 24 8
      src/views/approve_manage/approveDetail.vue

+ 23 - 16
src/components/notificationMsg.vue

@@ -3,13 +3,13 @@
     <el-popover
         placement="bottom"
         width="443"
-        trigger="click">
+        trigger="click" v-model="visible">
         <div class="notifation-wrap">
             <!-- 防止tabs在popover前渲染,会导致tab选中状态不正确 -->
             <el-tabs v-model="activeName" v-if="visible">
                 <el-tab-pane label="研报审批" name="first"></el-tab-pane>
             </el-tabs>
-            <div class="massage-list">
+            <div class="massage-list" v-if="visible">
                 <div class="message-item" v-for="item in msgList" :key="item.Id" @click="readMsg(item)">
                     <span class="icon">
                         <img :src="require(`@/assets/img/approve_m/${approveState[item.ApproveState]||'process'}-msg.svg`)" alt="">
@@ -25,7 +25,7 @@
                 <tableNoData v-if="!msgList.length" text="暂无消息"></tableNoData>
             </div>
         </div>
-        <span slot="reference" @click="visible = true" style="cursor: pointer;">
+        <span slot="reference" @click="visible = !visible" style="cursor: pointer;">
             <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
                 <path d="M16.7344 15.4904L15.2941 12.9564V7.84847C15.2941 5.89142 13.8231 3.77337 11.6786 2.99732C11.5741 1.96012 10.8811 1.20374 9.97287 1.20374C9.06595 1.20374 8.37036 1.96014 8.26717 2.99732C6.12392 3.77337 4.65292 5.8914 4.65292 7.84847V12.9564L3.14258 15.6146C3.04183 15.7903 3.04429 16.0054 3.14504 16.1799C3.24581 16.3544 3.43263 16.4601 3.63415 16.4601H7.22871C7.49293 17.7357 8.62233 18.6967 9.97289 18.6967C11.3247 18.6967 12.4541 17.7357 12.7171 16.4601H16.3116C16.3215 16.4601 16.3288 16.4601 16.3374 16.4601C16.6508 16.4601 16.904 16.2082 16.904 15.8948C16.904 15.7362 16.8401 15.5925 16.7344 15.4904ZM9.97287 2.33803C10.1769 2.33803 10.3415 2.49286 10.4472 2.7239C10.2899 2.70792 10.1375 2.67106 9.97287 2.67106C9.8082 2.67106 9.65583 2.70792 9.49851 2.7239C9.60422 2.49284 9.76889 2.33803 9.97287 2.33803ZM9.97287 17.5636C9.25396 17.5636 8.65303 17.1016 8.41951 16.4601H11.5262C11.2927 17.1015 10.693 17.5636 9.97287 17.5636ZM4.60745 15.3282L5.71102 13.3853C5.76015 13.3017 5.78719 13.2034 5.78719 13.1051V7.84847C5.78719 5.93934 7.57648 3.80413 9.97287 3.80413C12.3692 3.80413 14.161 5.93934 14.161 7.84847V13.1051C14.161 13.2034 14.1868 13.3017 14.2347 13.3853L15.3395 15.3282H4.60745Z" fill="currentColor"/>
             </svg>
@@ -34,29 +34,27 @@
 </template>
 
 <script>
+import {approveInterence} from '@/api/modules/approve.js';
 export default {
-    props:{
-        msgList:{
-            type:Array,
-            default:[]
-        }
-    },
     data() {
         this.approveState=['','process','passed','reject','return',]
         return {
             activeName:'first',
-            visible:false
+            visible:false,
+            msgList:[]
         };
     },
+    watch:{
+        visible(val){
+            if(val){
+                this.getMsgList()
+            }
+        }
+    },
     methods:{
         readMsg(msg){
             const {ApproveState,ReportApproveId} = msg
-            /* const typeMap = {
-                1:'approve',
-                2:'detail',
-                3:'myself',
-                4:'myself'
-            } */
+            
             const type = ApproveState===1?'approve':ApproveState===4?'detail':'myself'
             this.$router.push({
                 path:'/approveDetail',
@@ -65,6 +63,15 @@ export default {
                     approveId:ReportApproveId
                 }
             })
+        },
+        getMsgList(){
+            approveInterence.getApproveMsgList({
+                CurrentIndex:1,
+                PageSize:1000
+            }).then(res=>{
+                if(res.Ret!==200) return 
+                this.msgList = res.Data.List||[]
+            })
         }
     }
 };

+ 1 - 14
src/views/Home.vue

@@ -249,7 +249,7 @@
                 </div>
               </div>
                <!-- 消息通知 -->
-              <notification-msg :msg-list="approveMsgList"/>
+              <notification-msg />
               <el-dropdown trigger="click" style="width:130px;">
                 <span class="el-dropdown-link userinfo-inner">
                   <img src="~@/assets/img/home/avatar.png"/>
@@ -311,7 +311,6 @@ import {
   homeInterface
 } from "api/api.js";
 import { getPublicSettingsApi } from '@/api/modules/oldApi';
-import {approveInterence} from '@/api/modules/approve.js';
 import PwdDlg from "@/components/pwdDlg.vue";
 import questionMsgDia from "@/components/questionMsgDia.vue";
 import questionnaireDia from "../components/questionnaireDia.vue";
@@ -468,7 +467,6 @@ export default {
       linkSystems: this.$setting.linkSystems,
       bus_code:"",
 
-      approveMsgList:[]
     };
   },
   created() {
@@ -485,7 +483,6 @@ export default {
     this.getBusinessCodeFun()
     
     this.getQuestionStaus()
-    this.getApproveMsgList()
   },
   mounted() {
     if (sessionStorage.getItem("hasGetMenu")) {
@@ -512,16 +509,6 @@ export default {
         this.dialogVisiblePwd = res.Data;
       }
     },
-    //获取审批消息列表
-    getApproveMsgList(){
-        approveInterence.getApproveMsgList({
-            CurrentIndex:1,
-            PageSize:1000
-        }).then(res=>{
-            if(res.Ret!==200) return 
-            this.approveMsgList = res.Data.List||[]
-        })
-    },
     // 点击导航 打开今日待办
     // handleShowSallerTodayList() {
     //   this.getSellerTodayList("click");

+ 24 - 8
src/views/approve_manage/approveDetail.vue

@@ -43,7 +43,7 @@
         <div class="approve-tool">
             <div class="tool-btn">
                 <!-- 根据审批的状态决定显示 -->
-                <el-button type="danger" v-if="formType==='approve'&&approveInfo.isCurrentApprover" @click="handleRejectApprove">驳回</el-button>
+                <el-button type="danger" v-if="formType==='approve'&&approveInfo.isCurrentApprover" @click="changeApprove('reject')">驳回</el-button>
                 <el-button type="primary" v-if="formType==='approve'&&approveInfo.isCurrentApprover" @click="changeApprove('pass')">通过</el-button>
                 <el-button type="primary" v-if="formType==='myself'&&approveInfo.state!==4" @click="changeApprove('return')">撤销</el-button>
                 <el-button type="primary" plain @click="$router.replace('/approveList')">返回</el-button>
@@ -201,9 +201,12 @@ export default {
                 //检查最后一个节点是否有人审批
                 let hasApprove = true
                 Nodes[currentIndex].approveList.forEach(u=>{
-                    if(!u.approveStatus){
+                    if(!u.approveStatus||u.approveStatus==='待审批'){
                         hasApprove = false
                     }
+                    if(u.approveStatus==='已驳回'){
+                        Nodes[currentIndex].nodeStatus = 'reject'
+                    }
                 })
                 //若没有,则把这个节点删除
                 !hasApprove&&(Nodes.pop())
@@ -219,14 +222,27 @@ export default {
             }
             this.TimeLineData = [startNode,...Nodes]
         },
-        changeApprove(type){
+        async changeApprove(type){
             const {approveId} = this.$route.query
             if(!approveId) return
-        },
-        handleRejectApprove(){
-            console.log('a?')
-            //打开驳回理由弹窗
-            this.isDetailDialogShow = true
+            if(type==='reject'){
+                this.isDetailDialogShow = true
+                return 
+            }
+            let res = null
+            if(type==='return'){
+                res = await approveInterence.cancelApprove({
+                    ReportApproveId:Number(approveId)
+                })
+            }
+            if(type==='pass'){
+                res = await approveInterence.passApprove({
+                    ReportApproveId:Number(approveId)
+                })
+            }
+            if(res.Ret!==200) return 
+            this.$message.success(`${type==='return'?'撤销':'通过'}成功`)
+            type!=='reject'&&(this.$router.replace("/approveList"))
         },
         rejectApprove(reason){
             this.isDetailDialogShow = false