(function() {
$.jgrid.defaults.styleUI="Bootstrap";
Vue.component('upstream-channel-dropdown-list', {
template: '
',
props: [],
data: function() {
return {
orgName: "",
orgCode: ""
}
},
mounted: function() {
initTable()
initContainer(this)
initEventOnBus()
this.search()
},
methods: {
goBack: function() {
var layerid = parent.layer.getFrameIndex(window.name)
parent.layer.close(layerid)
},
search: function() {
var vm = this
$("#table_list").jqGrid('setGridParam',{datatype:'json', page: 1, postData: {
agency_code: vm.orgCode,
shanhu_name: vm.orgName
}}).trigger('reloadGrid');
},
confirm: function() {
var rowId = $("#table_list").jqGrid('getGridParam','selrow')
var rowData = $("#table_list").jqGrid('getRowData',rowId);
top.GlobalEventBus.$emit("upstream-channel-dropdown-list:selected", rowData)
this.goBack()
},
reset: function() {
vm.orgName = ""
vm.orgCode = ""
this.search()
}
}
})
function resetWidth(vm) {
var $searchbar = $("#searchbar")
$("#table_list").setGridWidth($(window).width());
$("#table_list").jqGrid("setGridHeight", $(window).height() - $searchbar.height() - 153)
}
function initContainer(vm) {
resetWidth(vm)
window.onresize = function() {
resetWidth(vm)
}
}
function initEventOnBus() {
EventBus.$on('org-dropdown-list-search', function (arg) {
$("#table_list").jqGrid('setGridParam',{datatype:'json', page: 1, postData: arg}).trigger('reloadGrid');
})
}
function initTable() {
$("#table_list").jqGrid({
url: httpRequest.server+"/w0/Hlpay/Web/getChannelList.html",
datatype:"json",
mtype: 'POST',
ajaxGridOptions: {
beforeSend: function(request, grid) {
var userAgent = window.localStorage.getItem(httpRequest.agentName);
request.setRequestHeader(httpRequest.agentName, userAgent);
}
},
postData: {
},
prmNames: {
page: "pageno",
rows: "rowcount"
},
rowNum: 10,
jsonReader: {
root: "data",
page: "pageno",
records: "total",
total: "totalpages"
},
height:400,
autowidth:true,
shrinkToFit:true,
rowNum:10,
rowList:[10,20,30],
colNames:["编号","名称"],
colModel:[
{name:"code",index:"code",width:150},
{name:"name",index:"name",width:150}
],
pager:"#pager_list",
pagerpos: "left",
viewrecords:true,
hidegrid:false})
}
})()