懒羊羊
2023-11-14 abb175b29054b9708af27136c035b1b7351dcd20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
 
    //获取信息
    var ajax = new $ax(Feng.ctxPath + "/salesOrder/list?id=" + Feng.getUrlParam("id"));
    var result = ajax.start();
    let productCode = result.data[0].productCode;
 
    $.ajax({
        type: "POST",
        contentType: "application/json;charset=UTF-8",
        url: Feng.ctxPath + '/productBomInfo/list?productCode='+productCode,
        success: function (result) {
            console.log(result.data)
            $.each(result.data, function (index, value) {
                $('#bomCode').append(new Option(value.bomName,value.bomCode));// 下拉菜单里添加元素
            });
            layui.form.render("select");//重新渲染 固定写法
        },
    });
 
    $.ajax({
        type: "POST",
        contentType: "application/json;charset=UTF-8",
        url: Feng.ctxPath + '/productRouteInfo/list?productCode='+productCode,
        success: function (result) {
            console.log(result.data)
            $.each(result.data, function (index, value) {
                $('#routeCode').append(new Option(value.routeName,value.routeCode));// 下拉菜单里添加元素
            });
            layui.form.render("select");//重新渲染 固定写法
        },
    });
 
    $('#cancel').click(function(){
        window.location.href = Feng.ctxPath + '/salesOrder'
    });
 
    $('#btnSubmit').click(function(){
        var ajax = new $ax(Feng.ctxPath + "/salesOrder/DistributeSalesOrder", function (data) {
        }, function (data) {
            Feng.error("更新失败!" + data.responseJSON.message)
        });
        ajax.set('id',Feng.getUrlParam("id"));
        ajax.set('routeCode',$('#routeCode').val());
        ajax.set('recipeCode',$('#recipeCode').val());
        ajax.set('bomCode',$('#bomCode').val());
        ajax.start();
        Feng.success("下发完成")
        window.location.href = Feng.ctxPath + '/salesOrder'
        return false;
    });
 
    //表单提交事件
    // form.on('submit(btnSubmit)', function (data) {
    //     var ajax = new $ax(Feng.ctxPath + "/salesOrder/DistributeSalesOrder", function (data) {
    //         Feng.success("下发完成")
    //         window.location.href = Feng.ctxPath + '/salesOrder'
    //     }, function (data) {
    //         Feng.error("添加失败!" + data.responseJSON.message)
    //     });
    //     ajax.set('id',Feng.getUrlParam("id"));
    //     ajax.set('routeCode',$('#routeCode').val());
    //     ajax.set('recipeCode',$('#recipeCode').val());
    //     ajax.set('bomCode',$('#bomCode').val());
    //     ajax.start();
    //     return false;
    // });
 
});