懒羊羊
2023-11-14 abb175b29054b9708af27136c035b1b7351dcd20
提交 | 用户 | 时间
1ac2bc 1 /**
2  * 添加或者修改页面
3  */
4 var MaterialInfoInfoDlg = {
5     data: {
6         id: "",
7         materialCode: "",
8         materialName: "",
9         materialView: "",
10         typeZ: "",
11         typeL: "",
12         unit: "",
13         matterVersion: "",
14         remarks: "",
15         createUser: "",
16         createTime: "",
17         updateUser: "",
18         updateTime: "",
19         erpSpec: ""
20     }
21 };
22
23 layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
24     var $ = layui.jquery;
25     var $ax = layui.ax;
26     var form = layui.form;
27     var admin = layui.admin;
28
abb175 29     getDictType();
30     function getDictType(){
31         $.ajax({
32             type: "POST",
33             contentType: "application/json;charset=UTF-8",
34             url: Feng.ctxPath + '/dict/list?dictTypeId=1724238087352172546',
35             success: function (result) {
36                 $.each(result.data, function (index, value) {
37                     $('#typeL').append(new Option(value.name,value.code));// 下拉菜单里添加元素
38                 });
39                 layui.form.render("select");//重新渲染 固定写法
40             },
41         });
42     }
1ac2bc 43
44     //表单提交事件
45     form.on('submit(btnSubmit)', function (data) {
46         var ajax = new $ax(Feng.ctxPath + "/materialInfo/addItem", function (data) {
47             Feng.success("添加成功!");
48             window.location.href = Feng.ctxPath + '/materialInfo'
49         }, function (data) {
50             Feng.error("添加失败!" + data.responseJSON.message)
51         });
52         ajax.set(data.field);
53         ajax.start();
54
55         return false;
56     });
57
58     $('#cancel').click(function(){
59         window.location.href = Feng.ctxPath + '/materialInfo'
60     });
61
62 });