	var nbComponent = {
		template:`
		<div>
			<div style="display: flex;margin-top: 10px;">
				<el-radio-group v-model="radio1" @change="radio_change">
			      <el-radio-button label="1" >电池</el-radio-button>
			      <el-radio-button label="2" >井位</el-radio-button>
			    </el-radio-group>
				<!--<el-input v-model="series_id_v" placeholder="系列号" clearable style="width: 15%;"  @change="input_change"></el-input>
				-->
				<div v-if='radio1=="1"' style="display: flex;">
					<el-input v-model="num_v" placeholder="序列号" clearable style="width: 200px;" ></el-input>
					<el-button style="margin-left: 5px;" id ="bt_serach" plain type="primary" icon="el-icon-search" @click="get_nb()">搜索</el-button>
					<el-button style="margin-left: 5px;" id ="bt_add" plain type="primary" icon="el-icon-circle-plus-outline" @click="add_nb_dialog()">新增</el-button>
					<el-button style="margin-left: 5px;" id ="bt_export" plain type="primary" icon="el-icon-document" @click="get_nb_pdf()">导出电池使用报告</el-button>
					<el-button style="margin-left: 5px;" id ="bt_export_w" plain type="primary" icon="el-icon-document" @click="get_nb_warning_csv()">导出预警</el-button>
				</div>
				
				<div v-if='radio1=="2"' style="display: flex;">
					<el-select v-model="wellname_v" filterable clearable placeholder="请选择井名" style="width: 200px;">
					    <el-option
					      v-for="item in options"
					      :key="item.value"
					      :label="item.label"
					      :value="item.value">
					    </el-option>
					  </el-select>
					<el-checkbox style="margin-left: 10px;background-color: #ECF5FF;" v-model="checked1" label="工程服务" border></el-checkbox>
					  
					<el-button style="margin-left: 10px;" id ="bt_serach" plain type="primary" icon="el-icon-search" @click="get_nb_his_ex2()">搜索</el-button>
					<el-button id ="bt_add" plain type="primary" icon="el-icon-circle-plus-outline" @click="add_nb_dialog()">新增</el-button>
					<el-button id ="bt_export" plain type="primary" icon="el-icon-document" @click="get_well_nb_pdf()">导出井位电池使用报告</el-button>
				</div>
				
			</div>
			<div class="span" v-if='radio1=="1"'>
				<el-table
				    :data="tableData"
				    style="width: 100%;font-size:14px;overflow-y: auto;"
				    :height="tHeight"
					:cell-style="{background:'#304156'}"
					border
					>
				    <!--<el-table-column
				      prop="b_id"
				      label="电池系列号"
				      :width="150"
					  :show-overflow-tooltip="true">
				    </el-table-column>
					-->
					<el-table-column
					  prop="b_code"
					  label="电池序列号"
					  :width="200"
					  :show-overflow-tooltip="true">
					</el-table-column>
					
					<el-table-column
					  prop="b_life"
					  label="电池寿命(h)"
					 :width="120">
					</el-table-column>
					
				    <el-table-column
				      prop="uset"
				      label="已使用时间(h)"
				     :width="120">
				    </el-table-column>
					
					<el-table-column
					  prop="remaining_t"
					  label="剩余时间(h)"
					 :width="120">
					</el-table-column>
					
					<el-table-column
					  prop="remaining_t1"
					  label="剩余占比(%)"
					 :width="120">
					</el-table-column>
				    
					<el-table-column
					      label="操作"
					      width="80">
					      <template slot-scope="scope">
							  <el-button @click="get_nb_his(scope.row)" type="text" size="medium">详情</el-button>
							</template>
					    </el-table-column>
				  </el-table>
				  <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>
			</div>
			<div class="span" v-if='radio1=="2"'>
				<el-table
				    :data="his_tableData"
				    style="width: 100%;font-size:14px;overflow-y: auto;"
				    :height="tHeight"
					:cell-style="{background:'#304156'}"
					border
					>
				    <el-table-column
				      prop="wellname"
				      label="井名称"
				      :width="120"
				      :show-overflow-tooltip="true">
				    </el-table-column>
				    <el-table-column
				      prop="b_code"
				      label="电池序列号"
				      :width="200">
				    </el-table-column>
				    <el-table-column
				      prop="sid"
				      label="短节系列号"
				      :width="100"
				      :show-overflow-tooltip="true">
				    </el-table-column>
				    <el-table-column
				      prop="iid"
				      label="短节序列号"
				      :width="100"
					  :show-overflow-tooltip="true">
				    </el-table-column>
				    
				    <!--<el-table-column
				      prop="b_id"
				      label="电池系列号"
				      :width="100"
				      :show-overflow-tooltip="true">
				    </el-table-column>-->
				    
				    <el-table-column
				      prop="bt"
				      label="开始日期"
				     :width="100">
				    </el-table-column>
				    
					<!--
				    <el-table-column
				      prop="et"
				      label="结束日期"
				     :width="100">
				    </el-table-column>
					-->
				    
				    <el-table-column
				      prop="uset"
				      label="已使用时间"
				     :width="100">
				    </el-table-column>
				    
				    <el-table-column
				          label="操作"
				          width="80">
				          <template slot-scope="scope">
				    		  <el-button v-if="scope.row.flag==1" @click="update_b(scope.row)" type="text" size="medium">修改</el-button>
				    		  <el-button v-if="scope.row.flag==1" @click="remove_nb_his(scope.row)" type="text" size="medium">删除</el-button>
				    		</template>
				        </el-table-column>
				  </el-table>
				  <div class="block">
				      <span class="demonstration" style="background-color: #ECF5FF;"></span>
				      <el-pagination
				        @size-change="handleSizeChange1"
				        @current-change="handleCurrentChange1"
				        :current-page="currentPage1"
				        :page-sizes="[50,100, 200, 300]"
				        :page-size="pagesize1"
				        layout="total, sizes, prev, pager, next, jumper"
				        :total="recordTotal1" style="background-color: #ECF5FF;">
				      </el-pagination>
				    </div>
			</div>
			
			  
			  <el-dialog
				   title="电池使用信息"
				   :visible.sync="add_visible"
				   :lock-scroll ="false"
				   width="45%">
				   <el-form ref="bform" :model="form" :rules="rules" label-width="100px" :inline="false" class="demo-form-inline" size="medium">
					  
					<el-row :gutter="10">
					  <el-col :span="12">
						  <el-form-item label="井名" prop="wellname">
						  <!--<el-input v-model="form.wellname" ></el-input>-->
						  <el-select v-model="form.wellname" filterable clearable placeholder="请选择井名" style="width: 200px;">
						      <el-option
						        v-for="item in options"
						        :key="item.value"
						        :label="item.label"
						        :value="item.value">
						      </el-option>
						    </el-select>
						  </el-form-item>
					  </el-col>
					  <el-col :span="12">
						  <el-form-item label="电池序列号" prop="battery_num">
						  <el-input v-model="form.battery_num" ></el-input>
						  </el-form-item>
					  </el-col>
				  </el-row>
				  
				  <el-row :gutter="10">
					  <el-col :span="12">
						  <el-form-item label="短节系列号" prop="series_id">
						  <el-input v-model="form.series_id" ></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" ></el-input>
						  </el-form-item>
					  </el-col>
				  </el-row>
				  
			  	  <el-row :gutter="10">
					<el-col :span="12">
						  <el-form-item label="开始日期" prop="begin_t">
						  <el-date-picker
							v-if="if_show_bt==1"
							key="2"
							style="width: 200px;"
							 v-model="form.begin_t"
							 type="date"
							 placeholder="选择日期时间"
						  value-format="yyyy-MM-dd">
						   </el-date-picker>
						   <el-date-picker
								v-if="if_show_bt==2"
								key="2"
								style="width: 200px;"
							  v-model="form.begin_t"
							  type="date"
							  placeholder="选择日期时间"
							  format="MM-dd-yyyy"
						   value-format="yyyy-MM-dd">
							</el-date-picker>
							
							<el-date-picker
								v-if="if_show_bt==3"
								key="2"
								style="width: 200px;"
							  v-model="form.begin_t"
							  type="date"
							  placeholder="选择日期时间"
							  format="dd/MM/yyyy"
							value-format="yyyy-MM-dd">
							</el-date-picker>
						  </el-form-item>
						</el-col>
			  	  <el-col :span="12">
			  		  <el-form-item label="结束日期" prop="end_t">
					  <el-date-picker
						v-if="if_show_bt==1"
						key="2"
						style="width: 200px;"
					     v-model="form.end_t"
					     type="date"
					     placeholder="选择日期时间"
					  value-format="yyyy-MM-dd">
					   </el-date-picker>
					   <el-date-picker
							v-if="if_show_bt==2"
							key="2"
							style="width: 200px;"
					      v-model="form.end_t"
					      type="date"
					      placeholder="选择日期时间"
						  format="MM-dd-yyyy"
					   value-format="yyyy-MM-dd">
					    </el-date-picker>
						<el-date-picker
							v-if="if_show_bt==3"
							key="2"
							style="width: 200px;"
						  v-model="form.end_t"
						  type="date"
						  placeholder="选择日期时间"
						  format="dd/MM/yyyy"
						value-format="yyyy-MM-dd">
						</el-date-picker>
			  		  </el-form-item>
					</el-col>
			  	  </el-row>
				  
				   <el-row>
				  <el-col :span="12">
					  <el-form-item label="已使用时间" prop="use_t">
					  <el-input-number v-model="form.use_t" :min="0.1" :precision="2"></el-input-number>
					  </el-form-item>
				  </el-col>
				  </el-row>
			  	  
			   </el-form>
			   <span slot="footer" class="dialog-footer">
			   <el-button @click="add_visible = false">取 消</el-button>
			   <el-button id ="bt_ok" plain type="primary" @click="add_nb()">确 定</el-button>
			   </span>
			  </el-dialog>
			  
			  <el-dialog
				   title="电池使用信息"
				   :visible.sync="update_visible"
				   :lock-scroll ="false"
				   width="45%">
				   <el-form ref="bform" :model="form" :rules="rules" label-width="100px" :inline="false" class="demo-form-inline" size="medium">
								  
			   				  <el-row :gutter="10">
			   					  <el-col :span="12">
			   						  <el-form-item label="井名" prop="wellname">
			   						  <!--<el-input v-model="form.wellname" ></el-input>-->
			   						  <el-select v-model="form.wellname" filterable clearable placeholder="请选择井名" style="width: 200px;">
			   						      <el-option
			   						        v-for="item in options"
			   						        :key="item.value"
			   						        :label="item.label"
			   						        :value="item.value">
			   						      </el-option>
			   						    </el-select>
			   						  </el-form-item>
			   					  </el-col>
			   					  <el-col :span="12">
			   						  <el-form-item label="电池序列号" prop="battery_num">
			   						  <el-input v-model="form.battery_num" ></el-input>
			   						  </el-form-item>
			   					  </el-col>
			   				  </el-row>
			   				  
			   				  <el-row :gutter="10">
			   					  <el-col :span="12">
			   						  <el-form-item label="短节系列号" prop="series_id">
			   						  <el-input v-model="form.series_id" ></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" ></el-input>
			   						  </el-form-item>
			   					  </el-col>
			   				  </el-row>
			   				  
			   			  	  <el-row :gutter="10">
			   					<el-col :span="12">
			   						  <el-form-item label="开始日期" prop="begin_t">
			   						  <el-date-picker
			   							v-if="if_show_bt==1"
			   							key="2"
			   							style="width: 200px;"
			   							 v-model="form.begin_t"
			   							 type="date"
			   							 placeholder="选择日期时间"
			   						  value-format="yyyy-MM-dd">
			   						   </el-date-picker>
			   						   <el-date-picker
			   								v-if="if_show_bt==2"
			   								key="2"
			   								style="width: 200px;"
			   							  v-model="form.begin_t"
			   							  type="date"
			   							  placeholder="选择日期时间"
			   							  format="MM-dd-yyyy"
			   						   value-format="yyyy-MM-dd">
			   							</el-date-picker>
			   							
			   							<el-date-picker
			   								v-if="if_show_bt==3"
			   								key="2"
			   								style="width: 200px;"
			   							  v-model="form.begin_t"
			   							  type="date"
			   							  placeholder="选择日期时间"
			   							  format="dd/MM/yyyy"
			   							value-format="yyyy-MM-dd">
			   							</el-date-picker>
			   						  </el-form-item>
			   						</el-col>
			   			  	  <el-col :span="12">
			   			  		  <el-form-item label="结束日期" prop="end_t">
			   					  <el-date-picker
			   						v-if="if_show_bt==1"
			   						key="2"
			   						style="width: 200px;"
			   					     v-model="form.end_t"
			   					     type="date"
			   					     placeholder="选择日期时间"
			   					  value-format="yyyy-MM-dd">
			   					   </el-date-picker>
			   					   <el-date-picker
			   							v-if="if_show_bt==2"
			   							key="2"
			   							style="width: 200px;"
			   					      v-model="form.end_t"
			   					      type="date"
			   					      placeholder="选择日期时间"
			   						  format="MM-dd-yyyy"
			   					   value-format="yyyy-MM-dd">
			   					    </el-date-picker>
			   						<el-date-picker
			   							v-if="if_show_bt==3"
			   							key="2"
			   							style="width: 200px;"
			   						  v-model="form.end_t"
			   						  type="date"
			   						  placeholder="选择日期时间"
			   						  format="dd/MM/yyyy"
			   						value-format="yyyy-MM-dd">
			   						</el-date-picker>
			   			  		  </el-form-item>
			   					</el-col>
			   			  	  </el-row>
			   				  
			   				   <el-row>
			   				  <el-col :span="12">
			   					  <el-form-item label="已使用时间" prop="use_t">
			   					  <el-input-number v-model="form.use_t" :min="0.1" :precision="2"></el-input-number>
			   					  </el-form-item>
			   				  </el-col>
			   				  </el-row>
			   			  	  
			   </el-form>
			   <span slot="footer" class="dialog-footer">
			   <el-button @click="update_visible = false">取 消</el-button>
			   <el-button id ="bt_ok" plain type="primary" @click="update_nb_his()">确 定</el-button>
			   </span>
			  </el-dialog>
			  
			  
			  <el-dialog
			   title="电池使用记录"
			   :visible.sync="history_visible"
			   :lock-scroll ="false"
			   width="70%">
				<el-table
				    :data="his_tableData"
				    style="width: 100%;font-size:14px"
				    :height="tHeight1"
					:cell-style="{background:'#304156'}"
					border
					>
					<el-table-column
					  prop="wellname"
					  label="井名称"
					  :width="120"
					  :show-overflow-tooltip="true">
					</el-table-column>
					<el-table-column
					  prop="b_code"
					  label="电池序列号"
					  :width="100"
					  :show-overflow-tooltip="true">
					</el-table-column>
					<el-table-column
					  prop="sid"
					  label="短节系列号"
					  :width="100"
					  :show-overflow-tooltip="true">
					</el-table-column>
					<el-table-column
					  prop="iid"
					  label="短节序列号"
					  :width="100">
					</el-table-column>
				    
					<!--<el-table-column
				      prop="b_id"
				      label="电池系列号"
				      :width="100"
					  :show-overflow-tooltip="true">
				    </el-table-column>-->
					
					<el-table-column
					  prop="bt"
					  label="开始日期"
					 :width="100">
					</el-table-column>
					
					<el-table-column
					  prop="et"
					  label="结束日期"
					 :width="100">
					</el-table-column>
					
				    <el-table-column
				      prop="uset"
				      label="已使用时间"
				     :width="100">
				    </el-table-column>
					
					<el-table-column
					      label="操作"
					      width="80">
					      <template slot-scope="scope">
							  <el-button v-if="scope.row.flag==1" @click="update_b(scope.row)" type="text" size="medium">修改</el-button>
							  <el-button v-if="scope.row.flag==1" @click="remove_nb_his(scope.row)" type="text" size="medium">删除</el-button>
							</template>
					    </el-table-column>
				  </el-table>
			</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,
		tHeight1:screenH*0.5,
		tableData: Array(0),
		series_id_v:'',
		num_v:'',
		input:'',
		currentPage: 1,
		pagesize:50,
		recordTotal:0,
		
		currentPage1: 1,
		pagesize1:50,
		recordTotal1:0,
		
		add_visible:false,
		update_visible:false,
		
		form: {
			id:0,
			wellname:'',
			battery_sid:'',
			battery_num:'',
			series_id: '',
			instrument_id:'',
			begin_t:'',
			end_t:'',
			use_t:0,
		},
		
		rules: {
		    wellname: [
		        { required: true, message: '井名不可为空', trigger: 'blur' }
		    ],
		    battery_sid: [
		        { required: true, message: '电池系列号不可为空', trigger: 'blur' }
		    ],
			battery_num: [
			    { required: true, message: '电池序列号不可为空', trigger: 'blur' }
			],
			series_id: [
			    { required: true, message: '短节系列号不可为空', trigger: 'blur' }
			],
			instrument_id: [
			    { required: true, message: '短节序列号不可为空', trigger: 'blur' }
			],
			begin_t: [
			    { required: true, message: '上电时间不可为空', trigger: 'blur' }
			],
			end_t: [
			    { required: true, message: '断电时间不可为空', trigger: 'blur' }
			],
		},
		history_visible:false,
		his_tableData:[],
		
		if_show_bt:1,
		ps_info:'',
		
		radio1: '1',
		
		options: [],
		wellname_v:'',
		
		checked1:false,
	  }
	},
	mounted() {
		
		var _this = this;
		
		axios.post('/deescloud/get_page_setting', {
			opuser:localStorage.getItem("online_user"),
			opuser_uuid:localStorage.getItem("uuid"),
		  })
		  .then(function (response) {
				_this.$data.ps_info = response.data;
				console.log(response.data)
				if(response.data.r3=="1"){
					_this.$data.if_show_bt=1;
				}else if(response.data.r3=="2"){
					_this.$data.if_show_bt=2;
				}else if(response.data.r3=="3"){
					_this.$data.if_show_bt=3;
				}else{
					_this.$data.if_show_bt=1;
				}
		  })
		  .catch(function (error) {
		    console.log(error);
		  });
		  
		this.get_all_wellname();
		
		var objs;
		axios.post('/deescloud/get_nb', {
			series_id: "",
			num: "",
		    index: this.$data.currentPage,
		    count: this.$data.pagesize,
			opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid")
		  })
		  .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: {
		get_well_nb_pdf(){
			document.getElementById("bt_export").blur();
			
			if (this.$data.wellname_v==""){
				this.$message({
					message: "请选择井名称",
					type: "warning",
					duration: 1500
				});
				
				return;
			}
			
			var _this = this;
			
			axios.post('deescloud/get_well_nb_pdf',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				wellname:_this.$data.wellname_v,
			},
			).then(function (response) {
				console.log(response.data);
				var fileid = response.data.fileId;
				
				var downUrl = 'file/'+fileid;
				downloadUrl(_this.$data.wellname_v+"电池使用报告"+".pdf",downUrl);
			})
			.catch(function (error) {
				console.log(error);
			});
		},
		get_nb_pdf(){
			document.getElementById("bt_export").blur();
			var _this = this;
			
			axios.post('deescloud/get_nb_pdf',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				bcode:_this.$data.num_v,
			},
			).then(function (response) {
				console.log(response.data);
				var fileid = response.data.fileId;
				
				var downUrl = 'file/'+fileid;
				downloadUrl("电池使用报告"+".pdf",downUrl);
			})
			.catch(function (error) {
				console.log(error);
			});
		},
		get_nb_his_ex2(){
			document.getElementById("bt_serach").blur();
			
			var _this = this;
			
			var objs;
			axios.post('/deescloud/get_nb_his_ex', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
					wellname: _this.$data.wellname_v,
					index: this.$data.currentPage1,
					count: this.$data.pagesize1,
					checked:this.$data.checked1
				})
				.then(function (response) {
				  console.log(response.data);
					objs = response.data.data;
					rcnt = response.data.total;
					_this.$data.his_tableData = objs;
					_this.$data.recordTotal1 = rcnt;
				})
				.catch(function (error) {
				  console.log(error);
				});
		},
		radio_change(){
			console.log(this.$data.radio1)
			if (this.$data.radio1=="1"){
				this.get_nb();
			} else if (this.$data.radio1=="2"){
				this.$data.his_tableData=[];
				this.get_nb_his_ex2()
			}
		},
		get_all_wellname(){
			var _this = this;
			
			axios.post('/deescloud/getWellNames',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
			})
			  .then(function (response) {
			    console.log(response.data);
				_this.$data.options = response.data;
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
		},
		
		get_nb_warning_csv(){
			var _this = this;
			
			axios.post('deescloud/get_nb_warning_csv',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
			},
			).then(function (response) {
				console.log(response.data);
				var fileid = response.data.fileId;
				
				var downUrl = 'file/'+fileid;
				downloadUrl("电池预警记录"+".csv",downUrl);
			})
			.catch(function (error) {
				console.log(error);
			});
		},
		get_nb_csv(){
			var _this = this;
			
			axios.post('deescloud/get_nb_csv',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
			},
			).then(function (response) {
				console.log(response.data);
				var fileid = response.data.fileId;
				
				var downUrl = 'file/'+fileid;
				downloadUrl("电池使用记录"+".csv",downUrl);
			})
			.catch(function (error) {
				console.log(error);
			});
		},
		remove_nb_his(row){
			var _this = this;
			
			var r;
			axios.post('/deescloud/remove_nb_his', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				id: row.id,
				b_id: row.b_id,
				b_code:row.b_code,
				wellname:row.wellname,
			  })
			  .then(function (response) {
			    console.log(response.data);
				r = response.data.r;
				if (r==0){
					_this.$message({
						message: "删除成功",
						type: "success",
						duration: 1500
					});
				}else{
					_this.$message({
						message: "删除失败",
						type: "error",
						duration: 1500
					});
				}
				
				if (_this.$data.radio1=="1"){
					_this.get_nb_his_ex(row.b_id,row.b_code);
				} else if (_this.$data.radio1=="2"){
					_this.get_nb_his_ex2()
				}
				
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
		},
		update_nb_his(){
			this.$refs['bform'].validate((valid) => {
				if (valid) {
					var _this = this;
					
					var r;
					axios.post('/deescloud/update_nb_his', {
						opuser:localStorage.getItem("online_user"),
						opuser_uuid:localStorage.getItem("uuid"),
						id: _this.$data.form.id,
						wellname: _this.$data.form.wellname,
						sid: _this.$data.form.series_id,
					    iid: _this.$data.form.instrument_id,
					    b_id: _this.$data.form.battery_sid,
						b_code:_this.$data.form.battery_num,
						uset:_this.$data.form.use_t,
						action:0,
						bt:_this.$data.form.begin_t,
						et:_this.$data.form.end_t,
					  })
					  .then(function (response) {
					    console.log(response.data);
						r = response.data.r;
						if (r==0){
							_this.$message({
								message: "修改成功",
								type: "success",
								duration: 1500
							});
							
							if (_this.$data.radio1=="1"){
								_this.get_nb_his_ex(_this.$data.form.battery_sid,_this.$data.form.battery_num);
							} else if (_this.$data.radio1=="2"){
								_this.get_nb_his_ex2()
							}
							
							_this.$data.update_visible=false;
						}else if (r==1){
							_this.$message({
								message: "结束日期必须在开始日期之后!",
								type: "error",
								duration: 1500
							});
						}else{
							_this.$message({
								message: "修改失败",
								type: "error",
								duration: 1500
							});
						}
					  })
					  .catch(function (error) {
					    console.log(error);
					  });
				}})
		},
		update_b(row){
			this.$data.form.id=row.id;
			this.$data.form.wellname=row.wellname;
			this.$data.form.battery_sid=row.b_id;
			this.$data.form.battery_num=row.b_code;
			this.$data.form.series_id= row.sid;
			this.$data.form.instrument_id=row.iid;
			this.$data.form.begin_t='';
			this.$data.form.end_t='';
			
			console.log(row.bt,row.et);
			if(this.$data.ps_info.r3=="1"){
				this.$data.form.begin_t=row.bt;
				this.$data.form.end_t=row.et;
			}else if (this.$data.ps_info.r3=="2"){
				if (row.bt.length>=10){
					var arr = row.bt.split("-")
					var t = arr[1]+"-"+arr[2]+"-"+arr[0];
					console.log(t);
					this.$data.form.begin_t=t;
				}
				
				if (row.et.length>=10){
					var arr = row.etsplit("-")
					var t = arr[1]+"-"+arr[2]+"-"+arr[0];
					console.log(t);
					this.$data.form.end_t=t;
				}
			}else if (this.$data.ps_info.r3=="3"){
				if (row.bt.length>=10){
					var arr = row.bt.split("/")
					var month = arr[1]
					if (this.$data.ps_info.r4){
						month=get_month(month)
					}
					var t = arr[2]+"-"+month+"-"+arr[0];
					console.log(t);
					this.$data.form.begin_t=t;
				}
				
				if (row.et.length>=10){
					var arr = row.et.split("/")
					var month = arr[1]
					if (this.$data.ps_info.r4){
						month=get_month(month)
					}
					
					var t = arr[2]+"-"+month+"-"+arr[0];
					console.log(t);
					this.$data.form.end_t=t;
				}
			}else{
				this.$data.form.begin_t=row.bt;
				this.$data.form.end_t=row.et;
			}
			
			console.log(this.$data.form.begin_t,this.$data.form.end_t)
			this.$data.form.use_t=row.uset;
			
			this.$nextTick(() => {
				this.$refs['bform'].clearValidate()
			});
			this.$data.update_visible=true;
		},
		input_change(value) {
			this.get_nb();
		},
		add_nb(){
			this.$refs['bform'].validate((valid) => {
				if (valid) {
					var _this = this;
					
					var r;
					axios.post('/deescloud/add_nb_his', {
						opuser:localStorage.getItem("online_user"),
						opuser_uuid:localStorage.getItem("uuid"),
						wellname: _this.$data.form.wellname,
						sid: _this.$data.form.series_id,
					    iid: _this.$data.form.instrument_id,
					    b_id: _this.$data.form.battery_sid,
						b_code:_this.$data.form.battery_num,
						uset:_this.$data.form.use_t,
						action:0,
						bt:_this.$data.form.begin_t,
						et:_this.$data.form.end_t,
					  })
					  .then(function (response) {
					    console.log(response.data);
						r = response.data.r;
						if (r==0){
							_this.$message({
								message: "添加成功",
								type: "success",
								duration: 1500
							});
							if (_this.$data.radio1=="1"){
								_this.get_nb();
							} else if (_this.$data.radio1=="2"){
								_this.get_nb_his_ex2()
							}
							_this.$data.add_visible=false;
						} else if (r==1){
							_this.$message({
								message: "结束日期必须在开始日期之后!",
								type: "error",
								duration: 1500
							});
						}else{
							_this.$message({
								message: "添加失败",
								type: "error",
								duration: 1500
							});
						}
					  })
					  .catch(function (error) {
					    console.log(error);
					  });
				}})
		},
		add_nb_dialog(){
			document.getElementById("bt_add").blur();
			
			this.$data.form.wellname='',
			this.$data.form.battery_sid='',
			this.$data.form.battery_num='',
			this.$data.form.series_id= '',
			this.$data.form.instrument_id='',
			this.$data.form.begin_t='',
			this.$data.form.end_t='',
			this.$data.form.use_t=0,
			
			this.$nextTick(() => {
				this.$refs['bform'].clearValidate()
			});
			this.$data.add_visible=true;
		},
		get_nb(){
			  
			document.getElementById("bt_serach").blur();
		  	
		  	this.$data.currentPage=1;
		  	
			var _this = this;
			
			var objs;
			axios.post('/deescloud/get_nb', {
				series_id: _this.$data.series_id_v,
				num: _this.$data.num_v,
			    index: this.$data.currentPage,
			    count: this.$data.pagesize,
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid")
			  })
			  .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_nb', {
					series_id: _this.$data.series_id_v,
					num: _this.$data.num_v,
					index: this.$data.currentPage,
					count: this.$data.pagesize,
					opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid")
				})
				.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_nb', {
					series_id: _this.$data.series_id_v,
					num: _this.$data.num_v,
					index: this.$data.currentPage,
					count: this.$data.pagesize,
					opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid")
				})
				.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) {
			  //console.log(`每页 ${val} 条`);
			  this.$data.pagesize1 = val;
			  
			  this.get_nb_his_ex2();
		},
		handleCurrentChange1(val) {
		  //console.log(`当前页: ${val}`);
		  this.$data.currentPage1 = val;
		  
		  this.get_nb_his_ex2();
		},
		
		
		get_nb_his_ex(b_id,b_code){
			var _this = this;
			
			var objs;
			axios.post('/deescloud/get_nb_his', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
					b_id: b_id,
					b_code: b_code,
				})
				.then(function (response) {
				  console.log(response.data);
					objs = response.data.data;
					
					_this.$data.his_tableData = objs;
				})
				.catch(function (error) {
				  console.log(error);
				});
			
		},
		
		get_nb_his(row){
			var _this = this;
			
			var objs;
			axios.post('/deescloud/get_nb_his', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
					b_id: row.b_id,
					b_code: row.b_code,
					index: this.$data.currentPage,
					count: this.$data.pagesize
				})
				.then(function (response) {
				  console.log(response.data);
					objs = response.data.data;
					_this.$data.his_tableData = objs;
					
					_this.$data.history_visible=true;
				})
				.catch(function (error) {
				  console.log(error);
				});
			
		},
		
	  }
	}
			