Commit 86ec99f4 authored by zhengke's avatar zhengke

新增编辑文件夹

parent db0917d3
...@@ -4,6 +4,13 @@ import Api,{ HttpResponse, Result } from './../utils/request'; ...@@ -4,6 +4,13 @@ import Api,{ HttpResponse, Result } from './../utils/request';
* 配置相关方法 * 配置相关方法
*/ */
class ConfigService{ class ConfigService{
/**
* 我的云文档列表(行程、广告)
*/
static async GetMyTripFolderPage(params : any):Promise<HttpResponse>{
return Api.Post("triptemplate_GetMyTripFolderPage",params)
}
/** /**
* 分享销售模版详情 * 分享销售模版详情
......
...@@ -3,11 +3,12 @@ import Api,{ HttpResponse, Result } from './../utils/request'; ...@@ -3,11 +3,12 @@ import Api,{ HttpResponse, Result } from './../utils/request';
class FolderService{ class FolderService{
static async SetFolderAsync(FolderId:number,FolderName:string,ParendFolderId:number):Promise<HttpResponse>{ static async SetFolderAsync(FolderId:number,FolderName:string,ParendFolderId:number,FolderType:number):Promise<HttpResponse>{
let msg = { let msg = {
FolderId, FolderId,
FolderName, FolderName,
ParendFolderId ParendFolderId,
FolderType
} }
return Api.Post("triptemplate_SetTripFolder",msg) return Api.Post("triptemplate_SetTripFolder",msg)
} }
......
...@@ -34,8 +34,12 @@ const props = defineProps({ ...@@ -34,8 +34,12 @@ const props = defineProps({
type:String, type:String,
default:'' default:''
}, },
folderType:{
type:String,
default:1
}
}) })
const emit = defineEmits<{ const emit = defineEmits<{
(event: 'close'): void, (event: 'close'): void,
(event: 'success'): void (event: 'success'): void
}>() }>()
...@@ -51,8 +55,9 @@ const saveFolder=async ()=>{ ...@@ -51,8 +55,9 @@ const saveFolder=async ()=>{
if(name.value=='') errmsg='请输入文件夹名称' if(name.value=='') errmsg='请输入文件夹名称'
if(errmsg==''){ if(errmsg==''){
try { try {
let response = await FolderService.SetFolderAsync(props.folderId,name.value,props.parentId) let response = await FolderService.SetFolderAsync(props.folderId,name.value,props.parentId,props.folderType)
if(response.data.resultCode==ApiResult.SUCCESS){ if(response.data.resultCode==ApiResult.SUCCESS){
emit('success')
ElMessage.success({ ElMessage.success({
message:'操作成功' message:'操作成功'
}) })
......
<template>
<el-dialog v-model="show" v-loading="loading" :show-close="false"
:close-on-press-escape="false" :close-on-click-modal="false"
style="max-width:1000px;">
<template #header>
<div class="row overflow-hide">
<div>
<img class="q-px-md"
:src="details.TemplateType==1?datas.pdfImg:datas.adsImg"
style="height: 43px;" />
</div>
<div class="q-pl-md col">
<div>
<el-tooltip
placement="top-start">
<template #content><div style="max-width: 600px;">{{details.Title}}</div></template>
<div class="HistoricalVersion-Title pointer">{{details.Title}}</div>
</el-tooltip>
</div>
<div class="text-small text-5B5D62 q-pt-sm">创建者:{{details.CreateByName}}</div>
</div>
</div>
</template>
<el-scrollbar @scroll="scrollingHandler" height="100%">
<div class="HistoricalVersion-container" ref="HistoricalVersion">
<table class="text-small" style="width: 100%;">
<tr class="text-left">
<th class="text-light" style="min-width: 100px;width: 110px;">时间</th>
<th class="text-light"><div class="text-left q-pl-md">更新者</div></th>
<th class="text-light" style="min-width: 100px;width: 110px;">大小</th>
<th class="text-light" style="min-width: 100px;width: 100px;">版本名称</th>
<th class="text-light" style="min-width: 120px;width: 120px;">操作</th>
</tr>
<template v-for="(item,index) in dataList">
<tr class="text-5B5D62 journeyAdsple-table pointer">
<td style="width: 30px;">
</td>
<td class="journeyAds-title wrap">
<span>{{}}</span>
</td>
<td class="text-center"><span>{{}}</span></td>
<td class="text-center"><span>{{}}</span></td>
<td class="text-center">
</td>
</tr>
</template>
</table>
<div v-if="dataList.length == 0 && !loading" class="q-mt-lg bg-white rounded"
style="padding: 30px 10px 30px 10px;">
<el-empty description="暂无数据" />
</div>
<el-divider class="no-bg q-mt-lg" v-if='queryObj.pageCount == queryObj.pageIndex && !loading'>
<span class="text-small bg-white" style="padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span>
</el-divider>
<div style="height:40px;" class="q-mt-md no-bg" background="transparent" v-loading="loading" element-loading-text="正在加载中"></div>
</div>
</el-scrollbar>
<template #footer>
<span class="dialog-footer">
<el-button @click="()=>closedhandler()">关闭</el-button>
<!-- <el-button type="primary" @click="()=>closedhandler()"> 保存分享配置 </el-button> -->
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ApiResult } from '@/configs/axios';
import OrgService from '@/services/OrgService';
import { ref,reactive } from 'vue';
import { View,Download,EditPen,Delete } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
import ConfigService from '@/services/ConfigService';
const props = defineProps({
id:{
type:Number,
required:true
},
details: {
type:Object,
required:{}
}
})
const emit = defineEmits<{
(event: 'close'): void
}>()
const datas = reactive({
pdfImg: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708337830000_43.png',
adsImg: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708250377000_777.png',
})
const show=ref(true)
const loading = ref(true)
const HistoricalVersion = ref<any>()
const queryObj = reactive({
Title: '',
pageIndex: 1,
pageSize: 20,
pageCount: 0, //总页数
Id: props.details.Id,
TemplateType: props.details.TemplateType,
})
const dataList=ref([])
const closedhandler=()=>{
emit('close')
}
const querySearchHandler = async () => {
loading.value = true
try {
if(queryObj.pageIndex == 1) dataList.value =[]
let pageRes = await ConfigService.sellGetTripOtherPage(queryObj);
if (pageRes.data.resultCode == 1) {
dataList.value = dataList.value.concat(pageRes.data.data.pageData);
queryObj.pageCount = pageRes.data.data.pageCount;
}
loading.value = false
} catch (error) {
loading.value = false
}
}
const scrollingHandler = () =>{
if(HistoricalVersion.value && !loading.value){
let maxHeight = HistoricalVersion.value.scrollHeight - HistoricalVersion.value.offsetHeight
let scrollTop = HistoricalVersion.value.scrollTop
if((maxHeight - scrollTop==0||maxHeight - scrollTop<1) && queryObj.pageCount > queryObj.pageIndex) {
queryObj.pageIndex++
querySearchHandler()
}
}
}
querySearchHandler()
</script>
<style scoped>
.HistoricalVersion-Title{
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 15px;
}
.HistoricalVersion-container th{
padding: 0 10px 10px 10px;
border-bottom: 1px solid #f6f6f6;
}
.HistoricalVersion-container td{
padding: 0 10px;
}
</style>
\ No newline at end of file
...@@ -47,31 +47,35 @@ ...@@ -47,31 +47,35 @@
:style="{'opacity':item.singleChoice?1:''}"> :style="{'opacity':item.singleChoice?1:''}">
<el-checkbox size="sm" class="SelectAllBox" v-model="item.singleChoice" <el-checkbox size="sm" class="SelectAllBox" v-model="item.singleChoice"
@click="singleChoice(item)"/></div></td> @click="singleChoice(item)"/></div></td>
<td style="width: 30px;" @click.stop="OffEdit"><img class="q-px-md" :src="item.TemplateType==1?datas.pdfImg:datas.adsImg" <td style="width: 30px;" @click.stop="OffEdit">
style="height: 25px;" /></td> <img v-if="item.FileType" class="q-px-md" :src="item.FileType==1?datas.pdfImg:datas.adsImg"
<td class="journeyAds-title wrap"> style="height: 25px;" />
<div> <!-- <img v-else class="q-px-md" :src="item.FileType==1?datas.pdfImg:datas.adsImg"
<el-tooltip v-if="!item.editTitle" @click.stop="OffEdit" style="height: 25px;" /> -->
</td>
<td class="journeyAds-title wrap row">
<div v-if="!item.editTitle" class="col">
<el-tooltip @click.stop="OffEdit"
placement="top-start"> placement="top-start">
<template #content><div style="max-width: 600px;">{{item.Title}}</div></template> <template #content><div style="max-width: 600px;">{{item.FileName}}</div></template>
<div class="journeyAds-TitleCenter">{{item.Title}} <div class="journeyAds-TitleCenter">{{item.FileName}}
<span v-if="item.Title.length>70">...</span> <span v-if="item.FileName.length>70">...</span>
</div> </div>
</el-tooltip> </el-tooltip>
</div> </div>
<el-input <el-input
class="journeyAds-Input" class="journeyAds-Input"
v-model="item.Title" v-model="item.FileName"
autosize autosize
type="textarea" type="textarea"
placeholder="Please input" placeholder="Please input"
maxlength="500" maxlength="500"
size="small" size="small"
v-if="item.editTitle" v-if="item.editTitle"
@blur="handleUpdateTitle(item)" @blur="handleUpdateTitle(item)"/>
/></td> </td>
<td class="text-center" @click.stop="OffEdit"><span>{{item.Day?item.Day+'天前':item.UpdateTime}}</span></td> <td class="text-center" @click.stop="OffEdit"><span>{{item.Day?item.Day+'天前':item.UpdateTime}}</span></td>
<td class="text-center" @click.stop="OffEdit"><span>{{item.CreateByName}}</span></td> <td class="text-center" @click.stop="OffEdit"><span>{{item.CreateName}}</span></td>
<td class="text-center"> <td class="text-center">
<div class="hoverShow row items-center just-center q-pt-sm"> <div class="hoverShow row items-center just-center q-pt-sm">
<el-button type="primary" :icon="Edit" size="small" @click.stop="editDelete(item)">编辑</el-button> <el-button type="primary" :icon="Edit" size="small" @click.stop="editDelete(item)">编辑</el-button>
...@@ -79,14 +83,15 @@ ...@@ -79,14 +83,15 @@
<el-icon size="16" color="#b1b7cf"><MoreFilled /></el-icon> <el-icon size="16" color="#b1b7cf"><MoreFilled /></el-icon>
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="q-pa-md" @click.stop="OffEdit"> <el-dropdown-menu class="q-pa-md" @click.stop="OffEdit">
<el-dropdown-item icon="EditPen" @click.stop="startEditTitle(item)">重命名</el-dropdown-item> <el-dropdown-item v-if="item.FileType" icon="EditPen" @click.stop="startEditTitle(item)">重命名</el-dropdown-item>
<el-dropdown-item icon="Clock">历史版本</el-dropdown-item> <el-dropdown-item v-if="item.FileType" icon="Clock" @click.stop="history(item)">历史版本</el-dropdown-item>
<el-dropdown-item icon="Position" @click="()=>shareId=item.Id">分享</el-dropdown-item> <el-dropdown-item v-if="item.FileType" icon="Position" @click="()=>shareId=item.Id">分享</el-dropdown-item>
<el-dropdown-item icon="Delete" @click="editDelete(item,1)">删除</el-dropdown-item> <el-dropdown-item icon="Delete" @click="editDelete(item,1)">删除</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
</div></td> </div>
</td>
</tr> </tr>
</template> </template>
</table> </table>
...@@ -102,7 +107,13 @@ ...@@ -102,7 +107,13 @@
</el-scrollbar> </el-scrollbar>
</div> </div>
<ShareForm :id="shareId" v-if="shareId>0" @close="()=>shareId=0"></ShareForm> <ShareForm :id="shareId" v-if="shareId>0" @close="()=>shareId=0"></ShareForm>
<Folder :folder-id="folderObj?.id" :folder-name="folderObj?.name" :parent-id="folderObj.parentId" v-if="folderObj.id>-1" @close="()=>folderObj.id=-1"></Folder> <Folder :folder-id="folderObj?.id" :folder-name="folderObj?.name"
:parent-id="folderObj.parentId" :folder-type="folderObj?.type" v-if="folderObj.id>-1"
@close="()=>folderObj.id=-1" @success="()=>{folderObj.id=-1;refreshHandler()}"></Folder>
<HistoricalVersion :details="journeyAdsDetails"
v-if="journeyAdsDetails.Id>0"
@close="()=>journeyAdsDetails={}"></HistoricalVersion>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, provide, watch, inject, onMounted } from 'vue' import { ref, reactive, provide, watch, inject, onMounted } from 'vue'
...@@ -114,6 +125,7 @@ ...@@ -114,6 +125,7 @@
import { useSellTemplateStore, useScreenStore, useSlidesStore } from '@/store' import { useSellTemplateStore, useScreenStore, useSlidesStore } from '@/store'
import ShareForm from './ShareForm.vue'; import ShareForm from './ShareForm.vue';
import Folder from './Folder.vue'; import Folder from './Folder.vue';
import HistoricalVersion from './HistoricalVersion.vue';
const SalesEditorStore = useSellTemplateStore() const SalesEditorStore = useSellTemplateStore()
const marketStore = useScreenStore() const marketStore = useScreenStore()
...@@ -127,6 +139,8 @@ ...@@ -127,6 +139,8 @@
const PopoverVisibleControls = ref(false) const PopoverVisibleControls = ref(false)
const shareId = ref(0) const shareId = ref(0)
const journeyAdsDetails = ref({})
const showHistory = ref(true)
const isIndeterminate = ref(false) const isIndeterminate = ref(false)
const dataList = ref([] as Array < any > ) const dataList = ref([] as Array < any > )
const searchData = ref({} as any) const searchData = ref({} as any)
...@@ -137,22 +151,28 @@ ...@@ -137,22 +151,28 @@
journeyAds:{RefreshLoading:false} as any, journeyAds:{RefreshLoading:false} as any,
pdfImg: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708337830000_43.png', pdfImg: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708337830000_43.png',
adsImg: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708250377000_777.png', adsImg: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708250377000_777.png',
folderImg: '',
}) })
const folderObj = ref<{id:number,name:string,parentId:number}>({id:-1,name:'',parentId:0}) const folderObj = ref<{id:number,name:string,parentId:number,type:number}>({id:-1,name:'',parentId:0,number:1})
let TemplateType = 0 let TemplateType = 0
if(searchData.value.SellTemplateType) TemplateType = searchData.value.SellTemplateType if(searchData.value.SellTemplateType) TemplateType = searchData.value.SellTemplateType
const queryObj = reactive({ const queryObj = reactive({
Title: '',
pageIndex: 1, pageIndex: 1,
pageSize: 20, pageSize: 20,
pageCount: 0, //总页数 pageCount: 0, //总页数
TemplateType: TemplateType, FileType: TemplateType,
FileId: 0
}) })
const editObj = reactive({}) const editObj = reactive({})
//datas.journeyAds = inject('journeyAds') //datas.journeyAds = inject('journeyAds')
const loading = ref(false as any) const loading = ref(false as any)
const SellTemplateRef = ref<any>() const SellTemplateRef = ref<any>()
const history = (row:any) => {
journeyAdsDetails.value = row
}
// 重命名 // 重命名
const OffEdit = () => { const OffEdit = () => {
for(let i=0;i<dataList.value.length;i++){ for(let i=0;i<dataList.value.length;i++){
...@@ -276,11 +296,48 @@ ...@@ -276,11 +296,48 @@
if(datasList==0&&checkedCount==0) datas.selectAll = '' if(datasList==0&&checkedCount==0) datas.selectAll = ''
} }
const setTemplateType = (Id:number) => {
queryObj.pageIndex = 1 const DeleteFile = async (item:any) => {
queryObj.TemplateType = Id ElMessageBox.confirm(
querySearchHandler() '此操作将删除该文件夹,是否确定?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(async () => {
try {
let queryMsg = {
FolderId: item.FileId
}
deleteLoading.value = ElLoading.service({
lock:true,
text:'正在处理'
})
let pageRes = await ConfigService.RemoveTripFolder(queryMsg);
if (pageRes.data.resultCode == 1) {
queryObj.pageIndex = 1
ElMessage({
showClose: true,
message: `删除${item.TemplateType==2?'广告':'行程'}成功`,
type: 'success',
})
querySearchHandler()
}else {
ElMessage({
showClose: true,
message: `删除${item.TemplateType==2?'广告':'行程'}失败`,
type: 'warning',
})
}
deleteLoading.value.close()
deleteLoading.value = null
} catch (error) {}
}).catch(() => {})
} }
const DeleteTemplate = async (item:any) => { const DeleteTemplate = async (item:any) => {
ElMessageBox.confirm( ElMessageBox.confirm(
'此操作将删除该模版,是否确定?', '此操作将删除该模版,是否确定?',
...@@ -293,7 +350,7 @@ ...@@ -293,7 +350,7 @@
).then(async () => { ).then(async () => {
try { try {
let queryMsg = { let queryMsg = {
Id: item.Id Id: item.FileId
} }
deleteLoading.value = ElLoading.service({ deleteLoading.value = ElLoading.service({
lock:true, lock:true,
...@@ -323,32 +380,39 @@ ...@@ -323,32 +380,39 @@
} }
const editDelete = async (row:any,type:Number) => { const editDelete = async (row:any,type:Number) => {
if(type==1){ if(type==1){
DeleteTemplate(row) if(row.FileType) DeleteTemplate(row)
else DeleteFile(row)
}else{ }else{
let list = [ if(row.FileType){
{ let list = [
id: 'test-slide-1', {
pageType: 0, id: 'test-slide-1',
elements: [], pageType: 0,
background: { elements: [],
type: 'solid', background: {
color: '#ffffff', type: 'solid',
}, color: '#ffffff',
} },
] }
useSlidesStore().setSlides(list) ]
searchData.value.sellId = row.Id useSlidesStore().setSlides(list)
searchData.value.sellTempId = row.TempId searchData.value.sellId = row.FileId
searchData.value.TemplateType = row.TemplateType searchData.value.sellTempId = row.TempId
SalesEditorStore.setSalesEditor(2) searchData.value.TemplateType = row.FileType
marketStore.setMarket(false) SalesEditorStore.setSalesEditor(2)
marketStore.setMarket(false)
}else {
folderObj.value.id=row.FileId
folderObj.value.name=row.FileName
folderObj.value.type=row.FileType
}
} }
} }
const querySearchHandler = async () => { const querySearchHandler = async () => {
loading.value = true loading.value = true
try { try {
if(queryObj.pageIndex == 1) dataList.value =[] if(queryObj.pageIndex == 1) dataList.value =[]
let pageRes = await ConfigService.sellGetTripOtherPage(queryObj); let pageRes = await ConfigService.GetMyTripFolderPage(queryObj);
if (pageRes.data.resultCode == 1) { if (pageRes.data.resultCode == 1) {
let arrList = function(list){ let arrList = function(list){
list.forEach(x => { list.forEach(x => {
...@@ -393,13 +457,16 @@ ...@@ -393,13 +457,16 @@
const operaFolder = (id:number,name:string)=>{ const operaFolder = (id:number,name:string)=>{
folderObj.value.id=id folderObj.value.id=id
folderObj.value.name=name folderObj.value.name=name
folderObj.value.type=queryObj.FileType
console.log(folderObj.value)
} }
watch(() => searchData.value.SellTemplateType, (n,o) => { watch(() => searchData.value.SellTemplateType, (n,o) => {
isIndeterminate.value = false isIndeterminate.value = false
datas.selectAll = false datas.selectAll = false
datas.selectedDatas = [] datas.selectedDatas = []
setTemplateType(n) queryObj.FileType = n
refreshHandler()
}) })
onMounted(()=>{ onMounted(()=>{
...@@ -418,7 +485,7 @@ ...@@ -418,7 +485,7 @@
} }
.journeyAds-TitleCenter{ .journeyAds-TitleCenter{
max-width: 1000px; width: 100%;
height: 18px; height: 18px;
overflow: hidden; /* 隐藏超出部分 */ overflow: hidden; /* 隐藏超出部分 */
text-overflow: ellipsis; /* 显示省略号 */ text-overflow: ellipsis; /* 显示省略号 */
...@@ -428,8 +495,8 @@ ...@@ -428,8 +495,8 @@
} }
.journeyAds-TitleCenter span{ .journeyAds-TitleCenter span{
position: absolute; position: absolute;
right: 10px; right: 16px;
top: -4px; top: 0px;
} }
.journeyAds-Input{ .journeyAds-Input{
padding-right: 20px; padding-right: 20px;
......
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