cldu преди 3 месеца
родител
ревизия
f95a6682e4

+ 64 - 0
src/api/ppt.js

@@ -152,4 +152,68 @@ export function apiPPTSearch(params){
     }else{
         return get('/pptv2/ppt/list',params)
     }
+}
+
+/**
+     * 共享ppt列表
+     * @param {*} params GroupId
+     */
+export function apiPPTShareList(params){
+    if(window.location.pathname.startsWith('/ppten')){
+        return get('/ppt_english/grant/ppt/list',params)
+    }else{
+        return get('/pptv2/grant/ppt/list',params)
+    }
+}
+
+
+/**
+     * 取消共享
+     * @param {*} params  PptId
+     * @returns 
+*/
+export function cancelShareAuth(params) {
+    if(window.location.pathname.startsWith('/ppten')){
+        return post('/ppt_english/grant/cancel',params)
+    }else{
+        return post('/pptv2/grant/cancel',params)
+    }
+}
+
+
+/**
+     * 设置共享
+     * @param 
+     * * PptId 
+	 * GrantType  1:全部用户;2:指定成员
+	 * AdminIdStr
+*/
+export function setShareAuth(params) {
+    if(window.location.pathname.startsWith('/ppten')){
+        return post('/ppt_english/grant',params)
+    }else{
+        return post('/pptv2/grant',params)
+    }
+}
+
+/**
+     * 获取分配ppt详情
+     * @param {*} params PptId
+     * @returns 
+     */
+export function getSharedDetail(params) {
+    if(window.location.pathname.startsWith('/ppten')){
+        return get('/ppt_english/grant/info',params)
+    }else{
+        return get('/pptv2/grant/info',params)
+    }
+}
+
+/**
+	 * 用户检索
+	 * @param {KeyWord} params 
+	 * @returns 
+	 */
+export function userSearch(params) {
+    return get('/datamanage/manual/sysuser/search',params)
 }

BIN
src/assets/imgs/ppt/ppt_icon_choose_member.png


BIN
src/assets/imgs/ppt/ppt_icon_choose_member_black.png


BIN
src/assets/imgs/ppt/ppt_icon_set_close.png


BIN
src/assets/imgs/ppt/ppt_icon_set_shared.png


BIN
src/assets/imgs/ppt/ppt_icon_set_shared_black.png


+ 2 - 0
src/hooks/useAuthBtn.js

