text: $(function () {
      $("#jqGrid").jqGrid({
          url: baseURL + 'sys/travelcapturerecord/list',
          datatype: "json",
          colModel: [			
  			{ label: 'id', name: 'id', index: 'id', width: 50, key: true },
  			{ label: '主动抓的宠物id', name: 'strongPetId', index: 'strong_pet_id', width: 80 }, 			
  			{ label: '被抓的宠物id', name: 'weakPetId', index: 'weak_pet_id', width: 80 }, 			
  			{ label: '抓捕地区uid', name: 'addressUid', index: 'address_uid', width: 80 }, 			
  			{ label: '抓捕描述', name: 'description', index: 'description', width: 80 }, 			
  			{ label: '创建时间', name: 'createdTm', index: 'created_tm', width: 80 }			
          ],
  		viewrecords: true,
          height: 385,
          rowNum: 10,
  		rowList : [10,30,50],
          rownumbers: true, 
          rownumWidth: 25, 
          autowidth:true,
          multiselect: true,
          pager: "#jqGridPager",
          jsonReader : {
              root: "page.list",
              page: "page.currPage",
              total: "page.totalPage",
              records: "page.totalCount"
          },
          prmNames : {
              page:"page", 
              rows:"limit", 
              order: "order"
          },
          gridComplete:function(){
          	//隐藏grid底部滚动条
          	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
          }
      });
  });
  
  var vm = new Vue({
  	el:'#rrapp',
  	data:{
  		showList: true,
  		title: null,
  		travelCaptureRecord: {}
  	},
  	methods: {
  		query: function () {
  			vm.reload();
  		},
  		add: function(){
  			vm.showList = false;
  			vm.title = "新增";
  			vm.travelCaptureRecord = {};
  		},
  		update: function (event) {
  			var id = getSelectedRow();
  			if(id == null){
  				return ;
  			}
  			vm.showList = false;
              vm.title = "修改";
              
              vm.getInfo(id)
  		},
  		saveOrUpdate: function (event) {
  			var url = vm.travelCaptureRecord.id == null ? "sys/travelcapturerecord/save" : "sys/travelcapturerecord/update";
  			$.ajax({
  				type: "POST",
  			    url: baseURL + url,
                  contentType: "application/json",
  			    data: JSON.stringify(vm.travelCaptureRecord),
  			    success: function(r){
  			    	if(r.code === 0){
  						alert('操作成功', function(index){
  							vm.reload();
  						});
  					}else{
  						alert(r.msg);
  					}
  				}
  			});
  		},
  		del: function (event) {
  			var ids = getSelectedRows();
  			if(ids == null){
  				return ;
  			}
  			
  			confirm('确定要删除选中的记录？', function(){
  				$.ajax({
  					type: "POST",
  				    url: baseURL + "sys/travelcapturerecord/delete",
                      contentType: "application/json",
  				    data: JSON.stringify(ids),
  				    success: function(r){
  						if(r.code == 0){
  							alert('操作成功', function(index){
  								$("#jqGrid").trigger("reloadGrid");
  							});
  						}else{
  							alert(r.msg);
  						}
  					}
  				});
  			});
  		},
  		getInfo: function(id){
  			$.get(baseURL + "sys/travelcapturerecord/info/"+id, function(r){
                  vm.travelCaptureRecord = r.travelCaptureRecord;
              });
  		},
  		reload: function (event) {
  			vm.showList = true;
  			var page = $("#jqGrid").jqGrid('getGridParam','page');
  			$("#jqGrid").jqGrid('setGridParam',{ 
                  page:page
              }).trigger("reloadGrid");
  		}
  	}
  });