Browse Source

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

jwyu 1 năm trước cách đây
mục cha
commit
9ebb7d4d1b

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

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

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

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