提交 | 用户 | 时间
|
1ac2bc
|
1 |
/** |
懒 |
2 |
* 添加或者修改页面 |
|
3 |
*/ |
|
4 |
var OpInfoInfoDlg = { |
|
5 |
data: { |
|
6 |
id: "", |
|
7 |
opCode: "", |
|
8 |
opName: "", |
|
9 |
lineCode: "", |
|
10 |
opType: "", |
|
11 |
status: "", |
|
12 |
spareField1: "", |
|
13 |
spareField2: "", |
|
14 |
remark: "", |
|
15 |
createUser: "", |
|
16 |
createTime: "", |
|
17 |
updateUser: "", |
|
18 |
updateTime: "" |
|
19 |
} |
|
20 |
}; |
|
21 |
|
|
22 |
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () { |
|
23 |
var $ = layui.jquery; |
|
24 |
var $ax = layui.ax; |
|
25 |
var form = layui.form; |
|
26 |
var admin = layui.admin; |
|
27 |
getDictType(); |
|
28 |
|
|
29 |
$.ajax({ |
|
30 |
type: "POST", |
|
31 |
contentType: "application/json;charset=UTF-8", |
|
32 |
url: Feng.ctxPath + '/lineInfo/list', |
|
33 |
success: function (result) { |
|
34 |
$.each(result.data, function (index, value) { |
|
35 |
$('#lineCode').append(new Option(value.lineCode));// 下拉菜单里添加元素 |
|
36 |
}); |
|
37 |
layui.form.render("select");//重新渲染 固定写法 |
|
38 |
}, |
|
39 |
}); |
|
40 |
|
|
41 |
function getDictType(){ |
|
42 |
$.ajax({ |
|
43 |
type: "POST", |
|
44 |
contentType: "application/json;charset=UTF-8", |
|
45 |
url: Feng.ctxPath + '/dict/list?dictTypeId=1694972441967951874', |
|
46 |
success: function (result) { |
|
47 |
$.each(result.data, function (index, value) { |
|
48 |
// $('#opType').append(new Option(value.code,value.name));// 下拉菜单里添加元素 |
|
49 |
$('#opType').append(new Option(value.name,value.code));// 下拉菜单里添加元素 |
|
50 |
}); |
|
51 |
layui.form.render("select");//重新渲染 固定写法 |
|
52 |
}, |
|
53 |
}); |
|
54 |
} |
|
55 |
|
|
56 |
//表单提交事件 |
|
57 |
form.on('submit(btnSubmit)', function (data) { |
|
58 |
var ajax = new $ax(Feng.ctxPath + "/opInfo/addItem", function (data) { |
|
59 |
Feng.success("添加成功!"); |
|
60 |
window.location.href = Feng.ctxPath + '/opInfo' |
|
61 |
}, function (data) { |
|
62 |
Feng.error("添加失败!" + data.responseJSON.message) |
|
63 |
}); |
|
64 |
ajax.set(data.field); |
|
65 |
ajax.start(); |
|
66 |
|
|
67 |
return false; |
|
68 |
}); |
|
69 |
|
|
70 |
$('#cancel').click(function(){ |
|
71 |
window.location.href = Feng.ctxPath + '/opInfo' |
|
72 |
}); |
|
73 |
|
|
74 |
}); |