duan
2024-08-21 22bd5bc1ce2b49284cc2f042c7f4f48619fcf85b
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
$(function () {
    initICSTime();
    initICSDialog();
    initICSCombobox();
    initICSTable();
    initICSClick();
});
 
 
function initICSTime() {
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    var dateBeginStr = year + '-' + (month >= 10 ? '' : '0') + month + '-' + (day >= 10 ? '' : '0') + day;
    var dateEndStr = year + '-' + (month >= 10 ? '' : '0') + month + '-' + (day >= 10 ? '' : '0') + day;
    $('#searchICStimeBegin').val(dateBeginStr);
    $('#searchICStimeEnd').val(dateEndStr);
}
 
function initICSCombobox() {
    var $option = $('');
    var $inspectOrgId = $('#searchICSInspectOrgId');
    var $inspectObjectType = $('#searchICSInspectObjectType');
    var $inspectType = $('#searchICSInspectType');
    $inspectOrgId.empty();
    $inspectObjectType.empty();
    $inspectType.empty();
 
    var data = ajaxSame('../../GlobalM/Org/GetDropDownListOrg', null, 'post', 'json');
    if (typeof (data) == 'string') data = $.parseJSON(data);
    for (var i in data) {
        if (data[i].Id == -1) {
            $option = $('<option value = "' + data[i].Id + '" selected = "selected">' + data[i].Text + '</option>');
        } else {
            $option = $('<option value = "' + data[i].Id + '" >' + data[i].Text + '</option>');
        }
        $inspectOrgId.append($option);
    }
 
    var data = ajaxSame('../../GlobalM/Statement/GetInspectObjectType', null, 'post', 'json');
    for (var i in data) {
        if (data[i].Id == -1) {
            $option = $('<option value = "' + data[i].Id +'" selected = "selected">'+data[i].Text+'</option>');
        } else {
            $option = $('<option value = "' + data[i].Id + '" >' + data[i].Text +'</option>');
        }
        $inspectObjectType.append($option);
    }
 
    var data = ajaxSame('../../GlobalM/Statement/GetInspectType', null, 'post', 'json');
    for (var i in data) {
        if (data[i].Id == -1) {
            $option = $('<option value = "' + data[i].Id + '" selected = "selected">' + data[i].Text + '</option>');
        } else {
            $option = $('<option value = "' + data[i].Id + '" >' + data[i].Text + '</option>');
        }
        $inspectType.append($option);
    }
}
 
 
function initICSTable() {
    var param = getICSSearchParam();
    
    console.info(param);
    $('#tabICSTable').datagrid({
        singleSelect: false,
        url: '../../GlobalM/Statement/GetICS',
        singleSelect: true,
        queryParams: param,
        idField: 'Attention',
        animate: true,
        pagination: true,
        rownumbers: true,
        pagePosition: 'bottom',
        pageSize: 100,
        pageNumber: 1,
        fitColumns: true,
        pageList: [100, 200, 300, 500, 1000],
        //toolbar: '#tabICSSearch',
        //数据格式
        columns: [[
            { title: '时间区间', width: 160, field: 'Attention', },
            { title: '点检类别Id', field: 'InspectTypeId', hidden: true, },
            { title: '点检类别', width: 80, field: 'InspectTypeName', },
            { title: '设备类别Id', field: 'InspectObjectTypeId', hidden: true,  },
            { title: '设备类别', width: 80, field: 'InspectObjectTypeName', },
            { title: '应点检', width: 80, field: 'PlanNeed', },
            { title: '未点检', width: 80, field: 'LastCheck', },
            { title: '已点检', width: 80, field: 'HasCheck', },
            { title: '点检OK', width: 80, field: 'CheckedOK', },
            { title: '现场维修OK', width: 80, field: 'CanRepair', },
            { title: '维修中', width: 80, field: 'InRepair', },
            { title: '维修完成', width: 80, field: 'OKRepair', },
        ]],
        loadFilter: function (data) {
            if (data.Code == 200) {
                loadECharts(data.Extend);
                return data;
            } else {
                if (data.Message=='') {
 
                } else {
                    show(data.Message);
                }
            }
        },
    });
}
 
