Jelajahi Sumber

Merge branch 'zdsz3.0' of http://192.168.10.18:3000/wangtong/zd_wechatApp into zdsz3.0

menchuang 1 tahun lalu
induk
melakukan
f9fccd6141
2 mengubah file dengan 81 tambahan dan 64 penghapusan
  1. 40 49
      pages/enginproject/enginproject.vue
  2. 41 15
      pages/municipal/municipal.vue

+ 40 - 49
pages/enginproject/enginproject.vue

@@ -114,16 +114,24 @@
 					<view class="align-items" style="margin-bottom: 20px;">
 						<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
 							<view v-for="(item,index) in fileArr" :key="index" style="position: relative;">
-								<view style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
-									@click="chooseModel(item.picUrl,item.fileName)">
-									{{item.fileName}}
 
-								</view>
-								<view @click="removeFile(index)" v-if="this.$user.state.name==this.createBy"
-									style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
-									<image src="../../static/images/icon_close.png" style=" width: 15px; height: 15px;">
+								<view
+									v-if="item.picUrl.substring(item.picUrl.length - 3) == 'png' || item.picUrl.substring(item.picUrl.length - 3) == 'jpg'||item.picUrl.substring(item.picUrl.length-3)=='jpeg' ">
+									<image v-if="fileImageArr.concat(item.picUrl)" :src="item.picUrl" mode=""
+										style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
+										@click="showPhotoFile(fileImageArr.indexOf(item.picUrl))">
 									</image>
 								</view>
+								<view v-else-if="item.picUrl.substring(item.picUrl.length - 3) == 'mp4'">
+									<video :src="item.picUrl"
+										style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
+								</view>
+
+
+								<view v-else style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
+									@click="chooseModel(item.picUrl,item.fileName)">
+									{{item.fileName}}
+								</view>
 
 							</view>
 						</view>
@@ -269,7 +277,6 @@
 			getToken
 		} from '../../utils/auth';
 
-		import storage from '../../utils/storage';
 		export default {
 			components: {
 				SelectPicker,
@@ -281,12 +288,6 @@
 
 
 				return {
-					user: {
-						nickName: "",
-						phonenumber: "",
-						email: "",
-						sex: ""
-					},
 					historyList: {}, //历史数据
 					show_loding: false,
 					popupText: '', //对话框内容
@@ -324,6 +325,7 @@
 					dictOptions: [],
 					imgArr: [],
 					fileArr: [],
+					fileImageArr: [],
 					fileNameArr: [],
 					type: '',
 					jlPhoneValue: '', //监理电话
@@ -343,7 +345,6 @@
 					enginId: '', //工程id
 					createTime: '',
 					infonId: '', //info id
-					createBy: '',
 
 				}
 			},
@@ -373,13 +374,6 @@
 			methods: {
 				//判断是否选择
 
-				// getUser() {
-				// 	console.log("aaaa", this.$user.state.name)
-				// 	getUserProfile().then(response => {
-				// 		//this.user = response.data.user
-				// 		console.log("dddd", response.data)
-				// 	})
-				// },
 				isEmpty(str) {
 
 					return (!str || 0 === str.length);
@@ -402,9 +396,8 @@
 					let h = time.getHours();
 					let mm = time.getMinutes();
 					let s = time.getSeconds();
-					return y + '-' + this.addTimes(m) + '-' + this.addTimes(d) + ' ' + this.addTimes(h) + ':' + this
-						.addTimes(
-							mm) + ':' + this.addTimes(s);
+					return y + '-' + this.addTimes(m) + '-' + this.addTimes(d) + ' ' + this.addTimes(h) + ':' + this.addTimes(
+						mm) + ':' + this.addTimes(s);
 
 
 				},
@@ -453,11 +446,10 @@
 						this.open = true;
 						//请求
 						console.log("sss", this.objValue.value)
-						getengineeringNameList(this.projectType.dictValue, "1", this.objValue.value).then(
-							response => {
+						getengineeringNameList(this.projectType.dictValue, "1", this.objValue.value).then(response => {
 
-								this.selectList = response.data;
-							});
+							this.selectList = response.data;
+						});
 
 
 					}
@@ -466,7 +458,13 @@
 
 				},
 
