懒羊羊
2024-01-10 a556270e96bc6e7fa4202c466d57cc75f778c614
提交 | 用户 | 时间
71e81e 1 /**
2  * 添加或者修改页面
3  */
4 var KanbanConfInfoDlg = {
5     data: {
6         id: "",
7         pageCode: "",
8         ipAddress: "",
9         macAddress: "",
10         workshopCode: "",
11         workshopName: "",
12         lineCode: "",
13         lineName: "",
14         locationCode: "",
15         locationName: "",
16         warehouseCode: "",
17         warehouseName: ""
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     $(document).ready(function() {
27         console.log("$('#pageCode').val()---------  "+$('#pageCode').val());
28         $.ajax({
29             type: "POST",
30             contentType: "application/json;charset=UTF-8",
31             url: Feng.ctxPath + '/lineInfo/list',
32             success: function (result) {
33                 $('#lineCode').empty();
34                 $.each(result.data, function (index, value) {
35                     $('#lineCode').append(new Option(value.lineCode, value.lineCode));// 下拉菜单里添加元素
36                 });
37                 $('#lineCode').val($("#testlineCode").val());
38                 layui.form.render("select");//重新渲染 固定写法
39             },
40         });
41
42         $.ajax({
43             type: "POST",
44             contentType: "application/json;charset=UTF-8",
45             url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+ $('#testlineCode').val(),
46             success: function (result) {
47                 $('#locationCode').empty();
48                 $.each(result.data, function (index, value) {
49                     $('#locationCode').append(new Option(value.locationCode, value.locationCode));// 下拉菜单里添加元素
50                 });
51                 $('#locationCode').val($("#testlocationCode").val());
52                 layui.form.render("select");//重新渲染 固定写法
53             },
54         });
55     });
56
57     form.on("select", function (data) {
58         if (data.value !== "") {
59             if (data.elem.id === "lineCode") {
60                 $.ajax({
61                     type: "POST",
62                     contentType: "application/json;charset=UTF-8",
63                     url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+ $('#lineCode').val(),
64                     success: function (result) {
65                         $('#locationCode').empty();
66                         $.each(result.data, function (index, value) {
67                             $('#locationCode').append(new Option(value.locationCode, value.locationCode));// 下拉菜单里添加元素
68                         });
69                         $('#locationCode').val($("#testlocationCode").val());
70                         layui.form.render("select");//重新渲染 固定写法
71                     },
72                 });
73             }
74         }
75     });
76
77     // 表单提交事件
78     form.on('submit(btnSubmit)', function (data) {
79         if($('#locationCode').val() === null){
80             Feng.error("请选择工位")
81         }else {
82         let ajax = new $ax(Feng.ctxPath + "/lineFeedingView/addKanBanConfItem", function (data) {
83             Feng.success("设置成功!");
84             //关掉对话框
85             admin.closeThisDialog();
86             window.parent.location.reload()
87         }, function (data) {
88             Feng.error("设置失败!" + data.responseJSON.message)
89         });
90         ajax.set(data.field);
91         ajax.start();
92         return false;
93         }
94     });
95 });