yantian yue
2023-10-17 487b2f2a353b89ab46cd9b784226b600b7b915b8
提交 | 用户 | 时间
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     getDictType();
26     getOpList();
27
28     function getOpList(){
29         $.ajax({
30             type: "POST",
31             contentType: "application/json;charset=UTF-8",
32             url: Feng.ctxPath + '/opInfo/list?status=ENABLE',
33             success: function (result) {
34                 $.each(result.data, function (index, value) {
35                     $('#opCode').append(new Option(value.opCode));// 下拉菜单里添加元素
36                 });
37                 console.log(result)
38                 layui.form.render("select");//重新渲染 固定写法
39             },
40         });
41     }
42
43     function getDictType(){
44         $.ajax({
45             type: "POST",
46             contentType: "application/json;charset=UTF-8",
47             url: Feng.ctxPath + '/dict/list?dictTypeId=1694972441967951874',
48             success: function (result) {
49                 $.each(result.data, function (index, value) {
50                     // $('#opType').append(new Option(value.code,value.name));// 下拉菜单里添加元素
51                     $('#opType').append(new Option(value.name,value.code));// 下拉菜单里添加元素
52                 });
53                 layui.form.render("select");//重新渲染 固定写法
54             },
55         });
56     }
57
58     //表单提交事件
59     form.on('submit(btnSubmit)', function (data) {
60         var ajax = new $ax(Feng.ctxPath + "/productRouteChildInfo/addItem", function (data) {
61             Feng.success("添加成功!");
62             admin.putTempData('formOk', true);
63             admin.closeThisDialog();
64             // window.location.href = Feng.ctxPath + '/productRouteChildInfo'
65         }, function (data) {
66             Feng.error("添加失败!" + data.responseJSON.message)
67         });
68         ajax.set(data.field);
69         ajax.start();
70
71         return false;
72     });
73
74     $('#cancel').click(function(){
75         admin.closeThisDialog();
76         // window.location.href = Feng.ctxPath + '/productRouteChildInfo'
77     });
78
79 });