wxw
2025-05-12 c7c2f7aa20427204944ba80a2704232b2f281582
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>添加入库单</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport"
            content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
        <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    </head>
    <body>
        <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list"
            style="padding: 20px 30px 0 0;">
            <div class="layui-form-item">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <table id="LAY-app-content-list" name="LAY-app-content-list" lay-filter="LAY-app-content-list">
                        </table>
                        <script type="text/html" id="table-content-list">
                            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="get"> <i
                                    class="layui-icon layui-icon-search"></i>详情</a>
                        </script>
                    </div>
                </div>
            </div>
        </div>
 
        <script src="../../../layuiadmin/layui/layui.js"></script>
        <script src="../../../js/public.js"></script>
        <script src="../../../js/jquery-3.5.1.min.js"></script>
        <script src="../../../js/jquery.cookie.js"></script>
        <script>
            layui.config({
                base: '../../../layuiadmin/' //静态资源所在路径
            }).extend({
                index: 'lib/index' //主入口模块
            }).use(['index', 'form', 'layer', 'laydate', 'table'], function() {
                var $ = layui.$,
                    form = layui.form,
                    laydate = layui.laydate,
                    table = layui.table,
                    layer = layui.layer;
                var pCode = getQueryString('pCode');
                var stockCodeId = getQueryString('id')
 
                function refreshTable() {
                    var param = {
                        msg: pCode,
                        id: stockCodeId,
                        status: 0
                    };
                    sendData(IP + "/Stock/GetStockInfoList", param, 'post', function(res) {
                        console.log(res);
                        if (res.code == 1) { //成功
                            var list = res.data;
                            $.extend(infoOptions, {
                                data: list
                            });
                            infoOptions.page = {
                                curr: 1
                            }
                            tableIns = table.render(infoOptions);
                        } else { //不成功
                            layer.msg(res.msg, {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {});
                        }
                    });
                }
                var infoOptions = {
                    elem: '#LAY-app-content-list',
                    height: 'full-80',
                    id: 'LAY-app-content-list',
                    page: true,
                    limit: pageCnt,
                    limits: pageLimits,
                    cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
                    cols: [
                        [{
                            field: 'ParentCode',
                            title: '托盘条码',
                            align: 'center',
                        }, {
                            field: 'BoxCode',
                            title: '箱码',
                            align: 'center',
                        }, {
                            field: 'Qty',
                            title: '箱内数量',
                            align: 'center',
                        }, {
                            field: 'aaa',
                            title: '操作',
                            align: 'center',
                            templet: '#table-content-list',
                            width: 80,
                        }]
                    ],
                };
                var tableIns;
                refreshTable();
                var $ = layui.$;
                $('.layui-btn.layuiadmin-btn-list').on('click', function() {
                    var type = $(this).data('type');
                    active[type] ? active[type].call(this) : '';
                });
                var ImportId = 0;
                table.on('tool(LAY-app-content-list)', function(obj) {
                    var data = obj.data;
                    if (obj.event === 'get') {
                        layer.open({
                            type: 2,
                            title: '库存详情',
                            content: 'StockInfoForm.html?pCode=' + data.BoxCode + '&id=' + stockCodeId,
                            maxmin: true,
                            area: ['800px', '750px'],
                            btn: ['确定', '取消'],
                            yes: function(index, layero) {
                                var iframeWindow = window['layui-layer-iframe' + index],
                                    submitID = 'layuiadmin-app-form-submit',
                                    submit = layero.find('iframe').contents().find('#' + submitID);
                                //监听提交
                                iframeWindow.layui.form.on('submit(' + submitID + ')', function(
                                data) {
                                    var field = data.field; //获取提交的字段
                                    console.log(field);
                                    //提交 Ajax 成功后,静态更新表格中的数据
                                    var param = {
                                        Id: 0,
                                        BillTypeCode: field.BillTypeCode,
                                        BillTypeName: field.BillTypeName,
                                        BillTypeType: field.BillTypeType,
                                        BillTypeRemark: field.BillTypeRemark
                                    };
                                    sendData(IP + "/Interface/AddBillType", param, 'post',
                                        function(res) {
                                            console.log(res);
                                            if (res.code == 1) { //成功
                                                layer.msg(res.msg, {
                                                    icon: 1,
                                                    time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                                }, function() {
                                                    refreshTable($("#Msg")
                                                .val());
                                                    // table.reload('LAY-app-content-list'); //数据刷新
                                                    layer.close(index); //关闭弹层
                                                });
                                            } else { //不成功
                                                layer.msg(res.msg, {
                                                    icon: 2,
                                                    time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                                }, function() {});
                                            }
                                        });
                                    //$.ajax({});
                                });
                                submit.trigger('click');
                            }
                        });
                    }
                });
                //获取浏览器参数
                function getQueryString(name) {
                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                    var r = window.location.search.substr(1).match(reg);
                    if (r != null) return unescape(r[2]);
                    return null;
                }
 
            })
        </script>
    </body>
</html>