Browse Source

前后期影像,实地拍照不压缩

maxiaoxiao 2 days ago
parent
commit
78e00c75e0
1 changed files with 37 additions and 3 deletions
  1. 37 3
      pages/index/common/hcDetails.vue

+ 37 - 3
pages/index/common/hcDetails.vue

@@ -28,6 +28,15 @@
 							<view class="text-right">{{infoObj[item.prop]}}</view>
 						</view>
 					</view>
+					<view class="list-cell list-cell-arrow" v-if="infoObj.qsxtif">
+						<view>前期影像</view>
+						{{infoObj.qsxtifimg}}
+						<image :src="infoObj.qsxtifimg" mode="widthFix"></image>
+					</view>
+					<view class="list-cell list-cell-arrow" v-if="infoObj.hsxtif">
+						<view>后期影像</view>
+						<image :src="infoObj.hsxtifimg" mode="widthFix"></image>
+					</view>
 				</view>
 				<!-- <van-cell v-for="(item, i) in jbxxs" :key="i" :title="item.name" :value="infoObj[item.prop]" /> -->
 			</view>
@@ -72,7 +81,8 @@
 			<view class="hclist" v-show="active==2">
 				<view class="example-body">
 					<uni-file-picker ref="upsgfjsRef" limit="9" title="最多选择9张图片" v-model="fileList.sdfjs"
-						@select="e=>selectfile(e,'sdfjs')" @delete="e=>fileDelete(e,'sdfjs')"></uni-file-picker>
+						:sizeType="['original']" @select="e=>selectfile(e,'sdfjs')"
+						@delete="e=>fileDelete(e,'sdfjs')"></uni-file-picker>
 				</view>
 
 			</view>
@@ -107,7 +117,8 @@
 			<button type="primary" size="mini" @click=" toggle">举证说明</button>
 			<button type="primary" size="mini" :disabled=" !qrdis" @click="affirm(0)">确认</button>
 			<button type="primary" size="mini" :disabled=" !qrdis" @click="affirm(1)">退回</button>
-			<button type="primary" size="mini" @click="save">保存</button>
+			<button type="primary" size="mini" :disabled="!steps.find(x => x.auditflowStep=='WYDC')"
+				@click="save">保存</button>
 			<button type="primary" size="mini" :disabled=" !tjdis" @click="tj">提交</button>
 		</div>
 		<uni-popup ref="popup" background-color="#fff">
@@ -118,6 +129,10 @@
 
 </template>
 <script>
+	import {
+		TIFF
+	}
+	from 'tiff.js';
 	import {
 		uploadFile
 	} from '@/utils/choose.js'
@@ -179,6 +194,9 @@
 				let id = val.dkjdxxId
 				getDkjbxx(id).then((res) => {
 					this.infoObj = res.data;
+					this.loadAndConvertTIFF(this.infoObj.qsxtif, 'qsxtif')
+					this.loadAndConvertTIFF(this.infoObj.hsxtif, 'hsxtif')
+					console.log(this.infoObj, 'this.infoObj')
 				});
 				getDkjbywy(id).then((res) => {
 					if (res.data) {
@@ -246,10 +264,25 @@
 				}).then((res) => {
 					this.steps = res.data;
 					this.qrdis = this.steps.find((x) => x.auditflowStep.includes('WYQR'))
-					this.tjdis = this.steps.find((x) => x.auditflowStep.includes('TJ'))
+
+					// this.tjdis = this.steps.find((x) => x.auditflowStep=='WYDC')
+					this.tjdis = this.steps.find((x) => x.auditflowStep.includes('WYTJ'))
 
 				});
 			},
+			loadAndConvertTIFF(url, name) {
+				if (!url) return
+				// console.log(TIFF, 'TIFF')
+				fetch(url).then(function(tiff) {
+					var image = tiff.toRGBAImage(); // 转换为RGBA格式的图像数据
+					var canvas = document.createElement('canvas');
+					var ctx = canvas.getContext('2d');
+					var imageData = ctx.createImageData(image.getWidth(), image.getHeight());
+					imageData.data.set(image.getData().buffer);
+					ctx.putImageData(imageData, 0, 0);
+					this.infoObj[name + img] = canvas.toDataURL('image/png'); // 转换为PNG格式以便显示
+				}.bind(this));
+			},
 			reset() {
 				this.checkform = {
 					fieldworkId: this.nowobj.id,
@@ -314,6 +347,7 @@
 						url: item.path
 					})
 					uploadFile(item.path, (data) => {
+						console.log(data, 'data')
 						if (data) {
 							_this.checkform[fname].push({
 								fjPath: data.path,