@@ -44,6 +44,7 @@ export const pptBtn={
     ppt_publish:'ppt:publish',
     ppt_visible:'ppt:visible',//可见权限
     ppt_save:'ppt:save',//添加PPT按钮,同时也控制目录重命名权限
+    ppt_setShare:'ppt:setShare',//设置共享
 }
 export const enPPTBtn={
     ppt_del:'pptEn:del',
@@ -53,6 +54,7 @@ export const enPPTBtn={
     ppt_publish:'pptEn:publish',
     ppt_visible:'pptEn:visible',
     ppt_save:'pptEn:save',//添加PPT按钮,同时也控制目录重命名权限
+    ppt_setShare:'pptEn:setShare',//设置共享
 }
 
 /*

+ 43 - 23
src/views/ppt/Detail.vue

@@ -211,27 +211,24 @@ const showPopover=ref(false)
         position="bottom"
     >
         <div class="file-opt-wrap ppt-opt-wrap">
-            <div class="item border top-box">
-                <div class="flex">
-                    <img class="ppt-icon" src="@/assets/imgs/ppt/icon01.png" alt="">
-                    <div >
-                        <div class="title">{{PPTOptState.data.Title}}</div>
-                        <div class="name">
+            <div class="top-box">
+                 <img src="@/assets/imgs/ppt/icon01.png" alt="">
+                 <div class="title">
+                    <div class="name">{{PPTOptState.data.Title}}</div>
+                    <div class="person">
                             {{PPTOptState.data.AdminRealName}}
                             {{PPTOptState.data.PptCreateTime.split(' ')[0]}}
                             创建
-                        </div>
                     </div>
-                </div>
-                <div class="flex" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_visible)">
-                    <span style="margin-right:4px">公开</span>
-                    <van-switch 
-                        size="22px" 
-                        :model-value="PPTOptState.data.IsSingleShareBoolean"
-                        @update:model-value="handlePPTShare"
-                    />
-                </div>
-                
+                 </div>
+                 <div class="share" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_visible)">
+                       <span class="share-font">公开</span>
+                        <van-switch 
+                            size="16px" 
+                            :model-value="PPTOptState.data.IsSingleShareBoolean"
+                            @update:model-value="handlePPTShare"
+                        />
+                 </div>
             </div>
             <div class="item border blue" @click="handleDownLoadFile" v-permission="permissionBtn.ppt_download">
                 <img src="@/assets/imgs/ppt/icon_action_download.png" alt="">
@@ -383,18 +380,41 @@ const showPopover=ref(false)
 }
 .ppt-opt-wrap{
     .top-box{
+        box-sizing: border-box;
+        padding: 40px 40px 21px 40px;
         display: flex;
         justify-content: space-between;
-        .ppt-icon{
+        align-items: flex-start;
+        border-bottom: 1px solid $border-color;
+        img{
             width: 80px;
+            height: 80px;
+            margin-right: 23px;
         }
-        .flex{
-            display: flex;
-            align-items: center;
+
+        .title{
+            flex: 1;
             .name{
-                color: #999;
+                color: #333;
+                font-size: 28px;
+                font-weight: 400;
+            }
+            .person{
+                font-size: 24px;
+                color: #999999;
+                margin-top: 20px;
+            }
+        }
+
+        .share{
+            height: 80px;
+            margin-left: 32px;
+            display:flex;
+            align-items: center;
+            .share-font{
+                color: #666666;
                 font-size: 24px;
-                margin-top: 5px;
+                margin-right: 20px
             }
         }
     }

+ 244 - 30
src/views/ppt/components/MobileClassifyWrap.vue

@@ -26,12 +26,22 @@ const {
 
     goPPTDetail,
 
+    handleSetPPTShared,
+    PPTSetSharedOptState,
+    PPTSetSharedOptMethods,
+    getResearcherList,
+    researcherList,
+
+    chooseMemberOptState,
+    chooseMemberOptMethods,
+    handleChooseMember,
+
     permissionBtn,
-    checkAuthBtn
+    checkAuthBtn,
 }=useClassify()
 
 getPPTClassifyData()
-
+getResearcherList()
 
 // 跳转搜索
 async function goMobileSearch(){
@@ -85,13 +95,45 @@ const showPopover=ref(false)
                             @click.stop="goPPTDetail(_item)"
                         >
                             <span class="van-ellipsis text">{{ _item.Title }}</span>
-                            <div @click.stop="handleShowPPTOpt(_item)" class="menu-icon">
+                            <div @click.stop="handleShowPPTOpt(_item,'myPPT')" class="menu-icon">
                                 <img class="icon" src="@/assets/imgs/ppt/ppt_icon_menu.png" alt="">
                             </div>
                         </div>
                     </van-collapse-item>
                 </van-collapse>
             </van-collapse-item>
+            <van-collapse-item class="level-one" name="sharedPPT" :is-link="true">
+                <template #title>
+                    <div class="title-first">共享PPT</div>
+                </template>
+                <van-collapse class="level-two" v-model="classifyState.sharedActiveType" :border="false">
+                    <van-collapse-item
+                        :name="item.GroupId"
+                        v-for="item in classifyState.sharedList"
+                        :key="item.GroupId"
+                        :is-link="false"
+                    >
+                        <template #title>
+                            <div class="title-second">
+                                <img src="@/assets/imgs/ppt/ppt_icon_file.png" alt="">
+                                <span class="van-ellipsis">{{item.GroupName}}</span>
+                            </div>
+                        </template>
+                        <div 
+                            class="ppt-item"
+                            v-for="_item in item.PptList" 
+                            :key="_item.GroupId"
+                            @click.stop="goPPTDetail(_item)"
+                        >
+                            <span class="van-ellipsis text">{{ _item.Title }}</span>
+                            <div v-if="_item.IsGrant" @click.stop="handleShowPPTOpt(_item,'sharedPPT')" class="menu-icon">
+                                <img class="icon" src="@/assets/imgs/ppt/ppt_icon_menu.png" alt="">
+                            </div>
+                        </div>
+                    </van-collapse-item>
+                </van-collapse>
+            </van-collapse-item>
+
             <van-collapse-item class="level-one" name="pubPPT" :is-link="true">
                 <template #title>
                     <div class="title-first">公共PPT</div>
@@ -116,16 +158,81 @@ const showPopover=ref(false)
                             @click.stop="goPPTDetail(_item)"
                         >
                             <span class="van-ellipsis text">{{ _item.Title }}</span>
-                            <div @click.stop="handleShowPPTOpt(_item,true)" class="menu-icon">
+                            <div @click.stop="handleShowPPTOpt(_item,'pubPPT')" class="menu-icon">
                                 <img class="icon" src="@/assets/imgs/ppt/ppt_icon_menu.png" alt="">
                             </div>
                         </div>
                     </van-collapse-item>
                 </van-collapse>
-            </van-collapse-item>
+            </van-collapse-item>    
         </van-collapse>
     </div>
 
+    <!-- 设置共享弹框 -->
+    <van-popup 
+        v-model:show="PPTSetSharedOptState.show" 
+        round
+        position="bottom"
+    >
+        <div class="set-shared-popup">
+            <div class="set-shared-title">
+                    <span @click="PPTSetSharedOptMethods.cancel">取消</span>
+                    <span>选择共享用户</span>
+                    <span @click="PPTSetSharedOptMethods.save">确认</span>
+            </div>
+
+            <div class="set-shared-radios">
+                <van-radio-group v-model="PPTSetSharedOptState.chooseType" shape="dot">
+                    <van-cell-group inset>
+                        <van-cell title="全部用户" clickable @click="PPTSetSharedOptState.chooseType = '1'">
+                            <template #right-icon>
+                                <van-radio icon-size="14px" name="1" />
+                            </template>
+                        </van-cell>
+                        <van-cell title="指定成员" clickable @click="PPTSetSharedOptState.chooseType = '2'">
+                            <template #right-icon>
+                                <van-radio icon-size="14px" name="2" />
+                            </template>
+                        </van-cell>
+                    </van-cell-group>
+                </van-radio-group>
+            </div>
+
+            <div class="set-shared-result" >
+               <div v-show="PPTSetSharedOptState.chooseType == '2'" class="choosed-member-wrap">
+                   <div class="members-item-wrap">
+                       <div v-for="item in PPTSetSharedOptState.members" :key="item.text+item.id" class="members-item">
+                         <span>{{ item.text }}</span>
+                         <img src="@/assets/imgs/ppt/ppt_icon_set_close.png" @click="PPTSetSharedOptMethods.delete(item)" />
+                       </div>
+                   </div>
+               </div>
+              <div v-if="PPTSetSharedOptState.chooseType == '2'" class="btn" @click="PPTSetSharedOptMethods.chooseMember">选择指定成员</div> 
+            </div>
+
+        </div>
+    </van-popup>
+
+    <!-- 选择成员弹框 -->
+    <van-popup v-model:show="chooseMemberOptState.show" round position="bottom">
+        <div class="set-shared-title">
+                    <span @click="chooseMemberOptMethods.cancel">取消</span>
+                    <span>选择指定成员</span>
+                    <span @click="chooseMemberOptMethods.save">确认</span>
+        </div>
+        <div class="choose-member-popup" >
+            <van-sidebar v-model="chooseMemberOptState.slideActive" @change="chooseMemberOptMethods.change">
+                <van-sidebar-item v-for="item in researcherList" :title="item.text" :key="item.text+item.id"/>
+            </van-sidebar>
+            <van-tree-select
+                style="flex:1;height: 100%"
+                v-model:active-id="chooseMemberOptState.activeIdCopy"
+                v-model:main-active-index="chooseMemberOptState.activeIndex"
+                :items="chooseMemberOptState.acitiveItem"
+            />
+        </div>
+    </van-popup>
+
     <!-- 目录编辑弹窗 -->
     <van-popup 
         v-model:show="fileOptState.show" 
@@ -171,33 +278,38 @@ const showPopover=ref(false)
         position="bottom"
     >
         <div class="file-opt-wrap ppt-opt-wrap">
-            <div class="item border top-box">
-                <div class="flex">
-                    <img class="ppt-icon" src="@/assets/imgs/ppt/icon01.png" alt="">
-                    <div >
-                        <div class="title">{{PPTOptState.data.Title}}</div>
-                        <div class="name">
+            <div class="top-box">
+                 <img src="@/assets/imgs/ppt/icon01.png" alt="">
+                 <div class="title">
+                    <div class="name">{{PPTOptState.data.Title}}</div>
+                    <div class="person">
                             {{PPTOptState.data.AdminRealName}}
                             {{PPTOptState.data.PptCreateTime.split(' ')[0]}}
                             创建
-                        </div>
                     </div>
-                </div>
-                <div class="flex" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_visible)">
-                    <span style="margin-right:4px">公开</span>
-                    <van-switch 
-                        size="22px" 
-                        :model-value="PPTOptState.data.IsSingleShareBoolean"
-                        @update:model-value="handlePPTShare"
-                    />
-                </div>
-                
+                 </div>
+                 <div class="share" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_visible)&&PPTOptState.activeType=='myPPT'">
+                       <span class="share-font">公开</span>
+                        <van-switch 
+                            size="16px" 
+                            :model-value="PPTOptState.data.IsSingleShareBoolean"
+                            @update:model-value="handlePPTShare"
+                        />
+                 </div>
             </div>
-            <div class="item border blue" @click="handleShowPPTCopy" v-permission="permissionBtn.ppt_copy">
+            <div class="item border blue" @click="handleShowPPTCopy"  v-if="checkAuthBtn(permissionBtn.ppt_copy)&&(PPTOptState.activeType=='myPPT'||PPTOptState.activeType=='pubPPT')">
                 <img src="@/assets/imgs/ppt/ppt_icon_copy.png" alt="">
                 <span>复制</span>
             </div>
-            <div class="item border red" @click="handlePPTDel" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_del)">
+            <div class="item border blue" @click="handleSetPPTShared"  v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_setShare)&&(PPTOptState.activeType=='myPPT'||PPTOptState.activeType=='sharedPPT')">
+                <img src="@/assets/imgs/ppt/ppt_icon_set_shared.png" alt="">
+                <span>{{ PPTOptState.data.IsGrant ? '取消共享' : '设置共享' }}</span>
+            </div>
+            <div class="item border blue" @click="handleChooseMember"  v-if="!PPTOptState.isCommon&&PPTOptState.data.IsGrant&&PPTOptState.activeType=='sharedPPT'">
+                <img src="@/assets/imgs/ppt/ppt_icon_choose_member.png" alt="">
+                <span>选择用户</span>
+            </div>
+            <div class="item border red" @click="handlePPTDel" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_del)&&PPTOptState.activeType=='myPPT'">
                 <img src="@/assets/imgs/icon_del.png" alt="">
                 <span>删除</span>
             </div>
@@ -361,6 +473,76 @@ const showPopover=ref(false)
     }
 }
 
+.set-shared-popup{
+    .set-shared-radios{
+        padding-top: 20px;
+       :deep(.van-cell-group--inset){
+          margin: 0 40px;
+       }
+       :deep(.van-cell__title){
+          font-size: 28px;
+       }
+       :deep(.van-cell){
+          padding: 12px 0;
+       }
+       :deep(.van-cell::after){
+           border: none;
+       }
+    }
+    .set-shared-result{
+        height: 26vh;
+        display: flex;
+        flex-direction: column;
+        .choosed-member-wrap{
+            flex: 1;
+            overflow: auto;
+            .members-item-wrap{
+                display: flex;
+                flex-wrap: wrap;
+                box-sizing: border-box;
+                padding: 10px 20px;
+                .members-item{
+                    display: flex;
+                    align-items: center;
+                    vertical-align: middle;
+                    background-color: #F8F8F8;
+                    font-size: 28px;
+                    padding: 8px 16px;
+                    font-weight: 400;
+                    margin: 8px;
+                    color: #0052D9;
+                }
+                img{
+                    width: 32px;
+                    height: 32px;
+                    margin-left: 16px;
+                }
+            }
+        }
+
+        .btn{
+            margin: 28px auto 40px;
+            font-size: 28px;
+            background-color: rgb(0,82,217);
+            border-radius: 30px;
+            color: #ffffff;
+            cursor: pointer;
+            width: 500px;
+            height: 60px;
+            line-height: 60px;
+            text-align: center;
+        }
+    }
+}
+.set-shared-title{
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        box-sizing: border-box;
+        padding: 26px 42px;
+        border-bottom: 1px solid $border-color;
+        font-size: 26px;
+    }
 .file-rename-wrap{
     display: flex;
     align-items: center;
@@ -381,23 +563,55 @@ const showPopover=ref(false)
 
 .ppt-opt-wrap{
     .top-box{
+        box-sizing: border-box;
+        padding: 40px 40px 21px 40px;
         display: flex;
         justify-content: space-between;
-        .ppt-icon{
+        align-items: flex-start;
+        border-bottom: 1px solid $border-color;
+        img{
             width: 80px;
+            height: 80px;
+            margin-right: 23px;
         }
-        .flex{
-            display: flex;
-            align-items: center;
+
+        .title{
+            flex: 1;
             .name{
-                color: #999;
+                color: #333;
+                font-size: 28px;
+                font-weight: 400;
+            }
+            .person{
+                font-size: 24px;
+                color: #999999;
+                margin-top: 20px;
+            }
+        }
+
+        .share{
+            height: 80px;
+            margin-left: 32px;
+            display:flex;
+            align-items: center;
+            .share-font{
+                color: #666666;
                 font-size: 24px;
-                margin-top: 5px;
+                margin-right: 20px
             }
         }
     }
 }
 
+.choose-member-popup{
+    display: flex;
+    height: 48vh;
+    :deep(.van-sidebar-item){
+        padding: 38px 24px;
+        font-size: 28px;
+    }
+}
+
 .ppt-copy-wrap{
     display: flex;
     align-items: center;

+ 256 - 8
src/views/ppt/components/PadPPTIndexWrap.vue

@@ -3,7 +3,7 @@ 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'
-import {apiPPTList,apiPPTPubList} from '@/api/ppt'
+import {apiPPTList,apiPPTPubList,apiPPTShareList} from '@/api/ppt'
 import { useRouter } from 'vue-router'
 import moment from 'moment'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
@@ -32,16 +32,26 @@ const {
 
     goPPTDetail,
 
+    handleSetPPTShared,
+    PPTSetSharedOptState,
+    PPTSetSharedOptMethods,
+    getResearcherList,
+    researcherList,
+
+    chooseMemberOptState,
+    chooseMemberOptMethods,
+    handleChooseMember,
+
     permissionBtn,
     checkAuthBtn
 }=useClassify()
 getPPTClassifyData()
-
+getResearcherList()
 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)
+    return checkAuthBtn(permissionBtn.ppt_copy)||checkAuthBtn(permissionBtn.ppt_del) || checkAuthBtn(permissionBtn.ppt_setShare)
 })
 const activeType=ref('myPPT')
 
@@ -52,6 +62,8 @@ async function getPPTList(){
     let res 
     if(activeType.value=='myPPT'){
         res=await apiPPTList({GroupId:activeGroupId.value})
+    } else if(activeType.value=='sharedPPT'){
+        res=await apiPPTShareList({GroupId:activeGroupId.value})
     }else{
         res=await apiPPTPubList({AdminId:activeGroupId.value})
     }
@@ -98,6 +110,10 @@ const showPopover=ref(false)
                     :class="activeType=='myPPT'&&'active'"
                     @click="activeType='myPPT'"
                 >我的PPT</span>
+                <span 
+                    :class="activeType=='sharedPPT'&&'active'"
+                    @click="activeType='sharedPPT'"
+                >共享PPT</span>
                 <span
                     :class="activeType=='pubPPT'&&'active'"
                     @click="activeType='pubPPT'"
@@ -147,7 +163,7 @@ const showPopover=ref(false)
                             @click.stop="goPPTDetail(_item)"
                         >
                             <span class="van-ellipsis text">{{ _item.Title }}</span>
-                            <div @click.stop="handleShowPPTOpt(_item)">
+                            <div @click.stop="handleShowPPTOpt(_item,'myPPT')">
                                 <van-popover position="bottom-start">
                                     <template #reference>
                                         <img class="share-icon" :src="_item.IsSingleShareBoolean?openShareIcon:closeShareIcon" alt="" v-if="checkAuthBtn(permissionBtn.ppt_visible)">
@@ -164,7 +180,7 @@ const showPopover=ref(false)
                                     </div>
                                 </van-popover>
                             </div>
-                            <div @click.stop="handleShowPPTOpt(_item)">
+                            <div @click.stop="handleShowPPTOpt(_item,'myPPT')">
                                 <van-popover position="bottom-start">
                                     <template #reference>
                                         <div class="menu-icon" v-if="isOptPPTShow">
@@ -176,6 +192,10 @@ const showPopover=ref(false)
                                             <img src="@/assets/imgs/ppt/icon_action_copy.png" alt="">
                                             <span>复制</span>
                                         </div>
+                                        <div class="item" @click="handleSetPPTShared"  v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_setShare)">
+                                            <img src="@/assets/imgs/ppt/ppt_icon_set_shared_black.png" alt="">
+                                            <span>{{ PPTOptState.data.IsGrant ? '取消共享' : '设置共享' }}</span>
+                                        </div>
                                         <div class="item del" @click="handlePPTDel" v-permission="permissionBtn.ppt_del">
                                             <img src="@/assets/imgs/icon_del.png" alt="">
                                             <span>删除</span>
@@ -188,6 +208,53 @@ const showPopover=ref(false)
                     </van-collapse-item>
                 </van-collapse>
             </div>
+
+            <div class="classify-list" v-if="activeType=='sharedPPT'">
+                <van-collapse class="level-two" v-model="classifyState.sharedActiveType" :border="false">
+                    <van-collapse-item
+                        :name="item.GroupId"
+                        v-for="item in classifyState.sharedList"
+                        :key="item.GroupId"
+                        :is-link="false"
+                    >
+                        <template #title>
+                            <div class="title-second" @click="handleClickCatalogue(item)">
+                                <img src="@/assets/imgs/ppt/ppt_icon_file.png" alt="">
+                                <span class="van-ellipsis">{{item.GroupName}}</span>
+                            </div>
+                        </template>
+                        <div 
+                            class="ppt-item"
+                            v-for="_item in item.PptList" 
+                            :key="_item.GroupId"
+                            @click.stop="goPPTDetail(_item)"
+                        >
+                            <span class="van-ellipsis text">{{ _item.Title }}</span>
+                            <div v-if="_item.IsGrant" @click.stop="handleShowPPTOpt(_item,'sharedPPT')">
+                                <van-popover position="bottom-start">
+                                    <template #reference>
+                                        <div class="menu-icon" v-if="checkAuthBtn(permissionBtn.ppt_setShare)">
+                                            <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="handleSetPPTShared" v-if="!PPTOptState.isCommon&&checkAuthBtn(permissionBtn.ppt_setShare)">
+                                            <img src="@/assets/imgs/ppt/ppt_icon_set_shared_black.png" alt="">
+                                            <span>取消共享</span>
+                                        </div>
+                                        <div class="item" @click="handleChooseMember" v-if="!PPTOptState.isCommon&&PPTOptState.data.IsGrant">
+                                            <img src="@/assets/imgs/ppt/ppt_icon_choose_member_black.png" alt="">
+                                            <span>选择用户</span>
+                                        </div>
+                                    </div>
+                                </van-popover>
+                            </div>
+                            
+                        </div>
+                    </van-collapse-item>
+                </van-collapse>
+            </div>
+
             <div class="classify-list" v-if="activeType=='pubPPT'">
                 <van-collapse class="level-two" v-model="classifyState.pubActiveType" :border="false">
                     <van-collapse-item
@@ -209,7 +276,7 @@ const showPopover=ref(false)
                             @click.stop="goPPTDetail(_item)"
                         >
                             <span class="van-ellipsis text">{{ _item.Title }}</span>
-                            <div @click.stop="handleShowPPTOpt(_item)">
+                            <div @click.stop="handleShowPPTOpt(_item,'pubPPT')">
                                 <van-popover position="bottom-start">
                                     <template #reference>
                                         <div class="menu-icon">
@@ -298,6 +365,71 @@ const showPopover=ref(false)
             </van-popover>
         </div>
     </van-dialog>
+    <!-- 设置共享弹框 -->
+    <van-popup 
+        v-model:show="PPTSetSharedOptState.show" 
+        :close-on-click-overlay="false"
+        round
+    >
+        <div class="set-shared-popup">
+            <div class="set-shared-title">
+                    <span @click="PPTSetSharedOptMethods.cancel" class="cancel" >取消</span>
+                    <span class="title" >选择共享用户</span>
+                    <span @click="PPTSetSharedOptMethods.save" class="confirm">确认</span>
+            </div>
+
+            <div class="set-shared-radios">
+                <van-radio-group v-model="PPTSetSharedOptState.chooseType" shape="dot">
+                    <van-cell-group inset>
+                        <van-cell title="全部用户" clickable @click="PPTSetSharedOptState.chooseType = '1'">
+                            <template #right-icon>
+                                <van-radio icon-size="16px" name="1" />
+                            </template>
+                        </van-cell>
+                        <van-cell title="指定成员" clickable @click="PPTSetSharedOptState.chooseType = '2'">
+                            <template #right-icon>
+                                <van-radio icon-size="16px" name="2" />
+                            </template>
+                        </van-cell>
+                    </van-cell-group>
+                </van-radio-group>
+            </div>
+
+            <div class="set-shared-result">
+                    <div v-show="PPTSetSharedOptState.chooseType == '2'" class="choosed-member-wrap">
+                        <div class="members-item-wrap">
+                            <div v-for="item in PPTSetSharedOptState.members" :key="item.text+item.id" class="members-item">
+                                <span>{{ item.text }}</span>
+                                <img src="@/assets/imgs/ppt/ppt_icon_set_close.png" @click="PPTSetSharedOptMethods.delete(item)" />
+                            </div>
+                        </div>
+                    </div>
+                    <div v-show="PPTSetSharedOptState.chooseType == '2'" class="btn" @click="PPTSetSharedOptMethods.chooseMember">选择指定成员</div> 
+            </div>
+
+        </div>
+    </van-popup>
+    <!-- 选择成员弹框 -->
+    <van-popup v-model:show="chooseMemberOptState.show" round :close-on-click-overlay="false">
+        <div class="choose-memeber-wrap">
+            <div class="choose-memeber-title">
+                    <span>选择指定成员</span>
+                    <img src="../../../assets/imgs/dataEDB/close_outline_black.png" @click="chooseMemberOptMethods.cancel">
+            </div>
+            <div class="choose-member-popup">
+                    <van-sidebar v-model="chooseMemberOptState.slideActive" @change="chooseMemberOptMethods.change">
+                        <van-sidebar-item v-for="item in researcherList" :title="item.text" :key="item.text+item.id"/>
+                    </van-sidebar>
+                    <van-tree-select
+                        style="flex:1;height: 100%"
+                        v-model:active-id="chooseMemberOptState.activeIdCopy"
+                        v-model:main-active-index="chooseMemberOptState.activeIndex"
+                        :items="chooseMemberOptState.acitiveItem"
+                    />
+            </div>
+            <div class="choose-memeber-footer" @click="chooseMemberOptMethods.save">确定</div>
+        </div>
+    </van-popup>
 </template>
 
 <style lang="scss">
@@ -353,10 +485,127 @@ const showPopover=ref(false)
 </style>
 <style lang="scss" scoped>
 @media screen and (min-width:$media-width){
+    .choose-memeber-wrap{
+        width: 375px;
+        .choose-memeber-title{
+            position: relative;
+            text-align: center;
+            padding: 17px 56px;
+            font-size: 16px;
+            border-bottom: 1px solid $border-color;
+            img{
+                width: 24px;
+                height: 24px;
+                position: absolute;
+                right: 17px;
+                top:50%;
+                transform: translateY(-50%);
+            }
+        }
+        .choose-member-popup{
+                height: 27vh;
+                display: flex;
+                :deep(.van-sidebar-item){
+                    padding: 14px 12px;
+                    font-size: 14px;
+                }
+        }
+        .choose-memeber-footer{
+            font-size: 16px;
+            font-weight: 400;
+            text-align: center;
+            color: rgba(0, 82, 217, 1);
+            padding: 16px 0;
+            border-top: 1px solid $border-color;
+            cursor: pointer;
+        }
+        
+    }
+    .set-shared-popup{
+        width: 375px;
+        .set-shared-title{
+            display: flex;
+            justify-content: space-between;
+            align-items: flex-end;
+            padding: 17px;
+            border-bottom: 1px solid $border-color;
+            font-size: 16px;
+            .title{
+                font-size: 18px;
+                font-weight: 600;
+            }
+            .confirm{
+                color:rgba(0, 82, 217, 1);
+            }
+        }
+        .set-shared-radios{
+            padding-top: 5px;
+            :deep(.van-cell-group--inset){
+                margin: 0;
+            }
+            :deep(.van-cell__title){
+                font-size: 16px;
+            }
+            :deep(.van-cell){
+                padding: 14px 17px;
+            }
+            :deep(.van-cell::after){
+                left: 0;
+                width: 100%;
+                border: 1px solid $border-color;
+            }
+        }
+        .set-shared-result{
+            height: 23vh;
+            display: flex;
+            flex-direction: column;
+                .choosed-member-wrap{
+                    flex: 1;
+                    overflow: auto;
+                    .members-item-wrap{
+                        display: flex;
+                        flex-wrap: wrap;
+                        box-sizing: border-box;
+                        padding: 0 16px;
+                        .members-item{
+                            display: flex;
+                            align-items: center;
+                            vertical-align: middle;
+                            font-size: 14px;
+                            font-weight: 400;
+                            color: rgba(0, 82, 217, 1);
+                            padding: 4px 8px;
+                            background: rgba(248, 248, 248, 1);
+                            margin: 8px;
+                            img{
+                                width: 16px;
+                                height: 16px;
+                                margin-left: 8px;
+                            }
+                        }
+                    }
+                }
+                .btn{
+                    width: 341px;
+                    height: 44px;
+                    padding: 10px 20px 10px 20px;
+                    border-radius: 4px;
+                    background: rgba(0, 82, 217, 1);
+                    display: flex;
+                    justify-content: center;
+                    align-items: center;
+                    margin:16px auto 20px;
+                    font-size: 14px;
+                    color: rgba(255, 255, 255, 1);
+                }
+        }
+
+    }
+
     .pad-ppt-index-wrap{
         display: flex;
         .left-classify-wrap{
-            width: 300px;
+            width: 350px;
             min-height: 100vh;
             border-right: 1px solid $border-color;
             padding: 30px;
@@ -541,7 +790,6 @@ const showPopover=ref(false)
         }
     }
 
-
 }
 
 </style>

+ 183 - 8
src/views/ppt/hooks/useClassify.js

@@ -14,7 +14,11 @@ import {
     apiPPTCatalogueRename,
     apiPPTDel,
     apiPPTShare,
-    apiPPTCopy
+    apiPPTCopy,
+    cancelShareAuth,
+    setShareAuth,
+    getSharedDetail,
+    userSearch,
 } from '@/api/ppt'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 
@@ -30,9 +34,11 @@ export function useClassify(){
     const classifyState = reactive({
         privateList:[],
         publicList:[],
-        activeType:['myPPT','pubPPT'],//一级分类是否展开
+        sharedList:[],
+        activeType:['myPPT','pubPPT','sharedPPT'],//一级分类是否展开
         myActiveType:[],//我的ppt文件夹是否展开
         pubActiveType:[],//公共ppt文件夹是否展开
+        sharedActiveType:[],//共享ppt文件夹是否展开
     })
     // 获取ppt分类数据
     const getPPTClassifyData=async()=>{
@@ -53,6 +59,7 @@ export function useClassify(){
                 return item.GroupId
             }) */
             classifyState.publicList=res.Data.PublicList||[]
+            classifyState.sharedList=res.Data.GrantList||[]
         }
     }
 
