xiaoxin 1 рік тому
батько
коміт
0fd1976ef2

+ 1 - 1
components/c-img/index.vue

@@ -23,7 +23,7 @@ export default {
 		return {
 		return {
 			uploadlist: [], //上传图片数组
 			uploadlist: [], //上传图片数组
 			value: '', //提交图片数组
 			value: '', //提交图片数组
-			action: 'https://www.jxydyw.cn/patrol-app/v1/file/upload' //没用到的
+			action: 'https://xj.chuanghai-tech.com/patrol-app/v1/file/upload'
 		}
 		}
 	},
 	},
 	created() {},
 	created() {},

+ 335 - 352
scan_pages/patroldetail/patroldetail.vue

@@ -1,450 +1,433 @@
 <template>
 <template>
-	<view class="u-flex f-d-c m-w ccc ">
-		<view class="m-w u-m-t-30 u-p-l-20 u-p-r-20  " style="background: #FFFFFF;">
+	<view class="u-flex f-d-c m-w ccc">
+		<view class="m-w u-m-t-30 u-p-l-20 u-p-r-20" style="background: #ffffff">
 			<!-- <view @click="lintext(content.pointNo)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 			<!-- <view @click="lintext(content.pointNo)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 				<view class="item-name">记录单号</view>
 				<view class="item-name">记录单号</view>
 				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.pointNo}}</view>
 				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.pointNo}}</view>
 			</view> -->
 			</view> -->
 			<view @click="lintext(content.roomName)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 			<view @click="lintext(content.roomName)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 				<view class="item-name">房间名称</view>
 				<view class="item-name">房间名称</view>
-				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.roomName}}</view>
+				<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ content.roomName }}</view>
 			</view>
 			</view>
 			<view @click="lintext(content.roomNumber)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 			<view @click="lintext(content.roomNumber)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 				<view class="item-name">房间编号</view>
 				<view class="item-name">房间编号</view>
-				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.roomNumber}}</view>
+				<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ content.roomNumber }}</view>
 			</view>
 			</view>
-			<view @click="lintext(content.buildingName+content.floorName)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
+			<view @click="lintext(content.buildingName + content.floorName)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 				<view class="item-name">房间位置</view>
 				<view class="item-name">房间位置</view>
-				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.buildingName}}{{content.floorName}}</view>
+				<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ content.buildingName }}{{ content.floorName }}</view>
 			</view>
 			</view>
 			<view @click="lintext(content.name)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 			<view @click="lintext(content.name)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 				<view class="item-name">巡检计划</view>
 				<view class="item-name">巡检计划</view>
-				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.name}}</view>
+				<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ content.name }}</view>
 			</view>
 			</view>
 			<view @click="lintext(content.time)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 			<view @click="lintext(content.time)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 				<view class="item-name">巡检时间</view>
 				<view class="item-name">巡检时间</view>
-				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.time}}</view>
+				<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ content.time }}</view>
 			</view>
 			</view>
 			<view @click="lintext(content.username)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 			<view @click="lintext(content.username)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 				<view class="item-name">巡检人员</view>
 				<view class="item-name">巡检人员</view>
-				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.username}}</view>
+				<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ content.username }}</view>
 			</view>
 			</view>
 			<view @click="lintext(content.qualified)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 			<view @click="lintext(content.qualified)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 				<view class="item-name">是否合格</view>
 				<view class="item-name">是否合格</view>
-				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.qualified==true?"合格":"不合格"}}</view>
+				<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ content.qualified == true ? '合格' : '不合格' }}</view>
 			</view>
 			</view>
 			<view @click="lintext(content.score)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 			<view @click="lintext(content.score)" class="u-flex u-row-between border-bottom u-p-b-28 u-p-t-28">
 				<view class="item-name">评分</view>
 				<view class="item-name">评分</view>
-				<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{content.score}}</view>
+				<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ content.score }}</view>
 			</view>
 			</view>
-			
+
 			<!-- 巡检项目头 -->
 			<!-- 巡检项目头 -->
-				<view class="collect_tit u-flex u-row-left u-col-center">
-					<view class="tit">
-						巡检项目
+			<view class="collect_tit u-flex u-row-left u-col-center">
+				<view class="tit">巡检项目</view>
+				<image :src="icon1"></image>
+				<span>设备:{{ content.devices.length + 1 }}件</span>
+				<image :src="icon2"></image>
+				<span>项目:{{ checkItemCount }}个</span>
+			</view>
+			<block>
+				<!--自带项目-设备名 -->
+				<label class="sel_point u-flex u-row-between u-m-b-34" @click="sel_show1">
+					<view class="sel_tit u-flex u-row-left u-m-l-26">
+						<span>{{ content.roomName }}自带项目</span>
+						<!-- <sup class="sup">*</sup> -->
 					</view>
 					</view>
-					<image :src="icon1"></image>
-					<span>设备:{{content.devices.length + 1}}件</span>
-					<image :src="icon2"></image>
-					<span>项目:{{checkItemCount}}个</span>
-				</view>
-				<block>
-					<!--自带项目-设备名 -->
-					<label class="sel_point u-flex u-row-between u-m-b-34" @click="sel_show1">
-						<view class="sel_tit u-flex u-row-left u-m-l-26">
-							<span>{{content.roomName}}自带项目</span>
-							<!-- <sup class="sup">*</sup> -->
-						</view>
-						<view class="triangle u-m-r-26" :style="tri_style1">
-						</view>
-					</label>
-					<!-- 检查项 -->
-					<block class="scan_itm1" v-if="itm1_show" >
-						<view v-for="(iam,i) in content.checkItems" :key="i">
-							<!-- <view @click="lintext(iam.value)" class="u-flex u-row-between border-bottom u-p-b-34 u-p-t-34">
+					<view class="triangle u-m-r-26" :style="tri_style1"></view>
+				</label>
+				<!-- 检查项 -->
+				<block class="scan_itm1" v-if="itm1_show">
+					<view v-for="(iam, i) in content.checkItems" :key="i">
+						<!-- <view @click="lintext(iam.value)" class="u-flex u-row-between border-bottom u-p-b-34 u-p-t-34">
 								<view class="item-name">{{iam.checkItemName}}</view>
 								<view class="item-name">{{iam.checkItemName}}</view>
 								<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{iam.value}}</view>
 								<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{iam.value}}</view>
 							</view> -->
 							</view> -->
