history.pushState(null, null, document.URL);
			window.addEventListener('popstate', function () {
				console.log(document.URL);
				history.pushState(null, null, document.URL);
			});
			
			setInterval(checkUser,5000);
		
			var appVue = new Vue(
				{
					el:"#app",
					data(){
						var url = decodeURI(window.location.href);
						
						let reg = new RegExp("(^|&)" + 'sid' + "=([^&]*)(&|$)", "i");
						let r = window.location.search.substr(1).match(reg);
						let arg = decodeURI(r[2]);
						
						reg = new RegExp("(^|&)" + 'iid' + "=([^&]*)(&|$)", "i");
						r = window.location.search.substr(1).match(reg);
						let arg1 = decodeURI(r[2]);
						
						// 获取当前屏幕的分辨率
						let screenW = window.screen.width;
						let screenH = window.innerHeight;
						console.log("screen width:",screenW);
						console.log("screen height:",screenH);
						return {
							tHeight:screenH-196,
							tHeight_1:screenH/2,
							tableData: [],
							sid:arg,
							iid:arg1,
							currentPage: 1,
							pagesize:50,
							recordTotal:0,
							form: {
								id:'',
								series: '',
								instrument_id:'',
								repair_cnt:'',
								repair_level: '',
								applicanter:'',
								note:'',
								change_series:false
							},
							dialogVisible:false,
							oper_type:0,
							rules: {
							    series: [
							        { required: true, message: '系列号不可为空', trigger: 'blur' }
							    ],
							    instrument_id: [
							        { required: true, message: '编码不可为空', trigger: 'blur' }
							    ],
								applicanter: [
								    { required: true, message: '维保人不可为空', trigger: 'blur' }
								]
							},
							tableData1:[],
							currentPage1: 1,
							pagesize1:50,
							recordTotal1:0,
							begin_t:'',
							end_t:'',
							if_show:false,
							onlineuser:localStorage.getItem("online_user"),
							
							if_show_bt:1,
							if_show_et:false,
							
							wellname:'',
							X:'',
							Y:'',
							WellDepth:'',
							Drilling_num:'',
							Servicer:'',
							Work_time:'',
							Wait_time:'',
							
							tableData_1: [],
							currentPage_1: 1,
							pagesize_1:50,
							recordTotal_1:0,
							dialogVisible_1:false,
							oper_type_1:0,
							form_1: {
								id:'',
								series: '',
								instrument_id:'',
								op_user:'',
								note:'',
							},
							
						}
					},
					mounted() {
						var _this = this;
						
						_this.getLcminfo_ex();
						
						axios.post('/deescloud/get_page_setting', {
							opuser:localStorage.getItem("online_user"),
							opuser_uuid:localStorage.getItem("uuid"),
						  })
						  .then(function (response) {
								if(response.data.r3=="1"){
									_this.$data.if_show_bt=1;
									//_this.$data.if_show_et=false;
								}else if(response.data.r3=="2"){
									//_this.$data.if_show_et=true;
									_this.$data.if_show_bt=2;
								}else if(response.data.r3=="3"){
									//_this.$data.if_show_et=true;
									_this.$data.if_show_bt=3;
								}else{
									_this.$data.if_show_bt=1;
								}
						  })
						  .catch(function (error) {
						    console.log(error);
						  });
						
						var objs;
						axios.post('/deescloud/getLcm', {
							opuser:localStorage.getItem("online_user"),
							opuser_uuid:localStorage.getItem("uuid"),
							sid: _this.$data.sid,
							iid:_this.$data.iid,
						    index: this.$data.currentPage,
						    count: this.$data.pagesize
						  })
						  .then(function (response) {
							  
						    console.log(response.data);
							objs = response.data.data;
							rcnt = response.data.total;
							_this.$data.tableData = objs;
							_this.$data.recordTotal = rcnt;
							
							_this.$data.if_show = true;
						  })
						  .catch(function (error) {
						    console.log(error);
						  });
						  
						  axios.post('/deescloud/getLcmMss', {
							  opuser:localStorage.getItem("online_user"),
							  opuser_uuid:localStorage.getItem("uuid"),
								sid: _this.$data.sid,
								iid:_this.$data.iid,
						      index: this.$data.currentPage1,
						      count: this.$data.pagesize1
						    })
						    .then(function (response) {
						  	_this.$data.tableData1 = response.data.data;
						  	_this.$data.recordTotal1 = response.data.total;
						    })
						    .catch(function (error) {
						      console.log(error);
						    });
						
					},
					methods: {
						postLcm_ex(){
							this.$refs['authform'].validate((valid) => {
							if (valid) {
										  
								this.$data.dialogVisible_1 = false;
								  
								var _this = this;
								
								axios.post('/deescloud/postLcm_ex', {
									opuser:localStorage.getItem("online_user"),
									opuser_uuid:localStorage.getItem("uuid"),
									oper_type: _this.$data.oper_type_1,
									id:_this.$data.form_1.id,
									series: _this.$data.form_1.series,
									instrument_id:_this.$data.form_1.instrument_id,
									op_user:_this.$data.form_1.op_user,
									note:_this.$data.form_1.note,
								})
								.then(function (response) {
									
									let r = response.data.r;
									let s = ""
									let errType = ""
									if (r == 0) {
										errType = "success"
									} else{
										errType = "error"
									}
									
									if (_this.$data.oper_type == 1) {
													  
										  if (r ==0) {
											s = "新增成功！";
										  } else if (r ==1) {
											s = "已存在相同的仪器系列号和编码！";
										  }else{
											s = "新增失败！";
										  }
										
									} else if (_this.$data.oper_type ==2){
													  
										  if (r ==0) {
											s = "修改成功！";
										  } else if (r ==1){
											s = "已存在相同的仪器系列号和编码！";
										  } else{
											s = "修改失败！";
										  }
									}
									
									_this.$message({
										message: s,
										type: errType,
										duration: 1500
									});
									
									//更新页面
									_this.getLcminfo_ex();
								})
								.catch(function (error) {
								  console.log(error);
								});
							}
						});
						},
						
						delLcm_ex(info){
						  this.$data.oper_type_1 = 3;
						  
						  var _this = this;
						  
						   var objs;
						   axios.post('/deescloud/postLcm_ex', {
							opuser:localStorage.getItem("online_user"),
							opuser_uuid:localStorage.getItem("uuid"),
							oper_type: _this.$data.oper_type_1,
							id:info.id,
							series: info.series,
							instrument_id:info.instrument_id,
							op_user:info.op_user,
							note:info.note,
						  })
						  .then(function (response) {
							
							let r = response.data.r;
							let s = ""
							let errType = ""
							if (r == 0) {
								s = "删除成功！";
								errType = "success"
							} else{
								s = "删除失败！";
								errType = "error"
							}
						
							_this.$message({
								message: s,
								type: errType,
								duration: 1500
							});
							
							if (r ==0) {
								_this.getLcminfo_ex();//更新页面
							}
							
						  })
						  .catch(function (error) {
							console.log(error);
						  });
						},
						
						addlcm_ex(){
							document.getElementById("bt_add").blur();
							
							  this.$data.oper_type_1 = 1;
							  this.$data.form_1 = {
								id:'',
								series: this.$data.sid,
								instrument_id:this.$data.iid,
								op_user:localStorage.getItem("online_user"),
								note:'',
							};
						
							this.$nextTick(() => {
								this.$refs['authform'].clearValidate()
							});
						
							this.$data.dialogVisible_1 = true;
						},
						
						updateLcm_ex(info){
						  this.$data.oper_type_1 = 2;
						  this.$data.form_1 = {
							id:info.id,
							series: info.series,
							instrument_id:info.instrument_id,
							op_user:info.op_user,
							note:info.note,
						  };
						  
						  this.$nextTick(() => {
							  this.$refs['authform'].clearValidate()
						  });
						  
						  this.$data.dialogVisible_1 = true;
						},
						
						getLcminfo_ex(){
							document.getElementById("bt_search").blur();
							
							if (this.$data.begin_t != '' && this.$data.end_t != '' && this.$data.begin_t>this.$data.end_t) {
								this.$message({
									message: '结束时间必须在开始时间之后!',
									type: 'warning',
									duration: 1500
								});
								return;
							}
							
							var _this = this;
							
							var objs;
							axios.post('/deescloud/getLcm_ex', {
								opuser:localStorage.getItem("online_user"),
								opuser_uuid:localStorage.getItem("uuid"),
								sid: _this.$data.sid,
								iid:_this.$data.iid,
								index: this.$data.currentPage_1,
								count: this.$data.pagesize_1,
								beginTime:this.$data.begin_t,
								endTime:this.$data.end_t,
							  })
							  .then(function (response) {
								console.log(response.data);
								objs = response.data.data;
								rcnt = response.data.total;
								_this.$data.tableData_1 = objs;
								_this.$data.recordTotal_1 = rcnt;
							  })
							  .catch(function (error) {
								console.log(error);
							  });
						},
						 
						handleSizeChange_1(val) {
							  this.$data.pagesize_1 = val;
							  
							  this.getLcminfo_ex();
						},
						handleCurrentChange_1(val) {
						  this.$data.currentPage_1 = val;
						  
						   this.getLcminfo_ex();
						},
						
						
						handleCommand(command) {
							if (command === 'exit') {
								loginout();
							}
						},
						
						postLcm(){
							this.$refs['authform'].validate((valid) => {
							if (valid) {
										  
								this.$data.dialogVisible = false;
								  
								var _this = this;
								
								console.log(_this.$data.form);
								 
								axios.post('/deescloud/postLcm', {
									opuser:localStorage.getItem("online_user"),
									opuser_uuid:localStorage.getItem("uuid"),
									oper_type: _this.$data.oper_type,
									id:_this.$data.form.id,
									series: _this.$data.form.series,
									instrument_id:_this.$data.form.instrument_id,
									repair_cnt:_this.$data.form.repair_cnt,
									repair_level: _this.$data.form.repair_level,
									applicanter:_this.$data.form.applicanter,
									note:_this.$data.form.note,
								})
								.then(function (response) {
									
									let r = response.data.r;
									let s = ""
									let errType = ""
									if (r == 0) {
										errType = "success"
									} else{
										errType = "error"
									}
									
									if (_this.$data.oper_type == 1) {
													  
										  if (r ==0) {
											s = "新增成功！";
										  } else if (r ==1) {
											s = "已存在相同的仪器系列号和编码！";
										  }else{
											s = "新增失败！";
										  }
										
									} else if (_this.$data.oper_type ==2){
													  
										  if (r ==0) {
											s = "修改成功！";
										  } else if (r ==1){
											s = "已存在相同的仪器系列号和编码！";
										  } else{
											s = "修改失败！";
										  }
									}
									
									_this.$message({
										message: s,
										type: errType,
										duration: 1500
									});
									
									//更新页面
									_this.getLcminfo();
								})
								.catch(function (error) {
								  console.log(error);
								});
							}
						});
						},
						
						delLcm(info){
						  this.$data.oper_type = 3;
						  
						  var _this = this;
						  
						   var objs;
						   axios.post('/deescloud/postLcm', {
							opuser:localStorage.getItem("online_user"),
							opuser_uuid:localStorage.getItem("uuid"),
							oper_type: _this.$data.oper_type,
							id:info.id,
							series: info.series,
							instrument_id:info.instrument_id,
							repair_cnt:info.repair_cnt,
							repair_level: info.repair_level,
							applicanter:info.applicanter,
							note:info.note,
						  })
						  .then(function (response) {
							
							let r = response.data.r;
							let s = ""
							let errType = ""
							if (r == 0) {
								s = "删除成功！";
								errType = "success"
							} else{
								s = "删除失败！";
								errType = "error"
							}
						
							_this.$message({
								message: s,
								type: errType,
								duration: 1500
							});
							
							if (r ==0) {
								_this.getLcminfo("");//更新页面
							}
							
						  })
						  .catch(function (error) {
							console.log(error);
						  });
						},
						
						addlcm(){
							document.getElementById("bt_add").blur();
							
							  this.$data.oper_type = 1;
							  this.$data.form = {
								id:'',
								series: this.$data.sid,
								instrument_id:this.$data.iid,
								repair_cnt:'',
								repair_level: '',
								applicanter:localStorage.getItem("online_user"),
								note:'',
								change_series:true
							};
						
							this.$nextTick(() => {
								this.$refs['authform'].clearValidate()
							});
						
							this.$data.dialogVisible = true;
						},
						
						updateLcm(info){
						  this.$data.oper_type = 2;
						  this.$data.form = {
							id:info.id,
							series: info.series,
							instrument_id:info.instrument_id,
							repair_cnt:info.repair_cnt,
							repair_level: info.repair_level,
							applicanter:info.applicanter,
							note:info.note,
							change_series:true
						  };
						  
						  this.$nextTick(() => {
							  this.$refs['authform'].clearValidate()
						  });
						  
						  this.$data.dialogVisible = true;
						},
						
						getLcminfo(){
							document.getElementById("bt_search").blur();
							
							if (this.$data.begin_t != '' && this.$data.end_t != '' && this.$data.begin_t>this.$data.end_t) {
								this.$message({
									message: '结束时间必须在开始时间之后!',
									type: 'warning',
									duration: 1500
								});
								return;
							}
							
							this.$data.currentPage=1;
							
							var _this = this;
							
							var objs;
							axios.post('/deescloud/getLcm', {
								opuser:localStorage.getItem("online_user"),
								opuser_uuid:localStorage.getItem("uuid"),
								sid: _this.$data.sid,
								iid:_this.$data.iid,
								index: this.$data.currentPage,
								count: this.$data.pagesize,
								beginTime:this.$data.begin_t,
								endTime:this.$data.end_t,
							  })
							  .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) {
							  this.$data.pagesize = val;
							  this.$data.currentPage = 1;
							  if (this.$data.begin_t != '' && this.$data.end_t != '' && this.$data.begin_t>this.$data.end_t) {
							  	this.$message({
							  		message: '结束时间必须在开始时间之后!',
							  		type: 'warning',
							  		duration: 1500
							  	});
							  	return;
							  }
							  
							  var _this = this;
							  
							  var objs;
							  axios.post('/deescloud/getLcm', {
									opuser:localStorage.getItem("online_user"),
									opuser_uuid:localStorage.getItem("uuid"),
									sid: _this.$data.sid,
									iid:_this.$data.iid,
									index: this.$data.currentPage,
									count: this.$data.pagesize,
									beginTime:this.$data.begin_t,
									endTime:this.$data.end_t,
								})
								.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) {
						  this.$data.currentPage = val;
						  
						  if (this.$data.begin_t != '' && this.$data.end_t != '' && this.$data.begin_t>this.$data.end_t) {
						  	this.$message({
						  		message: '结束时间必须在开始时间之后!',
						  		type: 'warning',
						  		duration: 1500
						  	});
						  	return;
						  }
						  
						  var _this = this;
						  
						  var objs;
						  axios.post('/deescloud/getLcm', {
									opuser:localStorage.getItem("online_user"),
									opuser_uuid:localStorage.getItem("uuid"),
									sid: _this.$data.sid,
									iid:_this.$data.iid,
									index: this.$data.currentPage,
									count: this.$data.pagesize,
									beginTime:this.$data.begin_t,
									endTime:this.$data.end_t,
								})
								.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);
								});
						},
						
						handleSizeChange1(val) {
							  this.$data.pagesize1 = val;
							  var _this = this;
							  axios.post('/deescloud/getLcmMss', {
								  opuser:localStorage.getItem("online_user"),
								  opuser_uuid:localStorage.getItem("uuid"),
							  								sid: _this.$data.sid,
							  								iid:_this.$data.iid,
							      index: this.$data.currentPage1,
							      count: this.$data.pagesize1
							    })
							    .then(function (response) {
							  	_this.$data.tableData1 = response.data.data;
							  	_this.$data.recordTotal1 = response.data.total;
							    })
							    .catch(function (error) {
							      console.log(error);
							    });
						},
						handleCurrentChange1(val) {
						  this.$data.currentPage1 = val;
						  var _this = this;
						  
						  axios.post('/deescloud/getLcmMss', {
							  opuser:localStorage.getItem("online_user"),
							  opuser_uuid:localStorage.getItem("uuid"),
							sid: _this.$data.sid,
							iid:_this.$data.iid,
						      index: this.$data.currentPage1,
						      count: this.$data.pagesize1
						    })
						    .then(function (response) {
						  	_this.$data.tableData1 = response.data.data;
						  	_this.$data.recordTotal1 = response.data.total;
						    })
						    .catch(function (error) {
						      console.log(error);
						    });
						},
						
						flexColumnWidth(str, tableData, flag = 'max') {
						  // str为该列的字段名(传字符串);tableData为该表格的数据源(传变量);
						  // flag为可选值，可不传该参数,传参时可选'max'或'equal',默认为'max'
						  // flag为'max'则设置列宽适配该列中最长的内容,flag为'equal'则设置列宽适配该列中第一行内容的长度。
						  
						  let maxContext = new Array();
						  
						  str = str + ''
						  let columnContent = ''
						  if (!tableData || !tableData.length || tableData.length === 0 || tableData === undefined) {
						    return '120px'
						  }
						  if (!str || !str.length || str.length === 0 || str === undefined) {
						    return '120px'
						  }
						  if (flag === 'equal') {
						    // 获取该列中第一个不为空的数据(内容)
						    for (let i = 0; i < tableData.length; i++) {
						      if (tableData[i][str].length > 0) {
						        // console.log('该列数据[0]:', tableData[0][str])
						        columnContent = tableData[i][str]
						        break
						      }
						    }
						  } else {
						    // 获取该列中最长的数据(内容)
						    let index = 0
						    for (let i = 0; i < tableData.length; i++) {
						      if (tableData[i][str] === null) {
						        return
						      }
						      const now_temp = tableData[i][str] + ''
						      const max_temp = tableData[index][str] + ''
						      if (now_temp.length >= max_temp.length) {
						        index = i
						      }
						    }
						    columnContent = tableData[index][str]
							
							maxContext.push(columnContent);
						  }
						  // console.log('该列数据[i]:', columnContent)
						  // 以下分配的单位长度可根据实际需求进行调整
						  
						  //console.log(columnContent);
						  let max_flex_width = 0
						  
						  for (let i = 0; i < maxContext.length; i++) {
							let flexWidth = 0;
						  	for (const char of maxContext[i]) {
						  	  if ((char >= 'A' && char <= 'Z') || (char >= 'a' && char <= 'z')) {
						  	    // 如果是英文字符，为字符分配8个单位宽度
						  	    flexWidth += 8
						  	  } else if (char >= '\u4e00' && char <= '\u9fa5') {
						  	    // 如果是中文字符，为字符分配15个单位宽度
						  	    flexWidth += 15
						  	  } else {
						  	    // 其他种类字符，为字符分配8个单位宽度
						  	    flexWidth += 8
						  	  }
						  	}
							
							if (flexWidth>max_flex_width) {
								max_flex_width = flexWidth;
								console.log(maxContext[i]);
							}
						  }
						  
						  if (max_flex_width < 120) {
						    // 设置最小宽度
						    max_flex_width = 120
						  }
							if (max_flex_width > 500) {
							 // 设置最大宽度
							 max_flex_width = 500
							}
						  
						  //flexWidth = flexWidth;//20-padding
						  console.log("max_flex_width:",max_flex_width);
						  return max_flex_width + 'px'
						},
						
					}
				}
			);