提交 | 用户 | 时间
|
1ac2bc
|
1 |
/** |
懒 |
2 |
* 角色详情对话框 |
|
3 |
*/ |
|
4 |
var DeptInfoDlg = { |
|
5 |
data: { |
|
6 |
pid: "", |
|
7 |
pName: "" |
|
8 |
} |
|
9 |
}; |
|
10 |
|
|
11 |
layui.use(['layer', 'form', 'admin', 'ax'], function () { |
|
12 |
var $ = layui.jquery; |
|
13 |
var $ax = layui.ax; |
|
14 |
var form = layui.form; |
|
15 |
var admin = layui.admin; |
|
16 |
var layer = layui.layer; |
|
17 |
|
|
18 |
// 点击上级角色时 |
|
19 |
$('#pName').click(function () { |
|
20 |
var formName = encodeURIComponent("parent.DeptInfoDlg.data.pName"); |
|
21 |
var formId = encodeURIComponent("parent.DeptInfoDlg.data.pid"); |
|
22 |
var treeUrl = encodeURIComponent("/dept/tree"); |
|
23 |
|
|
24 |
layer.open({ |
|
25 |
type: 2, |
|
26 |
title: '父级部门', |
|
27 |
area: ['300px', '400px'], |
|
28 |
content: Feng.ctxPath + '/system/commonTree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl, |
|
29 |
end: function () { |
|
30 |
$("#pid").val(DeptInfoDlg.data.pid); |
|
31 |
$("#pName").val(DeptInfoDlg.data.pName); |
|
32 |
} |
|
33 |
}); |
|
34 |
}); |
|
35 |
|
|
36 |
// 表单提交事件 |
|
37 |
form.on('submit(btnSubmit)', function (data) { |
|
38 |
var ajax = new $ax(Feng.ctxPath + "/dept/add", function (data) { |
|
39 |
Feng.success("添加成功!"); |
|
40 |
|
|
41 |
//传给上个页面,刷新table用 |
|
42 |
admin.putTempData('formOk', true); |
|
43 |
|
|
44 |
//关掉对话框 |
|
45 |
admin.closeThisDialog(); |
|
46 |
|
|
47 |
}, function (data) { |
|
48 |
Feng.error("添加失败!" + data.responseJSON.message) |
|
49 |
}); |
|
50 |
ajax.set(data.field); |
|
51 |
ajax.start(); |
|
52 |
|
|
53 |
//添加 return false 可成功跳转页面 |
|
54 |
return false; |
|
55 |
}); |
|
56 |
|
|
57 |
}); |