|
|
@@ -24,24 +24,27 @@
|
|
|
@click="backPageHandler"
|
|
|
><ArrowLeft
|
|
|
/></el-icon>
|
|
|
- <span>{{ title|| '照片制卷' }}</span>
|
|
|
+ <span
|
|
|
+ >{{ title || "照片制卷" }}</span
|
|
|
+ >
|
|
|
</div>
|
|
|
<div class="header-main">
|
|
|
- <i
|
|
|
- class="iconfont icon-backout"
|
|
|
- :class="{ disable: currentIndex < 1 }"
|
|
|
- @click="undo(true)"
|
|
|
- title="撤销"
|
|
|
- style="margin-right: 24px"
|
|
|
- ></i>
|
|
|
- <i
|
|
|
- class="iconfont icon-redo"
|
|
|
- @click="undo(false)"
|
|
|
- :class="{ disable: historylength == currentIndex + 1 }"
|
|
|
- title="恢复"
|
|
|
- style="margin-right: 24px"
|
|
|
- ></i>
|
|
|
-
|
|
|
+ <span :class="{ disable: indexing }">
|
|
|
+ <i
|
|
|
+ class="iconfont icon-backout"
|
|
|
+ :class="{ disable: currentIndex < 1 }"
|
|
|
+ @click="undo(true)"
|
|
|
+ title="撤销"
|
|
|
+ style="margin-right: 24px"
|
|
|
+ ></i>
|
|
|
+ <i
|
|
|
+ class="iconfont icon-redo"
|
|
|
+ @click="undo(false)"
|
|
|
+ :class="{ disable: historylength == currentIndex + 1 }"
|
|
|
+ title="恢复"
|
|
|
+ style="margin-right: 24px"
|
|
|
+ ></i>
|
|
|
+ </span>
|
|
|
<i
|
|
|
class="iconfont icon-screen_f"
|
|
|
@click="toggleFullScreen"
|
|
|
@@ -78,25 +81,25 @@
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
|
</el-dropdown>
|
|
|
- <el-dropdown trigger="click" @command="handleLayoutChange">
|
|
|
- <i class="iconfont icon-layout" title="模板"></i>
|
|
|
- <template #dropdown>
|
|
|
- <el-dropdown-menu>
|
|
|
- <el-dropdown-item command="double">
|
|
|
- <i class="iconfont icon-layout_two"></i>
|
|
|
- 一页两张</el-dropdown-item
|
|
|
- >
|
|
|
- <el-dropdown-item command="single">
|
|
|
- <i class="iconfont icon-layout_h"></i>
|
|
|
- 一张横板
|
|
|
- </el-dropdown-item>
|
|
|
- <el-dropdown-item command="landscape">
|
|
|
- <i class="iconfont icon-layout_one"></i
|
|
|
- >一张竖版</el-dropdown-item
|
|
|
- >
|
|
|
- </el-dropdown-menu>
|
|
|
- </template>
|
|
|
- </el-dropdown></span
|
|
|
+ <el-dropdown trigger="click" @command="handleLayoutChange">
|
|
|
+ <i class="iconfont icon-layout" title="模板"></i>
|
|
|
+ <template #dropdown>
|
|
|
+ <el-dropdown-menu>
|
|
|
+ <el-dropdown-item command="double">
|
|
|
+ <i class="iconfont icon-layout_two"></i>
|
|
|
+ 一页两张</el-dropdown-item
|
|
|
+ >
|
|
|
+ <el-dropdown-item command="single">
|
|
|
+ <i class="iconfont icon-layout_h"></i>
|
|
|
+ 一张横板
|
|
|
+ </el-dropdown-item>
|
|
|
+ <el-dropdown-item command="landscape">
|
|
|
+ <i class="iconfont icon-layout_one"></i
|
|
|
+ >一张竖版</el-dropdown-item
|
|
|
+ >
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </template>
|
|
|
+ </el-dropdown></span
|
|
|
>
|
|
|
<i
|
|
|
class="iconfont icon-indexes"
|
|
|
@@ -163,7 +166,7 @@
|
|
|
/></el-icon>
|
|
|
</span>
|
|
|
<div class="selectImg" v-if="selectPhotos.includes(photo.id)">
|
|
|
- 已导入
|
|
|
+ 已导入{{ photo.id }}
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-if="photos.length == 0" class="zwsj">暂无现场照片</div>
|
|
|
@@ -305,28 +308,33 @@ const getImgList = async () => {
|
|
|
id: ele.filesId,
|
|
|
name: ele.filesTitle,
|
|
|
}));
|
|
|
- let count = 0
|
|
|
+ let count = 0;
|
|
|
let pageCentent = await getCasePhotoRollList(caseId.value);
|
|
|
pageCentent.map((ele) => {
|
|
|
if (ele.content && ele.content != "[]") {
|
|
|
- let content = JSON.parse(ele.content);
|
|
|
- if( ele.id != id){
|
|
|
+ let content = JSON.parse(ele.content);
|
|
|
+ if (ele.id != id) {
|
|
|
let listHiostry =
|
|
|
content.pages?.flatMap((item) => item.list.filter((i) => i)) || [];
|
|
|
historyPhotos.value.push(...listHiostry);
|
|
|
- }else{
|
|
|
- pageCount.value = count
|
|
|
+ } else {
|
|
|
+ pageCount.value = count;
|
|
|
}
|
|
|
- count = count + content.pages?.length
|
|
|
+ count = count + content.pages?.length;
|
|
|
}
|
|
|
});
|
|
|
+ if(!id){
|
|
|
+ pageCount.value = count;
|
|
|
+ }
|
|
|
+ editor.value.pageCount = pageCount.value;
|
|
|
pageCententList.value = pageCentent;
|
|
|
let item = pageCentent.find((ele) => ele.id == id);
|
|
|
- if(id && !item){//已删除
|
|
|
- ElMessage.error('当前照片卷已被删除')
|
|
|
- setTimeout(()=>{
|
|
|
- backPageHandler()
|
|
|
- }, 2000)
|
|
|
+ if (id && !item) {
|
|
|
+ //已删除
|
|
|
+ ElMessage.error("当前照片卷已被删除");
|
|
|
+ setTimeout(() => {
|
|
|
+ backPageHandler();
|
|
|
+ }, 2000);
|
|
|
}
|
|
|
title.value = item?.name || "";
|
|
|
let content = item && item.content && JSON.parse(item?.content);
|
|
|
@@ -335,8 +343,11 @@ const getImgList = async () => {
|
|
|
// editor.value._layoutMode = content.pages.some(ele =>ele.layoutMode == 'double') ? "double" : "single";
|
|
|
pages.value = content.pages;
|
|
|
editor.value.pageCount = pageCount.value;
|
|
|
+ console.log("saveHistoryNew", content.pages);
|
|
|
+ editor.value.isHistory = true;
|
|
|
editor.value.pages = pages.value;
|
|
|
editor.value.indexingLineList = content.indexingLineList || [];
|
|
|
+ editor.value.saveHistory(); //保留初始化数据
|
|
|
}
|
|
|
};
|
|
|
const handleSee = async () => {
|
|
|
@@ -413,7 +424,9 @@ onMounted(async () => {
|
|
|
// 初始化绘制
|
|
|
editor.value.drawAllPages(photos.value);
|
|
|
editor.value.resetPosition(); // 移除scrollToCenter,用resetPosition
|
|
|
-
|
|
|
+ if(!id){
|
|
|
+ editor.value.saveHistory(); //保留初始化数据
|
|
|
+ }
|
|
|
// 同步初始数据
|
|
|
scale.value = editor.value.scale;
|
|
|
}
|
|
|
@@ -458,7 +471,7 @@ const undo = (type) => {
|
|
|
//type = true 表示撤销,type = false 表示重做
|
|
|
if (editor.value) {
|
|
|
editor.value.indexingNum = 0;
|
|
|
- editor.value.undo(currentIndex.value, type);
|
|
|
+ editor.value.undo(type);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -515,7 +528,8 @@ const handleLayoutChange = async (value) => {
|
|
|
);
|
|
|
if (selectedPageIndex.value == -1 || isActiveItem) {
|
|
|
//未选中页面
|
|
|
- if(layoutMode.value != editor.value.layoutMode) editor.value.layoutMode = layoutMode.value;
|
|
|
+ if (layoutMode.value != editor.value.layoutMode)
|
|
|
+ editor.value.layoutMode = layoutMode.value;
|
|
|
autoLayout();
|
|
|
} else {
|
|
|
//选中页面
|
|
|
@@ -589,8 +603,8 @@ const deleteSelectedPage = async () => {
|
|
|
};
|
|
|
const handleKeyDown = (e) => {
|
|
|
console.log("handleKeyDown", e);
|
|
|
- if(selectedPageIndex.value === -1){
|
|
|
- return
|
|
|
+ if (selectedPageIndex.value === -1) {
|
|
|
+ return;
|
|
|
}
|
|
|
if (e.key === "Delete" || e.key === "Backspace") {
|
|
|
e.preventDefault();
|
|
|
@@ -632,8 +646,9 @@ const handleDrop = async (e) => {
|
|
|
const position = editor.value.getPhotoPositionInPage(e);
|
|
|
const { pageIndex, itemIndex } = position;
|
|
|
|
|
|
+ console.log("saveHistory", editor.value.history);
|
|
|
if (pageIndex === -1 || itemIndex === -1) return;
|
|
|
-
|
|
|
+ pages.value = editor.value.pages;
|
|
|
// 更新页面数据
|
|
|
const newPages = [...pages.value];
|
|
|
// 确保页面数组存在
|
|
|
@@ -642,7 +657,7 @@ const handleDrop = async (e) => {
|
|
|
while (newPages[pageIndex].list.length <= itemIndex) {
|
|
|
newPages[pageIndex].list.push("");
|
|
|
}
|
|
|
- if(newPages[pageIndex].item.length < itemIndex) {
|
|
|
+ if (newPages[pageIndex].item.length < itemIndex) {
|
|
|
newPages[pageIndex].item.push(draggedPhoto.value);
|
|
|
}
|
|
|
// 放入照片ID
|
|
|
@@ -651,13 +666,13 @@ const handleDrop = async (e) => {
|
|
|
|
|
|
// 同步数据
|
|
|
pages.value = newPages;
|
|
|
- // selectedPageIndex.value = pageIndex;
|
|
|
+ selectedPageIndex.value = pageIndex;
|
|
|
draggedPhoto.value = null;
|
|
|
|
|
|
// 重新绘制
|
|
|
editor.value.pages = pages.value;
|
|
|
- editor.value.saveHistory();
|
|
|
editor.value.drawAllPages(photos.value);
|
|
|
+ editor.value.saveHistory();
|
|
|
e.preventDefault();
|
|
|
};
|
|
|
|
|
|
@@ -665,7 +680,10 @@ const handleDrop = async (e) => {
|
|
|
* 重置画布偏移,居中显示当前选中页
|
|
|
*/
|
|
|
const exportToPDF = (paperType) => {
|
|
|
- exportCasePhotos({ showPagesRef: editor.value, title: title.value + '照片卷'});
|
|
|
+ exportCasePhotos({
|
|
|
+ showPagesRef: editor.value,
|
|
|
+ title: title.value + "照片卷",
|
|
|
+ });
|
|
|
};
|
|
|
const handleContextMenu = (e) => {
|
|
|
e.preventDefault();
|