...
|
...
|
@@ -25,7 +25,8 @@ var g = new common.grid({ |
|
|
size: 10,
|
|
|
parms: function () {
|
|
|
return {
|
|
|
department:common.util.__input("choose-department")
|
|
|
department:common.util.__input("choose-department"),
|
|
|
departmentSel:common.util.__input("sel-departmentId")
|
|
|
};
|
|
|
},
|
|
|
columns: [
|
...
|
...
|
@@ -42,7 +43,7 @@ var g = new common.grid({ |
|
|
name: "status",
|
|
|
render: function (items) {
|
|
|
var HtmArr = [];
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-xs btn-danger info-delete">删除</a>');
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">编辑</a>');
|
|
|
return HtmArr.join('');
|
|
|
}
|
|
|
}]
|
...
|
...
|
@@ -69,11 +70,10 @@ $(document).on("change", ".observe", function () { |
|
|
/*验证*/
|
|
|
var edit = new common.edit2(".modal-body");
|
|
|
var Bll = {
|
|
|
module: {
|
|
|
"departmentName":""
|
|
|
},
|
|
|
module: null,
|
|
|
//弹框
|
|
|
toast: function (module, hint, url) {
|
|
|
Bll.module = module;
|
|
|
var d = new common.dialog({
|
|
|
title: hint + "部门",
|
|
|
content: common.util.__template2($("#template").html(), Bll.module),
|
...
|
...
|
@@ -83,16 +83,20 @@ var Bll = { |
|
|
value: "保存",
|
|
|
callback: function () {
|
|
|
if (edit.validate()) {
|
|
|
console.log("Bll.module",Bll.module.departmentName);
|
|
|
common.util.__ajax2({
|
|
|
var departmentName = $("#departmentName").val();
|
|
|
if(departmentName.length>20){
|
|
|
common.util.__tip("部门名称不能超过20字符", "warning");
|
|
|
return false;
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url: url,
|
|
|
data: Bll.module
|
|
|
}, function (res) {
|
|
|
if (res.code == '200') {
|
|
|
common.util.__tip("添加成功", 'success');
|
|
|
g.reload();
|
|
|
d.close();
|
|
|
}else{
|
|
|
}
|
|
|
else {
|
|
|
common.util.__tip(res.message, "warning");
|
|
|
}
|
|
|
}, true);
|
...
|
...
|
@@ -109,16 +113,6 @@ var Bll = { |
|
|
});
|
|
|
Bll.__editRender();
|
|
|
},
|
|
|
deleteAction:function(content,department){
|
|
|
common.dialog.confirm("温馨提示",content,function(){
|
|
|
common.util.__ajax({
|
|
|
url:'/coupon/deleteDepartment',
|
|
|
data:{department:department}
|
|
|
},function(){
|
|
|
g.reload();
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
__editRender: function () {
|
|
|
edit.init();
|
|
|
}
|
...
|
...
|
@@ -139,3 +133,16 @@ $(document).on('click', '.info-delete', function() { |
|
|
var item=g.rows[$(this).data("index")];
|
|
|
Bll.deleteAction("确定删除该部门吗?",item.department);
|
|
|
});
|
|
|
/**
|
|
|
* 编辑--点击事件
|
|
|
*/
|
|
|
$(document).on('click', '.info-modify', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
console.log("id:",item.id);
|
|
|
common.util.__ajax({
|
|
|
url: "/coupon/queryDepartmentById",
|
|
|
data: {department: item.department}
|
|
|
}, function (res) {
|
|
|
Bll.toast(res.data, "修改", '/coupon/updateDepartment');
|
|
|
}, true);
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|