|
@@ -1,16 +1,24 @@
|
|
|
//ppt分类模块
|
|
|
|
|
|
import {ref,reactive} from 'vue'
|
|
|
-import { showToast,showDialog } from 'vant';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
+import { showToast,showDialog,Dialog } from 'vant';
|
|
|
import {
|
|
|
apiPPTClassify,
|
|
|
apiPPTCatalogueCopy,
|
|
|
apiPPTCatalogueDel,
|
|
|
- apiPPTDel
|
|
|
+ apiPPTCatalogueRename,
|
|
|
+ apiPPTDel,
|
|
|
+ apiPPTShare,
|
|
|
+ apiPPTCopy
|
|
|
} from '@/api/ppt'
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
export function useClassify(){
|
|
|
+ const router=useRouter()
|
|
|
// ppt分类数据
|
|
|
const classifyState = reactive({
|
|
|
privateList:[],
|
|
@@ -25,7 +33,7 @@ export function useClassify(){
|
|
|
if(res.Ret===200){
|
|
|
const temPriArr=res.Data.PrivateList||[]
|
|
|
classifyState.privateList=temPriArr.map(item=>{
|
|
|
- item.PptList=item.PptList.map(_item=>{
|
|
|
+ item.PptList=item.PptList?.map(_item=>{
|
|
|
return {
|
|
|
..._item,
|
|
|
IsSingleShareBoolean:_item.IsSingleShare?true:false
|
|
@@ -44,9 +52,12 @@ export function useClassify(){
|
|
|
const fileOptState=reactive({
|
|
|
show:false,
|
|
|
data:{},//当前点击的目录数据
|
|
|
+ showReName:false,//显示重命名弹窗
|
|
|
+ reNameVal:"",
|
|
|
})
|
|
|
const handleShowFileOpt=e=>{
|
|
|
fileOptState.data=e
|
|
|
+ fileOptState.reNameVal=e.GroupName
|
|
|
fileOptState.show=true
|
|
|
}
|
|
|
// 复制ppt目录
|
|
@@ -66,6 +77,7 @@ export function useClassify(){
|
|
|
showDialog({
|
|
|
title: '提示',
|
|
|
message: '删除操作不可恢复,确认删除吗?',
|
|
|
+ showCancelButton:true
|
|
|
}).then(() => {
|
|
|
// on close
|
|
|
apiPPTCatalogueDel({GroupId:fileOptState.data.GroupId}).then(res=>{
|
|
@@ -76,11 +88,28 @@ export function useClassify(){
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
+ // 目录重命名
|
|
|
+ const handlePPTCatalogueReName=async ()=>{
|
|
|
+ if(!fileOptState.reNameVal){
|
|
|
+ showToast('请填写目录名称');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const res=await apiPPTCatalogueRename({
|
|
|
+ GroupId:fileOptState.data.GroupId,
|
|
|
+ GroupName:fileOptState.reNameVal
|
|
|
+ })
|
|
|
+ if(res.Ret===200){
|
|
|
+ getPPTClassifyData()
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 显示ppt录编辑弹窗
|
|
|
const PPTOptState=reactive({
|
|
|
show:false,
|
|
|
- data:{}
|
|
|
+ data:{},
|
|
|
+ showCopy:false,//显示选择复制到目录的弹窗
|
|
|
+ copyActions:[],//选择复制到目录数
|
|
|
+ copySelectData:{},//复制选择的目录
|
|
|
})
|
|
|
const handleShowPPTOpt=(e)=>{
|
|
|
PPTOptState.data=e
|
|
@@ -91,16 +120,61 @@ export function useClassify(){
|
|
|
showDialog({
|
|
|
title: '提示',
|
|
|
message: '删除操作不可恢复,若该PPT被共享,则同步删除共享PPT,确认删除吗?',
|
|
|
+ showCancelButton:true
|
|
|
}).then(() => {
|
|
|
// on close
|
|
|
- apiPPTDel({GroupId:PPTOptState.data.PptId}).then(res=>{
|
|
|
+ apiPPTDel({PptId:PPTOptState.data.PptId}).then(res=>{
|
|
|
if(res.Ret===200){
|
|
|
getPPTClassifyData()
|
|
|
PPTOptState.show=false
|
|
|
}
|
|
|
- })
|
|
|
+ }).catch(()=>{})
|
|
|
});
|
|
|
}
|
|
|
+ //设置ppt是否共享
|
|
|
+ const handlePPTShare=async (e)=>{
|
|
|
+ const res=await apiPPTShare({
|
|
|
+ PptId:PPTOptState.data.PptId
|
|
|
+ })
|
|
|
+ if(res.Ret===200){
|
|
|
+ getPPTClassifyData()
|
|
|
+ PPTOptState.data.IsSingleShareBoolean=e
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 显示复制ppt选择目录弹窗
|
|
|
+ const handleShowPPTCopy=()=>{
|
|
|
+ PPTOptState.copyActions=classifyState.privateList.map(item=>{
|
|
|
+ return {
|
|
|
+ text:item.GroupName,
|
|
|
+ ...item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ PPTOptState.showCopy=true
|
|
|
+ }
|
|
|
+ // 保存 复制ppt
|
|
|
+ const handlePPTCopy=()=>{
|
|
|
+ apiPPTCopy({
|
|
|
+ PptId:PPTOptState.data.PptId,
|
|
|
+ GroupId:PPTOptState.copySelectData.GroupId
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.Ret===200){
|
|
|
+ getPPTClassifyData()
|
|
|
+ PPTOptState.showCopy=false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 跳转ppt详情
|
|
|
+ const goPPTDetail=(e)=>{
|
|
|
+ console.log(e);
|
|
|
+ router.push({
|
|
|
+ path:"/ppt/detail",
|
|
|
+ query:{
|
|
|
+ id:e.PptId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
|
|
|
return {
|
|
@@ -111,9 +185,15 @@ export function useClassify(){
|
|
|
handleShowFileOpt,
|
|
|
handlePPTCatalogueCopy,
|
|
|
handlePPTCatalogueDel,
|
|
|
+ handlePPTCatalogueReName,
|
|
|
|
|
|
PPTOptState,
|
|
|
handleShowPPTOpt,
|
|
|
- handlePPTDel
|
|
|
+ handlePPTDel,
|
|
|
+ handlePPTShare,
|
|
|
+ handleShowPPTCopy,
|
|
|
+ handlePPTCopy,
|
|
|
+
|
|
|
+ goPPTDetail
|
|
|
}
|
|
|
}
|