懒羊羊
2024-01-10 1b72fc0dd1d7004de54ab0886e0323cb1b96198d
提交 | 用户 | 时间
71e81e 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     var admin = layui.admin;
26
27     $(document).ready(function () {
28         $.ajax({
29             type: "POST",
30             contentType: "application/json;charset=UTF-8",
31             url: Feng.ctxPath + '/workshopInfo/list',
32             success: function (result) {
33                 $.each(result.data, function (index, value) {
34                     $('#workshopCode').append(new Option(value.workshopCode));// 下拉菜单里添加元素
35                 });
36                 layui.form.render("select");//重新渲染 固定写法
37             },
38         });
39     });
40
41     //表单提交事件
42     form.on('submit(btnSubmit)', function (data) {
43         var ajax = new $ax(Feng.ctxPath + "/lineInfo/addItem", function (data) {
44             Feng.success("添加成功!");
45             window.location.href = Feng.ctxPath + '/lineInfo'
46         }, function (data) {
47             Feng.error("添加失败!" + data.responseJSON.message)
48         });
49         ajax.set(data.field);
50         ajax.start();
51
52         return false;
53     });
54
55     $('#cancel').click(function(){
56         window.location.href = Feng.ctxPath + '/lineInfo'
57     });
58
59 });