懒羊羊
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         $.ajax({
28             type: "POST",
29             contentType: "application/json;charset=UTF-8",
30             url: Feng.ctxPath + '/lineInfo/list',
31             success: function (result) {
32                 $('#lineCode').empty();
33                 $.each(result.data, function (index, value) {
34                     $('#lineCode').append(new Option(value.lineCode, value.lineCode));// 下拉菜单里添加元素
35                 });
36                 $('#lineCode').val($("#testlineCode").val());
37                 layui.form.render("select");//重新渲染 固定写法
38             },
39         });
40
41         $.ajax({
42             type: "POST",
43             contentType: "application/json;charset=UTF-8",
44             url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+ $('#testlineCode').val(),
45             success: function (result) {
46                 $('#locationCode').empty();
47                 $.each(result.data, function (index, value) {
48                     $('#locationCode').append(new Option(value.locationCode, value.locationCode));// 下拉菜单里添加元素
49                 });
50                 $('#locationCode').val($("#testlocationCode").val());
51                 layui.form.render("select");//重新渲染 固定写法
52             },
53         });
54     });
55
56     form.on("select", function (data) {
57         if (data.value !== "") {
58             if (data.elem.id === "lineCode") {
59                 $.ajax({
60                     type: "POST",
61                     contentType: "application/json;charset=UTF-8",
62                     url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+ $('#lineCode').val(),
63                     success: function (result) {
64                         $('#locationCode').empty();
65                         $.each(result.data, function (index, value) {
66                             $('#locationCode').append(new Option(value.locationCode, value.locationCode));// 下拉菜单里添加元素
67                         });
68                         $('#locationCode').val($("#testlocationCode").val());
69                         layui.form.render("select");//重新渲染 固定写法
70                     },
71                 });
72             }
73         }
74     });
75
76     // 表单提交事件
77     form.on('submit(btnSubmit)', function (data) {
78         if($('#locationCode').val() === null){
79             Feng.error("请选择工位")
80         }else {
81         let ajax = new $ax(Feng.ctxPath + "/badBoard/addKanBanConfItem", function (data) {
82             Feng.success("设置成功!");
83             //关掉对话框
84             admin.closeThisDialog();
85             window.parent.location.reload()
86         }, function (data) {
87             Feng.error("设置失败!" + data.responseJSON.message)
88         });
89         ajax.set(data.field);
90         ajax.start();
91         return false;
92         }
93     });
94 });