<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>部位检查-详情</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <link rel="stylesheet" type="text/css" href="../../assets/css/weui.css" />
    <link rel="stylesheet" type="text/css" href="../../assets/css/weuix.css" />

    <!-- vue -->
    <script src="../../../bi/js/vue.js"></script>
    <!--全局配置-->
    <script src="../../../config.js"></script>
	</head>
	<body style="background-color: #f1f1f1;">
		<div id="app">
			<div class="dy-card padding10" >
				<template v-for="(data,index) in varList">
					<div class="dy-card-info-box">
						<div class="dy-card-info-item">
							<div class="text">
								<span class="label">存在风险：</span>
								{{data.RISK_DESCR}}
							</div>
						</div>
						<div class="dy-card-info-item">
							<div class="text">
								<span class="label">检查内容：</span>
								{{data.CHECK_CONTENT}}
							</div>
						</div>
						<div class="dy-card-info-item">
							<div class="info-flex">
								<div class="weui-cells_checkbox">
									<label class="weui-flex" for="s1" style="flex: 1;">
										<div class="weui-cell__hd">
											<input class="weui-check" name="checkbox1" id="s1" disabled="disabled"
												type="checkbox" :checked="data.ISNORMAL==0">
											<i class="weui-icon-checked"></i>
										</div>
										<div class="weui-cell__bd">
											<p>合格</p>
										</div>
									</label>
									<label class="weui-flex" for="s4">
										<div class="weui-cell__hd">
											<input class="weui-check" name="checkbox1" disabled="disabled" id="s4"
												type="checkbox" :checked="data.ISNORMAL==1">
											<i class="weui-icon-checked wrong"></i>
										</div>
										<div class="weui-cell__bd">
											<p>不合格</p>
										</div>
									</label>
											<div v-if="data.ISNORMAL==1" class="icon-sp"  v-on:click="goHidden(data.HIDDEN_ID)">
												<i class="icon icon-40 f-blue"></i>
											</div>
								</div>
							</div>

						</div>
					</div>
				</template>
			</div>
			<div style="overflow: hidden;width: 100%;height: 500px;margin: 0;font-family: '微软雅黑';"   id="container">
			</div>
			<div class="dy-card">
				<div class="weui-cells">
				    <a class="weui-cell weui-cell_access" href="javascript:;">
				        <div class="weui-cell__bd">
							<p><span>检查人：</span>{{pd.USERS}}</p>
							<p><span>检查部位：</span>{{idData.PARTSNAME}}</p>
							<p><span>检查时间：</span>{{pd.CHECK_TIME}}</p>
				        </div>
				    </a>
				</div>
			</div>
		</div>
		<div style="padding: 0 20px;">
			<a href="javascript:;" class="weui-btn bg-blue" style="font-size: 14px;line-height:2.6;" onclick="back()">返回列表</a>
		</div>


    <script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr"></script>
    <script type="text/javascript" src="../../assets/js/jquery-3.7.1.min.js"></script>
    <script type="text/javascript" src="../../../bi/js/pre-loader.js"></script>
    <script src="../../../bi/js/sweetalert.min.js"></script>
		<script type="text/javascript">
			function goToDetail()
			    {
			        window.location = "./part-detail.html"
			    }
			var vm = new Vue({
				el: '#app',
				data:{
					CHECKRECORD_ID : '',
					varList:[],
					pd:[],
					LEVELID:'',
					DEPT_NAME:'',
					ACCIDENTS_NAME:"",
					IDENTIFICATION_ID:'',
					varList:[],
					idData:[]

				},
				methods: {
					//初始执行
					init() {
						var FID = this.getUrlKey('FID');	//当接收过来的FID不为null时,表示此页面是修改进来的
						this.CHECKRECORD_ID=this.getUrlKey('FID');
						this.IDENTIFICATION_ID = this.getUrlKey('IDENTIFICATION_ID');
						this.getData();
						this.getMap();
					},
					getMap: function (){
						  $.ajax({
				            	xhrFields: {
				                    withCredentials: true
				                },
								type: "POST",
								url: config.httpurl+'app/checkrecord/goMapWeui',
						    	data: {
						    		CHECKRECORD_ID:this.CHECKRECORD_ID,
						    		tm:new Date().getTime()
						    		},
								dataType:"json",
								success: function(data){
				                     if("success" == data.result){

				                    	 if(data.varList!=null){
				                    		 var map = new BMapGL.Map('container');
											 var point ='';
											 if(data.cinfo.LONGITUDE==undefined || data.cinfo.LATITUDE==undefined ||
													 data.cinfo.LONGITUDE=='' || data.cinfo.LATITUDE==''){
												point = '河北省秦皇岛市';
											 }else{
												point = new BMapGL.Point(data.cinfo.LONGITUDE, data.cinfo.LATITUDE);
											 }
											map.centerAndZoom(point, 18);
				                        	map.enableScrollWheelZoom(true);
				                    		 for(var i=0;i<data.varList.length;i++){
				                                 var myIcon = new BMapGL.Icon("../../assets/images/map/50.png", new BMapGL.Size(23, 25));
				                            	 // 创建Marker标注，使用小车图标
				                            	 var pt = new BMapGL.Point(data.varList[i].LONGITUDE, data.varList[i].LATITUDE);
				                            	 var marker = new BMapGL.Marker(pt, {
				                            	     icon: myIcon
				                            	 });
				                            	 // 将标注添加到地图
				                            	 map.addOverlay(marker);
				                    		 }
				                             for(var i=0;i<data.hdList.length;i++){
				                                 var myIcon = new BMapGL.Icon("../../assets/images/map/h.png", new BMapGL.Size(23, 25));
				                                 // 创建Marker标注，使用小车图标
				                                 var pt = new BMapGL.Point(data.hdList[i].LONGITUDE, data.hdList[i].LATITUDE);
				                                 var marker = new BMapGL.Marker(pt, {
				                                     icon: myIcon
				                                 });
				                                 // 将标注添加到地图
				                                 map.addOverlay(marker);
				                             }
				                        	 var myIcon4 = new BMapGL.Icon("../../assets/images/map/50.png", new BMapGL.Size(50, 54));
				                        	 // 创建Marker标注，使用小车图标
				                        	 var pt4 = new BMapGL.Point(data.checkrecord.LONGITUDE, data.checkrecord.LATITUDE);
				                        	 var marker4 = new BMapGL.Marker(pt4, {
				                        	     icon: myIcon4
				                        	 });
				                        	 // 将标注添加到地图
				                        	 map.addOverlay(marker4);
				                    	 }



				                     }else if ("exception" == data.result){
				                     	showException("清单检查",data.exception);	//显示异常
				                     	$("#showform").show();
				                 		$("#jiazai").hide();
				                     }
				                  }
							}).done().fail(function(){
				                  swal("登录失效!", "请求服务器无响应，稍后再试", "warning");
				                  $("#showform").show();
				          		  $("#jiazai").hide();
				               });
					},
					getData: function(){
						var _this = this;
						_this.loading = true;
						//发送 post 请求
			            $.ajax({
			            	xhrFields: {
			                    withCredentials: true
			                },
							type: "POST",
							url: config.httpurl+'app/checkrecord/goEditWeui',
					    	data: {CHECKRECORD_ID:this.CHECKRECORD_ID,IDENTIFICATION_ID:this.IDENTIFICATION_ID,tm:new Date().getTime()},
							dataType:"json",
							success: function(data){
			                     if("success" == data.result){
			                      	 vm.pd = data.pd;							//参数map
									 vm.varList = data.varList;							//参数map						//参数map
									 vm.idData = data.idData;
			                     }else if ("exception" == data.result){
			                     	showException("清单检查",data.exception);	//显示异常
			                     	$("#showform").show();
			                 		$("#jiazai").hide();
			                     }
			                  }
						}).done().fail(function(){
			                  swal("登录失效!", "请求服务器无响应，稍后再试", "warning");
			                  $("#showform").show();
			          		  $("#jiazai").hide();
			               });
					},
					goHidden: function (e){
						window.location.href = './part-detail.html?FID='+e;
					},
					//根据url参数名称获取参数值
					getUrlKey: function (name) {
						return decodeURIComponent(
								(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null;
					}
				},
				mounted(){
					this.init();
				}
			})

			function back(e) {
				window.history.go(-1);
			}
		</script>
	</body>
</html>