+				showPhotoFile(index) {
+					uni.previewImage({
+						current: index,
+						urls: this.fileImageArr,
+					})
 
+				},
 
 				showPhoto(index) {
 					uni.previewImage({
@@ -475,20 +473,7 @@
 					})
 
 				},
-				removeFile(index) {
-					uni.showModal({
-						title: '提示',
-						content: '是否删除该文件?',
-						success: (res) => {
-							if (res.confirm) {
-								this.fileArr.splice(index, 1)
-								this.fileNameArr.splice(index, 1)
-								console.log('this.fileArr', this.fileArr)
 
-							}
-						}
-					})
-				},
 				remove(index) {
 					uni.showModal({
 						title: '提示',
@@ -545,8 +530,7 @@
 											_this.$modal.msg(data.msg)
 										} else {
 											if (_this.progress === 100) {
-												console.log('_this.progress', _this
-													.progress)
+												console.log('_this.progress', _this.progress)
 												//console.log('data----', data)data
 												console.log('res--', res)
 												_this.imgArr.push(data.data.url)
@@ -660,10 +644,10 @@
 					this.xmfzrValue = ''; //重置项目负责人
 					this.jsdwValue = ''; //重置建设单位
 					this.enginId = ''; //重置工程id
-					this.fileArr = ''
+					this.fileArr = '';
+					this.fileImageArr = [];
 					this.createTime = '';
 					this.infonId = '';
-					this.createBy = '';
 
 				},
 				changeSelect(item, index) {
@@ -694,7 +678,6 @@
 							uni.hideLoading();
 							console.log("res", response)
 							//	this.enginList = response.data
-							this.createBy = response.data.createBy;
 							this.jlPhoneValue = response.data.supervisionPhone; //监理电话
 							this.jlfzrValue = response.data.supervisionHead; //监理负责人
 							this.jldwValue = response.data.supervisionUnit; //监理单位
@@ -707,8 +690,16 @@
 							this.enginId = response.data.id; //工程id
 							this.fileArr = response.data.pics
 							this.createTime = response.data.createTime;
-							this.infonId = response.data.zEngineeringNodeBoList[0].zEngineeringInfoBoList[0]
-								.id
+							this.infonId = response.data.zEngineeringNodeBoList[0].zEngineeringInfoBoList[0].id
+							this.fileArr.forEach((list, index) => {
+								if (list.picUrl.substring(list.picUrl.length - 3) == 'png' || list.picUrl
+									.substring(list.picUrl.length - 3) == 'jpg' || list.picUrl.substring(list
+										.picUrl.length - 3) == 'jpeg') {
+									this.fileImageArr.push(list.picUrl)
+								}
+
+
+							});
 						});
 					}
 				},

+ 41 - 15
pages/municipal/municipal.vue

@@ -112,15 +112,26 @@
 				</view>
 				<view class="uni-list">
 					<view class="align-items" style="margin-bottom: 20px;">
-						<!-- 	<view class="container" style="color: gainsboro;">*请上传文件</view> -->
 						<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
 							<view v-for="(item,index) in fileArr" :key="index" style="position: relative;">
-								<view style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
-									@click="chooseModel(item.picUrl,item.fileName)">
-									{{item.fileName}}
 
+								<view
+									v-if="item.picUrl.substring(item.picUrl.length - 3) == 'png' || item.picUrl.substring(item.picUrl.length - 3) == 'jpg'||item.picUrl.substring(item.picUrl.length-3)=='jpeg' ">
+									<image v-if="fileImageArr.concat(item.picUrl)" :src="item.picUrl" mode=""
+										style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
+										@click="showPhotoFile(fileImageArr.indexOf(item.picUrl))">
+									</image>
+								</view>
+								<view v-else-if="item.picUrl.substring(item.picUrl.length - 3) == 'mp4'">
+									<video :src="item.picUrl"
+										style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
 								</view>
 
