提交 | 用户 | 时间
|
1ac2bc
|
1 |
/** |
懒 |
2 |
* 详情对话框 |
|
3 |
*/ |
|
4 |
var CodingRuleInfoDlg = { |
|
5 |
data: { |
|
6 |
id: "", |
|
7 |
codingRuleCode: "", |
|
8 |
codingRuleDesc: "", |
|
9 |
codingRulePrefix: "", |
|
10 |
enableDate: "", |
|
11 |
dateType: "", |
|
12 |
currentCode: "", |
|
13 |
codeLength: "", |
|
14 |
spareField1: "", |
|
15 |
spareField2: "", |
|
16 |
remark: "", |
|
17 |
createUser: "", |
|
18 |
createTime: "", |
|
19 |
updateUser: "", |
|
20 |
updateTime: "" |
|
21 |
} |
|
22 |
}; |
|
23 |
|
|
24 |
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () { |
|
25 |
var $ = layui.jquery; |
|
26 |
var $ax = layui.ax; |
|
27 |
var form = layui.form; |
|
28 |
var admin = layui.admin; |
|
29 |
|
|
30 |
//获取详情信息,填充表单 |
|
31 |
var ajax = new $ax(Feng.ctxPath + "/codingRule/detail?id=" + Feng.getUrlParam("id")); |
|
32 |
var result1 = ajax.start(); |
|
33 |
form.val('codingRuleForm', result1.data); |
|
34 |
$('#enableDate').val(result1.data.enableDate); |
|
35 |
getDictType(); |
|
36 |
|
|
37 |
|
|
38 |
// 监听select的change事件 |
|
39 |
form.on('select', function(data){ |
|
40 |
if (data.elem.id === 'enableDate') { |
|
41 |
if (data.value === '0') { |
|
42 |
$('#dateType').prop('disabled', true); |
|
43 |
var selectElem = layui.$('#dateType'); // 获取select元素 |
|
44 |
selectElem.empty(); // 清空select中的 |
|
45 |
$('#dateType').append(new Option(""));// 下拉菜单里添加元素 |
|
46 |
getDictType(); |
|
47 |
} else { |
|
48 |
$('#dateType').prop('disabled', false); |
|
49 |
} |
|
50 |
form.render('select'); |
|
51 |
} |
|
52 |
}); |
|
53 |
|
|
54 |
function getDictType(){ |
|
55 |
$.ajax({ |
|
56 |
type: "POST", |
|
57 |
contentType: "application/json;charset=UTF-8", |
|
58 |
url: Feng.ctxPath + '/dict/list?dictTypeId=1694171602147848194', |
|
59 |
success: function (result) { |
|
60 |
$.each(result.data, function (index, value) { |
|
61 |
$('#dateType').append(new Option(value.code));// 下拉菜单里添加元素 |
|
62 |
}); |
|
63 |
$('#dateType').val(result1.data.dateType); |
|
64 |
layui.form.render("select");//重新渲染 固定写法 |
|
65 |
}, |
|
66 |
}); |
|
67 |
} |
|
68 |
//表单提交事件 |
|
69 |
form.on('submit(btnSubmit)', function (data) { |
|
70 |
var ajax = new $ax(Feng.ctxPath + "/codingRule/editItem", function (data) { |
|
71 |
Feng.success("更新成功!"); |
|
72 |
window.location.href = Feng.ctxPath + '/codingRule' |
|
73 |
}, function (data) { |
|
74 |
Feng.error("更新失败!" + data.responseJSON.message) |
|
75 |
}); |
|
76 |
ajax.set(data.field); |
|
77 |
ajax.start(); |
|
78 |
|
|
79 |
return false; |
|
80 |
}); |
|
81 |
|
|
82 |
$('#cancel').click(function(){ |
|
83 |
window.location.href = Feng.ctxPath + '/codingRule' |
|
84 |
}); |
|
85 |
}); |