Commit 76deebad authored by zhengke's avatar zhengke

文件夹移动

parent e240a855
......@@ -2,6 +2,13 @@ import Api,{ HttpResponse, Result } from './../utils/request';
class FolderService{
/**
* 文件夹树形结构
*/
static async GetMyFolderTree(params : any):Promise<HttpResponse>{
return Api.Post("triptemplate_GetMyFolderTree",params)
}
/**
* 移动到文件夹
*/
......
......@@ -44,21 +44,8 @@
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="MoveToFolder(1)">移动至
<el-select
class="q-pl-md"
v-model="datas.batchId"
filterable
placeholder="文件夹"
style="width: 90px"
size="small" @change="MoveToFolder">
<el-option
v-for="x in datas.fileList"
:key="x.FileId"
:label="x.FileName"
:value="x.FileId"
:disabled="datas.selectedDatas.indexOf(x.FileId)!=-1"/>
</el-select>
<el-dropdown-item @click="MoveFile(0)">移动至
<el-tree :data="datas.fileList" :props="defaultProps" show-checkbox />
</el-dropdown-item>
</el-dropdown-menu>
</template>
......@@ -164,22 +151,7 @@
<el-dropdown-item v-if="item.FileType" icon="EditPen" @click.stop="startEditTitle(item)">重命名</el-dropdown-item>
<el-dropdown-item v-if="item.FileType" icon="Clock" @click.stop="history(item)">历史版本</el-dropdown-item>
<el-dropdown-item v-if="item.FileType" icon="Position" @click.stop="()=>shareId=item.FileId">分享</el-dropdown-item>
<el-dropdown-item icon="Expand">移动至
<el-select
class="q-pl-md"
v-model="item.Id"
filterable
placeholder="文件夹"
style="width: 90px"
size="small" @change="MoveToFolder(item)">
<el-option
v-for="x in datas.fileList"
:key="x.FileId"
:label="x.FileName"
:value="x.FileId"
:disabled="x.FileId==item.FileId"/>
</el-select>
</el-dropdown-item>
<el-dropdown-item icon="Expand" @click.stop="MoveFile(item)">移动至</el-dropdown-item>
<el-dropdown-item icon="Delete" @click="editDelete(item,1)">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
......@@ -234,9 +206,15 @@
<HistoricalVersion
:details="journeyAdsDetails"
v-if="journeyAdsDetails.FileId > 0"
@close="() => (journeyAdsDetails = {})"
v-if="isHistoricalVersion"
@close="() => {journeyAdsDetails = '';isHistoricalVersion=false}"
></HistoricalVersion>
<TreeFile v-if="isTreeFile"
:details="journeyAdsDetails"
:selected-datas="datas.selectedDatas" :file-type="queryObj.FileType"
@close="() => {journeyAdsDetails = '';isTreeFile=false}"
@success="() => {journeyAdsDetails = '';isTreeFile=false;refreshHandler()}"></TreeFile>
</template>
<script setup lang="ts">
import { ref, reactive, provide, watch, inject, onMounted } from "vue";
......@@ -250,6 +228,7 @@ import { useSellTemplateStore, useScreenStore, useSlidesStore } from "@/store";
import ShareForm from "./ShareForm.vue";
import Folder from "./Folder.vue";
import HistoricalVersion from "./HistoricalVersion.vue";
import TreeFile from "./TreeFile.vue";
const SalesEditorStore = useSellTemplateStore();
const marketStore = useScreenStore();
......@@ -262,7 +241,9 @@ const props = defineProps({
const PopoverVisibleControls = ref(false);
const shareId = ref(0);
const journeyAdsDetails = ref({});
const journeyAdsDetails = ref('');
const isHistoricalVersion = ref(false);
const isTreeFile = ref(false)
const Navigation = ref({});
const showHistory = ref(true);
const isIndeterminate = ref(false);
......@@ -271,7 +252,6 @@ const searchData = ref({} as any);
searchData.value = inject(injectKeyTemplate);
const deleteLoading = ref<any>(null);
const datas = reactive({
batchId: '',
selectedDatas: [] as Array,
selectAll: false as any,
journeyAds: { RefreshLoading: false } as any,
......@@ -304,59 +284,14 @@ const editObj = reactive({});
const loading = ref(false as any);
const SellTemplateRef = ref<any>();
// 移动到文件夹
const MoveToFolder = (item:any) => {
let File = datas.fileList.find(x=>{ return x.FileId==item.Id})
let title = ''
if(item==1) {
File = datas.fileList.find(x=>{ return x.FileId==datas.batchId})
title = `文件${datas.selectedDatas.join(',')}`
}else {
File = datas.fileList.find(x=>{ return x.FileId==item.Id})
title = item.FileName
}
ElMessageBox.confirm(`此操作将${title}移动到${File.FileName},是否确定?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
try {
let queryMsg = {
FolderId: item.Id, //文件夹Id
Id: item.FileId, //广告行程Id
};
deleteLoading.value = ElLoading.service({
lock: true,
text: "正在处理",
});
let pageRes = await FolderService.UpdateTripOtherFolder(queryMsg);
if (pageRes.data.resultCode == 1) {
ElMessage({
showClose: true,
message: `移动${
queryObj.FileType == 2 ? "广告" : "行程"
}至文件夹成功`,
type: "success",
});
refreshHandler();
} else {
ElMessage({
showClose: true,
message: `移动${
queryObj.FileType == 2 ? "广告" : "行程"
}至文件夹失败`,
type: "warning",
});
}
deleteLoading.value.close();
deleteLoading.value = null;
} catch (error) {}
})
.catch(() => {});
const MoveFile = (item:any) => {
journeyAdsDetails.value = item
isTreeFile.value = true
}
// 历史版本
const history = (row: any) => {
journeyAdsDetails.value = row;
isHistoricalVersion.value = true
};
// 重命名
......@@ -372,12 +307,31 @@ const OffEdit = () => {
}
}
};
const handleUpdateTitle = (row: any) => {
const handleUpdateTitle = async (row: any) => {
if (!row.FileName) row.FileName = editObj.value.FileName;
row.editTitle = false;
if (row.FileName != editObj.value.FileName) {
editObj.value.FileName = row.FileName;
SetSellTemplate(row);
try {
let queryMsg = {
FileId: row.FileId,
Title: editObj.value.FileName,
};
let TemplateRes = await ConfigService.ReNameTripOther(queryMsg);
if (TemplateRes.data.resultCode == 1) {
ElMessage({
showClose: true,
message: "重命名成功",
type: "success",
});
} else {
ElMessage({
showClose: true,
message: "重命名失败",
type: "warning",
});
}
} catch (error) {}
}
};
const startEditTitle = (row: any) => {
......@@ -385,29 +339,6 @@ const startEditTitle = (row: any) => {
editObj.value = JSON.parse(JSON.stringify(row));
};
// 保存重命名
const SetSellTemplate = async (row: any) => {
try {
let queryMsg = {
FileId: row.FileId,
Title: editObj.value.FileName,
};
let TemplateRes = await ConfigService.ReNameTripOther(queryMsg);
if (TemplateRes.data.resultCode == 1) {
ElMessage({
showClose: true,
message: "重命名成功",
type: "success",
});
} else {
ElMessage({
showClose: true,
message: "重命名失败",
type: "warning",
});
}
} catch (error) {}
};
// 全选按钮
const clickSelectAll = () => {
......@@ -588,7 +519,6 @@ const querySearchHandler = async () => {
};
arrList(pageRes.data.data.pageData);
dataList.value = dataList.value.concat(pageRes.data.data.pageData);
datas.fileList = dataList.value.filter(x=>{ return !x.FileType })
queryObj.pageCount = pageRes.data.data.pageCount;
}
loading.value = false;
......@@ -639,6 +569,7 @@ watch(
onMounted(() => {});
querySearchHandler();
</script>
<style lang="scss" scoped>
@import url("../../../assets/styles/common.css");
......
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