-							<!-- 数字项与选择项 -->
-							<view v-if="iam.checkItemType == 2 || iam.checkItemType == 1" @click="lintext(iam.value)" class="u-flex u-row-between border-bottom u-m-b-34 u-p-b-34 ">
-								<view class="item-name">{{iam.checkItemName}}</view>
-								<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{iam.value == '' ? "暂无数据" : iam.value }}</view>
-							</view>
-							<!-- 文本项 -->
-							<view v-else-if="iam.checkItemType == 3" @click="lintext(iam.value)" class=" border-bottom u-m-b-34">
-								<view class="item-name" >{{iam.checkItemName}}:</view>
-								<view v-if="iam.value != ''" class="text_box u-m-t-18">{{iam.value}}</view>
-								<block v-else>
-									<u-empty text="数据为空" ></u-empty>
-								</block>
-							</view>
-							<!-- 图片项 -->
-							<view v-else class="img_box  u-m-b-34  u-p-b-2">
-								<view class="item-name">{{iam.checkItemName}}</view>
-								<!-- <view v-if="iam.value != ''"  class="img_itms u-m-t-18">
+						<!-- 数字项与选择项 -->
+						<view v-if="iam.checkItemType == 2 || iam.checkItemType == 1" @click="lintext(iam.value)" class="u-flex u-row-between border-bottom u-m-b-34 u-p-b-34">
+							<view class="item-name">{{ iam.checkItemName }}</view>
+							<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ iam.value == '' ? '暂无数据' : iam.value }}</view>
+						</view>
+						<!-- 文本项 -->
+						<view v-else-if="iam.checkItemType == 3" @click="lintext(iam.value)" class="border-bottom u-m-b-34">
+							<view class="item-name">{{ iam.checkItemName }}:</view>
+							<view v-if="iam.value != ''" class="text_box u-m-t-18">{{ iam.value }}</view>
+							<block v-else>
+								<u-empty text="数据为空"></u-empty>
+							</block>
+						</view>
+						<!-- 图片项 -->
+						<view v-else class="img_box u-m-b-34 u-p-b-2">
+							<view class="item-name">{{ iam.checkItemName }}</view>
+							<!-- <view v-if="iam.value != ''"  class="img_itms u-m-t-18">
 									<view class="img_itm" v-for="(index,key) in iam.value" :key="key">
 									<view class="img_itm" v-for="(index,key) in iam.value" :key="key">
 										<u-image @click="previewImage(key,iam.value)" width="139rpx" height="139rpx" :src="index"></u-image>
 										<u-image @click="previewImage(key,iam.value)" width="139rpx" height="139rpx" :src="index"></u-image>
 									</view>
 									</view>
 								</view> -->
 								</view> -->
-								<view v-if="iam.value != ''" class=" u-m-t-18" v-for="(index,key) in iam.value" :key="key">
-									<view class="titl  u-flex u-row-left u-m-t-12  u-m-l-8">
-										<span>{{key + 1}}.{{index.name}}</span>
-									</view>
-									<view class="img_itms">
-										<view class="img_itm" v-for="(img,imgIndex) in index.value" :key="key">
-											<u-image  @click="previewImage(imgIndex,index.value)" width="139rpx" height="139rpx" :src="img"></u-image>
-										</view>	
+							<view v-if="iam.value != ''" class="u-m-t-18" v-for="(index, key) in iam.value" :key="key">
+								<view class="titl u-flex u-row-left u-m-t-12 u-m-l-8">
+									<span>{{ key + 1 }}.{{ index.name }}</span>
+								</view>
+								<view class="img_itms">
+									<view class="img_itm" v-for="(img, imgIndex) in index.value" :key="key">
+										<u-image @click="previewImage(imgIndex, index.value)" width="139rpx" height="139rpx" :src="img"></u-image>
 									</view>
 									</view>
 								</view>
 								</view>
-								<block v-else>
-									<u-empty text="数据为空" ></u-empty>
-								</block>
 							</view>
 							</view>
+							<block v-else>
+								<u-empty text="数据为空"></u-empty>
+							</block>
 						</view>
 						</view>
-					</block>
+					</view>
 				</block>
 				</block>
-				
-				<block v-for="(item,i) in content.devices" :key="item.id">
-					<!--巡检设备-设备名 -->
-					<label class="sel_point u-flex u-row-between u-m-b-40" @click="sel_show(i)">
-						<view class="sel_tit u-flex u-row-left u-m-l-26">
-							<span>{{item.deviceName}}</span>
-							<!-- <sup class="sup">*</sup> -->
+			</block>
+
+			<block v-for="(item, i) in content.devices" :key="item.id">
+				<!--巡检设备-设备名 -->
+				<label class="sel_point u-flex u-row-between u-m-b-40" @click="sel_show(i)">
+					<view class="sel_tit u-flex u-row-left u-m-l-26">
+						<span>{{ item.deviceName }}</span>
+						<!-- <sup class="sup">*</sup> -->
+					</view>
+					<view class="triangle u-m-r-26" :style="sel_style[i].tri_style"></view>
+				</label>
+				<!-- 检查项 -->
+				<block class="scan_itm1" v-if="sel_style[i].it_show">
+					<view v-for="ite in item.checkItems" :key="ite.id">
+						<!-- 选择项或数字项 -->
+						<view v-if="ite.checkItemType == 1 || ite.checkItemType == 2" @click="lintext(ite.value)" class="u-flex u-row-between border-bottom u-p-b-34 u-m-b-34">
+							<view class="item-name">{{ ite.checkItemName }}</view>
+							<view class="u-line-1 item-config u-text-right" style="width: 342rpx">{{ ite.value == '' ? '数据为空' : ite.value }}</view>
 						</view>
 						</view>
