Browse Source

ppt模块权限设置

cxmo 1 year ago
parent
commit
e3e4054c55

+ 20 - 2
src/hooks/useAuthBtn.js

@@ -29,9 +29,27 @@ export const enReportManageBtn = {
 
 /*
 --------------------------智能PPT-----------------
+PS:由于移动端中英文PPT是一个页面,特地把按钮名称设置为一致的方便处理
+与ETA后台不同,修改时请注意
 */
-export const pptBtn={}
-export const enPPTBtn={}
+export const pptBtn={
+    ppt_del:'ppt:del',
+    ppt_copy:'ppt:copy',
+    ppt_download:'ppt:download',
+    ppt_show:'ppt:show',//演示
+    ppt_publish:'ppt:publish',
+    ppt_visible:'ppt:visible',//可见权限
+    ppt_save:'ppt:save',//添加PPT按钮,同时也控制目录重命名权限
+}
+export const enPPTBtn={
+    ppt_del:'pptEn:del',
+    ppt_copy:'pptEn:copy',
+    ppt_download:'pptEn:download',
+    ppt_show:'pptEn:show',
+    ppt_publish:'pptEn:publish',
+    ppt_visible:'pptEn:visible',
+    ppt_save:'pptEn:save',//添加PPT按钮,同时也控制目录重命名权限
+}
 
 /*
 --------------------------ETA指标库---------------

+ 5 - 0
src/store/modules/authBtn.js

@@ -28,6 +28,11 @@ export const useAuthBtnStore = defineStore('authBtn',{
                     {ButtonCode:'enReport:reportDel'},
                     {ButtonCode:'enReport:reportView'},
                     {ButtonCode:'enReport:reportEdit'},
+
+                    //ppt
+                    {ButtonCode:'ppt:del'},
+                    {ButtonCode:'ppt:copy'},
+                    {ButtonCode:'ppt:download'},
                 ]
                 resolve('权限获取成功')
             })

+ 16 - 13
src/views/ppt/Detail.vue

@@ -60,7 +60,10 @@ const {
     handleShowPPTCopy,
     handlePPTDel,
     handlePPTCopy,
-    handlePPTCopyBeforeClose
+    handlePPTCopyBeforeClose,
+
+    permissionBtn,
+    checkAuthBtn
 
 }=useClassify()
 
@@ -142,27 +145,27 @@ const showPopover=ref(false)
     <div class="ppt-detail-page" :style="{height:pptContentHeight+'px'}">
         <!-- pad端顶部操作栏 -->
         <div class="pad-top-action-wrap">
-            <div class="item-box" @click="handllePublishPPT">
+            <div class="item-box" @click="handllePublishPPT" v-permission="permissionBtn.ppt_publish">
                 <img src="@/assets/imgs/ppt/icon_action_publish.png" alt="">
                 <span>发布</span>
             </div>
-            <div class="item-box" @click="showPlayOpt=true">
+            <div class="item-box" @click="showPlayOpt=true" v-permission="permissionBtn.ppt_show">
                 <img src="@/assets/imgs/ppt/icon_action_play.png" alt="">
                 <span>播放</span>
             </div>
-            <div class="item-box" @click="handleShowPPTCopy({pptid:$route.query.id})">
+            <div class="item-box" @click="handleShowPPTCopy({pptid:$route.query.id})" v-permission="permissionBtn.ppt_copy">
                 <img src="@/assets/imgs/ppt/icon_action_copy.png" alt="">
                 <span>复制</span>
             </div>
-            <div class="item-box" @click="handleDownLoadFile">
+            <div class="item-box" @click="handleDownLoadFile" v-permission="permissionBtn.ppt_download">
                 <img src="@/assets/imgs/ppt/icon_action_download2.png" alt="">
                 <span>下载</span>
             </div>
-            <div class="item-box red" @click="handlePPTDel({back:true})" v-if="!PPTOptState.isCommon">
+            <div class="item-box red" @click="handlePPTDel({back:true})" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_del)">
                 <img src="@/assets/imgs/icon_del.png" alt="">
                 <span>删除</span>
             </div>
-            <div class="item-box" style="flex-direction:row">
+            <div class="item-box" style="flex-direction:row" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_visible)">
                 <span style="margin-right:4px">公开</span>
                 <van-switch 
                     size="22px" 
@@ -180,15 +183,15 @@ const showPopover=ref(false)
             </template>
         </div>
         <div class="mobile-fix-bot-warp">
-            <div class="item-box" @click="handllePublishPPT">
+            <div class="item-box" @click="handllePublishPPT" v-permission="permissionBtn.ppt_publish">
                 <img src="@/assets/imgs/ppt/icon_action_publish.png" alt="">
                 <span>发布</span>
             </div>
-            <div class="item-box" @click="showPlayOpt=true">
+            <div class="item-box" @click="showPlayOpt=true" v-permission="permissionBtn.ppt_show">
                 <img src="@/assets/imgs/ppt/icon_action_play.png" alt="">
                 <span>播放</span>
             </div>
-            <div class="item-box" @click="handleShowPPTCopy({pptid:$route.query.id})">
+            <div class="item-box" @click="handleShowPPTCopy({pptid:$route.query.id})" v-permission="permissionBtn.ppt_copy">
                 <img src="@/assets/imgs/ppt/icon_action_copy.png" alt="">
                 <span>复制</span>
             </div>
@@ -217,7 +220,7 @@ const showPopover=ref(false)
                         </div>
                     </div>
                 </div>
-                <div class="flex" v-if="!PPTOptState.isCommon">
+                <div class="flex" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_visible)">
                     <span style="margin-right:4px">公开</span>
                     <van-switch 
                         size="22px" 
@@ -227,11 +230,11 @@ const showPopover=ref(false)
                 </div>
                 
             </div>
-            <div class="item border blue" @click="handleDownLoadFile">
+            <div class="item border blue" @click="handleDownLoadFile" v-permission="permissionBtn.ppt_download">
                 <img src="@/assets/imgs/ppt/icon_action_download.png" alt="">
                 <span>下载</span>
             </div>
-            <div class="item border red" @click="handlePPTDel({back:true})" v-if="!PPTOptState.isCommon">
+            <div class="item border red" @click="handlePPTDel({back:true})" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_del)">
                 <img src="@/assets/imgs/icon_del.png" alt="">
                 <span>删除</span>
             </div>

+ 10 - 7
src/views/ppt/components/MobileClassifyWrap.vue

@@ -24,7 +24,10 @@ const {
     handlePPTCopy,
     handlePPTCopyBeforeClose,
 
-    goPPTDetail
+    goPPTDetail,
+
+    permissionBtn,
+    checkAuthBtn
 }=useClassify()
 
 getPPTClassifyData()
@@ -134,15 +137,15 @@ const showPopover=ref(false)
                 <img src="@/assets/imgs/ppt/ppt_icon_file.png" alt="">
                 <span>{{fileOptState.data.GroupName}}</span>
             </div>
-            <div class="item border blue" @click="handlePPTCatalogueCopy">
+            <div class="item border blue" @click="handlePPTCatalogueCopy" v-permission="permissionBtn.ppt_copy">
                 <img src="@/assets/imgs/ppt/ppt_icon_copy.png" alt="">
                 <span>复制</span>
             </div>
-            <div class="item border blue" @click="fileOptState.showReName=true">
+            <div class="item border blue" @click="fileOptState.showReName=true" v-permission="permissionBtn.ppt_save">
                 <img src="@/assets/imgs/ppt/ppt_icon_write.png" alt="">
                 <span>重命名</span>
             </div>
-            <div class="item border red" @click="handlePPTCatalogueDel">
+            <div class="item border red" @click="handlePPTCatalogueDel" v-permission="permissionBtn.ppt_del">
                 <img src="@/assets/imgs/icon_del.png" alt="">
                 <span>删除</span>
             </div>
@@ -180,7 +183,7 @@ const showPopover=ref(false)
                         </div>
                     </div>
                 </div>
-                <div class="flex" v-if="!PPTOptState.isCommon">
+                <div class="flex" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_visible)">
                     <span style="margin-right:4px">公开</span>
                     <van-switch 
                         size="22px" 
@@ -190,11 +193,11 @@ const showPopover=ref(false)
                 </div>
                 
             </div>
-            <div class="item border blue" @click="handleShowPPTCopy">
+            <div class="item border blue" @click="handleShowPPTCopy" v-permission="permissionBtn.ppt_copy">
                 <img src="@/assets/imgs/ppt/ppt_icon_copy.png" alt="">
                 <span>复制</span>
             </div>
-            <div class="item border red" @click="handlePPTDel" v-if="!PPTOptState.isCommon">
+            <div class="item border red" @click="handlePPTDel" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_del)">
                 <img src="@/assets/imgs/icon_del.png" alt="">
                 <span>删除</span>
             </div>

+ 21 - 12
src/views/ppt/components/PadPPTIndexWrap.vue

@@ -1,5 +1,5 @@
 <script setup>
-import {ref} from 'vue'
+import {computed, ref} from 'vue'
 import {useClassify} from '../hooks/useClassify'
 import openShareIcon from '@/assets/imgs/ppt/ppt_icon_user1.png'
 import closeShareIcon from '@/assets/imgs/ppt/ppt_icon_user2.png'
@@ -30,10 +30,19 @@ const {
     handlePPTCopy,
     handlePPTCopyBeforeClose,
 
-    goPPTDetail
+    goPPTDetail,
+
+    permissionBtn,
+    checkAuthBtn
 }=useClassify()
 getPPTClassifyData()
 
+const isOptBoxShow = computed(()=>{
+    return checkAuthBtn(permissionBtn.ppt_copy)||checkAuthBtn(permissionBtn.ppt_save)||checkAuthBtn(permissionBtn.ppt_del)
+})
+const isOptPPTShow = computed(()=>{
+    return checkAuthBtn(permissionBtn.ppt_copy)||checkAuthBtn(permissionBtn.ppt_del)
+})
 const activeType=ref('myPPT')
 
 // 获取ppt列表
@@ -109,20 +118,20 @@ const showPopover=ref(false)
                                 <div @click.stop="handleShowFileOpt(item)">
                                     <van-popover position="bottom-start">
                                         <template #reference>
-                                            <div class="menu-icon">
+                                            <div class="menu-icon" v-if="isOptBoxShow">
                                                 <img class="icon" src="@/assets/imgs/ppt/ppt_icon_menu.png" alt="">
                                             </div>
                                         </template>
                                         <div class="pad-classify-file-opt-box">
-                                            <div class="item" @click="handlePPTCatalogueCopy">
+                                            <div class="item" @click="handlePPTCatalogueCopy" v-permission="permissionBtn.ppt_copy">
                                                 <img src="@/assets/imgs/ppt/icon_action_copy.png" alt="">
                                                 <span>复制</span>
                                             </div>
-                                            <div class="item" @click="fileOptState.showReName=true">
+                                            <div class="item" @click="fileOptState.showReName=true" v-permission="permissionBtn.ppt_save">
                                                 <img src="@/assets/imgs/ppt/ppt_icon_write02.png" alt="">
                                                 <span>重命名</span>
                                             </div>
-                                            <div class="item del" @click="handlePPTCatalogueDel">
+                                            <div class="item del" @click="handlePPTCatalogueDel" v-permission="permissionBtn.ppt_del">
                                                 <img src="@/assets/imgs/icon_del.png" alt="">
                                                 <span>删除</span>
                                             </div>
@@ -141,14 +150,14 @@ const showPopover=ref(false)
                             <div @click.stop="handleShowPPTOpt(_item)">
                                 <van-popover position="bottom-start">
                                     <template #reference>
-                                        <img class="share-icon" :src="_item.IsSingleShareBoolean?openShareIcon:closeShareIcon" alt="">
+                                        <img class="share-icon" :src="_item.IsSingleShareBoolean?openShareIcon:closeShareIcon" alt="" v-if="checkAuthBtn(permissionBtn.ppt_visible)">
                                     </template>
                                     <div class="pad-classify-file-opt-box">
-                                        <div class="item" @click="handleChangePPTShare(1,_item)">
+                                        <div class="item" @click="handleChangePPTShare(1,_item)" v-permission="permissionBtn.ppt_visible">
                                             <img :src="closeShareIcon" alt="">
                                             <span>仅自己可见</span>
                                         </div>
-                                        <div class="item" @click="handleChangePPTShare(2,_item)">
+                                        <div class="item" @click="handleChangePPTShare(2,_item)" v-permission="permissionBtn.ppt_visible">
                                             <img :src="openShareIcon" alt="">
                                             <span>所有人可见</span>
                                         </div>
@@ -158,16 +167,16 @@ const showPopover=ref(false)
                             <div @click.stop="handleShowPPTOpt(_item)">
                                 <van-popover position="bottom-start">
                                     <template #reference>
-                                        <div class="menu-icon">
+                                        <div class="menu-icon" v-if="isOptPPTShow">
                                             <img class="icon" src="@/assets/imgs/ppt/ppt_icon_menu.png" alt="">
                                         </div>
                                     </template>
                                     <div class="pad-classify-file-opt-box">
-                                        <div class="item" @click="handleShowPPTCopy">
+                                        <div class="item" @click="handleShowPPTCopy" v-permission="permissionBtn.ppt_copy">
                                             <img src="@/assets/imgs/ppt/icon_action_copy.png" alt="">
                                             <span>复制</span>
                                         </div>
-                                        <div class="item del" @click="handlePPTDel">
+                                        <div class="item del" @click="handlePPTDel" v-permission="permissionBtn.ppt_del">
                                             <img src="@/assets/imgs/icon_del.png" alt="">
                                             <span>删除</span>
                                         </div>

+ 7 - 1
src/views/ppt/hooks/useClassify.js

@@ -4,6 +4,9 @@ import {ref,reactive} from 'vue'
 import { useRouter } from 'vue-router';
 import { showToast,showDialog,Dialog  } from 'vant';
 import {useUserInfo} from '@/hooks/common'
+import {pptBtn,enPPTBtn,useAuthBtn} from '@/hooks/useAuthBtn'
+const  {checkAuthBtn} = useAuthBtn()
+const permissionBtn = window.location.pathname.startsWith('/ppten')?enPPTBtn:pptBtn
 import {
     apiPPTClassify,
     apiPPTCatalogueCopy,
@@ -242,6 +245,9 @@ export function useClassify(){
         handlePPTCopy,
         handlePPTCopyBeforeClose,
 
-        goPPTDetail
+        goPPTDetail,
+
+        permissionBtn,
+        checkAuthBtn
     }
 }