懒羊羊
2023-11-14 036dcdcec6235d82b008f5c736d27a0d1f90d4a2
提交 | 用户 | 时间
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
29     //获取详情信息,填充表单
30     var ajax = new $ax(Feng.ctxPath + "/materialInfo/detail?id=" + Feng.getUrlParam("id"));
abb175 31     var result1 = ajax.start();
32     form.val('materialInfoForm', result1.data);
33
34     getDictType();
35     function getDictType(){
36         $.ajax({
37             type: "POST",
38             contentType: "application/json;charset=UTF-8",
39             url: Feng.ctxPath + '/dict/list?dictTypeId=1724238087352172546',
40             success: function (result) {
41                 $.each(result.data, function (index, value) {
42                     $('#typeL').append(new Option(value.name,value.code));// 下拉菜单里添加元素
43                 });
44                 $('#typeL').val(result1.data.typeL)
45                 layui.form.render("select");//重新渲染 固定写法
46             },
47         });
48     }
49
50
1ac2bc 51
52     //表单提交事件
53     form.on('submit(btnSubmit)', function (data) {
54         var ajax = new $ax(Feng.ctxPath + "/materialInfo/editItem", function (data) {
55             Feng.success("更新成功!");
56             window.location.href = Feng.ctxPath + '/materialInfo'
57         }, function (data) {
58             Feng.error("更新失败!" + data.responseJSON.message)
59         });
60         ajax.set(data.field);
61         ajax.start();
62
63         return false;
64     });
65
66     $('#cancel').click(function(){
67         window.location.href = Feng.ctxPath + '/materialInfo'
68     });
69 });