bklLiudl
2025-04-02 1bbbbc8bb49411b544626996a1370788142300e0
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
<!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-fluid">
            <div class="layui-card">
                <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">关键字</label>
                            <div class="layui-input-inline">
                                <input type="text" id="Msg" name="Msg" placeholder="物品名称/编码/规格" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                            </button>
                            <button class="layui-btn layuiadmin-btn-list" data-type="setParent">确定</button>
                        </div>
                    </div>
                </div>
                <div class="layui-card-body">
                    <table id="goods-list" lay-filter="goods-list"></table>
                </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>
            layui.config({
                base: '../../layuiadmin/' //静态资源所在路径
            }).extend({
                index: 'lib/index' //主入口模块
            }).use(['index', 'table', 'laypage', 'layer'], function() {
                var table = layui.table,
                    form = layui.form,
                    laypage = layui.laypage,
                    index1 = parent.layer.getFrameIndex(window.name),
                    layer = layui.layer;
                refreshTable("");
                var active = {
                  setParent: function(){
                    var checkStatus = table.checkStatus('goods-list');   
                    var id = '#LAY-app-content-list'
                    ,goods = $('#goods-list');
                    if(checkStatus.data.length == 0){
                      parent.layer.msg('请选择待入库的物品!');
                      return true;
                    }
                    window.parent.success(checkStatus.data);
                    parent.layer.close(index1);
                  }
                };
                $('.layui-inline .layui-btn').on('click', function(){
                  var othis = $(this)
                  ,type = othis.data('type');
                  active[type] && active[type].call(this);
                });
                
                
                var tableIns;
                function refreshTable(msg) {
                    var param = {
                        msg: msg,
                    };
                    sendData(IP + "/Import/GetGoodsList", param, 'post', function(res) {
                        if (res.code == 1) { //成功
                            var list = res.data;
                            $.extend(infoOptions, {
                                data: list
                            });
                            infoOptions.page = {
                                curr: 1
                            }
                            tableIns = table.render(infoOptions);
                        } else { //不成功
                            layer.msg('获取物品信息失败!', {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function() {});
                        }
                    });
        
                }
                // table.reload()
                // 表单需要的变量
                var infoOptions = {
                    elem: '#goods-list',
                    height: 'full-100',
                    id: 'goods-list',
                    page: true,
                    limit: pageCnt,
                    limits: pageLimits,
                    cellMinWidth: 80, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
                    cols: [
                        [{
                            field: 'GoodId',
                            title: 'GoodId',
                            type: 'checkbox',
                            width: 120,
                            sort: true,
                            fixed: 'left'
                        }, {
                            field: 'GoodsCode',
                            title: '物品编码',
                            width: 120,
                            fixed: 'left'
                        }, {
                            field: 'GoodsName',
                            title: '物品名称',
                            width: 200,
                        }, {
                            field: 'GoodsStandard',
                            title: '物品规格',
                            width: 220
                        }, {
                            field: 'GoodsUnit',
                            title: '计量单位',
                            width: 120,
                        }, {
                            field: 'WarehouseName',
                            title: '所属仓库',
                            width: 120
                        }, {
                            field: 'AreaName',
                            title: '所属区域',
                            width: 120
                        }, {
                            field: 'GoodsValidityDay',
                            title: '保质期(天)',
                            width: 120
                        }, {
                            field: 'GoodsAlarmDay',
                            title: '提前报警(天)',
                            width: 120,
                        }, {
                            field: 'GoodsStockHigh',
                            title: '最高储备',
                            width: 120
                        }, {
                            field: 'GoodsStockLow',
                            title: '最低储备',
                            width: 120
                        }, {
                            field: 'GoodsRemark',
                            title: '备注',
                            width: 200
                        }]
                    ],
        
                };
                //监听搜索
                form.on('submit(LAY-app-contlist-search)', function(data) {
                    var msg = data.field.Msg;
                    refreshTable(msg);
                });
            });
        </script>
    </body>
</html>