Commit fc933bf8 authored by zhengke's avatar zhengke

查看历史版本入口

parent 71bce5cd
......@@ -26,6 +26,7 @@ import { injectKeyTemplate } from '@/types/injectKey'
import ConfigService from '@/services/ConfigService'
import { domainManager } from '@/utils/domainManager'
import { enterFullscreen, exitFullscreen, isFullscreen } from '@/utils/fullscreen'
import { VIEWPORT_SIZE, VIEWPORT_VER_SIZE } from '@/configs/canvas'
import Editor from './views/Editor/index.vue'
import Screen from './views/Screen/index.vue'
......@@ -77,7 +78,7 @@ const userLoginHandler = async ()=>{
SalesTripId = param.SalesTripId
SellTemplateStore.setSalesTripId(SalesTripId)
try {
await sellGetTripTemplate()
await sellShareTemplate()
} catch (error) {}
}
ConfigIdStore.setConfigId(ConfigId)
......@@ -86,6 +87,11 @@ const userLoginHandler = async ()=>{
if(param.uid) await userStore().setUserLoginAsync(userId)
if(ConfigId>0&&model!=2) await GetTripConfig(ConfigId)
} catch (error) {}
if(param.ViewSlideshow) {
try {
await sellHistoryTripTemplate(param.sellId)
} catch (error) {}
}
if(userId>0)isFinish.value=true
if(!ConfigId&&!model&&(param.SalesTripId&&param.SalesTripId=='')) ElMessageBox.confirm(
'当前没有权限进行任何操作,请联系管理员!',
......@@ -105,8 +111,55 @@ onMounted(async () => {
mainStore.setAvailableFonts()
})
// 销售模版数据
const sellGetTripTemplate = async () =>{
// 销售历史版本模版数据
const sellHistoryTripTemplate = async (sellId:any) => {
const loadingObj = ElLoading.service({
text:'正在渲染数据',
lock:true
})
try {
let queryMsg = {
Id: sellId
}
let dataRes = await ConfigService.sellGetTemplateDetails(queryMsg);
if (dataRes.data.resultCode == 1) {
loadingObj.close()
loading.value = false
isFinish.value=true
let dataObj = dataRes.data.data
let viewportRatios = 1.414
if(dataObj.TemplateType==1) viewportRatios = 0.7069
if(dataObj.Width&&dataObj.Height) {
viewportRatios = dataObj.Height/dataObj.Width
VIEWPORT_SIZE.Value = dataObj.Height
VIEWPORT_VER_SIZE.Value = dataObj.Width
}else{
VIEWPORT_SIZE.Value = 1754
VIEWPORT_VER_SIZE.Value = 1240
}
slidesStore.setViewportRatio(viewportRatios)
let SlidesData = JSON.parse(dataObj.TempData)
let newSlides = []
await SlidesData.forEach((x,i)=>{
newSlides.push(x)
})
slidesStore.setSlides(newSlides)
slidesStore.updateSlideIndex(0)
ScreenStore.setScreening(true)
enterScreeningFromStart
}else{
loading.value = true
ShareTips.value = dataRes.data.message
loadingObj.close()
}
} catch (error) {
}
}
// 销售分享模版数据
const sellShareTemplate = async () =>{
const loadingObj = ElLoading.service({
text:'正在渲染数据',
......@@ -124,9 +177,17 @@ const sellGetTripTemplate = async () =>{
isFinish.value=true
let dataObj = dataRes.data.data
let viewportRatio = 1.414
if(dataRes.data.data.TempType==1) viewportRatio = 0.7069
if(dataRes.data.data.Width&&dataRes.data.data.Height) viewportRatio = dataRes.data.data.Height/dataRes.data.data.Width
if(dataObj.TempType==1) viewportRatio = 0.7069
if(dataObj.Width&&dataObj.Height) {
viewportRatio = dataObj.Height/dataObj.Width
VIEWPORT_SIZE.Value = dataObj.Height
VIEWPORT_VER_SIZE.Value = dataObj.Width
}else{
VIEWPORT_SIZE.Value = 1754
VIEWPORT_VER_SIZE.Value = 1240
}
slidesStore.setViewportRatio(viewportRatio)
let SlidesData = JSON.parse(dataObj.TempData)
let newSlides = []
await SlidesData.forEach((x,i)=>{
......
......@@ -19,23 +19,20 @@ export const isPC = () => {
export const query = (url?:string)=>{
url = url??location.href
if(url.indexOf(process.env.VUE_APP_SHARE_URL)!=-1){
let str = url.substr(url.indexOf('?') + 1)
let json = {
SalesTripId: str.slice(2)
} as any
return json
}else{
let str = url.substr(url.indexOf('?') + 1)
let json = {} as any
const arr = str.split('&')
let json = {} as any
for(let i = 0; i < arr.length; i++) {
let item = arr[i].split('=')
json[item[0]] = item[1]
}
return json
}
if(url.indexOf(process.env.VUE_APP_SHARE_URL)!=-1&&!json.ViewSlideshow){
json = {
SalesTripId: str.slice(2)
} as any
return json
}else return json
}
/**
......
......@@ -136,7 +136,8 @@
<el-dropdown-item v-if="item.FileType" icon="Clock" @click.stop="history(item)">历史版本</el-dropdown-item>
<el-dropdown-item icon="Position" @click.stop="()=>shareId=item.FileId">分享</el-dropdown-item>
<el-dropdown-item v-if="item.IsShare" icon="Hide" @click.stop="removeShareHandler(item)">取消分享</el-dropdown-item>
<el-dropdown-item icon="Delete" @click="editDelete(item,1)">删除</el-dropdown-item>
<el-dropdown-item v-if="item.FileType" icon="CopyDocument" @click.stop="CopyTo(item)">复制到</el-dropdown-item>
<!-- <el-dropdown-item icon="Delete" @click="editDelete(item,1)">删除</el-dropdown-item> -->
</el-dropdown-menu>
</template>
</el-dropdown>
......@@ -156,7 +157,7 @@
</div>
<el-divider
class="no-bg q-mt-lg"
v-if="queryObj.pageCount == queryObj.pageIndex && !loading"
v-if="queryObj.pageCount == queryObj.pageIndex && !loading && queryObj.pageCount != 1"
>
<span
class="text-small bg-white"
......@@ -185,6 +186,10 @@
@close="() => {journeyAdsDetails = '';isHistoricalVersion=false}"
></HistoricalVersion>
<CopyFile v-if="isCopyTo"
:details="journeyAdsDetails"
@close="() => {journeyAdsDetails = '';isCopyTo=false}"></CopyFile>
</template>
<script setup lang="ts">
import { ref, reactive, provide, watch, inject, onMounted } from "vue";
......@@ -197,6 +202,7 @@
import { useSellTemplateStore, useScreenStore, useSlidesStore } from "@/store";
import ShareForm from "./ShareForm.vue";
import HistoricalVersion from "./HistoricalVersion.vue";
import CopyFile from "./CopyFile.vue";
const SalesEditorStore = useSellTemplateStore();
const marketStore = useScreenStore();
......@@ -211,6 +217,7 @@
const shareId = ref(0);
const journeyAdsDetails = ref('');
const isHistoricalVersion = ref(false);
const isCopyTo = ref(false);
const Navigations = ref([] as Array<any>);
const showHistory = ref(true);
const isIndeterminate = ref(false);
......@@ -246,6 +253,10 @@
const loading = ref(false as any);
const SellTemplateRef = ref<any>();
const CopyTo = (row:any) => {
isCopyTo.value = true
journeyAdsDetails.value = row
}
const clickSort = (type:any) =>{
if(datas.Sort==0) copyDataList.value = JSON.parse(JSON.stringify(dataList.value))
// 1降序 2升序
......
<template>
<el-dialog v-model="show" v-loading="loading" :show-close="false"
:close-on-press-escape="false" :close-on-click-modal="false"
style="width: 260px;">
<template #header>
<div class="row overflow-hide" @click="OffEdit">
<div>
<img v-if="details.FileType>0" class="q-px-md"
:src="details.FileType==1?datas.pdfImg:datas.adsImg"
style="height: 43px;" />
<img v-else class="q-px-md"
src="@/assets/img/file.png"
style="height: 43px;" />
</div>
<div class="q-pl-md col">
<div class="row flex-center">
<el-tooltip
v-if="!datas.editTitle"
placement="top-start">
<template #content><div class="text-center" style="width: 200px;">{{details.FileName}}</div></template>
<div class="TreeFile-Title pointer" @click.stop="datas.editTitle=true">{{details.FileName}}</div>
</el-tooltip>
<el-input
class="journeyAds-Input"
v-model="details.FileName"
autosize
type="textarea"
placeholder="Please input"
maxlength="500"
size="small"
v-if="datas.editTitle"
@blur="handleUpdateTitle"
/>
</div>
<div class="text-small text-5B5D62 q-pt-sm">
创建者:{{details.CreateName}}
</div>
</div>
</div>
</template>
<div class="TreeFile-container" @click="OffEdit">
<el-tree-select
placeholder="请选择文件"
node-key="FileId"
:props="defaultProps"
v-model="datas.FolderId"
:data="dataList"
default-expand-all
check-strictly
:render-after-expand="false"
style="width: 220px"
:filter-node-method="filterNode"
@check="handleTreeNodeClick"
/>
</div>
<template #footer>
<div @click="OffEdit">
<span class="dialog-footer">
<el-button @click="()=>closedhandler()">关闭</el-button>
<el-button type="primary" @click="()=>save()"> 保存复制 </el-button>
</span>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ApiResult } from '@/configs/axios';
import OrgService from '@/services/OrgService';
import { ref,reactive,watch } from 'vue';
import { View,Download,EditPen,Delete } from '@element-plus/icons-vue';
import { ElMessage,ElTree } from 'element-plus';
import FolderService from "@/services/FolderService";
const props = defineProps({
details:{
type:Object,
required:''
},
fileType: {
type:Number,
required: 1
}
})
const emit = defineEmits<{
(event: 'close'): void,
(event: 'success'): void
}>()
interface Tree {
[key: string]: any
}
const filterText = ref('')
const treeRef = ref<InstanceType<typeof ElTree>>()
const defaultProps = {
children: 'ChildList',
label: 'FileName',
disabled: 'disabled',
}
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',
fileList: [] as Tree[],
FolderId: null as Number,
FolderObj: {},
checkedKeys: null as any,
editTitle: false,
})
const show=ref(true)
const loading = ref(true)
const deleteLoading = ref<any>(null);
const dataList=ref([])
const OffEdit = () => {
datas.editTitle = false
}
const handleUpdateTitle = () => {
OffEdit()
}
const closedhandler=()=>{
emit('close')
}
const handleTreeNodeClick = (data:any,checkObj:any) => {
OffEdit()
if (checkObj.checkedKeys.length != 0) {
datas.FolderObj = data
}
}
const filterNode = (value: string, data: Tree) => {
if (!value) return true
return data.FileName.includes(value)
}
const save = () => {
return
let title = ''
let FileList = []
if(!props.details) {
title = ` 12121 `
FileList = []
}else {
title = props.details.FileName
FileList.push({
FileId: props.details.FileId,
FileType: props.details.FileType
})
}
ElMessageBox.confirm(`此操作将${title}移动到${datas.FolderObj.FileName},是否确定?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
try {
let queryMsg = {
FileList: FileList,
TargetFolderId: datas.FolderId,
};
deleteLoading.value = ElLoading.service({
lock: true,
text: "正在处理",
});
let pageRes = await FolderService.UpdateTripOtherFolder(queryMsg);
if (pageRes.data.resultCode == 1) {
ElMessage({
showClose: true,
message: `移动文件成功`,
type: "success",
});
emit('close')
emit('success')
} else {
ElMessage({
showClose: true,
message: `移动文件失败`,
type: "warning",
});
}
deleteLoading.value.close();
deleteLoading.value = null;
} catch (error) {}
})
.catch(() => {});
}
const getFile = async () => {
let querys = {
FileType: props.fileType
}
let pageRes = await FolderService.GetMyFolderTree(querys);
if (pageRes.data.resultCode == 1) {
dataList.value = pageRes.data.data
recursive(dataList.value)
}
}
const recursive = (arrs:Array,disabled:any) =>{
let isDisableds:Boolean
if(arrs.length>0) arrs.forEach(x => {
isDisableds = false
Object.assign(x,{disabled:isDisableds})
if(x.ChildList.length>0){
recursionChild(x,isDisableds)
}
})
else {
isDisableds = false
Object.assign(arrs,{disabled:isDisableds})
}
}
const recursionChild = (arrs:any,disabled:any) => {
if(arrs&&arrs.ChildList.length>0) {
recursive(arrs.ChildList,disabled)
}
}
watch(filterText, (val) => {
treeRef.value!.filter(val)
})
getFile()
</script>
<style scoped>
.TreeFile-Title{
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 15px;
position: relative;
}
.TreeFile-Title.text-sm{
font-size: 12px;
}
.TreeFile-container th{
padding: 0 10px 5px 10px;
border-bottom: 1px solid #f6f6f6;
background: #fff;
position: sticky;
top: 0px;
z-index: 2;
}
.TreeFile-container td{
padding: 8px 10px;
border-bottom: 1px solid #f6f6f6;
}
.TreeFile-table {
}
</style>
\ No newline at end of file
<template>
<el-dialog v-model="show" v-loading="loading" :show-close="false"
:close-on-press-escape="false" :close-on-click-modal="false"
style="width: 500px;">
style="width: 600px;">
<template #header>
<div class="row overflow-hide">
<div>
......@@ -32,20 +32,36 @@
<th class="text-light" style="min-width: 100px;width: 100px;"><span >更新者</span></th>
<th class="text-light" style="min-width: 80px;width: 80px;">大小</th>
<th class="text-light">版本名称</th>
<!-- <th class="text-light" style="min-width: 120px;width: 120px;">操作</th> -->
<th class="text-light text-center" style="min-width: 120px;width: 120px;">操作</th>
</tr>
<template v-for="(item,index) in dataList">
<tr class="text-5B5D62 HistoricalVersion-table pointer">
<td class="text-light">
<tr class="HistoricalVersion-table pointer">
<td class="text-light text-5B5D62">
<span class="text-bold">{{item.UpdateTime.substr(0,11)}}</span>
<span class="q-pl-md q-pt-sm">{{item.UpdateTime.substr(11,19)}}</span>
</td>
<td class="HistoricalVersion-title text-light wrap">
<td class="HistoricalVersion-title text-light wrap text-5B5D62">
<span>{{item.CreateByName}}</span>
</td>
<td class="text-light"><span>{{item.FileSize}}KB</span></td>
<td class="text-light"><span>{{item.Title}}</span></td>
<!-- <td class="text-center"></td> -->
<td class="text-light text-5B5D62"><span>{{item.FileSize}}KB</span></td>
<td class="text-light">
<span :class="[item.NewTitle?'active':'text-5B5D62']">
{{item.NewTitle?item.NewTitle:item.Title}}</span>
</td>
<td class="text-center">
<span class="hoverShow">
<el-button type="primary" icon="View" size="small" @click.stop="clickControls(item)">查看</el-button>
<el-dropdown class="q-pl-md" trigger="click">
<el-icon size="16" color="#b1b7cf"><MoreFilled /></el-icon>
<template #dropdown>
<el-dropdown-menu class="q-pa-md" @click.stop="OffEdit">
<el-dropdown-item icon="EditPen" @click.stop="clickControls(item,1)">另存</el-dropdown-item>
<el-dropdown-item icon="Clock" @click.stop="clickControls(item,2)">替换</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</span>
</td>
</tr>
</template>
</table>
......@@ -53,7 +69,7 @@
style="padding: 0 10px;">
<el-empty :image-size="60" description="暂无数据" />
</div>
<el-divider class="no-bg q-mt-lg" v-if='dataList.length>0&&queryObj.pageCount == queryObj.pageIndex && !loading'>
<el-divider class="no-bg q-mt-lg" v-if='dataList.length>0 && queryObj.pageCount == queryObj.pageIndex && !loading && queryObj.pageCount != 1'>
<span class="text-small bg-white" style="padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span>
</el-divider>
<div v-if="loading" style="height:40px;" class="q-mt-md no-bg" background="transparent" v-loading="loading" element-loading-text="正在加载中"></div>
......@@ -70,10 +86,12 @@
<script setup lang="ts">
import { ApiResult } from '@/configs/axios';
import OrgService from '@/services/OrgService';
import { ref,reactive } from 'vue';
import { ref,reactive,provide } from 'vue';
import { View,Download,EditPen,Delete } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
import ConfigService from '@/services/ConfigService';
import { isPC, query } from '@/utils/common'
import { injectKeyTemplate } from '@/types/injectKey'
const props = defineProps({
id:{
......@@ -93,17 +111,49 @@ import ConfigService from '@/services/ConfigService';
adsImg: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708250377000_777.png',
})
const searchData = ref({} as any)
provide(injectKeyTemplate,searchData)
const show=ref(true)
const loading = ref(true)
const HistoricalVersion = ref<any>()
const copyDataList = ref([] as Array<any>);
const queryObj = reactive({
pageIndex: 1,
pageSize: 10,
pageSize: 30,
pageCount: 0, //总页数
FileId: props.details.FileId,
UpdateTime: ''
})
const dataList=ref([])
const clickControls = (row:any,type:any) => {
if(type){
}else {
let param = query()
const url = `${process.env.VUE_APP_SHARE_URL}/?uid=${param.uid}&sellId=${row.FileId}&ViewSlideshow=1`
window.open(url);
}
}
const getSort = () => {
let list = JSON.parse(JSON.stringify(dataList.value))
for (let i=0;i<list.length;i++){
for (let j=i;j<list.length;j++){
let time
time = new Date(list[j].UpdateTime.replace(/-/,'/'))-new Date(list[i].UpdateTime.replace(/-/,'/'))
if(time>0){
let listObj=list[i];
list[i]=list[j];
list[j]=listObj;
}
}
}
datas.UpdateTime = list[0].UpdateTime
for (let i=0;i<dataList.value.length;i++){
if(dataList.value[i].UpdateTime==datas.UpdateTime) dataList.value[i].NewTitle = '当前版本'
}
}
const closedhandler=()=>{
emit('close')
}
......@@ -113,8 +163,16 @@ import ConfigService from '@/services/ConfigService';
if(queryObj.pageIndex == 1) dataList.value =[]
let pageRes = await ConfigService.GetFileHistory(queryObj);
if (pageRes.data.resultCode == 1) {
let arrList = function (list) {
list.forEach((x) => {
x.NewTitle = ''
});
};
arrList(pageRes.data.data.pageData);
dataList.value = dataList.value.concat(pageRes.data.data.pageData);
copyDataList.value = dataList.value
queryObj.pageCount = pageRes.data.data.pageCount;
getSort()
}
loading.value = false
} catch (error) {
......@@ -135,7 +193,7 @@ import ConfigService from '@/services/ConfigService';
querySearchHandler()
</script>
<style scoped>
<style lang="scss" scoped>
.HistoricalVersion-Title{
width: 100%;
overflow: hidden;
......@@ -156,7 +214,13 @@ import ConfigService from '@/services/ConfigService';
padding: 8px 10px;
border-bottom: 1px solid #f6f6f6;
}
.HistoricalVersion-table {
.hoverShow {
opacity: 0;
}
.HistoricalVersion-table:hover .hoverShow {
opacity: 1;
}
.active {
color: $themeColor;
}
</style>
\ No newline at end of file
......@@ -25,12 +25,12 @@
创建者:{{details.CreateName}}
</template>
<div v-else class="row items-center">
<el-tooltip
<!-- <el-tooltip
placement="top-start">
<template #content><div class="text-center" style="width: 200px;">移动文件 {{selectedDatas.join(',')}}</div></template>
<div class="TreeFile-Title text-sm pointer">移动文件 {{selectedDatas.join(',')}}</div>
</el-tooltip>
</el-tooltip> -->
<div class="TreeFile-Title text-sm pointer">批量移动文件</div>
</div>
</div>
</div>
......@@ -123,6 +123,7 @@ import FolderService from "@/services/FolderService";
FolderObj: {},
checkedKeys: null as any
})
datas.FolderId = props.details?props.details.ParentFileId:props.setFileList[0].ParentFileId
const show=ref(true)
const loading = ref(true)
const deleteLoading = ref<any>(null);
......@@ -153,7 +154,15 @@ import FolderService from "@/services/FolderService";
let title = ''
let FileList = []
if(!props.details) {
title = `文件ID ${props.selectedDatas.join(',')}`
title = `批量`
for(let i=0;i<props.setFileList.length;i++){
FileList.push(
{
FileId: props.setFileList[i].FileId,
FileType: props.setFileList[i].FileType
}
)
}
FileList = props.setFileList
}else {
title = props.details.FileName
......@@ -214,6 +223,7 @@ import FolderService from "@/services/FolderService";
const recursive = (arrs:Array,disabled:any) =>{
console.log(props.setFileList[0],'=====')
let isDisableds:Boolean
if(arrs.length>0) arrs.forEach(x => {
isDisableds = (props.selectedDatas.indexOf(x.FileId)!=-1&&!props.details)||props.details.FileId==x.FileId||disabled?true:false
......@@ -223,6 +233,7 @@ import FolderService from "@/services/FolderService";
if(props.setFileList[i].FileType&&props.setFileList[i].FileId==x.FileId) isDisableds = false
}
}
if((props.details.ParentFileId!=undefined&&props.details&&x.FileId==props.details.ParentFileId)||(props.setFileList.length>0&&props.setFileList[0].ParentFileId==x.FileId)) datas.FolderObj = x
Object.assign(x,{disabled:isDisableds})
if(x.ChildList.length>0){
recursionChild(x,isDisableds)
......
......@@ -152,6 +152,7 @@
<el-dropdown-item icon="Position" @click.stop="()=>shareId=item.FileId">分享</el-dropdown-item>
<el-dropdown-item v-if="item.IsShare" icon="Hide" @click.stop="removeShareHandler(item)">取消分享</el-dropdown-item>
<el-dropdown-item icon="Expand" @click.stop="MoveFile(item)">移动至</el-dropdown-item>
<el-dropdown-item v-if="item.FileType" icon="CopyDocument" @click.stop="CopyTo(item)">复制到</el-dropdown-item>
<el-dropdown-item icon="Delete" @click="editDelete(item,1)">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
......@@ -222,6 +223,10 @@
datas.selectAll = false;
datas.selectedDatas = [];
refreshHandler()}"></TreeFile>
<CopyFile v-if="isCopyTo"
:details="journeyAdsDetails"
@close="() => {journeyAdsDetails = '';isCopyTo=false}"></CopyFile>
</template>
<script setup lang="ts">
import { ref, reactive, provide, watch, inject, onMounted } from "vue";
......@@ -252,6 +257,7 @@ const PopoverVisibleControls = ref(false);
const shareId = ref(0);
const journeyAdsDetails = ref('');
const isHistoricalVersion = ref(false);
const isCopyTo = ref(false);
const isTreeFile = ref(false)
const Navigations = ref([] as Array<any>);
const showHistory = ref(true);
......@@ -298,6 +304,10 @@ const editObj = reactive({});
const loading = ref(false as any);
const SellTemplateRef = ref<any>();
const CopyTo = (row:any) => {
isCopyTo.value = true
journeyAdsDetails.value = row
}
const clickSort = (type:any) =>{
if(datas.Sort==0) copyDataList.value = JSON.parse(JSON.stringify(dataList.value))
// 1降序 2升序
......@@ -367,7 +377,8 @@ const MoveFile = (item:any) => {
datas.setFileList.push(
{
FileId: dataList.value[i].FileId,
FileType: dataList.value[i].FileType
FileType: dataList.value[i].FileType,
ParentFileId: dataList.value[i].ParentFileId
}
)
}
......
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