@@ -121,14 +128,15 @@ export function useClassify(){
         showCopy:false,//显示选择复制到目录的弹窗
         copyActions:[],//选择复制到目录数
         copySelectData:{},//复制选择的目录
-        
+        activeType:'',//该PPT的类型
     })
     // e ppt的数据
-    const handleShowPPTOpt=(e)=>{
+    const handleShowPPTOpt=(e,activeType)=>{
         PPTOptState.data=e
         PPTOptState.data.IsSingleShareBoolean=e.IsSingleShare?true:false
         PPTOptState.isCommon=userInfo.value.AdminId!=e.AdminId?true:false
         PPTOptState.show=true
+        PPTOptState.activeType = activeType
     }
     // 删除ppt
     // back 则返回上一级
@@ -160,6 +168,166 @@ export function useClassify(){
             PPTOptState.data.IsSingleShareBoolean=e
         }
     }
+
+    //设置共享 指定成员列表
+    const researcherList = ref([]); //指定成员列表
+    const getResearcherList = async () => {  
+        const formatList = function(arr){ //vant数据格式化
+            let result = [];
+            for(let i = 0;i < arr.length;i++){
+              let item = {};
+              item.id = arr[i].ItemId;
+              item.text = arr[i].ItemName;
+              if(arr[i].Children && arr[i].Children.length > 0){
+                item.children = formatList(arr[i].Children)
+              }
+              result.push(item)
+            }
+            return result
+        } ;
+
+        const { Data }  = await userSearch()
+        researcherList.value = formatList(Data) || [];
+        chooseMemberOptState.acitiveItem = researcherList.value[0].children || [];
+    }
+
+
+    // 显示设置共享ppt弹窗
+    const PPTSetSharedOptState=reactive({
+        show:false,
+        chooseType:'1',//共享类型
+        members:[], //选中成员的item
+    })
+
+    //设置为共享PPT
+    const handleSetPPTShared = () => {
+        if(PPTOptState.data.IsGrant) { //取消共享
+            showDialog({
+                title: '提示',
+                message: '确定要取消共享吗?',
+                showCancelButton:true
+            }).then(_=>{
+                cancelShareAuth({PptId:PPTOptState.data.PptId}).then(res=>{
+                    if(res.Ret == 200){
+                        showToast('取消共享成功');
+                        getPPTClassifyData();
+                        PPTOptState.show = false;
+                    }
+                }).catch(()=>{})
+            }).catch(err=>{})
+            return
+        }
+
+        //设置共享
+        PPTSetSharedOptMethods.init();
+        chooseMemberOptMethods.init();
+        PPTOptState.show = false; 
+        PPTSetSharedOptState.show = true;  
+    }
+
+    //设置共享弹窗方法
+    const PPTSetSharedOptMethods = {
+       init(){
+            PPTSetSharedOptState.show = false;
+            PPTSetSharedOptState.chooseType = '1';
+            PPTSetSharedOptState.members = [];
+       },
+       cancel(){
+            this.init();
+            chooseMemberOptMethods.init();
+       },
+       save(){
+            if(PPTSetSharedOptState.chooseType == '2' && !chooseMemberOptState.activeId.length) return showToast('请选择研究员!');
+            setShareAuth({
+                PptId:PPTOptState.data.PptId,
+                GrantType:+PPTSetSharedOptState.chooseType,
+                AdminIdStr: PPTSetSharedOptState.chooseType=='2' ? chooseMemberOptState.activeId.join(',') : ''
+            }).then(res=>{
+                if(res.Ret == 200){
+                    showToast('设置共享成功');
+                    getPPTClassifyData();
+                    PPTSetSharedOptState.show = false;
+                    PPTOptState.show = false;
+                }
+            })
+       },
+       chooseMember(){
+             chooseMemberOptState.show = true;
+       },
+       delete(e){
+         if(PPTSetSharedOptState.members.findIndex(_=>_.id == e.id) >= 0)  PPTSetSharedOptState.members.splice(PPTSetSharedOptState.members.findIndex(_=>_.id == e.id),1);
+         if(chooseMemberOptState.activeId.findIndex(_=>_ == e.id) >= 0)  chooseMemberOptState.activeId.splice(chooseMemberOptState.activeId.findIndex(_=>_ == e.id),1);
+         if(chooseMemberOptState.activeIdCopy.findIndex(_=>_ == e.id) >= 0) chooseMemberOptState.activeIdCopy.splice(chooseMemberOptState.activeIdCopy.findIndex(_=>_ == e.id),1);
+       },
+    }
+
+    //选择用户弹框
+    const handleChooseMember = () => {
+        PPTSetSharedOptMethods.init();
+        chooseMemberOptMethods.init();
+        getSharedDetail({PptId:PPTOptState.data.PptId}).then(res=>{
+            if(res.Ret == 200){
+                 chooseMemberOptState.activeId = res.Data.AdminIdStr ? res.Data.AdminIdStr.split(',').map(_=>+_) : [];
+                 chooseMemberOptState.activeIdCopy = chooseMemberOptState.activeId.slice(0);
+                 PPTSetSharedOptState.chooseType = res.Data.GrantType.toString();
+                 PPTSetSharedOptState.show = true;
+                 PPTOptState.show = false;
+                 PPTSetSharedOptState.members = chooseMemberOptMethods.idsForItems(chooseMemberOptState.activeId,researcherList.value);
+            }
+        })
+    }
+
+    //选取指定成员弹框
+    const chooseMemberOptState = reactive({
+        show:false,
+        slideActive:0, //侧边框默认值
+        acitiveItem:[], //侧边框选中的内容
+        activeId:[], // 选中的id
+        activeIndex:0, //分类选择index
+        activeIdCopy:[], //选择成员未保存时的副本
+    })
+
+    const chooseMemberOptMethods = {
+        change(){
+            chooseMemberOptState.acitiveItem = researcherList.value[chooseMemberOptState.slideActive].children || [];
+            chooseMemberOptState.activeIndex = 0;
+        },
+        init(options = {}){
+            chooseMemberOptState.acitiveItem = researcherList.value[0].children || [];
+            chooseMemberOptState.show = false;
+            chooseMemberOptState.slideActive = 0;
+            chooseMemberOptState.activeIndex = 0;
+            if(!options.jumpActiveId) chooseMemberOptState.activeId = [];
+            if(!options.jumpActiveIdCopy) chooseMemberOptState.activeIdCopy = [];
+        },
+        idsForItems(ids,lists){  //利用id转换items
+            let result = [];
+            for(let i = 0; i < lists.length;i++){
+                if(ids.includes(lists[i].id)){
+                    result.push(lists[i]);
+                }
+                if(lists[i].children && lists[i].children.length > 0){
+                    let r = this.idsForItems(ids,lists[i].children);
+                    result = result.concat(r);
+                }
+            }
+            return result
+        },
+        cancel(){
+            this.init({
+                jumpActiveIdCopy:true,
+                jumpActiveId:true
+            });
+            chooseMemberOptState.activeIdCopy = chooseMemberOptState.activeId.slice(0); 
+        },
+        save(){
+            chooseMemberOptState.activeId = chooseMemberOptState.activeIdCopy.slice(0);
+            PPTSetSharedOptState.members = chooseMemberOptMethods.idsForItems(chooseMemberOptState.activeId,researcherList.value);
+            chooseMemberOptState.show = false;
+        },
+
+    }
+
     // 显示复制ppt选择目录弹窗
     // 如果是详情页中调用则会传一个pptid
     const handleShowPPTCopy=({pptid})=>{
@@ -169,7 +337,6 @@ export function useClassify(){
                 ...item
             }
         })
-        console.log(pptid);
         if(pptid){
             PPTOptState.data.PptId=Number(pptid)
         }
@@ -198,7 +365,6 @@ export function useClassify(){
     }
     // 关闭复制ppt选择目录弹窗钩子函数
     const handlePPTCopyBeforeClose=(action)=>{
-        console.log(action);
         if(action==='confirm'&&!PPTOptState.copySelectData.GroupId){
             return false
         }else{
@@ -227,7 +393,6 @@ export function useClassify(){
         }
     }
 
-
     return {
         classifyState,
         getPPTClassifyData,
@@ -248,7 +413,17 @@ export function useClassify(){
 
         goPPTDetail,
 
+        getResearcherList,
+        researcherList,
+        handleSetPPTShared,
+        PPTSetSharedOptState,
+        PPTSetSharedOptMethods,
+
+        chooseMemberOptState,
+        chooseMemberOptMethods,
+        handleChooseMember,
+
         permissionBtn,
-        checkAuthBtn
+        checkAuthBtn,
     }
 }