提交 | 用户 | 时间
|
1ac2bc
|
1 |
/** |
懒 |
2 |
* 详情对话框 |
|
3 |
*/ |
|
4 |
var DictInfoDlg = { |
|
5 |
data: { |
|
6 |
dictTypeId: "", |
|
7 |
code: "", |
|
8 |
name: "", |
|
9 |
parentId: "", |
|
10 |
status: "", |
|
11 |
description: "", |
|
12 |
createTime: "", |
|
13 |
updateTime: "", |
|
14 |
createUser: "", |
|
15 |
updateUser: "" |
|
16 |
} |
|
17 |
}; |
|
18 |
|
|
19 |
layui.use(['form', 'ax', 'admin'], function () { |
|
20 |
var $ = layui.jquery; |
|
21 |
var $ax = layui.ax; |
|
22 |
var form = layui.form; |
|
23 |
var admin = layui.admin; |
|
24 |
|
|
25 |
//获取详情信息,填充表单 |
|
26 |
var ajax = new $ax(Feng.ctxPath + "/dict/detail?dictId=" + Feng.getUrlParam("dictId")); |
|
27 |
var result = ajax.start(); |
|
28 |
form.val('dictForm', result.data); |
|
29 |
|
|
30 |
//表单提交事件 |
|
31 |
form.on('submit(btnSubmit)', function (data) { |
|
32 |
var ajax = new $ax(Feng.ctxPath + "/dict/editItem", function (data) { |
|
33 |
Feng.success("更新成功!"); |
|
34 |
|
|
35 |
//传给上个页面,刷新table用 |
|
36 |
admin.putTempData('formOk', true); |
|
37 |
|
|
38 |
//关掉对话框 |
|
39 |
admin.closeThisDialog(); |
|
40 |
|
|
41 |
}, function (data) { |
|
42 |
Feng.error("更新失败!" + data.responseJSON.message) |
|
43 |
}); |
|
44 |
ajax.set(data.field); |
|
45 |
ajax.start(); |
|
46 |
return false; |
|
47 |
}); |
|
48 |
|
|
49 |
//父级字典时 |
|
50 |
$('#parentName').click(function () { |
|
51 |
var formName = encodeURIComponent("parent.DictInfoDlg.data.parentName"); |
|
52 |
var formId = encodeURIComponent("parent.DictInfoDlg.data.parentId"); |
|
53 |
var treeUrl = encodeURIComponent("/dict/ztree?dictTypeId=" + $("#dictTypeId").val() + "&dictId=" + $("#dictId").val()); |
|
54 |
|
|
55 |
layer.open({ |
|
56 |
type: 2, |
|
57 |
title: '父级字典', |
|
58 |
area: ['300px', '400px'], |
|
59 |
content: Feng.ctxPath + '/system/commonTree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl, |
|
60 |
end: function () { |
|
61 |
$("#parentId").val(DictInfoDlg.data.parentId); |
|
62 |
$("#parentName").val(DictInfoDlg.data.parentName); |
|
63 |
} |
|
64 |
}); |
|
65 |
}); |
|
66 |
}); |