	var lcmComponent = {
		template:`
		<div>
			<div v-show="if_show0">
				<div id="" style="display: inline-block;width: 100%;margin-top: 10px;">
				
					<div  style="float: left; width: 15%;background-color: #ECF5FF">
					<el-input v-model="sid" placeholder="请输入系列号" clearable></el-input>
					</div>
					<div  style="float: left; width: 15%;background-color: #ECF5FF">
					<el-input v-model="iid" placeholder="请输入编码" clearable></el-input>
					</div>
					<div style="float: left;background-color: #ECF5FF">
					  <el-date-picker
						v-if="if_show_bt==1"
					  	 v-model="begin_t"
					  	 type="datetime"
					  	 placeholder="开始时间"
					  	value-format="yyyy-MM-dd HH:mm:ss">
					  </el-date-picker>
					  <el-date-picker
						v-if="if_show_bt==2"
					  	 v-model="begin_t"
					  	 type="datetime"
					  	 placeholder="开始时间"
						 format="MM-dd-yyyy HH:mm:ss"
					  	value-format="yyyy-MM-dd HH:mm:ss">
					  </el-date-picker>
					  <el-date-picker
					  	v-if="if_show_bt==3"
					  	 v-model="begin_t"
					  	 type="datetime"
					  	 placeholder="开始时间"
					  	format="dd-MM-yyyy HH:mm:ss"
					  	value-format="yyyy-MM-dd HH:mm:ss">
					  </el-date-picker>
					</div>
					<div style="float: left;background-color: #ECF5FF">
						<el-date-picker
							v-if="if_show_bt==1"
							 v-model="end_t"
							 type="datetime"
							 placeholder="结束时间"
							value-format="yyyy-MM-dd HH:mm:ss">
						</el-date-picker>
						<el-date-picker
							v-if="if_show_bt==2"
							 v-model="end_t"
							 type="datetime"
							 placeholder="结束时间"
							 format="MM-dd-yyyy HH:mm:ss"
							value-format="yyyy-MM-dd HH:mm:ss">
						</el-date-picker>
						<el-date-picker
							v-if="if_show_bt==3"
							 v-model="end_t"
							 type="datetime"
							 placeholder="结束时间"
							 format="dd-MM-yyyy HH:mm:ss"
							value-format="yyyy-MM-dd HH:mm:ss">
						</el-date-picker>
					</div>
					<div style="float: left;margin-left: 5px;">
					<el-button id ="bt_search" plain type="primary" icon="el-icon-search" @click="getLcmDeviceinfo()">搜索</el-button>
					</div>
					
					<div style="float: left;margin-left: 5px; ">
						<el-button id ="bt_add" plain type="primary" icon="el-icon-circle-plus-outline" @click="addlcmDevice()">新增</el-button>
					</div>
				</div>
				<div class="span">
					<el-table
						:data="tableData"
						tooltip-effect="dark"
						style="width: 100%"
						:height="tHeight"
						:cell-style="{background:'#304156'}"
						:row-class-name="tableRowClassName"
						border
						>
					    <el-table-column
					      prop="series"
					      label="仪器系列号"
					      width="100">
					    </el-table-column>
					    <el-table-column
					      prop="instrument_id"
					      label="仪器编码"
					      width="80">
					    </el-table-column>
						
					    <el-table-column
					      prop="ver"
					      label="最新版本"
					      width="100">
					    </el-table-column>
									  
						<el-table-column
						 prop="op_user"
						 label="操作人"
						 :width="flexColumnWidth('op_user',tableData)">
						</el-table-column>
						
						<el-table-column
						 prop="op_time"
						 label="操作时间"
						 width="170">
						</el-table-column>
				
						<el-table-column
							 label="操作"
							 width="170">
							 <template slot-scope="scope">
								<el-button @click="show_detail(scope.row)" type="text" size="medium">详情</el-button>
								<el-button @click="updateLcmDevice(scope.row)" type="text" size="medium">修改</el-button>
								<el-button @click="delLcmDevice(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="dialogVisible"
				 :lock-scroll ="false"
				 width="40%">
				 <el-form ref="authform" :model="form" :rules="rules" label-width="80px" :inline="false" class="demo-form-inline" size="medium">
					  <el-row :gutter="10">
						  <el-col :span="12">
							  <el-form-item label="系列号" prop="series">
							  <el-input v-model="form.series" :disabled="form.change_series"></el-input>
							  </el-form-item>
						  </el-col>
						  <el-col :span="12">
							  <el-form-item label="编码" prop="instrument_id">
							  <el-input v-model="form.instrument_id" :disabled="form.change_series"></el-input>
							  </el-form-item>
						  </el-col>
					  </el-row>
					  
					  <el-row :gutter="10">
					  <el-col :span="12">
						  <el-form-item label="最新版本">
						  <el-input v-model="form.ver"></el-input>
						  </el-form-item>
					  </el-col>
					  <el-col :span="12">
						<el-form-item label="操作人" prop="op_user">
						<el-input v-model="form.op_user" :disabled="true"></el-input>
						</el-form-item>
					  </el-col>
					  </el-row>
				 </el-form>
				 <span slot="footer" class="dialog-footer">
				 <el-button @click="dialogVisible = false">取 消</el-button>
				 <el-button id ="bt_ok" plain type="primary" @click="postLcmDevice()">确 定</el-button>
				 </span>
				</el-dialog>
			</div>
				
			<div v-show="if_show" style="text-align: center; width: 100%;;font-size: 14px;">
			  <el-tag type="warning" style="width: 100%;height: 50px;font-size: 14px;">用户没有本菜单权限!</el-tag>
			</div>	
		</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: [],
			sid:'',
			iid:'',
			currentPage: 1,
			pagesize:50,
			recordTotal:0,
			form: {
				id:'',
				series: '',
				instrument_id:'',
				ver:'',
				op_user:'',
				change_series:false
			},
			dialogVisible:false,
			oper_type:0,
			rules: {
			    series: [
			        { required: true, message: '系列号不可为空', trigger: 'blur' }
			    ],
			    instrument_id: [
			        { required: true, message: '编码不可为空', trigger: 'blur' }
			    ],
				op_user: [
				    { required: true, message: '操作人不可为空', trigger: 'blur' }
				]
			},
			tableData1:[],
			if_show:false,
			if_show0:false,
			begin_t:'',
			end_t:'',
			
			if_show_bt:1,
			if_show_et:false,
		  }
		},
		mounted() {
			
			if (localStorage.getItem("level")==4) {
				this.$data.if_show = true;
				return;
			}
			this.$data.if_show0= true;
			
			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.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/getLcmDevice', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
			    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;
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
		},
	methods: {
		tableRowClassName({row, rowIndex}) {
			if (row.if_warning ==true) {
				return 'warning-row';
			}
			return '';
		},
		
		show_detail(row){
			var url = 'lcm.html?sid='+row.series+'&iid='+row.instrument_id;
			url = encodeURI(url);
			window.open(url, "");
		},
		
		postLcmDevice(){
			this.$refs['authform'].validate((valid) => {
			if (valid) {
						  
				this.$data.dialogVisible = false;
				  
				var _this = this;
				
				console.log(_this.$data.form);
				 
				axios.post('/deescloud/postLcmDevice', {
					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,
					ver:_this.$data.form.ver,
					op_user:_this.$data.form.op_user,
				})
				.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.getLcmDeviceinfo();
				})
				.catch(function (error) {
				  console.log(error);
				});
			}
		});
		},

		delLcmDevice(info){
		  this.$data.oper_type = 3;
		  
		  var _this = this;
		  
		   var objs;
		   axios.post('/deescloud/postLcmDevice', {
			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,
			ver:info.ver,
			op_user:info.op_user,
		  })
		  .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.getLcmDeviceinfo("");//更新页面
			}
			
		  })
		  .catch(function (error) {
			console.log(error);
		  });
		},

		addlcmDevice(){
			document.getElementById("bt_add").blur();
			
			  this.$data.oper_type = 1;
			  this.$data.form = {
				id:'',
				series: '',
				instrument_id:'',
				ver:'',
				op_user:localStorage.getItem("online_user"),
				change_series:false
			};

			this.$nextTick(() => {
				this.$refs['authform'].clearValidate()
			});

			this.$data.dialogVisible = true;
		},

		updateLcmDevice(info){
		  this.$data.oper_type = 2;
		  this.$data.form = {
			id:info.id,
			series: info.series,
			instrument_id:info.instrument_id,
			ver:info.ver,
			op_user:info.op_user,
			change_series:true
		  };
		  
		  this.$nextTick(() => {
			  this.$refs['authform'].clearValidate()
		  });
		  
		  this.$data.dialogVisible = true;
		},

		getLcmDeviceinfo(){
			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/getLcmDevice', {
				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/getLcmDevice', {
					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/getLcmDevice', {
					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);
				});
		},
		
		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 > 300) {
			 // 设置最大宽度
			 max_flex_width = 300
			}
		  
		  //flexWidth = flexWidth;//20-padding
		  console.log("max_flex_width:",max_flex_width);
		  return max_flex_width + 'px'
		},
	  
	  }
	}
			