-						<view class="triangle u-m-r-26" :style="sel_style[i].tri_style">
+						<!-- 文本项 -->
+						<view v-else-if="ite.checkItemType == 3" @click="lintext(ite.value)" class="u-m-b-34 border-bottom">
+							<view class="item-name">{{ ite.checkItemName }}:</view>
+							<view v-if="iam.value != ''" class="text_box u-m-t-18">{{ ite.value }}</view>
+							<block v-else>
+								<u-empty text="数据为空"></u-empty>
+							</block>
 						</view>
 						</view>
-					</label>
-					<!-- 检查项 -->
-						<block class="scan_itm1" v-if="sel_style[i].it_show">
-							<view v-for="ite in item.checkItems" :key="ite.id">
-								<!-- 选择项或数字项 -->
-								<view v-if="ite.checkItemType == 1 || ite.checkItemType == 2" @click="lintext(ite.value)" class="u-flex u-row-between border-bottom u-p-b-34 u-m-b-34">
-									<view class="item-name">{{ite.checkItemName}}</view>
-									<view class="u-line-1 item-config  u-text-right" style="width: 342rpx;">{{ite.value == '' ? "数据为空" : ite.value }}</view>
-								</view>
-								<!-- 文本项 -->
-								<view v-else-if="ite.checkItemType == 3" @click="lintext(ite.value)" class=" u-m-b-34  border-bottom">
-									<view class="item-name" >{{ite.checkItemName}}:</view>
-									<view v-if="iam.value != ''" class="text_box u-m-t-18">{{ite.value}}</view>
-									<block v-else>
-										<u-empty text="数据为空" ></u-empty>
-									</block>
+						<!-- 图片项 -->
+						<view v-else class="img_box u-m-b-34">
+							<view class="item-name">{{ ite.checkItemName }}</view>
+							<view v-if="ite.value != ''" class="u-m-t-18" v-for="(index, key) in ite.value" :key="key">
+								<view class="titl u-flex u-row-left u-m-t-12 u-m-l-8">
+									<span>{{ key + 1 }}.{{ index.name }}</span>
 								</view>
 								</view>
-								<!-- 图片项 -->
-								<view v-else class="img_box u-m-b-34">
-									<view class="item-name" >{{ite.checkItemName}}</view>
-										<view v-if="ite.value != ''" class=" u-m-t-18" v-for="(index,key) in ite.value" :key="key">
-											<view class="titl  u-flex u-row-left u-m-t-12  u-m-l-8">
-												<span>{{key + 1}}.{{index.name}}</span>
-											</view>
-											<view class="img_itms">
-												<view class="img_itm" v-for="(img,imgIndex) in index.value" :key="key">
-													<u-image  @click="previewImage(imgIndex,index.value)" width="139rpx" height="139rpx" :src="img"></u-image>
-												</view>	
-											</view>
-										</view>
-										<block v-else>
-											<u-empty text="数据为空" ></u-empty>
-										</block>
+								<view class="img_itms">
+									<view class="img_itm" v-for="(img, imgIndex) in index.value" :key="key">
+										<u-image @click="previewImage(imgIndex, index.value)" width="139rpx" height="139rpx" :src="img"></u-image>
 									</view>
 									</view>
 								</view>
 								</view>
-						</block>
+							</view>
+							<block v-else>
+								<u-empty text="数据为空"></u-empty>
+							</block>
+						</view>
+					</view>
 				</block>
 				</block>
-			</view>
+			</block>
+		</view>
 		<u-top-tips ref="chektost"></u-top-tips>
 		<u-top-tips ref="chektost"></u-top-tips>
