yantian yue
2023-10-23 0d7d6a88080dc8759ef84ed5ad7875f25642df6c
提交 | 用户 | 时间
1ac2bc 1 /**
2  * 详情对话框
3  */
4 var OpInfoInfoDlg = {
5     data: {
6         id: "",
7         opCode: "",
8         opName: "",
9         lineCode: "",
10         opType: "",
11         status: "",
12         spareField1: "",
13         spareField2: "",
14         remark: "",
15         createUser: "",
16         createTime: "",
17         updateUser: "",
18         updateTime: ""
19     }
20 };
21
22 layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
23     var $ = layui.jquery;
24     var $ax = layui.ax;
25     var form = layui.form;
26     var admin = layui.admin;
27
28
29     //获取详情信息,填充表单
30     var ajax = new $ax(Feng.ctxPath + "/opInfo/detail?id=" + Feng.getUrlParam("id"));
31     var result1 = ajax.start();
32     form.val('opInfoForm', result1.data);
33     getDictType();
34     function getDictType(){
35         $.ajax({
36             type: "POST",
37             contentType: "application/json;charset=UTF-8",
38             url: Feng.ctxPath + '/dict/list?dictTypeId=1694972441967951874',
39             success: function (result) {
40                 $.each(result.data, function (index, value) {
41                     $('#opType').append(new Option(value.name,value.code));// 下拉菜单里添加元素
42                 });
43                 $('#opType').val(result1.data.opType)
44                 layui.form.render("select");//重新渲染 固定写法
45             },
46         });
47     }
48
49     $.ajax({
50         type: "POST",
51         contentType: "application/json;charset=UTF-8",
52         url: Feng.ctxPath + '/lineInfo/list',
53         success: function (result) {
54             $.each(result.data, function (index, value) {
55                 $('#lineCode').append(new Option(value.lineCode));// 下拉菜单里添加元素
56             });
57             $('#lineCode').val(result1.data.lineCode);
58             layui.form.render("select");//重新渲染 固定写法
59         },
60     });
61     //表单提交事件
62     form.on('submit(btnSubmit)', function (data) {
63         var ajax = new $ax(Feng.ctxPath + "/opInfo/editItem", function (data) {
64             Feng.success("更新成功!");
65             window.location.href = Feng.ctxPath + '/opInfo'
66         }, function (data) {
67             Feng.error("更新失败!" + data.responseJSON.message)
68         });
69         ajax.set(data.field);
70         ajax.start();
71
72         return false;
73     });
74
75     $('#cancel').click(function(){
76         window.location.href = Feng.ctxPath + '/opInfo'
77     });
78 });