浏览代码

报告定时发布是否有推送功能修改

jwyu 1 年之前
父节点
当前提交
9ebb7d4d1b
共有 3 个文件被更改,包括 58 次插入9 次删除
  1. 28 4
      src/views/report/AddReport.vue
  2. 23 5
      src/views/report/EditReport.vue
  3. 7 0
      src/views/report/List.vue

+ 28 - 4
src/views/report/AddReport.vue

@@ -10,12 +10,13 @@ import moment from 'moment'
 import { showToast,showDialog  } from 'vant'
 import { useRouter } from 'vue-router'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
-import {reportManageBtn} from '@/hooks/useAuthBtn'
+import {reportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
 import {usePublicSettingStore} from '@/store/modules/publicSetting'
 const cachedViewsStore=useCachedViewsStore()
 const publicSettingStore = usePublicSettingStore()
 
 const router=useRouter()
+const {checkAuthBtn} = useAuthBtn()
 
 
 const {lastFocusPosition,initFroalaEditor}=useInitFroalaEditor()
@@ -210,6 +211,11 @@ async function handleReportOpt(type){
             }
         }else{
             // 显示发布提示弹窗,提示推送客群
+            //判断是否有推送权限
+            if(!checkAuthBtn(reportManageBtn.reportManage_sendMsg)){
+                handleConfirmPublish(1)
+                return
+            }
             showPublishPop.value=true
         }
     }
@@ -264,13 +270,30 @@ async function reportPublish(id){
 const showDSFBTime=ref(false)
 function onConfirmDSFBTime(time){
     console.log(time);
+    const isAuthPushMsg=checkAuthBtn(reportManageBtn.reportManage_sendMsg)
+    console.log(isAuthPushMsg);
     showDialog({
         title: '提示',
-        message:'是否发布定时报告,并推送模板消息?',
-        confirmButtonText:'推送',
-        cancelButtonText:'不推送',
+        message:isAuthPushMsg?'是否发布定时报告,并推送模板消息?':'是否发布定时报告',
+        confirmButtonText:isAuthPushMsg?'推送':'取消',
+        cancelButtonText:isAuthPushMsg?'不推送':'确定',
         showCancelButton:true
     }).then(()=>{
+        if(!isAuthPushMsg){
+            apiReport.reportPublishTimeSet({
+                ReportId:reportId,
+                PrePublishTime:time,
+                PreMsgSend:0
+            }).then(res=>{
+                if(res.Ret===200){
+                    showToast('定时发布成功!')
+                    setTimeout(() => {
+                        router.back()
+                    }, 1000);
+                }
+            })
+            return
+        }
         //推送
         apiReport.reportPublishTimeSet({
             ReportId:reportId,
@@ -285,6 +308,7 @@ function onConfirmDSFBTime(time){
             }
         })
     }).catch(()=>{
+        if(!isAuthPushMsg) return
         //不推送
         apiReport.reportPublishTimeSet({
             ReportId:reportId,

+ 23 - 5
src/views/report/EditReport.vue

@@ -11,12 +11,13 @@ import { showToast,showDialog } from 'vant'
 import { useRoute, useRouter } from 'vue-router'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 import {usePublicSettingStore} from '@/store/modules/publicSetting'
-import {reportManageBtn} from '@/hooks/useAuthBtn'
+import {reportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
 const cachedViewsStore=useCachedViewsStore()
 const publicSettingStore = usePublicSettingStore()
 
 const router=useRouter()
 const route=useRoute()
+const {checkAuthBtn} = useAuthBtn()
 
 const isApprove = ref(false)
 
@@ -285,7 +286,7 @@ async function handleReportOpt(type){
         //     // 显示发布提示弹窗,提示推送客群
         //     showPublishPop.value=true
         // }
-        if(isApprove.value){
+        if(isApprove.value||!checkAuthBtn(reportManageBtn.reportManage_sendMsg)){
             handleConfirmPublish(1)
             return
         }
@@ -355,13 +356,29 @@ function onConfirmDSFBTime(time){
         })
         return
     }
+    const isAuthPushMsg=checkAuthBtn(reportManageBtn.reportManage_sendMsg)
     showDialog({
         title: '提示',
-        message:'是否发布定时报告,并推送模板消息?',
-        confirmButtonText:'推送',
-        cancelButtonText:'不推送',
+        message:isAuthPushMsg?'是否发布定时报告,并推送模板消息?':'是否发布定时报告',
+        confirmButtonText:isAuthPushMsg?'推送':'确定',
+        cancelButtonText:isAuthPushMsg?'不推送':'取消',
         showCancelButton:true
     }).then(()=>{
+        if(!isAuthPushMsg){
+            apiReport.reportPublishTimeSet({
+                ReportId:reportData.value.Id,
+                PrePublishTime:time,
+                PreMsgSend:0
+            }).then(res=>{
+                if(res.Ret===200){
+                    showToast('定时发布成功!')
+                    setTimeout(() => {
+                        router.back()
+                    }, 1000);
+                }
+            })
+            return
+        }
         //推送
         apiReport.reportPublishTimeSet({
             ReportId:reportData.value.Id,
@@ -376,6 +393,7 @@ function onConfirmDSFBTime(time){
             }
         })
     }).catch(()=>{
+        if(!isAuthPushMsg) return
         //不推送
         apiReport.reportPublishTimeSet({
             ReportId:reportData.value.Id,

+ 7 - 0
src/views/report/List.vue

@@ -165,6 +165,13 @@ async function handleReportPublish(item){
         showReportItemOpt.value=false
         return
     }
+    // 判断是否有推送权限
+    if(!checkAuthBtn(reportManageBtn.reportManage_sendMsg)){
+        publishReportApprove()
+        showReportItemOpt.value=false
+        return
+    }
+
     showPublishPop.value=true
     showReportItemOpt.value=false
 }