-
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
-	import icon1 from '@/static/img/devi.png'
-	import icon2 from '@/static/img/proj.png'
-	import dayjs from "dayjs";
-	import {
-		partinfo
-	} from '@/api/index.js'
-	export default {
-		data() {
-			return {
-				icon1: icon1,
-				icon2: icon2,
-				checkItemCount:0,//项目数量
-				tri_style1: '', //自带项目三角形样式变化
-				itm1_show: true,//自带项目三角形样式变化
-				// tri_style: '',
-				// it_show: true,
-				sel_style:[],
-				content: null, //列表数据
-				finishStatus: ["", '按时完成', '尚未巡检(正常时效内未检)', '超时漏检(超过时效后未检)', '提前完成', '延时完成']
+import icon1 from '@/static/img/devi.png'
+import icon2 from '@/static/img/proj.png'
+import dayjs from 'dayjs'
+import { partinfo } from '@/api/index.js'
+export default {
+	data() {
+		return {
+			icon1: icon1,
+			icon2: icon2,
+			checkItemCount: 0, //项目数量
+			tri_style1: '', //自带项目三角形样式变化
+			itm1_show: true, //自带项目三角形样式变化
+			// tri_style: '',
+			// it_show: true,
+			sel_style: [],
+			content: null, //列表数据
+			finishStatus: ['', '按时完成', '尚未巡检(正常时效内未检)', '超时漏检(超过时效后未检)', '提前完成', '延时完成']
+		}
+	},
+	onLoad(option) {
+		this.init(option.taskId, option.roomId)
+	},
+
+	methods: {
+		//自带项目三角样式变化
+		sel_show1() {
+			this.itm1_show = !this.itm1_show
+			if (!this.itm1_show) {
+				this.tri_style1 = 'margin-top: 0rpx;margin-bottom:10rpx;border-top-color:transparent;border-bottom-color: #808080;'
+			} else {
+				this.tri_style1 = 'margin-top: 10rpx;margin-bottom:0rpx;border-top-color:#808080;border-bottom-color: transparent;'
 			}
 			}
 		},
 		},
-		onLoad(option) {
-			this.init(option.taskId, option.roomId)
-		},
+		//设备三角形样式变化
+		sel_show(index) {
+			// obj.tri_style
+			// obj.it_show
+			this.sel_style[index].it_show = !this.sel_style[index].it_show
 
 
-		methods: {
-			//自带项目三角样式变化
-			sel_show1() {
-				this.itm1_show = !this.itm1_show;
-				if (!this.itm1_show) {
-					this.tri_style1 =
-						'margin-top: 0rpx;margin-bottom:10rpx;border-top-color:transparent;border-bottom-color: #808080;';
-				} else {
-					this.tri_style1 =
-						'margin-top: 10rpx;margin-bottom:0rpx;border-top-color:#808080;border-bottom-color: transparent;';
-				}
-			},
-			//设备三角形样式变化
-			sel_show(index) {
-				// obj.tri_style
-				// obj.it_show
-				this.sel_style[index].it_show = !this.sel_style[index].it_show
-				
-				if (!this.sel_style[index].it_show) {
-					this.sel_style[index].tri_style =
-						'margin-top: 0rpx;margin-bottom:10rpx;border-top-color:transparent;border-bottom-color: #808080;';
-				} else {
-					this.sel_style[index].tri_style =
-						'margin-top: 10rpx;margin-bottom:0rpx;border-top-color:#808080;border-bottom-color: transparent;';
-				}
-			},
-			//预览图片
-			previewImage(index,i){
-						 uni.previewImage({
-						            current:index, //预览图片的下标
-						            urls: i//预览图片的地址,必须要数组形式,如果不是数组形式就转换成数组形式就可以
-						    })
-					},
-			// 获取页面数据
-			async init(taskId, roomId) {
-				let {
-					data,
-					code,
-					message
-				} = await partinfo({
-					taskId,
-					roomId
+			if (!this.sel_style[index].it_show) {
+				this.sel_style[index].tri_style = 'margin-top: 0rpx;margin-bottom:10rpx;border-top-color:transparent;border-bottom-color: #808080;'
+			} else {
+				this.sel_style[index].tri_style = 'margin-top: 10rpx;margin-bottom:0rpx;border-top-color:#808080;border-bottom-color: transparent;'
+			}
+		},
+		//预览图片
+		previewImage(index, i) {
+			uni.previewImage({
+				current: index, //预览图片的下标
+				urls: i //预览图片的地址,必须要数组形式,如果不是数组形式就转换成数组形式就可以
+			})
+		},
+		// 获取页面数据
+		async init(taskId, roomId) {
+			let { data, code, message } = await partinfo({
+				taskId,
+				roomId
+			})
+			if (code != 200) {
+				uni.showToast({
+					title: message,
+					type: 'warning'
 				})
 				})
-				if(code != 200) {
-					uni.showToast({
-						title:message,
-						type:"warning"
+			}
+			data.time = dayjs(data.time).format('YYYY-MM-DD HH:mm:ss')
+			//一、自带巡检项目-数据处理
+			data.checkItems.forEach((i) => {
+				let checkItem = JSON.parse(i.checkItem)
+				//图片数据处理
+				if (i.checkItemType == 4) {
+					let imgValue = JSON.parse(i.value)
+					i.value = []
+					let b = undefined //查找项
+					imgValue.forEach((j) => {
+						let a = j.value.match(/[^\,]+/g) //	图片数组
+						b = checkItem.photoPoints.find((ite, index) => {
+							return ite.id == j.id
+						})
+						if (a && b) {
+							let imgItem = {}
+							imgItem.name = b.name
+							imgItem.value = a
+							i.value.push(imgItem)
+						} else {
+							return i.value
+						}
 					})
 					})
 				}
 				}
-				data.time=dayjs(data.time).format("YYYY-MM-DD HH:mm:ss")
-				//一、自带巡检项目-数据处理
-				data.checkItems.forEach(i => {
+				//选择项数据处理
+				if (i.checkItemType == 1) {
+					if (i.value !== '') {
+						let selArr = i.value.match(/[^\,]+/g)
+						let resStr = ''
+						let rightItem = undefined
+						selArr.forEach((sel) => {
+							rightItem = checkItem.options.find((ite) => {
+								return ite.id == sel
+							})
+							resStr == '' ? (resStr = rightItem.optionName) : (resStr = resStr + ',' + rightItem.optionName)
+						})
+						i.value = resStr
+					} else {
+						i.value = ''
+					}
+				}
+			})
+			//二、巡检设备-数据处理
+			data.devices.forEach((item) => {
+				//计算巡检项目数
+				this.checkItemCount += item.checkItems.length
+				//收缩框虚拟DOM
+				let obj = {}
+				obj.tri_style = 'margin-top: 10rpx;margin-bottom:0rpx;border-top-color:#808080;border-bottom-color: transparent;'
+				obj.it_show = true
+				this.sel_style.push(obj)
+				//数据
+				item.checkItems.forEach((i) => {
 					let checkItem = JSON.parse(i.checkItem)
 					let checkItem = JSON.parse(i.checkItem)
-					//图片数据处理
+					//处理图片数据
 					if (i.checkItemType == 4) {
 					if (i.checkItemType == 4) {
 						let imgValue = JSON.parse(i.value)
 						let imgValue = JSON.parse(i.value)
 						i.value = []
 						i.value = []
-						let b = undefined //查找项
-						imgValue.forEach(j => {
-						let a =	j.value.match(/[^\,]+/g) //	图片数组
-						b = checkItem.photoPoints.find((ite,index) => {
-							return ite.id == j.id
+						let rightItem = undefined //查找项
+						imgValue.forEach((j) => {
+							let imgArr = j.value.match(/[^\,]+/g) //	图片数组
+							rightItem = checkItem.options.find((ite, index) => {
+								return ite.id == j.id
 							})
 							})
-						if(a && b) {
+							if (imgArr && rightItem) {
 								let imgItem = {}
 								let imgItem = {}
-								imgItem.name = b.name
-								imgItem.value = a
+								imgItem.name = rightItem.name
+								imgItem.value = imgArr
 								i.value.push(imgItem)
 								i.value.push(imgItem)
-						} else{
-							return i.value 
-						}
+							} else {
+								return i.value
+							}
 						})
 						})
 					}
 					}
 					//选择项数据处理
 					//选择项数据处理
-					if(i.checkItemType == 1) {
-						if(i.value !== '') {
-							let selArr =i.value.match(/[^\,]+/g)
+					if (i.checkItemType == 1) {
+						if (i.value != '') {
+							let selArr = i.value.match(/[^\,]+/g)
 							let resStr = ''
 							let resStr = ''
-							let rightItem = undefined
-							selArr.forEach(sel => {
-								 rightItem = checkItem.options.find((ite) => {
-								return ite.id == sel
+							let a = undefined //查找项
+							selArr.forEach((sel) => {
+								a = checkItem.options.find((ite, index) => {
+									return ite.id == sel
 								})
 								})
-								resStr == '' ? resStr = rightItem.optionName : resStr = resStr + ',' + rightItem.optionName
+								resStr == '' ? (resStr = a.optionName) : (resStr = resStr + ',' + a.optionName)
 							})
 							})
 							i.value = resStr
 							i.value = resStr
-						}
-						else {
+						} else {
 							i.value = ''
 							i.value = ''
 						}
 						}
 					}
 					}
 				})
 				})
-				//二、巡检设备-数据处理
-				data.devices.forEach(item => {
-					//计算巡检项目数
-					this.checkItemCount += item.checkItems.length 
-					//收缩框虚拟DOM
-					let obj = {}
-					obj.tri_style = 'margin-top: 10rpx;margin-bottom:0rpx;border-top-color:#808080;border-bottom-color: transparent;'
-					obj.it_show = true
-					this.sel_style.push(obj)
-					//数据
-					item.checkItems.forEach(i => {
-						let checkItem = JSON.parse(i.checkItem)
-						//处理图片数据
-						if (i.checkItemType == 4) {
-							let imgValue = JSON.parse(i.value)
-							i.value = []
-							let rightItem = undefined //查找项
-							imgValue.forEach(j => {
-							let imgArr = j.value.match(/[^\,]+/g) //	图片数组
-							rightItem = checkItem.options.find((ite,index) => {
-								return ite.id == j.id
-								})
-							if(imgArr && rightItem) {
-									let imgItem = {}
-									imgItem.name = rightItem.name
-									imgItem.value = imgArr
-									i.value.push(imgItem)
-							} else{
-								return i.value 
-							}
-							})
-						}
-						//选择项数据处理
-						if(i.checkItemType == 1) {
-							if(i.value != '') {
-								let selArr =i.value.match(/[^\,]+/g)
-								let resStr = ''
-								let a = undefined //查找项
-								selArr.forEach(sel => {
-									 a = checkItem.options.find((ite,index) => {
-									return ite.id == sel
-									})
-									resStr == '' ? resStr = a.optionName : resStr = resStr + ',' + a.optionName
-								})
-								i.value = resStr
-							}
-							else {
-								i.value = ''
-							}
-						}
-					})
-				})
-				//三、巡检项目数
-				this.checkItemCount +=  data.checkItems.length
-				this.content = data
-			},
-			// 点击顶部提示文字
-			lintext(text) {
-				this.$refs.chektost.show({
-					title: text,
-					type: 'primary',
-					duration: '2300'
-				})
-			}
+			})
+			//三、巡检项目数
+			this.checkItemCount += data.checkItems.length
+			this.content = data
+			console.log(this.content)
+		},
+		// 点击顶部提示文字
+		lintext(text) {
+			this.$refs.chektost.show({
+				title: text,
+				type: 'primary',
+				duration: '2300'
+			})
 		}
 		}
 	}
 	}
+}
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
-	page {
-		width: 100%;
-		height: 100%;
-		background: #FFFFFF
-	}
+page {
+	width: 100%;
+	height: 100%;
+	background: #ffffff;
+}
 
 
-	.border-bottom {
-		border-bottom: 2rpx solid #E6E6E6;
-	}
+.border-bottom {
+	border-bottom: 2rpx solid #e6e6e6;
+}
 
 
-	.item-name {
-		font-size: 28rpx;
-		font-family: Microsoft YaHei-3970(82674968);
-		font-weight: 400;
-		color: #333333;
-		box-sizing: border-box;
+.item-name {
+	font-size: 28rpx;
+	font-family: Microsoft YaHei-3970(82674968);
+	font-weight: 400;
+	color: #333333;
+	box-sizing: border-box;
+}
+
+.item-config {
+	font-size: 28rpx;
+	font-family: Microsoft YaHei-3970(82674968);
+	font-weight: 400;
+	color: #808080;
+	box-sizing: border-box;
+}
+
+.reacakye {
+	font-size: 28rpx;
+	font-family: Microsoft YaHei-3970(82674968);
+	font-weight: 400;
+	color: #333333;
+}
+
+.collect_tit {
+	width: 710rpx;
+	height: 104rpx;
+
+	.tit {
+		width: 128rpx;
+		height: 33rpx;
+		margin-left: 30rpx;
+		font-size: 32rpx;
+		font-weight: bold;
+		color: #010101;
 	}
 	}
 
 
-	.item-config {
-		font-size: 28rpx;
-		font-family: Microsoft YaHei-3970(82674968);
-		font-weight: 400;
-		color: #808080;
-		box-sizing: border-box;
+	image {
+		max-width: 24rpx;
+		max-height: 24rpx;
+		margin-left: 42rpx;
+		margin-top: 12rpx;
 	}
 	}
 
 
-	.reacakye {
-		font-size: 28rpx;
+	span {
+		height: 24rpx;
+		margin-left: 10rpx;
+		font-size: 24rpx;
 		font-family: Microsoft YaHei-3970(82674968);
 		font-family: Microsoft YaHei-3970(82674968);
 		font-weight: 400;
 		font-weight: 400;
-		color: #333333;
+		color: #808080;
 	}
 	}
+}
 
 
-	.collect_tit {
-		width: 710rpx;
-		height: 104rpx;
-
-		.tit {
-			width: 128rpx;
-			height: 33rpx;
-			margin-left: 30rpx;
-			font-size: 32rpx;
-			font-weight: bold;
-			color: #010101;
-		}
-
-		image {
-			max-width: 24rpx;
-			max-height: 24rpx;
-			margin-left: 42rpx;
-			margin-top: 12rpx;
-		}
+.sel_point {
+	width: 710rpx;
+	height: 70rpx;
+	background: #ebf8ff;
 
 
-		span {
-			height: 24rpx;
-			margin-left: 10rpx;
-			font-size: 24rpx;
-			font-family: Microsoft YaHei-3970(82674968);
-			font-weight: 400;
-			color: #808080;
-		}
+	.sup {
+		color: red;
 	}
 	}
 
 
-	.sel_point {
-		width: 710rpx;
-		height: 70rpx;
-		background: #EBF8FF;
-
-		.sup {
-			color: red;
-		}
-
-		.triangle {
-			margin-top: 10rpx;
-			display: inline-block;
-			/* Base Style */
-			border: solid 10rpx transparent;
-			border-top-color: #808080;
-		}
-	}
-	.img_box {
-		// width: 690rpx;
-	}
-	.img_itms{
-		display: flex;
-		flex-direction: row;
-		flex-wrap: wrap;
-		justify-content: flex-start;
-		align-items: center;
-		align-content:space-between;
-	}
-	.img_itm {
+	.triangle {
+		margin-top: 10rpx;
 		display: inline-block;
 		display: inline-block;
-		width: 139rpx;
-		height: 139rpx;
-		margin-right: 20rpx;
-	}
-	.text_box{
-		height: 150rpx;
-		max-height:210rpx ;
-		color: #808080;
-		text-indent: 40rpx;
+		/* Base Style */
+		border: solid 10rpx transparent;
+		border-top-color: #808080;
 	}
 	}
-	
+}
+.img_box {
+	// width: 690rpx;
+}
+.img_itms {
+	display: flex;
+	flex-direction: row;
+	flex-wrap: wrap;
+	justify-content: flex-start;
+	align-items: center;
+	align-content: space-between;
+}
+.img_itm {
+	display: inline-block;
+	width: 139rpx;
+	height: 139rpx;
+	margin-right: 20rpx;
+}
+.text_box {
+	height: 150rpx;
+	max-height: 210rpx;
+	color: #808080;
+	text-indent: 40rpx;
+}
 </style>
 </style>

