Commit 76deebad authored by zhengke's avatar zhengke

文件夹移动

parent e240a855
...@@ -2,6 +2,13 @@ import Api,{ HttpResponse, Result } from './../utils/request'; ...@@ -2,6 +2,13 @@ import Api,{ HttpResponse, Result } from './../utils/request';
class FolderService{ class FolderService{
/**
* 文件夹树形结构
*/
static async GetMyFolderTree(params : any):Promise<HttpResponse>{
return Api.Post("triptemplate_GetMyFolderTree",params)
}
/** /**
* 移动到文件夹 * 移动到文件夹
*/ */
......
...@@ -44,21 +44,8 @@ ...@@ -44,21 +44,8 @@
</el-button> </el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item @click="MoveToFolder(1)">移动至 <el-dropdown-item @click="MoveFile(0)">移动至
<el-select <el-tree :data="datas.fileList" :props="defaultProps" show-checkbox />
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> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
...@@ -164,22 +151,7 @@ ...@@ -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="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="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 v-if="item.FileType" icon="Position" @click.stop="()=>shareId=item.FileId">分享</el-dropdown-item>
<el-dropdown-item icon="Expand">移动至 <el-dropdown-item icon="Expand" @click.stop="MoveFile(item)">移动至</el-dropdown-item>
<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="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>
...@@ -234,9 +206,15 @@ ...@@ -234,9 +206,15 @@
<HistoricalVersion <HistoricalVersion
:details="journeyAdsDetails" :details="journeyAdsDetails"
v-if="journeyAdsDetails.FileId > 0" v-if="isHistoricalVersion"
@close="() => (journeyAdsDetails = {})" @close="() => {journeyAdsDetails = '';isHistoricalVersion=false}"
></HistoricalVersion> ></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> </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";
...@@ -250,6 +228,7 @@ import { useSellTemplateStore, useScreenStore, useSlidesStore } from "@/store"; ...@@ -250,6 +228,7 @@ 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"; import HistoricalVersion from "./HistoricalVersion.vue";
import TreeFile from "./TreeFile.vue";
const SalesEditorStore = useSellTemplateStore(); const SalesEditorStore = useSellTemplateStore();
const marketStore = useScreenStore(); const marketStore = useScreenStore();
...@@ -262,7 +241,9 @@ const props = defineProps({ ...@@ -262,7 +241,9 @@ const props = defineProps({
const PopoverVisibleControls = ref(false); const PopoverVisibleControls = ref(false);
const shareId = ref(0); const shareId = ref(0);
const journeyAdsDetails = ref({}); const journeyAdsDetails = ref('');
const isHistoricalVersion = ref(false);
const isTreeFile = ref(false)
const Navigation = ref({}); const Navigation = ref({});
const showHistory = ref(true); const showHistory = ref(true);
const isIndeterminate = ref(false); const isIndeterminate = ref(false);
...@@ -271,7 +252,6 @@ const searchData = ref({} as any); ...@@ -271,7 +252,6 @@ const searchData = ref({} as any);
searchData.value = inject(injectKeyTemplate); searchData.value = inject(injectKeyTemplate);
const deleteLoading = ref<any>(null); const deleteLoading = ref<any>(null);
const datas = reactive({ const datas = reactive({
batchId: '',
selectedDatas: [] as Array, selectedDatas: [] as Array,
selectAll: false as any, selectAll: false as any,
journeyAds: { RefreshLoading: false } as any, journeyAds: { RefreshLoading: false } as any,
...@@ -304,59 +284,14 @@ const editObj = reactive({}); ...@@ -304,59 +284,14 @@ const editObj = reactive({});
const loading = ref(false as any); const loading = ref(false as any);
const SellTemplateRef = ref<any>(); const SellTemplateRef = ref<any>();
// 移动到文件夹 // 移动到文件夹
const MoveToFolder = (item:any) => { const MoveFile = (item:any) => {
let File = datas.fileList.find(x=>{ return x.FileId==item.Id}) journeyAdsDetails.value = item
let title = '' isTreeFile.value = true
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 history = (row: any) => { const history = (row: any) => {
journeyAdsDetails.value = row; journeyAdsDetails.value = row;
isHistoricalVersion.value = true
}; };
// 重命名 // 重命名
...@@ -372,21 +307,11 @@ const OffEdit = () => { ...@@ -372,21 +307,11 @@ const OffEdit = () => {
} }
} }
}; };
const handleUpdateTitle = (row: any) => { const handleUpdateTitle = async (row: any) => {
if (!row.FileName) row.FileName = editObj.value.FileName; if (!row.FileName) row.FileName = editObj.value.FileName;
row.editTitle = false; row.editTitle = false;
if (row.FileName != editObj.value.FileName) { if (row.FileName != editObj.value.FileName) {
editObj.value.FileName = row.FileName; editObj.value.FileName = row.FileName;
SetSellTemplate(row);
}
};
const startEditTitle = (row: any) => {
row.editTitle = true;
editObj.value = JSON.parse(JSON.stringify(row));
};
// 保存重命名
const SetSellTemplate = async (row: any) => {
try { try {
let queryMsg = { let queryMsg = {
FileId: row.FileId, FileId: row.FileId,
...@@ -407,7 +332,13 @@ const SetSellTemplate = async (row: any) => { ...@@ -407,7 +332,13 @@ const SetSellTemplate = async (row: any) => {
}); });
} }
} catch (error) {} } catch (error) {}
}
}; };
const startEditTitle = (row: any) => {
row.editTitle = true;
editObj.value = JSON.parse(JSON.stringify(row));
};
// 全选按钮 // 全选按钮
const clickSelectAll = () => { const clickSelectAll = () => {
...@@ -588,7 +519,6 @@ const querySearchHandler = async () => { ...@@ -588,7 +519,6 @@ const querySearchHandler = async () => {
}; };
arrList(pageRes.data.data.pageData); arrList(pageRes.data.data.pageData);
dataList.value = dataList.value.concat(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; queryObj.pageCount = pageRes.data.data.pageCount;
} }
loading.value = false; loading.value = false;
...@@ -639,6 +569,7 @@ watch( ...@@ -639,6 +569,7 @@ watch(
onMounted(() => {}); onMounted(() => {});
querySearchHandler(); querySearchHandler();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import url("../../../assets/styles/common.css"); @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