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