懒羊羊
2023-11-14 8286c62256f23bc2367a6729c0f46f84215e380b
提交 | 用户 | 时间
8286c6 1 /**
2  * 添加或者修改页面
3  */
4 var ProductionOrderBatchInfoInfoDlg = {
5     data: {
6         id: "",
7         workOrderNo: "",
8         productionLine: "",
9         locationCode: "",
10         state: "",
11         spareField1: "",
12         spareField2: "",
13         createUser: "",
14         updateUser: "",
15         createTime: "",
16         updateTime: ""
17     }
18 };
19
20 layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
21     var $ = layui.jquery;
22     var $ax = layui.ax;
23     var form = layui.form;
24     var admin = layui.admin;
25
26     $.ajax({
27         type: "POST",
28         contentType: "application/json;charset=UTF-8",
29         url: Feng.ctxPath + '/lineInfo/list',
30         success: function (result) {
31             $.each(result.data, function (index, value) {
32                 $('#productionLine').append(new Option(value.lineCode));// 下拉菜单里添加元素
33             });
34             layui.form.render("select");//重新渲染 固定写法
35         },
36     });
37
38     form.on('select(productionLine)', function (data) {
39         console.log("11111");
40         $.ajax({
41             type: "POST",
42             contentType: "application/json;charset=UTF-8",
43             url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+data.value,
44             success: function (result) {
45                 $('#locationCode').empty();
46                 $('#locationCode').append(new Option("请选择工位", ""));// 下拉菜单里添加元素
47
48                 $.each(result.data, function (index, value) {
49                     $('#locationCode').append(new Option(value.locationCode));// 下拉菜单里添加元素
50                 });
51                 layui.form.render("select");//重新渲染 固定写法
52             },
53         });
54     });
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74         //表单提交事件
75     form.on('submit(btnSubmit)', function (data) {
76         var ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/addItem", function (data) {
77             Feng.success("添加成功!");
78             window.location.href = Feng.ctxPath + '/productionOrderBatchInfo'
79         }, function (data) {
80             Feng.error("添加失败!" + data.responseJSON.message)
81         });
82         ajax.set(data.field);
83         ajax.start();
84
85         return false;
86     });
87
88     $('#cancel').click(function(){
89         window.location.href = Feng.ctxPath + '/productionOrderBatchInfo'
90     });
91
92 });