var type = T.p("type");
var unionId = T.p("unionId");
var source=T.p("source");
$(function () {
if(type=="user"){
vm.showList = false;
vm.showCancelButton=false;
}
else{
$("#jqGrid").jqGrid({
url: '../cloud/apply/userlist',
datatype: "json",
postData:{"unionId":unionId},
colModel: [
{ label: 'ID', name: 'id', index: "id", width: 45, key: true },
{ label: '类型', name: 'type', index: "type", width: 45,formatter: function (value,options,row){
if(value===1){
return '推优入党'
}else if(value ===2){
return '法律援助'
}else if(value===3){
return '信访接待'
}else{
return '未知'
}
}
},
{ label: '状态', name: 'status', index: "status", width: 45,formatter: function (value,options,row){
if (value === 0) {
return '未处理';
}
else if (value === 3) {
return '已拒绝';
}
else if (value === 1) {
return '已处理';
} else if (value === 2) {
return '已撤销';
}else{
return '未知'
}
}
},
{ label: '工会名', name: 'unionName', index: "union_name", width: 45},
{ label: '申请者', name: 'apName', index: "apName", width: 45},
],
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 setting = {
data: {
simpleData: {
enable: true,
idKey: "id",
rootPId: -1
},
key: {
url:"nourl"
}
},
check:{
enable:true,
nocheckInherit:true
}
};
var ztree;
var vm = new Vue({
el:'#rrapp',
data:{
q:{
askContext: null
},
sre:source,
showList: true,
title:null,
apply:{},
showCancelButton:true,
},
mounted:function(){
},
methods: {
backTo:function(){
window.location.href="../sys/"+vm.sre+".html";
},
query: function () {
vm.reload();
},
add: function(){
vm.showList=false;
vm.title="新增";
vm.apply={};
},
update: function () {
var roleId = getSelectedRow();
if(roleId == null){
return ;
}
vm.showList = false;
vm.title = "修改";
$.get("../cloud/apply/info/"+roleId, function(r){
vm.showList = false;
vm.title = "修改";
vm.apply = r.apply;
});
},
del: function (event) {
var roleIds = getSelectedRows();
if(roleIds == null){
return ;
}
confirm('确定要删除选中的记录?', function(){
$.ajax({
type: "POST",
url: "../cloud/apply/delete",
data: JSON.stringify(roleIds),
success: function(r){
if(r.code == 0){
alert('操作成功', function(index){
vm.reload();
});
}else{
alert(r.msg);
}
}
});
});
},
saveOrUpdate: function (event) {
$('#baseInfoSave').prop('disabled', true)
var url = vm.apply.id == null ? "../cloud/apply/save" : "../cloud/apply/update";
vm.apply.apTime = $("#pubDate").val();
//console.log(vm.baseinfo)
$.ajax({
type: "POST",
url: url,
data:JSON.stringify(vm.apply),
success: function(r){
if(r.code === 0){
alert('操作成功', function(index){
vm.reload();
$('#baseInfoSave').prop('disabled', false)
});
}else{
alert(r.msg);
$('#baseInfoSave').prop('disabled', false)
}
}
});
},
reload: function (event) {
vm.showList = true;
var page = $("#jqGrid").jqGrid('getGridParam','page');
$("#jqGrid").jqGrid('setGridParam',{
postData:{'askContext': vm.q.askContext},
page:page
}).trigger("reloadGrid");
}
}
});