提交 | 用户 | 时间
|
1ac2bc
|
1 |
/** |
懒 |
2 |
* 详情对话框 |
|
3 |
*/ |
|
4 |
var ProductBomChildInfoInfoDlg = { |
|
5 |
data: { |
|
6 |
id: "", |
|
7 |
opCode: "", |
|
8 |
opName: "", |
|
9 |
materialCode: "", |
|
10 |
materialName: "", |
|
11 |
costQty: "", |
|
12 |
unit: "", |
|
13 |
spareField1: "", |
|
14 |
spareField2: "", |
|
15 |
spareField3: "", |
|
16 |
remark: "", |
|
17 |
bomCode: "" |
|
18 |
} |
|
19 |
}; |
|
20 |
|
|
21 |
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () { |
|
22 |
var $ = layui.jquery; |
|
23 |
var $ax = layui.ax; |
|
24 |
var form = layui.form; |
|
25 |
var admin = layui.admin; |
|
26 |
|
|
27 |
//获取详情信息,填充表单 |
|
28 |
var ajax = new $ax(Feng.ctxPath + "/productBomChildInfo/detail?id=" + Feng.getUrlParam("id")); |
|
29 |
var result1 = ajax.start(); |
|
30 |
form.val('productBomChildInfoForm', result1.data); |
|
31 |
|
|
32 |
getOpList(); |
|
33 |
function getOpList(){ |
|
34 |
$.ajax({ |
|
35 |
type: "POST", |
|
36 |
contentType: "application/json;charset=UTF-8", |
|
37 |
url: Feng.ctxPath + '/opInfo/list?status=ENABLE', |
|
38 |
success: function (result) { |
|
39 |
$.each(result.data, function (index, value) { |
|
40 |
$('#opCode').append(new Option(value.opCode));// 下拉菜单里添加元素 |
|
41 |
}); |
|
42 |
console.log(result) |
|
43 |
$('#opCode').val(result1.data.opCode); |
|
44 |
layui.form.render("select");//重新渲染 固定写法 |
|
45 |
}, |
|
46 |
}); |
|
47 |
} |
|
48 |
|
|
49 |
// $('#materialCode').click(function (){ |
|
50 |
// layer.open({ |
|
51 |
// type: 2, |
|
52 |
// area: ['1000px', '600px'], |
|
53 |
// // title: '设备列表', |
|
54 |
// content: Feng.ctxPath + '/materialInfo/materialInfoListOpen', |
|
55 |
// end: function () { |
|
56 |
// let msg = JSON.parse(window.localStorage.getItem('message')); |
|
57 |
// $('#materialCode').val(msg.materialCode); |
|
58 |
// $('#materialName').val(msg.materialName); |
|
59 |
// $('#unit').val(msg.unit); |
|
60 |
// console.log(msg); |
|
61 |
// } |
|
62 |
// }); |
|
63 |
// }); |
|
64 |
|
|
65 |
//表单提交事件 |
|
66 |
form.on('submit(btnSubmit)', function (data) { |
|
67 |
var ajax = new $ax(Feng.ctxPath + "/productBomChildInfo/editItem", function (data) { |
|
68 |
Feng.success("更新成功!"); |
|
69 |
// window.location.href = Feng.ctxPath + '/productBomChildInfo' |
|
70 |
//传给上个页面,刷新table用 |
|
71 |
admin.putTempData('formOk', true); |
|
72 |
//关掉对话框 |
|
73 |
admin.closeThisDialog(); |
|
74 |
}, function (data) { |
|
75 |
Feng.error("更新失败!" + data.responseJSON.message) |
|
76 |
}); |
|
77 |
ajax.set(data.field); |
|
78 |
ajax.start(); |
|
79 |
|
|
80 |
return false; |
|
81 |
}); |
|
82 |
|
|
83 |
$('#cancel').click(function(){ |
|
84 |
// window.location.href = Feng.ctxPath + '/productBomChildInfo' |
|
85 |
admin.closeThisDialog(); |
|
86 |
}); |
|
87 |
}); |