+ 118 - 112
scan_pages/scanning/scanItem/scanimg.vue

@@ -1,135 +1,141 @@
 <template>
 <template>
 	<view>
 	<view>
 		<view class="img_box u-m-t-24">
 		<view class="img_box u-m-t-24">
-			<view v-for="(imgItem,im) in photoPoints" :key="imgItem.id">
-				<view class="titl  u-flex u-row-left u-m-t-12  u-m-l-8">
-					<span>{{im + 1}}.{{imgItem.name}}</span>
+			<view v-for="(imgItem, im) in photoPoints" :key="imgItem.id">
+				<view class="titl u-flex u-row-left u-m-t-12 u-m-l-8">
+					<span>{{ im + 1 }}.{{ imgItem.name }}</span>
 					<sup class="sup" v-if="imgItem.isRequired">*</sup>
 					<sup class="sup" v-if="imgItem.isRequired">*</sup>
 				</view>
 				</view>
-				<u-upload :source-type="['camera']" @on-list-change="change(imgItem.id,im)" upload-text="拍照" width="139"
-					height="139" :max-size="10 * 1024 * 1024" max-count="6" ref="uUpload" :action="action"
-					:auto-upload="false">
-				</u-upload>
+				<u-upload
+					:source-type="['camera']"
+					@on-list-change="change(imgItem.id, im)"
+					upload-text="拍照"
+					width="139"
+					height="139"
+					:max-size="10 * 1024 * 1024"
+					max-count="6"
+					ref="uUpload"
+					:action="action"
+					:auto-upload="false"
+				></u-upload>
 			</view>
 			</view>
 		</view>
 		</view>
