helpCategory.js 1.93 KB
//帮助分类
var $ = require('jquery');
	common = require('../common/common');

	var g = new common.grid({
		el: '#help_list',
		columns: [
			{display: "编号", name: "name"},
			{display: "分类名称", name: "category"},
			{display: "显示平台", name: "paltform"},
			{display: "时间", name: "time"},
			{
				display: "操作", name: "", render: function (item) {
					
					var arr = [];
					arr.push('<a class="btn btn-info add2" data-index="' + item.__index + '">编辑</a>');
					arr.push('<a class="btn btn-info delbtn" data-index="' + item.__index + '">删除</a>');					
					return arr.join('');
				}
			}
		]
	});

	g.init("/operations111/helpcategory/index111");

var Bll = { 
	onClick:function(arg1, arg2, arg3) {
	var e = new common.edit("#baseform");

console.log(arg2);
	common.dialog.confirm(arg3,
		common.util.__template($("#template").html(), arg2),
		function() {
			e.submit(arg1,function(option){
					// option.data.category=option.data.category_name_value+"--uoho";
					// console.log(option.data);
					option.success=function(){
						alert("suc");
						g.reload();
					};
					option.error=function(){
						alert("fail");
					}
				});
		});
	e.init();
	new common.dropDown({el: "#xxx"});
	}
};

	$('#add-category').on('click', function () {
		var item={};
		Bll.onClick("/operations111/helpcategory/index222",item,"添加分类");
	});

	$('#help_list').on('click', '.add2', function () {
		var item=g.rows[$(this).data("index")];
		Bll.onClick("/operations111/helpcategory/indexModify",item, "修改分类");
	});
	$('#help_list').on('click', '.delbtn', function() {
		var e = new common.edit("baseform");
		common.dialog.confirm("是否确认删除", 
			"",
			function() {
			e.submit("/operations111/helpcategory/indexDelete", function(option) {
				option.success=function() {
					alert("删除成功");
					g.reload();
				};
				option.error=function() {
					alert("删除失败");
				};
			})
		});
		e.init();
	});