//组件
	var cmpcomponent = {
		template:`
		<div>
			<div style="display: flex;margin-top: 10px;">
				<el-input v-model="input" placeholder="请输入井名" clearable style="width: 20%;"></el-input>
				<el-checkbox style="background-color: #ECF5FF;margin-left: 5px;margin-right: 5px;" v-model="checked" label="工程服务" border></el-checkbox>
				<el-button id ="bt_serach" plain type="primary" icon="el-icon-search" @click="getWell(input)">搜索</el-button>
				
			</div>
			<div class="span">
				<el-table
				    :data="tableData"
				    style="width: 100%;font-size:14px"
				    :height="tHeight"
					:cell-style="{background:'#304156'}"
					border
					>
				    <el-table-column
				      prop="wellNameSource"
				      label="井号"
				      :width="150"
					  :show-overflow-tooltip="true">
				    </el-table-column>
				    <el-table-column
				      prop="welltime"
				      label="建井时间"
				     :width="170">
				    </el-table-column>
				    
				    <el-table-column
				      prop="welloperator"
				      label="操作用户"
				      :width="150"
					  :show-overflow-tooltip="true">
				    </el-table-column>
					<el-table-column
					  prop="upload_user"
					  label="上传用户"
					  :width="150"
					  :show-overflow-tooltip="true">
					</el-table-column>
					<el-table-column
					      label="施工文件"
					      width="120">
					      <template slot-scope="scope">
							<el-button @click="show_file(scope.row)" type="text" size="medium">文件明细</el-button>
						  </template>
					</el-table-column>
					<el-table-column
					      label="操作"
					      width="140">
					      <template slot-scope="scope">
							  <el-button @click="show_pdf(scope.row)" type="text" size="medium">报告明细</el-button>
							<el-button @click="export_pdf(scope.row)" type="text" size="medium">导出</el-button>
						  </template>
					</el-table-column>
				  </el-table>
			</div>
			<div class="block">
			    <span class="demonstration" style="background-color: #ECF5FF;"></span>
			    <el-pagination
			      @size-change="handleSizeChange"
			      @current-change="handleCurrentChange"
			      :current-page="currentPage"
			      :page-sizes="[50,100, 200, 300]"
			      :page-size="pagesize"
			      layout="total, sizes, prev, pager, next, jumper"
			      :total="recordTotal" style="background-color: #ECF5FF;">
			    </el-pagination>
			  </div>
			  
			<el-dialog
			 title="施工管理信息"
			 :visible.sync="pdf_visible"
			 :lock-scroll ="false"
			 :append-to-body="true"
			 width="50%">
				<div style="height: 450px;overflow: auto;">
					<div style="display: flex;">
						<div style="width: 50%;">工作时长(h): {{dialog_data.Total_work_time}}</div>
						<div style="width: 50%;">等待时长(h): {{dialog_data.Total_wait_time}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">井队长: {{dialog_data.well_captain}}</div>
						<div style="width: 50%;">安全员姓名: {{dialog_data.safety_officer_name}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">安全员电话: {{dialog_data.safety_officer_phone}}</div>
						<div style="width: 50%;">经纬度: {{dialog_data.lon_lat}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">医院电话: {{dialog_data.hosp_phone}}</div>
						<div style="width: 50%;">消防电话: {{dialog_data.fire_phone}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">民警电话: {{dialog_data.police_phone}}</div>
						<div  style="width: 50%;">地理位置: {{dialog_data.gl}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">仪器管理信息: </div>
					</div>
					<div v-if="dialog_data.Device_data.length>0">
						<div style="width: 100%;padding-top: 10px;"  v-for="item in dialog_data.Device_data">
						仪器系列号: {{item.sid}}
						&nbsp;&nbsp;仪器编码: {{item.iid}}
						&nbsp;&nbsp;出厂累计工时(h): {{item.Accrued_work_time}}
						&nbsp;&nbsp;所在地: {{item.Location}}
						&nbsp;&nbsp;负责人: {{item.Director}}
						</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">井队固控设备配备和使用情况: </div>
					</div>
					<div v-if="dialog_data.well_device!=''" style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">{{dialog_data.well_device}}</div>
					</div>
					<el-divider></el-divider>
					<div>设计数据</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">井口坐标: (X){{dialog_data.x}}&nbsp;&nbsp;(Y){{dialog_data.y}}</div>
						<div style="width: 50%;">磁偏角(°): {{dialog_data.declination}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">磁倾角(°): {{dialog_data.DIP}}</div>
						<div style="width: 50%;">磁场强度(μT): {{dialog_data.MT}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">设计闭合方位(°): {{dialog_data.CLsA}}</div>
						<div  style="width: 50%;">设计垂深(m): {{dialog_data.TVD}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div  style="width: 50%;">设计井深(m): {{dialog_data.design_depth}}</div>
						<div style="width: 50%;">设计最大井斜(°): {{dialog_data.design_deviation}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">设计水平段长度(m): {{dialog_data.design_hlength}}</div>
					</div>
					<el-divider></el-divider>
					
					<div>地质信息</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">目的层: {{dialog_data.Target_stratum}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">储层厚度(m): {{dialog_data.Reservoir_thickness}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">伽马范围(API): {{dialog_data.Gamma_range}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">地层电阻率(Ω·m): {{dialog_data.CHFR}}</div>
					</div>
					<el-divider></el-divider>
					
					<div v-if="dialog_data.Drilling_data.length>0">
						<div v-for="(item,index) in dialog_data.Drilling_data">
							<div v-if="index==0">钻次{{item.Drilling_num}}</div>
							<div v-if="index!=0" style="padding-top: 10px;">钻次{{item.Drilling_num}}</div>
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 100%;">人工: {{item.Servicer}}</div>
							</div>
							<div style="display: flex;padding-top: 10px;line-height: 23px;">
								<div style="width: 100%;">钻具组合: {{item.BHA}}</div>
							</div>
							<div style="display: flex;padding-top: 10px;line-height: 23px;">
								<div style="width: 100%;">仪器组合: {{item.ToolCombination}}</div>
							</div>
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 50%;">等待时长(h): {{item.Wait_time}}</div>
								<div style="width: 50%;">入井时长(h): {{item.Work_time}}</div>
							</div>
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 50%;">起钻原因: {{item.Reason}}</div>
								<div style="width: 50%;">入井井深(m): {{item.In_depth}}</div>
							</div>
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 50%;">出井井深(m): {{item.Out_depth}}</div>
								<div style="width: 50%;">本钻次进尺(m): {{item.Footage}}</div>
							</div>
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 100%;">下步计划: {{item.Next_step}}</div>
							</div>
						</div>
						
						<el-divider></el-divider>
					</div>
					
					<div>工况信息</div>
						<div style="display: flex;padding-top: 10px;">
							<div style="width: 50%;">时间: {{dialog_data.t1}}</div>
							<div style="width: 50%;">最大井深(m): {{dialog_data.Max_depth}}</div>
						</div>
						<div style="display: flex;padding-top: 10px;">
							<div style="width: 50%;">时间: {{dialog_data.t2}}</div>
							<div style="width: 50%;">最大垂深(m): {{dialog_data.Max_tvd}}</div>
						</div>
						<div style="display: flex;padding-top: 10px;">
							<div style="width: 50%;">时间: {{dialog_data.t3}}</div>
							<div v-if="if_show_t" style="width: 50%;">最高温度(℃): {{dialog_data.Max_temp}}</div>
							<div v-if="!if_show_t" style="width: 50%;">最高温度(℉): {{dialog_data.Max_temp}}</div>
						</div>
						<div style="display: flex;padding-top: 10px;">
							<div style="width: 50%;">时间: {{dialog_data.t4}}</div>
							<div style="width: 50%;">最大振动(g): {{dialog_data.Max_vibrate}}</div>
						</div>
					
					<el-divider></el-divider>
					<div>每日录入信息</div>
						<div v-for="item in dialog_data1">
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 100%;">{{item.context}}</div>
							</div>
						</div>
					<el-divider></el-divider>
					<div>下步工况</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">{{dialog_data.next_state}}</div>
					</div>
					<el-divider></el-divider>
					<div>完钻/完工信息</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">实际水平段长度(m): {{dialog_data.Hlength}}</div>
						<div style="width: 50%;">仪器总工时(h): {{dialog_data.Tool_work_time}}</div>
					</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">累计进尺(m): {{dialog_data.Total_footage}}</div>
						<div style="width: 50%;">钻遇率(%): {{dialog_data.Rate}}</div>
					</div>
					<el-divider></el-divider>
					<div>完钻总结</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">{{dialog_data.well_report}}</div>
					</div>
					<el-divider></el-divider>
					<div>参考信息</div>
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 50%;">IP+端口: {{dialog_data.IP}}</div>
						<div style="width: 50%;">地区: {{dialog_data.IP_addr}}</div>
					</div>
					<div v-if="dialog_data.Refer_Drilling_data.length>0">
						<div v-for="(item,index) in dialog_data.Refer_Drilling_data">
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 100%;">钻次{{item.Drilling_num}}</div>
							</div>
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 100%;">人工: {{item.Servicer}}</div>
							</div>
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 50%;">等待时长(h): {{item.Wait_time}}</div>
							</div>
							<div style="display: flex;padding-top: 10px;">
								<div style="width: 50%;">入井时长(h): {{item.Work_time}}</div>
							</div>
						</div>
					</div>
					
					<el-divider></el-divider>
				</div>
			</el-dialog>
			
			<el-dialog
			 title="施工文件信息"
			 :visible.sync="file_visible"
			 :lock-scroll ="false"
			 :append-to-body="true"
			 width="30%">
				<div style="height: 450px;overflow: auto;">
					<div style="display: flex;padding-top: 10px;">
						<div style="width: 100%;">文件列表: </div>
					</div>
					<div v-if="file_data.length>0" style="padding-top: 10px;">
						<div style="width: 100%;"  v-for="item in file_data">
							<el-button @click="down_file(item)" type="text" size="medium">{{item.filename}}</el-button>
						</div>
					</div>
					
				</div>
			</el-dialog>
		</div>
		`,
	data(){
		// 获取当前屏幕的分辨率
		let screenW = window.screen.width;
		let screenH = window.innerHeight;
		console.log("screen width:",screenW);
		console.log("screen height:",screenH);
	  return {
		tHeight:screenH-192,
		tableData: Array(0),
		input:'',
		currentPage: 1,
		pagesize:50,
		recordTotal:0,
		
		pdf_visible:false,
		dialog_data:{
			Device_data:[],
			Drilling_data:[],
			Refer_Drilling_data:[],
		},
		dialog_data1:{},
		
		file_visible:false,
		file_data:[],
		
		checked:false,
		
		if_show_t:true,
	  }
	},
	mounted() {
		this.$data.dialog_data.h=234;
		var _this = this;
		
		axios.post('/deescloud/get_page_setting', {
			opuser:localStorage.getItem("online_user"),
			opuser_uuid:localStorage.getItem("uuid"),
		  })
		  .then(function (response) {
				if(response.data.r1=="2"){
					//_this.$data.if_show_m=false;
				}
				
				if(response.data.r2 =="2"){
					_this.$data.if_show_t=false;
				}
		  })
		  .catch(function (error) {
		    console.log(error);
		  });
		
		var objs;
		axios.post('/deescloud/get_well_cmp', {
			opuser:localStorage.getItem("online_user"),
			opuser_uuid:localStorage.getItem("uuid"),
		    index: this.$data.currentPage,
		    count: this.$data.pagesize,
			checked:this.$data.checked
		  })
		  .then(function (response) {
		    console.log(response.data);
			objs = response.data.data;
			rcnt = response.data.total;
			_this.$data.tableData = objs;
			_this.$data.recordTotal = rcnt;
			
		  })
		  .catch(function (error) {
		    console.log(error);
		  });
	},
	  methods: {
		down_file(file){
			console.log(file);
			var downUrl = '/deescloud/download_file'+"?id="+file.id;
			downloadUrl(file.filename,downUrl);
		},
		show_file(row){
			//wellNameSource
			let _this= this;
			axios.post('/deescloud/get_well_files', {
					Wellname: row.wellNameSource
				  })
				  .then(function (response) {
					console.log(response.data);
					_this.$data.file_data = response.data.data;
					
					_this.$data.file_visible =true;
				  })
				  .catch(function (error) {
					console.log(error);
				  });
		},
		
		export_pdf(row){
			var _this = this;
			
			axios.post('deescloud/get_cmr_pdf',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				wellname: row.wellNameSource
			},
			).then(function (response) {
				console.log(response.data);
				var fileid = response.data.fileId;
				
				var downUrl = 'file/'+fileid;
				downloadUrl(row.wellNameSource+"-施工管理报告.pdf",downUrl);
			})
			.catch(function (error) {
				console.log(error);
			});
		},
		show_pdf(row){
			//wellNameSource
			let _this= this;
			axios.post('/deescloud/get_cmr_record', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
					Wellname: row.wellNameSource
				  })
				  .then(function (response) {
					console.log(response.data);
					_this.$data.dialog_data1 = response.data.data;
				  })
				  .catch(function (error) {
					console.log(error);
				  });
				  
			axios.post('/deescloud/get_cmr', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
					Wellname: row.wellNameSource
				  })
				  .then(function (response) {
					console.log(response.data);
					_this.$data.dialog_data = response.data.data;
					
					_this.$data.pdf_visible =true;
				  })
				  .catch(function (error) {
					console.log(error);
				  });
		},
		getWell(_search_name){
		  
			document.getElementById("bt_serach").blur();

			this.$data.currentPage=1;

			var _this = this;

			var objs;
			axios.post('/deescloud/get_well_cmp', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				Wellname: _search_name,
				index: this.$data.currentPage,
				count: this.$data.pagesize,
				checked:this.$data.checked
			  })
			  .then(function (response) {
				console.log(response.data);
				objs = response.data.data;
				rcnt = response.data.total;
				_this.$data.tableData = objs;
				_this.$data.recordTotal = rcnt;
			  })
			  .catch(function (error) {
				console.log(error);
			  });
		},
		  
		handleSizeChange(val) {
			  //console.log(`每页 ${val} 条`);
			  this.$data.pagesize = val;
			  this.$data.currentPage = 1;
			  var _this = this;
			  
			  var objs;
			  axios.post('/deescloud/get_well_cmp', {
				  opuser:localStorage.getItem("online_user"),
				  opuser_uuid:localStorage.getItem("uuid"),
					Wellname: this.$data.input,
					index: this.$data.currentPage,
					count: this.$data.pagesize,
					checked:this.$data.checked
				})
				.then(function (response) {
				  console.log(response.data);
				objs = response.data.data;
				rcnt = response.data.total;
				_this.$data.tableData = objs;
				_this.$data.recordTotal = rcnt;
				})
				.catch(function (error) {
				  console.log(error);
				});
		},
		handleCurrentChange(val) {
		  //console.log(`当前页: ${val}`);
		  this.$data.currentPage = val;
		  
		  var _this = this;
		  
		  var objs;
		  axios.post('/deescloud/get_well_cmp', {
			  opuser:localStorage.getItem("online_user"),
			  opuser_uuid:localStorage.getItem("uuid"),
					Wellname: this.$data.input,
					index: this.$data.currentPage,
					count: this.$data.pagesize,
					checked:this.$data.checked
				})
				.then(function (response) {
				  console.log(response.data);
				objs = response.data.data;
				rcnt = response.data.total;
				_this.$data.tableData = objs;
				_this.$data.recordTotal = rcnt;
				})
				.catch(function (error) {
				  console.log(error);
				});
				
		},
		
	  }
	}
			