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