王 垚
2022-06-30 dbe5254dccd9afc24b51ee442dd9f82c89410dff
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
 
 
<!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">
</head>
<body>
 
    <div class="layui-card layadmin-header">
        <div class="layui-breadcrumb" lay-filter="breadcrumb">
            <a lay-href="">送货单主页</a>
            <a><cite>送货单</cite></a>
            <a><cite>送货单表格</cite></a>
            <a><cite>送货单的表格重载</cite></a>
        </div>
    </div>
 
    <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-header">送货单</div>
                    <div class="layui-card-body">
                        <form id="form1" class="layui-form" action="">
                            <div class="layui-inline">
                                <button class="layui-btn layui-btn-sm" lay-submit="" lay-event="getCheckData" lay-filter="Saver">保存</button>
                                </div>
                                    <div class="layui-form-item" style="margin-bottom: 10px;">
                                        单 据 号:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" hbillno="test-table-demoReload" autocomplete="off" disabled>
                                        </div>
                                        单据日期:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HDate" id="HDate" hdate="test-table-demoReload" autocomplete="off" disabled>
                                        </div>
                                        主    管:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HManagerName" id="HManagerName" hmanagername="test-table-demoReload" autocomplete="off"  disabled>
                                            <input id="HManagerID" name="HManagerID" type="hidden" />
                                        </div>
                                        供 应 商:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HSupName" lay-verify="HSupName" value="DDD" id="HSupName" hsupname="test-table-demoReload" autocomplete="off" style="width: 180px;" disabled>
                                            <input id="HSupID" name="HSupID" type="hidden" />
                                        </div>
                                        <!--<button class="layui-btn" data-type="reload">选择</button>-->
                                    </div>
                                    <div class="layui-form-item" style="margin-bottom: 10px;">
                                        备    注:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HRemark" id="HRemark" hremark="test-table-demoReload" autocomplete="off" style="width: 660px;">
                                        </div>
                                        业 务 员:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HEmpName" id="HEmpName" hempname="test-table-demoReload" autocomplete="off" style="width: 180px;">
                                            <input id="HEmpID" name="HEmpID" type="hidden" />
                                        </div>
                                    </div>
                                    <div class="layui-form-item" style="margin-bottom: 10px;">
                                        制单日期:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HMakerDate" id="HMakerDate" hmakedate="test-table-demoReload" autocomplete="off"  disabled>
                                        </div>
                                        制 单 人:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HMaker" id="HMaker" hmaker="test-table-demoReload" autocomplete="off"  disabled>
                                        </div>
                                        审核日期:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HCheckDate" id="HCheckDate" hcheckdate="test-table-demoReload" autocomplete="off"  disabled>
                                        </div>
                                        审 核 人:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HChecker" id="HChecker" hchecker="test-table-demoReload" autocomplete="off" disabled>
                                        </div>
                                    </div>
                                    <div class="layui-form-item" style="margin-bottom: 10px;">
                                        主键:
                                        <div class="layui-inline">
                                            <input class="layui-input" name="HInterID" id="HInterID" hinterid="test-table-demoReload" autocomplete="off" style="width: 100px;" disabled>
                                        </div>
                                    </div>
                      </form>
                   </div>
                    <!--<script type="text/html" id="toolbarDemo">
                        <div class="test-table-reload-btn" style="margin-bottom: 10px;">
                            <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">删行</button>
 
                        </div>
                    </script>-->
                    <table class="layui-hide" id="test-table-reload" lay-filter="test-table-reload"></table>
                    <blockquote class="layui-elem-quote">送货单</blockquote>
                </div>
            </div>
        </div>
    </div>
    <!--<script src="../../layuiadmin/layui/lay/modules/mobile/jquery-3.3.1.min.js"></script>-->
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../../layuiadmin/Scripts/json2.js" type="text/javascript"></script>
    <script src="../../layuiadmin/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <!--<script src="../../../../Scripts/jquery-1.8.2.js"></script>-->
    <script>
        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 linterid = params[params[0]];
        var lentryid = params[params[1]];
      // debugger;
        $.ajax({
            url: "http://localhost:8083/Web/GetPOInStockShowBillMain",
            type: "GET",
            data: { "sMsg": linterid },
            success: function (d) {
                console.log(d.data);
                //$("#HDate").val(d.)
                $("#HInterID").val(d.data[0].HInterID);
                $("#HBillNo").val(d.data[0].HBillNo);
                $("#HRemark").val(d.data[0].HRemark);
                $("#HDate").val(d.data[0].HDateForWeb);
                $("#HMaker").val(d.data[0].HMaker);
                $("#HMakerDate").val(d.data[0].HMakerDate)
                $("#HChecker").val(d.data[0].HChecker);
                $("#HCheckDate").val(d.data[0].HCheckDate);
                $("#HSupID").val(d.data[0].HSupID);
                $("#HSupName").val(d.data[0].HSupName);
                $("#HEmpID").val(d.data[0].HEmpID);
                $("#HEmpName").val(d.data[0].HEmpName);
                $("#HManagerID").val(d.data[0].HManagerID);
                $("#HManagerName").val(d.data[0].HManagerName);
            }
        });
 
 
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'table','form'], function () {
            var table = layui.table
            ,$ = layui.$
            ,form = layui.form;
 
            form.on('submit(Saver)', function (data) {//保存
                //debugger;
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = JSON.stringify(table.cache['test-table-reload']);
                var sMainSub = sMainStr + ';' + sSubStr;
                layer.load(3)
                $.ajax(
                {
                    type: "POST",
                    url: "http://localhost:8083/web/SaverPOInStock", //方法所在页面和方法名
                    async: true,
 
                    data: { "msg": sMainSub },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // 说明验证成功了,
                            layer.msg(data.Message, { icon: 1 });
                        }
                        else {
                            layer.msg(data.Message, { icon: 5 });
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        f_alert("错误:" + err);
                    }
                });
                return false;
            });
 
 
            //监听提交
            //form.verify({
            //    numberOrEmpty: function (value, item) {
            //        // if (value != '') {
            //        if (!/^\d+$/.test(value)) {
            //            return '不能为空或数字或者0';
            //        }
            //        //}
            //    }
            //});
            layer.load(3)
            table.render({
                elem: '#test-table-reload'
              , url: 'http://localhost:8083/Web/GetPOInStockShowBillSub'
              , toolbar: '#toolbarDemo'
              , where: { sMsg: linterid, sMsg2: lentryid }
             // , where: { sMsg: '28', sMsg2: '28,5;' }
              ,cols: [[
               // , { field: 'HMTONO', title: '计划跟踪单号', width: 100,, sort: true, fixed: true edit: 'text', hide: true }
                , { field: 'HMaterID', title: '物料ID', width: 100, edit: 'text', hide: true }
                , { field: 'HMaterNumber', title: '物料代码', width: 100,edit: 'text' }
                , { field: 'HMaterName', title: '物料名称', width: 200, edit: 'text' }
                , { field: 'HMaterModel', title: '规格型号', width: 200, edit: 'text' }
                , { field: 'HUnitName', title: '计量单位', width: 100,edit: 'text' }
                , { field: 'HUnitNumber', title: '计量单位代码', width: 100, edit: 'text', hide: true }
                , { field: 'HUnitID', title: '计量单位ID', width: 100, edit: 'text', hide: true }
                , { field: 'HQty', title: '数量', width: 100, edit: 'text' }
                , { field: 'HPrice', title: '单价', width: 100, edit: 'text' }
                , { field: 'HMoney', title: '金额', width: 100, edit: 'text' }
                //, { field: 'HDate', title: '要求交货日期', width: 150, edit: 'text' }
                //, { field: 'HDate2', title: '确认交货日期', width: 150, edit: 'text' }
                , { field: 'HPOOrderInterID', title: '采购单主内码', width: 150, edit: 'text' }
                , { field: 'HPOOrderEntryID', title: '采购单子内码', width: 150, edit: 'text' }
                , { field: 'HSourceBillType', title: '源单类型', width: 100, edit: 'text' }
                , { field: 'HPOOrderBillNo', title: '采购单号', width: 200, edit: 'text' }
                , { field: 'HBillType', title: '单据类型', width: 100, edit: 'text' }
                , { field: 'HSourceBillNo', title: '源单单号', width: 200, edit: 'text' }
                , { field: 'HSourceEntryID', title: '源单子内码', width: 150, edit: 'text' }
                , { field: 'HSourceInterID', title: '源单主内码', width: 150, edit: 'text' }
               // , { field: 'HCheckDate', title: '审核日期', width: 150, edit: 'text' }
                , { field: 'HChecker', title: '审核人', width: 100, edit: 'text' }
                , { field: 'HSupID', title: '供应商ID', width: 150, edit: 'text' }
                , { field: 'HManagerID', title: '主管ID', width: 100, edit: 'text' }
                , { field: 'HEmpID', title: '职员ID', width: 100, edit: 'text' }
                , { field: 'HMaker', title: '制单人', width: 100, edit: 'text' }
              ]]
              // , data: [linterid]
             // , page: true
              , height: 500
              , done: function () {
                     layer.closeAll("loading");
                 }
            });
 
            function f_SaveBill() {
                //
                //jiuajax从服务器获取
                layer.load(3)
                $.ajax(
                {
                    type: "POST",            
                    url: "http://localhost:8083/web/SaverPOInStock", //方法所在页面和方法名
                    async:true,
                    data: { msg: sMainSub },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) { // 说明验证成功了,
                            layer.msg(data.Message, { icon: 1 });
                        }
                        else {
                            // $("#verifycode").click();
                            layer.msg(data.Message, { icon: 5 });
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        f_alert("错误:" + err);
                    }
                });
            }
            function f_alert(sMsg) {
              //  $.ligerDialog.success(sMsg);
                layer.msg(sMsg);
            }
            //function form2json() {
            //    var jsonuserinfo = jQuery('#form1').serializeObject();
            //    return JSON.stringify(jsonuserinfo).replace(/(")/g, "\\\"");
            //}
            //jQuery.fn.serializeObject = function () {
            //    var o = {};
            //    var a = this.serializeArray();
            //    jQuery.each(a, function () {
            //        if (o[this.name]) {
            //            if (!o[this.name].push) {
            //                o[this.name] = [o[this.name]];
            //            }
            //            o[this.name].push(this.value || '');
            //        } else {
            //            o[this.name] = this.value || '';
            //        }
            //    });
            //    return o;
            //};
            //form.on('submit(Saver)', function (data) {//保存
            //    debugger;
            //    var ajaxData = data.field;
 
            //    return JSON.stringify(ajaxData).replace(/(")/g, "\\\"");
            //   // return false;
            //});
 
            //function f_SaveBefore() {
            //    //保存前处理(字段格式:int类型不能为空,日期类型符合格式,bool类型)
            //    if ($("#HInterID").val() == '') {
            //        $("#HInterID").val('0');
            //    }
            //    //明细网格不能为空
 
            //    return 'Y'
            //}
            $('.test-table-reload-btn .layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
           });
    </script>
</body>
</html>