seimin преди 1 месец
родител
ревизия
06c01c2d59

+ 10 - 3
src/app/share/inspection-execute-detail/inspection-execute-detail.component.html

@@ -93,9 +93,13 @@
93 93
       <div class="content orders">
94 94
         <div class="inner">
95 95
           <div class="top" *ngFor="let item of valueList">
96
-            <div class="info" nz-row>
97
-              <div nz-col nzSpan="8" *ngFor="let value of item">
98
-                {{ value.name }}:<span [ngClass]="value.exception === 1 ? 'red': ''">{{ getValuex(value) }}</span>
96
+            <div class="info info_display" nz-row>
97
+              <div nz-col nzSpan="8" *ngFor="let value of item" [ngClass]="{ thumbs: value.inspectionFormItemDTO.type.value == 7 }">
98
+                {{ value.name }}:
99
+                <span *ngIf="value.inspectionFormItemDTO.type.value != 7" [ngClass]="value.exception === 1 ? 'red': ''">{{ getValuex(value) }}</span>
100
+                <div *ngIf="value.inspectionFormItemDTO.type.value == 7" class="thumbList">
101
+                  <div class="thumb" *ngFor="let item of value.valuex;let index = index;" (click)="previewImageHandler(value.valuex, index)"><img [src]="item.thumbFilePath" alt=""></div>
102
+                </div>
99 103
               </div>
100 104
             </div>
101 105
           </div>
@@ -143,3 +147,6 @@
143 147
 
144 148
 <!-- 遮罩 -->
145 149
 <app-mask *ngIf="maskFlag"></app-mask>
150
+
151
+<!-- 图片预览 -->
152
+<app-image-viewer [imageUrl]="imgs" hidden *ngIf="isPreview" [isPreviewNow]="true" [initialViewIndex]="initialViewIndex"></app-image-viewer>

+ 31 - 0
src/app/share/inspection-execute-detail/inspection-execute-detail.component.less

@@ -97,6 +97,33 @@
97 97
           border: 1px solid #D9D9D9;
98 98
           overflow: hidden;
99 99
           padding: 10px 0;
100
+          .thumbs{
101
+            display: flex;
102
+            align-items: center;
103
+            .thumbList{
104
+              display: flex;
105
+              align-items: center;
106
+              flex-wrap: wrap;
107
+              gap: 8px;
108
+            }
109
+            .colName{
110
+              flex-shrink: 0;
111
+            }
112
+            .thumb{
113
+              width: 64px;
114
+              height: 64px;
115
+              padding: 4px;
116
+              border-radius: 4px;
117
+              border: 1px solid rgba(0,0,0,0.15);
118
+              img{
119
+                width: 100%;
120
+                height: 100%;
121
+                object-fit: cover;
122
+                object-position: center;
123
+                cursor: pointer;
124
+              }
125
+            }
126
+          }
100 127
         }
101 128
       }
102 129
 
@@ -121,6 +148,10 @@
121 148
 
122 149
         .info {
123 150
           color: #666;
151
+          &.info_display{
152
+            display: flex;
153
+            align-items: center;
154
+          }
124 155
 
125 156
           .jiaji {
126 157
             margin: 0;

+ 57 - 0
src/app/share/inspection-execute-detail/inspection-execute-detail.component.ts

@@ -47,6 +47,21 @@ export class InspectionExecuteDetailComponent implements OnInit {
47 47
     return value.formItemConfigList ? value.formItemConfigList.map(v => v.valuex).toString() : value.valuex;
48 48
   }
49 49
 
50
+  // 预览图片
51
+  imgs = [];
52
+  isPreview = false;
53
+  initialViewIndex:number = 0;
54
+  previewImageHandler(data = [], index = 0) {
55
+    this.initialViewIndex = index;
56
+    console.log(index)
57
+    this.isPreview = false;
58
+    data = data || [];
59
+    this.imgs = data.map((v) => location.origin + '/file' + v.relativeFilePath);
60
+    setTimeout(() => {
61
+      this.isPreview = true;
62
+    }, 0)
63
+  }
64
+
50 65
   // 获取详情
51 66
   hsLoading:boolean = false;
52 67
   getInfo() {
@@ -82,9 +97,51 @@ export class InspectionExecuteDetailComponent implements OnInit {
82 97
       .getFetchDataList("simple/data", "inspectionFormValues", postData)
83 98
       .subscribe((data) => {
84 99
         let valueList = data.list || [];
100
+        let imgFlag = valueList.some(v => v.inspectionFormItemDTO.type.value == 7);
101
+
102
+        if(imgFlag){
103
+          valueList.forEach(v => {
104
+            if(v.inspectionFormItemDTO.type.value == 7){
105
+              v.valuex = [];
106
+            }
107
+          })
108
+        }
109
+
85 110
         this.valueList = chunk(valueList, 3);
86 111
         this.message.remove(this.maskFlag);
87 112
         this.maskFlag = false;
113
+
114
+        if(imgFlag){
115
+          this.getImgList();
116
+        }
117
+      });
118
+  }
119
+
120
+  // 获取巡检图片
121
+  getImgList(){
122
+    this.mainService
123
+      .getPreviewImage('inspection', this.id)
124
+      .subscribe((res:any) => {
125
+        res.data = res.data || [];
126
+        res.data.forEach(v => {
127
+          v.previewUrl = location.origin + "/file" + v.relativeFilePath;
128
+          v.thumbFilePath = location.origin + "/file" + v.thumbFilePath;
129
+        })
130
+        let imgList = res.data || [];
131
+        this.valueList.forEach(v => {
132
+          v.forEach(vv => {
133
+            imgList.forEach(item => {
134
+              if(vv.itemId == item.recordId){
135
+                if(vv.valuex && vv.valuex.length){
136
+                  vv.valuex.push(item)
137
+                }else{
138
+                  vv.valuex = [item];
139
+                }
140
+              }
141
+            })
142
+          })
143
+        })
144
+        console.log(this.valueList);
88 145
       });
89 146
   }
90 147