懒羊羊
2023-08-30 1ac2bc1590406d9babec036e154d8d08f34a6aa1
提交 | 用户 | 时间
1ac2bc 1 /**
2  * 添加或者修改页面
3  */
4 var LineInfoInfoDlg = {
5     data: {
6         id: "",
7         lineCode: "",
8         lineName: "",
9         workshopCode: "",
10         workCalendar: "",
11         spareField1: "",
12         spareField2: "",
13         remarks: "",
14         createUser: "",
15         createTime: "",
16         updateUser: "",
17         updateTime: ""
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
26     $.ajax({
27         type: "POST",
28         contentType: "application/json;charset=UTF-8",
29         url: Feng.ctxPath + '/workshopInfo/list',
30         success: function (result) {
31             $.each(result.data, function (index, value) {
32                 $('#workshopCode').append(new Option(value.workshopCode));// 下拉菜单里添加元素
33             });
34             layui.form.render("select");//重新渲染 固定写法
35         },
36     });
37
38     //表单提交事件
39     form.on('submit(btnSubmit)', function (data) {
40         var ajax = new $ax(Feng.ctxPath + "/lineInfo/addItem", function (data) {
41             Feng.success("添加成功!");
42             window.location.href = Feng.ctxPath + '/lineInfo'
43         }, function (data) {
44             Feng.error("添加失败!" + data.responseJSON.message)
45         });
46         ajax.set(data.field);
47         ajax.start();
48
49         return false;
50     });
51
52     $('#cancel').click(function(){
53         window.location.href = Feng.ctxPath + '/lineInfo'
54     });
55
56 });