-		
+
 		<u-toast ref="sacast" />
 		<u-toast ref="sacast" />
 	</view>
 	</view>
-
 </template>
 </template>
 
 
 <script>
 <script>
-	export default {
-		props: {
-			//照片点数组
-			photoPoints: {
-				type: [Object, Array]
-			},
-			//拍照选项项目巡检id
-			scan_id: {
-				type: Number
-			},
+export default {
+	props: {
+		//照片点数组
+		photoPoints: {
+			type: [Object, Array]
 		},
 		},
-		data() {
-			return {
-				uploadlist: [], //已上传图片数组
-				images: [], //本地图片数组
-				value: [], //提交图片数组
-				action: 'https://www.jxydyw.cn/patrol-app/v1/file/upload', //没用到的
-				load: false
-			}
-		},
-		methods: {
-			// 选择图片-暂存本地图片
-			change(id, index) {
-				// 重置待上传图片数组
-				this.images[index] = {};
-				this.images[index].id = id;
-				this.images[index].imgArr = [];
-				this.$nextTick(() => {
-					let lists = this.$refs.uUpload[index].lists;
-					lists.forEach(val => {
-						this.images[index].imgArr.push(val.url)
-					})
+		//拍照选项项目巡检id
+		scan_id: {
+			type: Number
+		}
+	},
+	data() {
+		return {
+			uploadlist: [], //已上传图片数组
+			images: [], //本地图片数组
+			value: [], //提交图片数组
+			action: 'https://xj.chuanghai-tech.com/patrol-app/v1/file/upload', //没用到的
+			load: false
+		}
+	},
+	methods: {
+		// 选择图片-暂存本地图片
+		change(id, index) {
+			// 重置待上传图片数组
+			this.images[index] = {}
+			this.images[index].id = id
+			this.images[index].imgArr = []
+			this.$nextTick(() => {
+				let lists = this.$refs.uUpload[index].lists
+				lists.forEach((val) => {
+					this.images[index].imgArr.push(val.url)
 				})
 				})
-			},
-			//提交
-			async submit() {
-				for (var index = 0; index < this.images.length; index++) {
-					const item = this.images[index];
-					this.uploadlist[index] = {};
-					this.uploadlist[index].imgArr = [];
-					this.uploadlist[index].id = item.id;
+			})
+		},
+		//提交
+		async submit() {
+			for (var index = 0; index < this.images.length; index++) {
+				const item = this.images[index]
+				this.uploadlist[index] = {}
+				this.uploadlist[index].imgArr = []
+				this.uploadlist[index].id = item.id
 
 
-					await Promise.all(item.imgArr.map(url => this.upload(url, item.id, index)));
-					
-					console.log("全部图片上传完成",JSON.stringify(this.uploadlist))
-				}
-				
-				console.log("执行了后续操作")
-				
-				//生成图片字符串
-				let uploadArr = JSON.parse(JSON.stringify(this.uploadlist));
-				let imgStr = '';
-				for (let i = 0; i < uploadArr.length; i++) {
-					let len = uploadArr[i].imgArr.length;
-					if (len > 1) {
-						imgStr = uploadArr[i].imgArr[0];
-						for (let j = 1; j < len; j++) {
-							imgStr = imgStr + "," + uploadArr[i].imgArr[j];
-						}
-					} else if (len == 1) {
-						imgStr = uploadArr[i].imgArr[0];
-					} else {
-						return imgStr = ''
+				await Promise.all(item.imgArr.map((url) => this.upload(url, item.id, index)))
+
+				console.log('全部图片上传完成', JSON.stringify(this.uploadlist))
+			}
+
+			console.log('执行了后续操作')
+
+			//生成图片字符串
+			let uploadArr = JSON.parse(JSON.stringify(this.uploadlist))
+			let imgStr = ''
+			for (let i = 0; i < uploadArr.length; i++) {
+				let len = uploadArr[i].imgArr.length
+				if (len > 1) {
+					imgStr = uploadArr[i].imgArr[0]
+					for (let j = 1; j < len; j++) {
+						imgStr = imgStr + ',' + uploadArr[i].imgArr[j]
 					}
 					}
-					let obj = {};
-					obj.id = uploadArr[i].id;
-					obj.value = imgStr;
-					this.value[i] = obj;
+				} else if (len == 1) {
+					imgStr = uploadArr[i].imgArr[0]
+				} else {
+					return (imgStr = '')
 				}
 				}
-				//巡检图片数据提交
-				let newarr = JSON.parse(JSON.stringify(this.value));
-				let item = {
-					id: this.scan_id,
-					value: JSON.stringify(newarr)
-				} //提交数据
-				this.$store.state.user.items.push(item);
-			},
-			//上传图片API
-			upload(item, id, index) {
-				return new Promise((resolve, reject) => {
-					uni.uploadFile({
-						url: 'https://www.jxydyw.cn/patrol-app/v1/file/upload', //仅为示例,非真实的接口地址
-						filePath: item,
-						name: 'file',
-						success: (uploadFileRes) => {
-							let data = JSON.parse(uploadFileRes.data);
-							let showUrl = data.data;
-							this.uploadlist[index].imgArr.push(showUrl);
-							resolve()
-						},
-						fail: (err) => {
-							this.$refs.sacast.show({
-								title: "图片不得超过10M",
-								type: 'warning',
-							})
-							reject()
-						}
-					});
+				let obj = {}
+				obj.id = uploadArr[i].id
+				obj.value = imgStr
+				this.value[i] = obj
+			}
+			//巡检图片数据提交
+			let newarr = JSON.parse(JSON.stringify(this.value))
+			let item = {
+				id: this.scan_id,
+				value: JSON.stringify(newarr)
+			} //提交数据
+			this.$store.state.user.items.push(item)
+		},
+		//上传图片API
+		upload(item, id, index) {
+			return new Promise((resolve, reject) => {
+				uni.uploadFile({
+					url: 'https://xj.chuanghai-tech.com/patrol-app/v1/file/upload',
+					filePath: item,
+					name: 'file',
+					success: (uploadFileRes) => {
+						let data = JSON.parse(uploadFileRes.data)
+						let showUrl = data.data
+						this.uploadlist[index].imgArr.push(showUrl)
+						resolve()
+					},
+					fail: (err) => {
+						this.$refs.sacast.show({
+							title: '图片不得超过10M',
+							type: 'warning'
+						})
+						reject()
+					}
 				})
 				})
-			},
-			//重置表单数据
-			reset() {
-				this.$nextTick(() => {
-					this.$refs.uUpload.forEach(i => {
-						i.lists.length = 0;
-					})
+			})
+		},
+		//重置表单数据
+		reset() {
+			this.$nextTick(() => {
+				this.$refs.uUpload.forEach((i) => {
+					i.lists.length = 0
 				})
 				})
-			}
+			})
 		}
 		}
 	}
 	}
+}
 </script>
 </script>
 
 
