/**
 * 系统配置管理
 */
$(function(){

    AppConfig = {
        Events : {'click .btn': function (e, value, row, index) {
			var event = $(e.target).data('event');
			if(event == 'view'){
                AppConfig.view(value);
			}else if(event == 'edit'){
                AppConfig.edit(value);
			}
		}},
		add : function(){
			window.location = String.format(Config.ROOT+'/auth/jump_basic?moduleId={0}&url=/sys/config/edit', $('#moduleId').val());
		},
		edit: function(oid){
			window.location = String.format(Config.ROOT+'/auth/jump_basic?moduleId={0}&url=/sys/config/edit?oid={1}', $('#moduleId').val(), oid);
		},
        view: function(oid){
            window.location = String.format(Config.ROOT+'/auth/jump_basic?moduleId={0}&url=/sys/config/edit&editType=view&oid={1}', $('#moduleId').val(), oid);
        }
	};
	
	
	//初始化表格
    var $table = new App.Table({
        url: Config.ROOT + '/sys/config/list',
        search: true,
        searchParamName: 'cfgName',
        searchPlaceholder: '配置项名称',
        columns	:[
            {checkbox: true},
            {field:'cfgDescribe', title:'配置项说明'},
            {field:'cfgName', title:'配置项名称'},
            {field:'cfgValue', title:'值'},
            {field:'cfgValue2', title:'值2'},
            {field:'oid', title:'操作', width: 200, toolbar: 'tableRowToolbar', events: AppConfig.Events}
        ]
    });

});