wtt
2025-03-17 980207d432914dce2d63a4358db2a5fcdcc7434f
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
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; 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, maximum-scale=1">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <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 src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/HideButton.js"></script>
    <script src="../../../layuiadmin/soulTable.slim.js"></script>
    <script src="../../../layuiadmin/PageTitle.js"></script>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-col-md12">
            <div class="layui-card" style="padding: 1px">
                <div class="layui-card-body" style="padding: 1px;">
                    <form class="layui-form" action="" lay-filter="component-form-group" onsubmit="return false;">
                        <div class="layui-collapse">
                            <div class="layui-colla-item">
                                <div class="layui-colla-title layui-inline">
                                    <div class="layui-inline">
                                        <span>更多</span>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width: 85px;">工序流转卡号</label>
                                    <div class="layui-input-block" style="margin-left: 120px;">
                                        <input type="text" class="layui-input" name="HProcExchBillNo" id="HProcExchBillNo">
                                    </div>
                                </div>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit=""  lay-filter="btnSearch" id="btnSearch">
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding: 0 5px;">重置</button>
                                <div class="layui-colla-content">
                                </div>
                            </div>
                        </div>
                        <table class="" id="mainTable" lay-filter="mainTable"></table>
                        <div class="layui-tab layui-tab-card" style="margin-top:0px;">
                            <ul class="layui-tab-title">
                                <li class="layui-this">条码信息</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show ">
                                    <!--缺少的数据-->
                                    <table class="layui-hide" id="mainTable1" lay-filter="mainTable1"></table>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index', //主入口模块
        }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate','soulTable'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element
                , laypage = layui.laypage
                , laydate = layui.laydate
                , util = layui.util
                , soulTable = layui.soulTable
            //公用变量
            var sWhere = "";
            var option = [];
            var option1 = [];
            var ins;                        //用于导出excel
            var HModName = "SingleItemTransitList";
            var HModName1 = "SingleItemTransitList_SN";
        
            var titleData = ["HMaterID", "HUnitID", "HSourceID", "hmainid", "HProcExchInterID", "HProcID", "HunitID", "HEmpID", "HGroupID", "HProcExchEntryID", "HSubID", "HICMOInterID", "选择", "查询日期", "成本对象", "成本对象名称", "HBillStatus", "HBillType", "HPRDORGID"];//不需要显示的字段 可扩展
 
            //初始化表格
            set_InitGrid();
 
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                set_ClearQuery();
            });
 
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery();
            });
 
        
            //点击主表带出从表数据
            table.on('row(mainTable)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
 
                var datas = obj.data; //获得当前行数据
                var HProcExchBillNo = datas.流转卡号;
                var HProcName = datas.工序;
 
                SelectTechParam(HProcExchBillNo, HProcName);//工艺参数
            });
 
 
            //初始化表格
            function set_InitGrid() {
                option = {
                    elem: '#mainTable'
                    //, toolbar: '#toolbarDemo'
                    , height: 700
                    , page: true
                    , totalRow: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
                    , cols: []
                    , text: {
                        none: '无数据!'
                    }
                };
                get_FastQuery();
            }
 
            //重置过滤条件
            function set_ClearQuery() {
                $("#HProcExchBillNo").val("");
                sWhere = "";
            }
 
            //快速过滤
            function get_FastQuery() {
               
                get_Display(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            }
 
 
            //查询数据
            function SelectTechParam(HProcExchBillNo, TableName) {
                var wait = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Cj_SingleStation/SingleItemTransit_SN_List',
                    type: "GET",
                    data: { "sWhere": HProcExchBillNo, "TableName": TableName },
                    async: false,
                    success: function (data1) {
                        if (data1.count == 1) {
                            var totalArray = ["生产数量", "工价", "金额", "任务数量", "数量", "出站数量", "报废数量", "不良数量", "工时", "流转卡数量", "任务单数量"];
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            }
                            //在列表左边添加勾选框
                            //col.push({ type: 'checkbox', fixed: 'left' });
                            for (var i = 0; i < data.length; i++) {
                                // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                                if ($.inArray(data[i].name, "") > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                } else if (data[i].name == '单据号') {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '单据号' });
                                }
                                else if ($.inArray(data[i].name, totalArray) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 200 });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
                                    }
                                }
                            }
 
                            //动态显示列名
                            option1 = {
                                elem: '#mainTable1'
                                //, toolbar: '#toolbarDemo1'
                                , cols: [col]
                                , data: data1.data
                                , height: 550
                                , page: true
                                , totalRow: true
                                , cellMinWidth: 90
                                , limit: 50
                                , limits: [50, 500, 5000, 20000]
                            }
                            table.render(option1);
 
                            layer.close(wait);
                            //layer.alert("查询成功", { icon: 1 });
                        } else {
                            layer.close(wait);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(wait);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
 
            //加载网格
            function get_Display(sWhere) {
                var HProcExchBillNo = $("#HProcExchBillNo").val(); //工序流转卡号
                //进入页面显示的缓存列表
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Cj_SingleStation/SingleItemTransitList',
                    type: "GET",
                    async: false,
                    data: { "HProcExchBillNo": HProcExchBillNo, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            }
                            //在列表左边添加勾选框
                            //col.push({ type: 'checkbox', fixed: 'left', totalRowText: '合计' });
                            for (var i = 0; i < data.length; i++) {
                                // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                                if ($.inArray(data[i].name, titleData) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 200 });
                                            break;
                                        default:
                                            if (data[i].name == '数量' || data[i].name == '出站数量' || data[i].name == '报废数量' || data[i].name == '取样数量' || data[i].name == '工时') {
                                                col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, totalRow: true });
                                            } else {
                                                col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
                                            }
                                    }
                                }
                            }
 
                            //动态显示列名
                            option = {
                                elem: '#mainTable'
                                //, toolbar: '#toolbarDemo'
                                , cols: [col]
                                , data: data1.data
                                , height: 700
                                , page: true
                                , totalRow: true
                                , cellMinWidth: 90
                                , limit: 50
                                , limits: [50, 500, 5000, 20000]
                                , done: function (res, curr, count) {
                                    soulTable.render(this);
                                }
                            }
                            table.render(option);
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                layer.close(ajaxLoad);
            }
 
 
            //以上是layui模块
        });
 
</script>