-<style>
-</style>
+<style></style>

Різницю між файлами не показано, бо вона завелика
+ 475 - 489
scan_pages/scanning/scanning.vue


+ 48 - 36
store/modules/user.js

@@ -4,34 +4,46 @@ import {
 } from '@/api/index.js'
 } from '@/api/index.js'
 const state = {
 const state = {
 	timer: {
 	timer: {
-		beginTimeStart: dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime())).format("YYYY-MM-DD HH:mm:ss"),
-		beginTimeEnd: dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1)).format("YYYY-MM-DD HH:mm:ss")
+		beginTimeStart: dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime())).format(
+			"YYYY-MM-DD HH:mm:ss"),
+		beginTimeEnd: dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1))
+			.format("YYYY-MM-DD HH:mm:ss")
 	},
 	},
 	people: [], //执行人数组
 	people: [], //执行人数组
-	taskdetail: null,// 最新任务详情
-	taskList: [],// 选择计划列表
+	taskdetail: null, // 最新任务详情
+	taskList: [], // 选择计划列表
 	roomId: null, // 扫码获取的房间id
 	roomId: null, // 扫码获取的房间id
-	items:[] // 巡检提交数据
+	items: [] // 巡检提交数据
 }
 }
 const actions = {
 const actions = {
 	//扫一扫
 	//扫一扫
-	gettasklist({ commit }) {
+	gettasklist({
+		commit
+	}) {
 		uni.scanCode({
 		uni.scanCode({
 			onlyFromCamera: true,
 			onlyFromCamera: true,
 			success: async (res) => {
 			success: async (res) => {
-			
-				let url =res.result; // 获取URL
-				
-				let id = url.match(/[^\=]\d/g)
+
+				let url = res.result; // 获取URL
+
+				// let id = url.match(/[^\=]\d/g)
+
+				let id = getQueryString(url, "id")
 				//有id则跳转巡检
 				//有id则跳转巡检
 				if (id) {
 				if (id) {
 
 
+					// let data = await getTaskPageOfScan({
+					// 	roomId: id[0]
+					// })
+
+					// state.roomId =id[0];
+
 					let data = await getTaskPageOfScan({
 					let data = await getTaskPageOfScan({
-						roomId: id[0]
+						roomId: id
 					})
 					})
-					
-					state.roomId =id[0];
-					
+
+					state.roomId = id;
+
 					if (data.code == 200) {
 					if (data.code == 200) {
 						commit("SET_TESK", data.data)
 						commit("SET_TESK", data.data)
 					} else {
 					} else {
@@ -41,29 +53,29 @@ const actions = {
 							duration: 2000
 							duration: 2000
 						});
 						});
 					}
 					}
-				//没有id则登入或核销
-				}  else{
-					
+					//没有id则登入或核销
+				} else {
+
 					let reg = url.match(/register/)
 					let reg = url.match(/register/)
-					
+
 					reg || (reg = false)
 					reg || (reg = false)
-					
-					if(reg[0] == 'register') {
+
+					if (reg[0] == 'register') {
 						uni.navigateTo({
 						uni.navigateTo({
-								url: '/pages/writeoff/register/register',
-								complete(data) {
-									console.log("to_register", data)
-								}						
-							})
-						} else {
-							uni.navigateTo({
-									url: '/pages/writeoff/exitwritoff/exitwritoff',
-									complete(data) {
-										console.log("to_exitwritoff", data)
-									}						
-								})
-						}
-					} 
+							url: '/pages/writeoff/register/register',
+							complete(data) {
+								console.log("to_register", data)
+							}
+						})
+					} else {
+						uni.navigateTo({
+							url: '/pages/writeoff/exitwritoff/exitwritoff',
+							complete(data) {
+								console.log("to_exitwritoff", data)
+							}
+						})
+					}
+				}
 			},
 			},
 			fail() {
 			fail() {
 				console.log("失败了")
 				console.log("失败了")
@@ -84,7 +96,7 @@ const mutations = {
 			}
 			}
 		})
 		})
 	}
 	}
-	
+
 
 
 }
 }
 
 
@@ -94,4 +106,4 @@ export default {
 	state,
 	state,
 	actions,
 	actions,
 	mutations
 	mutations
-};
+};

+ 14 - 0
util/getParams.js

@@ -0,0 +1,14 @@
+//获取当前URL指定参数
+export const getQueryString = (v, name) => {
+	// 获取URL
+	let url = v;
+	// 正则匹配URL
+	let pattern = new RegExp("[?&]" + name + "=([^&]+)", "i");
+	let matcher = pattern.exec(url);
+	if (matcher == null || matcher.length < 1) {
+		return false;
+	}
+	// 输出指定的参数值
+	return decodeURIComponent(matcher[1]);
+	// return matcher[1];
+}