王 垚
2022-07-12 295f6bfa5526f20e24f2ad8baf51bcc876bf512a
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
<!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">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <style type="text/css">
        .layui-form-label {
            width: 85px;
        }
    </style>
</head>
<body>
 
    <div id="layout1" class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body" style="padding: 15px;">
                        <form class="layui-form" action="" lay-filter="component-form-group">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <!--<button type="button" lay-submit="" class="layui-btn" lay-filter="FH">返回</button>-->
                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="Exit">退出</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
    <script type="text/html" id="barDemo">
        <!--<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script>
 
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , element = layui.element;
 
            //获取参数
            function getUrlVars() {
                var vars = [], hash;
                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
                for (var i = 0; i < hashes.length; i++) {
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = hash[1];
                }
                return vars;
            }
            var params = getUrlVars();
            var HInterID = params[params[0]];
            var HBillType = params[params[1]];
            form.on('submit(FH)', function () {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                parent.GetHKeeperValue(data);
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            });
            form.on('submit(Exit)', function () {
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            });
            RoadQuery(HInterID, HBillType);
            table.render({
                elem: '#mainTable'
                // , url: '/demo/table/user/'
                , toolbar: '#toolbarDemo'
                , height: 'full-1000'
                , data: []
                , cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增
                , cols: [[
                    { type: 'radio' }
                    , { field: 'HInterID', width: 150, title: 'HInterID', hide: true }//, hide: true
                    , { field: 'HBillType', width: 150, title: '单据类型' }
                    , { field: 'HMaterID', width: 150, title: 'HMaterID', hide: true }
                    , { field: 'HMaterNumber', width: 150, title: '产品编码' }
                    , { field: 'HMaterName', width: 150, title: '产品名称' }
                    , { field: 'HMaterModel', width: 150, title: '规格型号' }
                    , { field: 'HQty', width: 150, title: '数量' }
                    , { field: 'HQtyMust', width: 150, title: '应收数量' }
                    , { field: 'HBatchNo', width: 150, title: '批次' }
                    , { field: 'HPieceQty', width: 150, title: '件数' }
                    , { fixed: 'right', width: 70, title: '操作', toolbar: '#barDemo' }
                ]]
                , page: true
            });
            ///加载显示数据
            function RoadQuery(HInterID, HBillType) {
                $.ajax({
                    type: "get",
                    url: GetWEBURL() + "/Web/GetWMSBarCodeDetailsList",
                    async: true,
                    data: { "HInterID": HInterID, "HBillType": HBillType },
                    success: function (result) {
                        ajaxReturnData = JSON.parse(JSON.stringify(result)).data;
                        table.reload('mainTable', {
                            data: ajaxReturnData
                            , height: 'full-1000'
                            , loading: false
                            , done: function (index, res) {
 
                            }
                        });
                    },
                    error: function (result) {
                        console.log(result);
                        //layer.msg('获取采购订单出现异常', { icon: 2, time: 2000 });
                    }
                });
            };
 
            //行内事件
            table.on('tool(mainTable)', function (obj) {
                var data = obj.data;
                if (obj.event === 'del') {
                    layer.confirm('真的删除行么', function (index) {
                        $.ajax({
                            url: GetWEBURL() + '/Web/DelCacheList',
                            type: "GET",
                            data: { "sHitemID": data.HitemID },
                            success: function (data) {
                                if (data.count == 1) {
                                    layer.close(index);
                                    obj.del(); //删除对应行(tr)的DOM结构
                                    layer.msg('删除成功');
                                } else {
                                    layer.alert(data.code + data.msg, { icon: 5 });
                                }
                            }, error: function () {
                                layer.msg("接口请求失败!", {
                                    icon: 5, btn: ['确认'], time: 100000, offset: 't',
                                    skin: 'layui-layer-lan', title: "温馨提示"
                                });
                            }
                        });
                    });
                }
            });
            //以上为layui模块
        });
    </script>
</body>
</html>