cloudapply.js 4.91 KB
Newer Older
Zhou Yang's avatar
Zhou Yang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
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 '<span class="label label-primary">未处理</span>';
                    }
                    else if (value === 3) {
                        return '<span class="label label-danger">已拒绝</span>';
                    }
                    else if (value === 1) {
                        return '<span class="label label-success">已处理</span>';
                    }  else if (value === 2) {
                        return '<span class="label label-info">已撤销</span>';
                    }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");
			}

	}
});