function loadECharts(data) {
    console.info(data);
    var series = new Array();
    $('#divShowICS').empty();
    var $div = $('<div id="divEChartsICS" style="height:400px;overflow:scroll;"></div>');
    $('#divShowICS').append($div);
 
    for (var i in data.EChartsSeriesArr) {
        var temp = data.EChartsSeriesArr[i];
        var objectTypeName = temp.InspectObjectTypeName;
        var isShow = true;
        if (temp.name == "未点检") {
            isShow = true;
        } else {
            isShow = false;
        }
        var serie = {
            name: temp.name,
            type: temp.type,
            stack: temp.stack,
            data: temp.data,
            label: {
                normal: {
                    show: isShow,
                    position: "top",
                    textStyle: { color: "black" },
                    formatter: objectTypeName
                }
            },
        };
        series.push(serie);
    }
    var myChart = echarts.init(document.getElementById('divEChartsICS'));
    var option;
    option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow' 
            }
        },
        legend: {
            data: data.LegendData
        },
        grid: {
            left: '0%',
            right: '0%',
            bottom: '0%',
            containLabel: true
        },
        xAxis: [{
            type: 'category',
            data: data.xAxisData
        }],
        yAxis: [{
            type: 'value'
        }],
        series: series
    };
    myChart.setOption(option);
}
 
function initICSClick() {
    //点击查询按钮
    $('#btnICSSearch').click(function () {
        var param = getICSSearchParam();
        $('#tabICSTable').datagrid('reload', param);
    });
 
    //点击未完成详情按钮
    $('#btnICSSearchDetail').click(function () {
        var rows = $('#tabICSTable').datagrid('getSelections');
        if (rows.length != 1) { show('请选择任意一行!'); return; }
        var param = {
            InspectObjectTypeId: rows[0].InspectObjectTypeId,
            InspectTypeId: rows[0].InspectTypeId,
            Attention: rows[0].Attention,
        };
        console.info(param);
        $('#ICSDialog').dialog({ closed: false, });
 
        $('#tabICSDialogTable').datagrid({
            url: '../../GlobalM/Statement/GetNeedCheckDetail',
            queryParams: param,
            loadFilter: function (data) {
                console.info(data);
                if (data.Code == 200) {
                    return data;
                } else {
                    show(data.Message);
                }
            },
        });
    });
}
function getICSSearchParam() {
    var timeBegin = $('#searchICStimeBegin').val();
    var timeEnd = $('#searchICStimeEnd').val();
    var inspectObjectType = $('#searchICSInspectObjectType').val();
    var inspectType = $('#searchICSInspectType').val();
    var OrgId = $('#searchICSInspectOrgId').val();
    var param = { TimeBegin: timeBegin, TimeEnd: timeEnd, InspectObjectTypeId: inspectObjectType, InspectTypeId: inspectType, OrgId: OrgId }
    return param;
}
 
//初始化提示框
function initICSDialog() {
    $('#ICSDialog').dialog({
        closed: true,//默认关闭状态
        closable: false,//不提供关闭页面
        top: 10,
        //left: 10,
        resizable: false,//是否可改变窗口大小
        modal: true,//模式化窗口,打开其他地方不可点击
        buttons: [{
            text: '关闭',
            iconCls: 'icon-cancel',
            handler: function () {
 
                $('#ICSDialog').dialog({closed: true,});
            }
        }],
    });
 
    $('#tabICSDialogTable').datagrid({
        singleSelect: false,
        //url: '../../GlobalM/Statement/GetICS',
        singleSelect: true,
        //queryParams: param,
        closable:true,
        idField: 'InspectObjectId',
        animate: true,
        pagination: true,
        rownumbers: true,
        pagePosition: 'bottom',
        pageSize: 10,
        pageNumber: 1,
        fitColumns: true,
        pageList: [5, 10, 20,50,100,200,500,1000],
        //toolbar: '#tabICSSearch',
        //数据格式
        columns: [[
            { title: 'Id', width: 160, field: 'InspectObjectId', hidden: true, },
            { title: '组织名称', width: 160, field: 'OrgName', },
            { title: '设备类别', width: 80, field: 'InspectObjectTypeName', },
            { title: '设备编码', width: 80, field: 'InspectObjectCode', },
            { title: '设备名称', width: 80, field: 'InspectObjectName', },
            { title: '设备位置', width: 80, field: 'InspectLocation', },
            { title: '设备频率', width: 80, field: 'InspectFrequency', },
            {
                title: '设备状态', width: 80, field: 'InspectObjectStatusId', formatter: function (value, row, index) {
                    if (value == '1') {
                        return '使用中'
                    } else if (value == '2') {
                        return '备用中'
                    } else if (value == '3') {
                        return '维修中'
                    } else if (value == '4') {
                        return '闲置中'
                    } else if (value == '5') {
                        return '报废'
                    }
                } },
        ]],
    });
}