懒羊羊
2023-11-14 abb175b29054b9708af27136c035b1b7351dcd20
提交 | 用户 | 时间
1ac2bc 1 /**
2  * 添加或者修改页面
3  */
4 var SalesOrderInfoDlg = {
5     data: {
6         id: "",
7         salesOrderCode: "",
8         customerNo: "",
9         cargoNo: "",
10         productCode: "",
11         productName: "",
12         planNumber: "",
13         planStartTime: "",
14         planEndTime: "",
15         workshopCode: "",
16         lineCode: "",
17         deliveryTime: "",
18         state: "",
19         orderSource: "",
20         spareField1: "",
21         spareField2: "",
22         spareField3: "",
23         createUser: "",
24         createTime: "",
25         updateUser: "",
26         updateTime: "",
27         remark: ""
28     }
29 };
30
31 layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
32     var $ = layui.jquery;
33     var $ax = layui.ax;
34     var form = layui.form;
35     var admin = layui.admin;
36     var laydate = layui.laydate;
37
38     //初始化时间选择器
39     laydate.render({
40         elem: '#planStartTime',
abb175 41         // type: 'datetime'
1ac2bc 42     });
43     //初始化时间选择器
44     laydate.render({
45         elem: '#planEndTime',
abb175 46         // type: 'datetime'
1ac2bc 47     });
48     //初始化时间选择器
49     laydate.render({
50         elem: '#deliveryTime',
abb175 51         // type: 'datetime'
1ac2bc 52     });
53     $(document).ready(function () {
54         $.ajax({
55             type: "POST",
56             contentType: "application/json;charset=UTF-8",
57             url: Feng.ctxPath + '/lineInfo/list',
58             success: function (result) {
59                 $.each(result.data, function (index, value) {
60                     $('#lineCode').append(new Option(value.lineCode));// 下拉菜单里添加元素
61                 });
62                 layui.form.render("select");//重新渲染 固定写法
63             },
64         });
65     });
66
abb175 67     $('#productCode').click(function () {
68         layer.open({
69             type: 2,
70             area: ['1000px', '600px'],
71             title: '物料信息',
72             content: Feng.ctxPath + '/workOrder/productListing',
73             success: function (layero, index) {
74                 window.materialType = 'PRODUCE';
75             },
76             end: function () {
77                 let msg = JSON.parse(window.localStorage.getItem('message'));
78                 $('#productCode').val(msg.materialCode);
79                 $('#productName').val(msg.materialName);
80             }
81         });
82     });
1ac2bc 83
84     //表单提交事件
85     form.on('submit(btnSubmit)', function (data) {
86         var ajax = new $ax(Feng.ctxPath + "/salesOrder/addItem", function (data) {
87             Feng.success("添加成功!");
88             window.location.href = Feng.ctxPath + '/salesOrder'
89         }, function (data) {
90             Feng.error("添加失败!" + data.responseJSON.message)
91         });
92         ajax.set(data.field);
93         ajax.start();
94
95         return false;
96     });
97
98     $('#cancel').click(function(){
99         window.location.href = Feng.ctxPath + '/salesOrder'
100     });
101
102 });