cl
2024-01-23 6dadf36ef118fbb3b2cd5aca94cde88e29fb55dc
提交 | 用户 | 时间
71e81e 1 layui.use(['laydate','table', 'admin', 'ax', 'func'], function () {
2     var $ = layui.$;
3     var table = layui.table;
4     var $ax = layui.ax;
5     var admin = layui.admin;
6     var func = layui.func;
7     var form = layui.form;
8     var laydate = layui.laydate;
9
10
11     //日期时间选择器
12     laydate.render({
13         elem: '#startTime'
14         ,type: 'datetime'
15     });
16
17     laydate.render({
18         elem: '#endTime'
19         ,type: 'datetime'
20     });
21
22     /**
23      * 产品过站采集管理
24      */
25     var PassingStationCollection = {
26         tableId: "passingStationCollectionTable"
27     };
28
29     /**
30      * 初始化表格的列
31      */
32     PassingStationCollection.initColumn = function () {
33         return [[
34             {field: 'id', hide: true, title: '主键id'},
35             {field: 'locationCode', sort: true, title: '工位编号'},
36             {field: 'qualified', sort: true, title: '合格数'},
37             {field: 'unqualified', sort: true, title: '不合格数'},
38             {field: 'passRate', sort: true, title: '合格率'},
39         ]];
40     };
41
42     /**
43      * 点击查询按钮
44      */
45     PassingStationCollection.search = function () {
46         var queryData = {};
47         queryData['workOrderNo'] = $('#workOrderNo').val();
48         queryData['productionLine'] = $('#productionLine').val();
49         queryData['sfcCode'] = $('#sfcCode').val();
50         queryData['locationCode'] = $('#locationCode').val();
51         queryData['startTime'] = $("#startTime").val();
52         queryData['endTime'] = $("#endTime").val();
53         var i = 0;
54         if($('#workOrderNo').val()!=null&&$('#workOrderNo').val() != ''){
55             i = i+1
56         }
57         if($('#productionLine').val()!=null&&$('#productionLine').val() != ''){
58             i = i+1
59         }
60         if($('#sfcCode').val()!=null&&$('#sfcCode').val() != ''){
61             i = i+1
62         }
63         if($('#locationCode').val()!=null&&$('#locationCode').val() != ''){
64             i = i+1
65         }
66         if($('#startTime').val()!=null&&$('#startTime').val() != ''){
67             i = i+1
68         }
69         if($('#endTime').val()!=null&&$('#endTime').val() != ''){
70             i = i+1
71         }
72         if(i>0){
73             table.reload(PassingStationCollection.tableId, {
74                 where: queryData, page: {curr: 1}
75             });
76         }else {
77             Feng.error("查询条件不能为空!")
78         }
79     };
80     /**
81      * 导出excel按钮
82      */
83     PassingStationCollection.exportExcel = function () {
84         var checkRows = table.checkStatus(PassingStationCollection.tableId);
85         if (checkRows.data.length === 0) {
86             Feng.error("请选择要导出的数据");
87         } else {
88             table.exportFile(tableResult.config.id, checkRows.data, 'xls');
89         }
90     };
91
92
93     var queryData = {};
94     queryData['locationCode'] = " ";
95     //渲染表格
96     var tableResult = table.render({
97         elem: '#' + PassingStationCollection.tableId,
98         url: Feng.ctxPath + '/passingStationCollection/PassRate',
99         page: true,
100         height: "full-158",
101         cellMinWidth: 100,
102         where:queryData,
103         cols: PassingStationCollection.initColumn()
104     });
105
106     // 搜索按钮点击事件
107     $('#btnSearch').click(function () {
108         PassingStationCollection.search();
109     });
110
111     // 添加按钮点击事件
112     $('#btnAdd').click(function () {
113
114     PassingStationCollection.jumpAddPage();
115
116     });
117
118     // 导出excel
119     $('#btnExp').click(function () {
120         PassingStationCollection.exportExcel();
121     });
122 });