tangning 1 일 전
부모
커밋
90d1ff2844
4개의 변경된 파일34개의 추가작업 그리고 12개의 파일을 삭제
  1. 11 7
      src/view/case/photos/canvas-photo-editor.js
  2. 20 2
      src/view/case/photos/index.vue
  3. 1 1
      src/view/case/photos/style.scss
  4. 2 2
      src/view/material/sceneImg.vue

+ 11 - 7
src/view/case/photos/canvas-photo-editor.js

@@ -228,8 +228,7 @@ export class CanvasPhotoEditor {
         pageIndex: -1,
       }
     }
-    console.log('pageIndex', this.pages, this.selectedPageItem, pageIndex)
-    if(oldPageIndex == pageIndex == this.selectedPageIndex == this.selectedPageItem.pageIndex && pageIndex != -1 && this.selectedPageItem.index == -1){
+    if(oldPageIndex == pageIndex && pageIndex == this.selectedPageIndex && pageIndex == this.selectedPageItem.pageIndex && pageIndex != -1 && this.selectedPageItem.index == -1){
       if(this.indexingLineList.length){
         await this.checkIndexing('修改页面排序将会清除所有标引是否继续?')
         this.drawAllPages()
@@ -321,23 +320,25 @@ export class CanvasPhotoEditor {
   }
 
   handleMouseUp(e) {
-    console.log('handleMouseUp', this.isDragging)
     this.isDragging = false
     this.canvas.style.cursor = 'grab'
-    if(this.dragPageData.drawing){//鼠标释放左键时,移动页面到指定位置)
+    if(this.dragPageData.drawing && this.dragPageData.index != this.dragPageData.movedIndex){//鼠标释放左键时,移动页面到指定位置)
     // 末尾必须加分号!!!
-    let newPagelist = this.moveItem(this.pages, this.dragPageData.index, this.dragPageData.movedIndex-1)
+    console.log('handleMouseUpdragPageData', this.dragPageData)
+    let newPagelist = this.moveItem(this.pages, this.dragPageData.index, this.dragPageData.movedIndex)
     this.pages = newPagelist;
       this.drawAllPages()
     }
     this.dragPageData.drawing = false
     this.dragPageData.movedIndex = 0
+    this.dragPageData.index = 0
     // 松开鼠标后仅重绘一次,确认最终位置
     // this.drawDragPreview()
     // 选中页面(仅点击时重绘一次)
     console.log('pageIndex', this.indexing, this.indexingNum)
   }
   moveItem(arr, fromIndex, toIndex) {
+    let newtoIndex = fromIndex < toIndex ? toIndex : toIndex - 1;
     const newArr = [...arr]
     const item = newArr.splice(fromIndex, 1)[0]
     newArr.splice(toIndex, 0, item)
@@ -1092,13 +1093,16 @@ export class CanvasPhotoEditor {
     }else{//删除单个图片
       newPages.forEach((ele, index) => {
         if(index == this.selectedPageIndex){
-          ele.list.splice(this.selectedPageItem.index, 1)
+          ele.list[this.selectedPageItem.index] = null
+          // ele.list.splice(this.selectedPageItem.index, 1)
         }
       })
     }
     this.pages = newPages
     this.selectedPageIndex = Math.min(this.selectedPageIndex, this.pages.length - 1)
-    this.resetPosition()
+    if(this.selectedPageItem.index == -1){
+      this.resetPosition()
+    }
     return this.pages
   }
 

+ 20 - 2
src/view/case/photos/index.vue

@@ -1,5 +1,20 @@
 <template>
   <div class="phoneContent">
+      <div class="demo-image__preview">
+      <el-image-viewer
+        hide-on-click-modal
+        @close="
+          () => {
+            urlindex = -1;
+          }
+        "
+        :initial-index="urlindex"
+        show-progress
+        v-if="urlindex != -1"
+        :url-list="photos.map((item) => item.url)"
+        fit="cover"
+      />
+    </div>
     <div class="header">
       <div class="header-left">
         <el-icon
@@ -115,7 +130,8 @@
               v-for="(photo, index) in photos"
               :key="photo.id"
               class="photo-item"
-              @click="toggleSelect(photo.id)"
+              @click="()=>{urlindex = index}"
+
               @dragstart="handleDragStart($event, photo)"
               draggable
             >
@@ -125,7 +141,7 @@
                 "
                 alt="现场照片"
               />
-              <span class="used-tag">
+              <span class="used-tag" @click.stop="toggleSelect(photo.id)">
                 <el-icon
                   color="#26559B"
                   v-if="selectedPhotos.includes(photo.id)"
@@ -206,6 +222,8 @@ const selectedPageItem = ref({
   index: -1,
   pageIndex: -1,
 });
+const ImgsrcList = ref([]);
+const urlindex = ref(-1);
 const photos = ref([]);
 const historyPhotos = ref([]);
 const selectPhotos = computed(() => {

+ 1 - 1
src/view/case/photos/style.scss

@@ -81,7 +81,7 @@
     line-height: 22px;
   }
   &-top{
-    padding: 0 48px 60px 48px;
+    padding: 0 48px 100px 48px;
     max-height: calc(100vh - 98px);
     overflow-y: scroll;
     scrollbar-width: none; /* Firefox */

+ 2 - 2
src/view/material/sceneImg.vue

@@ -711,7 +711,7 @@ function getList(refresh = false) {
   //old  0 现场照片 1 现场图 2 勘验笔录 
   getCasePhotoRollList(caseId.value).then(res => {
     casePhotoList.value = res || []
-    if(active1.value == '照片卷' && res && res.length){
+    if(active1.value == '照片卷' && res && res.length && !refresh){
       handlItem2(res[0])
     }
   })
@@ -1157,7 +1157,7 @@ const handleConfirm = async () => {
         message: `修改成功`,
       });
       casePhotoItem.value.show = false;
-      await getList()
+      await getList(true)
 }
 const exportToPDF = async (isAll) => {
   if(isAll === true){