admin
2024-01-10 7f291910791bdb9a545dc12ef36c3c359cfa4e59
提交 | 用户 | 时间
71e81e 1 /**
2  * 详情对话框
3  */
4 var BomInfoInfoDlg = {
5     data: {
6         id: "",
7         materialCode: "",
8         materialName: "",
9         productCode: "",
10         productName: "",
11         locationCode: "",
12         locationName: "",
13         loadingCode: "",
14         loadingName: "",
15         traceabilityType: "",
16         quantity: "",
17         remarks: ""
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     $('#materialCode').click(function () {
29         layer.open({
30             type: 2,
31             area: ['1000px', '600px'],
32             title: '物料信息',
33             content: Feng.ctxPath + '/productionOrdeInfo/materialLists',
34             end: function () {
35                 let msg = JSON.parse(window.localStorage.getItem('message'));
36                 console.log(msg)
37                 if(msg !== null){
38                     $('#materialCode').val(msg.materialCode);
39                     $('#materialName').val(msg.materialName);
40                 }
41             }
42         });
43     });
44
45     $('#productCode').click(function () {
46         layer.open({
47             type: 2,
48             area: ['1000px', '600px'],
49             title: '物料信息',
50             content: Feng.ctxPath + '/productionOrdeInfo/materialList',
51             success: function (layero, index) {
52                 window.materialType = '成品';
53             },
54             end: function () {
55                 let msg = JSON.parse(window.localStorage.getItem('message'));
56                 console.log(msg)
57                 if(msg !== null){
58                     $('#productCode').val(msg.materialCode);
59                     $('#productName').val(msg.materialName);
60                 }
61             }
62         });
63     });
64
65     //获取详情信息,填充表单
66     var ajax = new $ax(Feng.ctxPath + "/bomInfo/detail?id=" + Feng.getUrlParam("id"));
67     var result = ajax.start();
68     form.val('bomInfoForm', result.data);
69
70     //表单提交事件
71     form.on('submit(btnSubmit)', function (data) {
72         var ajax = new $ax(Feng.ctxPath + "/bomInfo/editItem", function (data) {
73             Feng.success("更新成功!");
74             window.location.href = Feng.ctxPath + '/bomInfo'
75         }, function (data) {
76             Feng.error("更新失败!" + data.responseJSON.message)
77         });
78         ajax.set(data.field);
79         ajax.start();
80
81         return false;
82     });
83
84     $('#cancel').click(function(){
85         window.location.href = Feng.ctxPath + '/bomInfo'
86     });
87 });