4
hao
2025-04-16 c5fb1fbcbb2bf4d511773d348f9ef625855c61fc
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
/**
 * 应急实施
 */
var pageCurr;
$(function() {
    
    layui.use(['table', 'laydate'], function(){
        var table = layui.table
            ,form = layui.form,element = layui.element,laydate = layui.laydate;
 
        /*var sdate = new Date(new Date(new Date(
                new Date().setDate(new Date().getDate()-1)).toLocaleDateString()).getTime()+24*60*60*1000-1);
        */
        var sdate = getNextDate(-1);
        var edate = getCurDate(0);
        tableIns=table.render({
            elem: '#unitList'
            ,url:context+'/report/getOCVList'
            ,method: 'get' //默认:get请求
                 ,where:{stime:sdate,
                     etime:edate,prc_name:'APP_OCV1_DATA'}
            ,cellMinWidth: 80,limit:20
            ,page: true,
            request: {
                pageName: 'page' //页码的参数名称,默认:page
                ,limitName: 'rows' //每页数据量的参数名,默认:limit
            },
            parseData: function (res) {
                if(res.status == 1){
                    return {
                        "code": res.status,//code值为200表示成功
                       "count": 0,
                       "msg":res.msg,
                       "data":[]
                   }
                }
                // 可进行数据操作
                return {
                     "code": res.status,//code值为200表示成功
                    "count": res.data.total,
                    "msg":res.msg,
                    "data":res.data.rows
                }
            },
            cols: [[
                {type:'numbers'}
                ,{field:'PRO_MODEL', title:'型号', width:100,align:'center'}
                ,{field:'MODEL', title:'设备号', width:120,align:'center'}
                ,{field:'SN', title:'条码', width:200,align:'center'}
                ,{field:'OCT1', title:'OCV1时间', width:150,align:'center'}
                ,{field:'OCV1RESULT', title:'OCV1结果',width:100,align:'center', templet:'<div>{{changStatus(d.OCV1RESULT)}}</div>'}
                ,{field:'OCV1', title:'OCV1',width:100,align:'center'}
                ,{field:'OCV1MIN', title:'电压下限', width:150,align:'center'}
                ,{field:'OCV1MAX', title:'电压上限',width:100,align:'center'}
                ,{field:'VOL1RESULT', title:'电压结果',width:100,align:'center', templet:'<div>{{changStatus(d.VOL1RESULT)}}</div>'}
                ,{field:'OCR1', title:'IMP1', width:100,align:'center'}
                ,{field:'IMP1MIN', title:'IMP下限', width:100,align:'center'}
                ,{field:'IMP1MAX', title:'IMP上限', width:100,align:'center', templet:'<div>d.IMP1MAX</div>'}
                ,{field:'IMP1RESULT', title:'IMP结果', width:100,align:'center', templet:'<div>{{changStatus(d.IMP1RESULT)}}</div>'}
                ,{field:'THICKNESS1', title:'厚度', width:100,align:'center'}
                ,{field:'THICKNESS1MIN', title:'厚度下限', width:100,align:'center'}
                ,{field:'THICKNESS1MAX', title:'厚度上限', width:100,align:'center'}
                ,{field:'THICRESULT1', title:'厚度结果', width:100,align:'center', templet:'<div>{{changStatus(d.THICRESULT1)}}</div>'}
                ,{field:'LINENO', title:'线体号', width:100,align:'center'}
            ]]
            ,  done: function(res, curr, count){
                //如果是异步请求数据方式,res即为你接口返回的信息。
                //如果是直接赋值的方式,res即为:{data: [], count: 99} data为当前页数据、count为数据总长度
                pageCurr=curr;
            }
        });
        
/*        tableIns2=table.render({
            elem: '#list2'
            ,url:context+'/report/getOCV2List'
            ,method: 'get' //默认:get请求
            ,cellMinWidth: 80
            ,page: true,
            request: {
                pageName: 'page' //页码的参数名称,默认:page
                ,limitName: 'rows' //每页数据量的参数名,默认:limit
            },
            parseData: function (res) {
                // 可进行数据操作
                return {
                    "count": res.data.total,
                    "msg":res.msg,
                    "data":res.data.rows,
                    "code": res.status //code值为200表示成功
                }
            },
            cols: [[
                {type:'numbers'}
                ,{field:'MODEL', title:'型号', width:'7%'}
                ,{field:'SN', title:'条码', width:'20%',align:'center'}
                ,{field:'OCV2', title:'OCV2', width:'9%'}
                ,{field:'OCR2', title:'OCR2',width:'9%'}
                ,{field:'OCT2', title:'OCV2时间', width:'10%'}
                ,{field:'T12', title:'T12',width:'9%'}
                ,{field:'V12', title:'V12', width:'9%'}
                ,{field:'K12', title:'K12', width:'9%',align:'center'}
                ,{field:'THICKNESS', title:'THICKNESS', width:'9%',align:'center'}
            ]]
            ,  done: function(res, curr, count){
                //如果是异步请求数据方式,res即为你接口返回的信息。
                //如果是直接赋值的方式,res即为:{data: [], count: 99} data为当前页数据、count为数据总长度
                pageCurr=curr;
            }
        });*/
        
      //开始日期
        var insStart = laydate.render({
          elem: '#test-laydate-start'
          ,type: 'datetime'
              ,value:sdate      
              ,format: 'yyyy-MM-dd HH:mm:ss'
          ,done: function(value, date){
            //更新结束日期的最小日期
//            insEnd.config.min = lay.extend({}, date, {
//              month: date.month - 1
//            });
            
            //自动弹出结束日期的选择器
           insEnd.config.elem[0].focus();
          }
        });
        
        //结束日期
        var insEnd = laydate.render({
          elem: '#test-laydate-end'
          ,type: 'datetime'
              ,value:edate
              ,format: 'yyyy-MM-dd HH:mm:ss'
          ,done: function(value, date){
            //更新开始日期的最大日期
//            insStart.config.max = lay.extend({}, date, {
//              month: date.month - 1
//            });
          }
        });
        
        //监听工具条
        table.on('tool(unitTable)', function(obj){
            var data = obj.data;
            if(obj.event === 'approval'){
                //审核
                layer.alert('审核',function(){
                    layer.closeAll();
                });
            } else if(obj.event === 'edit'){
                //编辑
                editWork(data,data.id);
            } else if(obj.event === 'file'){
                //附件
                layer.alert('附件',function(){
                    layer.closeAll();
                });
            } else if(obj.event === 'del'){
                //删除
                // delUser(data,data.id,data.bsName);
                delWork(data,data.id,data.bsName);
            }
        });
        form.on('select(lineno)', function(data){
            $.ajax({
                type:'post',
                url:context+'/report/getLineList',
                data:{},
                dataType:'json',
                async:true,
                success:function(data){
                    if(data.result){
                        var option = '<option value="0">请选择</option>';  //默认值
                        for(var i=0;i<data.data.length;i++){
                            option += '<option value="'+data.data[i].LINE_NO+'">'+data.data[i].LINE_NO+'</option>';
                        }
                    }
                    $("#lineno").html("");
                    $("#lineno").append(option);
                    form.render('select','line');
                },
            });
        });
        
        $.ajax({
            type:'get',
            url:context+'/report/getLineList',
            data:{},
            dataType:'json',
            async:true,
            success:function(data){
                if(data.result){
                    var option = '<option value="">请选择</option>';  //默认值
                    for(var i=0;i<data.data.length;i++){
                        option += '<option value="'+data.data[i].LINE_NO+'">'+data.data[i].LINE_NO+'</option>';
                    }
                }
                $("#lineno").html("");
                $("#lineno").append(option);
              //重新渲染select
                form.render('select');
            },
        });
        
 
      //监听搜索框
        form.on('submit(doSearch)', function(data){
            //alert(data.elem.getAttribute('data-url'));
            //重新加载table
            load(data);
            return false;
        });
    });
 
});
 
 
//重新加载表格(搜索)
function load(obj){
    //重新加载table
    tableIns.reload({
        where: {
            keyword:obj.field.keyword,
            stime:obj.field.stime,
            etime:obj.field.etime
            ,lineno:obj.field.lineno
            ,pmodel:obj.field.pmodel
            ,prc_name:'APP_OCV1_DATA'
        }
        , page: {
            curr: pageCurr //从当前页码开始
        }
    });
   /* tableIns2.reload({
        where: {
            keyword:obj.field.keyword,
            stime:obj.field.stime,
            etime:obj.field.etime
        }
        , page: {
            curr: pageCurr //从当前页码开始
        }
    });*/
}
 
//重新加载表格(全部)
function loadAll(){
    //重新加载table
    tableIns.reload({
        page: {
            curr: pageCurr //从当前页码开始
        }
    });
}
 
//清空新增表单数据
function cleanUser(){
    $("#id").val("");
    $("#bsName").val("");
    $("#mobile").val("");
    $("#email").val("");
    $("#bsPassword").val("");
}
 
//清空修改密码表单数据
function cleanPassword(){
    $("#userId").val("");
    $("#password").val("");
    $("#rePassword").val("");
}
 
function indexOf(arr, str){
    // 如果可以的话,调用原生方法
    if(arr && arr.indexOf){
        return arr.indexOf(str);
    }
     
    var len = arr.length;
    for(var i = 0; i < len; i++){
        // 定位该元素位置
        if(arr[i] == str){
            return i;
        }
    }
     
    // 数组中不存在该元素
    return -1;
}