+
+								<view v-else style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
+									@click="chooseModel(item.picUrl,item.fileName)">
+									{{item.fileName}}
+								</view>
 							</view>
 						</view>
 					</view>
@@ -167,7 +178,7 @@
 								<view>
 									材质
 								</view>
-								<view class="uni-list-cell-db"  @click="pickerShow('cz',index)">
+								<view class="uni-list-cell-db" @click="pickerShow('cz',index)">
 									<span style="color: black;">{{a.cz.id==''?'请选择材质':a.cz.name}}</span>
 									<image src="../../static/images/icon_right.png"
 										style=" position: absolute; width: 15px;height: 15px;"></image>
@@ -180,7 +191,7 @@
 									规格
 								</view>
 
-								<view class="uni-list-cell-db"  @click="pickerShow('gg',index)">
+								<view class="uni-list-cell-db" @click="pickerShow('gg',index)">
 									<span style="color: black;">{{a.gg.id==''?'请选择规格':a.gg.name}}</span>
 									<image src="../../static/images/icon_right.png"
 										style=" position: absolute; width: 15px;height: 15px;"></image>
@@ -216,8 +227,8 @@
 								</view>
 								<view @click="remove(index)"
 									style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
-									<image src="../../../static/images/icon_close.png"
-										style=" width: 15px; height: 15px;"></image>
+									<image src="../../../static/images/icon_close.png" style=" width: 15px; height: 15px;">
+									</image>
 								</view>
 							</view>
 						</view>
@@ -281,6 +292,7 @@
 					titleText: '',
 					cancelText: '',
 					confirmText: '',
+					fileImageArr: [],
 					zEngineeringMaterialBo: [], //给后台传的值  用料列表
 					czggslList: [{
 						cz: {
@@ -298,7 +310,7 @@
 						Authorization: "Bearer " + getToken()
 					},
 					time: '', //施工时间
-					
+
 					loading: false,
 					loadingFile: false,
 					projectType: {}, //工程类型
@@ -399,7 +411,7 @@
 				closeDatetimePicker() {
 					this.$refs.myPicker.hide();
 				},
-				
+
 				pickerShow(e, index) {
 					this.SelectIndex = index;
 					this.type = e; //赋值类型
@@ -444,8 +456,14 @@
 
 				},
 
+				showPhotoFile(index) {
+					uni.previewImage({
+						current: index,
+						urls: this.fileImageArr,
+					})
+
+				},
 
-			
 				showPhoto(index) {
 					uni.previewImage({
 						current: index,
@@ -453,7 +471,7 @@
 					})
 
 				},
-				
+
 				remove(index) {
 					uni.showModal({
 						title: '提示',
@@ -627,6 +645,7 @@
 					this.fileArr = ''
 					this.createTime = '';
 					this.infonId = '';
+					this.fileImageArr = [];
 
 				},
 				changeSelect(item, index) {
@@ -670,6 +689,15 @@
 							this.fileArr = response.data.pics
 							this.createTime = response.data.createTime;
 							this.infonId = response.data.zEngineeringNodeBoList[0].zEngineeringInfoBoList[0].id
+							this.fileArr.forEach((list, index) => {
+								if (list.picUrl.substring(list.picUrl.length - 3) == 'png' || list.picUrl
+									.substring(list.picUrl.length - 3) == 'jpg' || list.picUrl.substring(list
+										.picUrl.length - 3) == 'jpeg') {
+									this.fileImageArr.push(list.picUrl)
+								}
+
+
+							});
 						});
 					}
 				},
@@ -809,7 +837,7 @@
 						this.$modal.msg('请选择工程名称')
 						return
 					}
-					
+
 
 					try {
 						//console.log("刚开始", this.czggslList);
@@ -961,6 +989,4 @@
 			min-height: 100upx;
 			line-height: 20px;
 		}
-
-		
 	</style>