Commit abecb121 authored by 罗超's avatar 罗超

新增分享,处理目录问题

parent cf245240
......@@ -9,7 +9,7 @@
</el-icon>
</span>
<span class="q-pl-md" :class="[queryObj.FileId == 0 ? '' : 'row items-center']">
<span class="pointer" @click="(queryObj.FileId = 0), refreshHandler()">分享</span>
<span class="pointer" @click="clearNavigationHandler">分享</span>
<breadPeeling v-if="queryObj.FileId" :navigations="navigations" @Inquire="breadPeelingInquire">
</breadPeeling>
</span>
......@@ -24,15 +24,15 @@
<div></div>
</div>
<div class="col full-width">
<el-table class="sample-table" :data="data" style="width: 100%" height="100%" v-loading="loading">
<el-table class="sample-table" :data="data" style="width: 100%" height="100%" v-loading="loading" @sort-change="sortHandler" :default-sort="{ prop: 'CreateTime', order: 'descending' }">
<el-table-column type="selection" width="20" />
<el-table-column label="文档名称" className="indentLeft">
<el-table-column label="文档名称 " className="indentLeft" :filters="[{ text: '行程', value: '1' },{ text: '广告', value: '2' }]" :filter-method="filterFileTypeHandler" filter-placement="bottom">
<template #default="scope">
<div class="row items-center full-width" style="padding-left: 12px;">
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708337830000_43.png" height="25" v-if="scope.row.FileType==1" />
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708250377000_777.png" height="25" v-else-if="scope.row.FileType==2" />
<img src="@/assets/img/file.png" height="25" v-else />
<div class="temp-tr col q-ml-md file-name" :class="{'cusor-pointer':scope.row.FileType==0}">
<div class="temp-tr col q-ml-md file-name" :class="{'cusor-pointer':scope.row.FileType==0}" @click="changeFolderHandler(scope.row)">
<el-tooltip effect="dark" :content="scope.row.FileName">
{{ scope.row.FileName }}
</el-tooltip>
......@@ -40,7 +40,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="最近修改" width="150">
<el-table-column label="最近修改" width="150" sortable="custom" prop="CreateTime">
<template #default="scope">
{{ formatDateTimeToRead(scope.row.UpdateTime&&scope.row.UpdateTime!=''?scope.row.UpdateTime:scope.row.CreateTime) }}
</template>
......@@ -54,9 +54,9 @@
<el-icon size="16" color="#b1b7cf"><MoreFilled /></el-icon>
<template #dropdown>
<el-dropdown-menu class="q-pa-md">
<el-dropdown-item v-if="scope.row.IsEditor && scope.row.FileType!=0" icon="EditPen">编辑</el-dropdown-item>
<el-dropdown-item v-if="scope.row.IsDownload && scope.row.FileType!=0" icon="Download">导出</el-dropdown-item>
<el-dropdown-item icon="Copy" v-if="scope.row.IsView">复制到</el-dropdown-item>
<el-dropdown-item v-if="scope.row.IsEdit && scope.row.FileType!=0" icon="EditPen" @click="editorFileHandler(scope.row)">编辑</el-dropdown-item>
<el-dropdown-item v-if="scope.row.IsDownload && scope.row.FileType!=0" icon="Download" @click="exportDocument(scope.row)">导出</el-dropdown-item>
<el-dropdown-item icon="Copy" v-if="scope.row.IsView" @click="openCopyHandler(scope.row)">复制到</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
......@@ -69,14 +69,19 @@
</el-table>
</div>
</div>
<CopyFile v-if="openCopy" :details="copyObject" @close="() => openCopy=false"></CopyFile>
</template>
<script setup lang="ts">
import { ApiResult } from "@/configs/axios";
import ConfigService from "@/services/ConfigService";
import { ElMessage } from "element-plus";
import { reactive, ref } from "vue";
import { inject, reactive, ref } from "vue";
import {formatDateTimeToRead, query} from '@/utils/common'
import { Download,View } from "@element-plus/icons-vue";
import breadPeeling from './components/breadPeeling.vue'
import CopyFile from './components/CopyFile.vue'
import { useScreenStore, useSellTemplateStore, useSlidesStore } from "@/store";
import { injectKeyTemplate } from "@/types/injectKey";
import FolderService from "@/services/FolderService";
const queryObj = reactive<any>({
pageIndex: 1,
......@@ -84,6 +89,7 @@ const queryObj = reactive<any>({
pageCount: 0, //总页数
FileType: 0,
FileId: 0,
OrderByType:2
});
const refreshLoading = ref(false);
const navigations = ref<{ FileId: number; FileName: string }[]>([]);
......@@ -93,6 +99,10 @@ const data = ref<any[]>([])
const loading = ref(false)
const pageCount = ref(0)
const showItemId = ref(0)
const openCopy = ref(false)
const copyObject = ref<any>()
const searchData = ref({} as any);
searchData.value = inject(injectKeyTemplate);
const backInquireHandler = () => {
let Navigation = navigations.value[navigations.value.length - 2];
......@@ -106,6 +116,25 @@ const breadPeelingInquire = (FileId: number, index: number) => {
queryObj.FileId = FileId;
refreshHandler();
}
const editorFileHandler = (item:any)=>{
let list:any = [{
id: "test-slide-1",
pageType: 0,
elements: [],
background: {
type: "solid",
color: "#ffffff",
},
}];
const SalesEditorStore = useSellTemplateStore();
useSlidesStore().setSlides(list);
const marketStore = useScreenStore();
searchData.value.sellId = item.FileId;
searchData.value.sellTempId = item.TempId;
searchData.value.TemplateType = item.FileType;
SalesEditorStore.setSalesEditor(2);
marketStore.setMarket(false);
}
const getDocumentData = async () => {
if(loading.value) return
loading.value=true
......@@ -133,12 +162,71 @@ const exportDocument = (item:any) => {
if(item.FileType==1) url = `http://fileservice.oytour.com/api/pdf/${item.FileId}`
window.open(url);
}
const changeFolderHandler = async (item:any) =>{
if(item.FileType==0){
queryObj.FileId=item.FileId
navigations.value.push({
FileId:item.FileId,
FileName:item.FileName
})
await refreshHandler()
}
}
const dropdownChange = (val:boolean,id:number) => {
showItemId.value = val?id:0
}
const refreshHandler = () => {
};
const clearNavigationHandler = async () => {
navigations.value = []
queryObj.FileId=0
await refreshHandler()
}
const refreshHandler = async () => {
queryObj.pageIndex=0
queryObj.pageCount=0
data.value=[]
refreshLoading.value=true
await getDocumentData()
}
const openCopyHandler = (item:any)=>{
openCopy.value=true,
copyObject.value = item
}
const sortHandler = (val:any)=>{
queryObj.OrderByType = val=='descending'?2:1
refreshHandler()
}
const filterFileTypeHandler = (val:any)=>{
console.log(val)
}
const collectHandler = async (row:any) => {
if(loading.value) return
let errmsg = ''
loading.value=true
try {
let queryMsg = {
FileId: row.FileId,
FileType: row.FileType,
IsCollect: row.IsCollect?0:1,
}
let response = await FolderService.SetFileCollect(queryMsg);
if (response.data.resultCode == ApiResult.SUCCESS) {
ElMessage.success({
message: `${queryMsg.IsCollect?'收藏':'取消收藏'}${row.FileName}成功`
});
row.IsCollect=!row.IsCollect
}else{
errmsg = `收藏${row.FileName}失败,请刷新页面重试`
}
} catch (error) {
errmsg = `收藏${row.FileName}失败,请刷新页面重试`
}
if(errmsg!=''){
ElMessage.error({
message:errmsg
})
}
loading.value=false
}
getDocumentData()
</script>
<style>
......@@ -193,6 +281,9 @@ getDocumentData()
text-overflow:ellipsis;
width: 0;
}
.el-table .caret-wrapper{
height: 12px !important;
}
/* .sample-table th:nth-child(2) .cell{
padding-left: 0 !important;
} */
......
......@@ -11,7 +11,6 @@ import OrgService from '@/services/OrgService';
import { ref,reactive,watch } from 'vue';
import { View,Download,EditPen,Delete } from '@element-plus/icons-vue';
import FolderService from "@/services/FolderService";
const props = defineProps({
navigations:{
type: Array,
......
......@@ -667,6 +667,7 @@ const operaFolder = (id: number, name: string) => {
folderObj.value.id = id;
folderObj.value.name = name;
folderObj.value.type = queryObj.FileType;
folderObj.value.parentId = queryObj.FileId
};
const checkPositionHandler = (n:any)=>{
if(n){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment