提交 | 用户 | age
|
762399
|
1 |
$(function () { |
A |
2 |
initTimeControl(); |
7d6280
|
3 |
initBillInspectFinishedCombobox(); |
762399
|
4 |
initBillInspectFinishedTable(); |
A |
5 |
initBillInspectFinishedClick(); |
|
6 |
}) |
|
7 |
|
7d6280
|
8 |
function initBillInspectFinishedCombobox() { |
A |
9 |
var $option = $('<option value = "-1" >==全部==</option>'); |
|
10 |
var $inspectArea = $('#divBillInspectFinishedWhere').find('select[name=area]'); |
|
11 |
$inspectArea.empty(); |
|
12 |
$inspectArea.append($option); |
|
13 |
var data = ajaxSame('../../GlobalM/Statement/GetInspectArea', null, 'post', 'json'); |
|
14 |
for (var i in data) { |
|
15 |
$option = $('<option value = "' + data[i].Id + '" >' + data[i].Text + '</option>'); |
|
16 |
$inspectArea.append($option); |
|
17 |
} |
|
18 |
$($inspectArea).find("option").eq(0).prop("selected", true); |
|
19 |
|
|
20 |
$inspectObjectType = $('#divBillInspectFinishedWhere').find('select[name=type]'); |
|
21 |
$inspectObjectType.empty(); |
|
22 |
var data = ajaxSame('../../GlobalM/Statement/GetInspectObjectType', null, 'post', 'json'); |
|
23 |
for (var i in data) { |
|
24 |
$option = $('<option value = "' + data[i].Id + '" >' + data[i].Text + '</option>'); |
|
25 |
$inspectObjectType.append($option); |
|
26 |
} |
|
27 |
$($inspectObjectType).find("option").eq(0).prop("selected", true); |
|
28 |
} |
762399
|
29 |
|
A |
30 |
function initBillInspectFinishedTable() { |
|
31 |
$('#tabBillInspectFinishedTable').empty(); |
|
32 |
var param = getBillInspectFinishedSearchParam(); |
7d6280
|
33 |
console.info(param); |
762399
|
34 |
$('#tabBillInspectFinishedTable').datagrid({ |
A |
35 |
singleSelect: true, |
7d6280
|
36 |
url: '../../GlobalM/Bill/GetFalseInspectBook', |
762399
|
37 |
queryParams: param, |
A |
38 |
idField: 'Id', |
|
39 |
animate: true, |
|
40 |
pagination: true, |
|
41 |
rownumbers: true, |
|
42 |
pagePosition: 'bottom', |
|
43 |
pageSize: 10, |
|
44 |
pageNumber: 1, |
|
45 |
fitColumns: true, |
|
46 |
pageList: [2, 10, 15, 20, 30, 50], |
7d6280
|
47 |
//toolbar: '#divBillInspectFinishedWhere', |
762399
|
48 |
//数据格式 |
A |
49 |
columns: [[ |
|
50 |
{ title: '序号', width: 30, field: 'Id', hidden: true, }, |
|
51 |
{ title: '序号', width: 30, field: 'BillId', hidden: true, }, |
|
52 |
{ checkbox: true, field: 'CreateDIXId', }, |
|
53 |
{ title: '设备类别', field: 'MachineTypeName', }, |
|
54 |
{ title: '设备编码', field: 'MachineCode', }, |
|
55 |
{ title: '设备名称', field: 'MachineName', }, |
|
56 |
{ title: '设备区域', field: 'MachineArea', }, |
|
57 |
{ title: '设备位置', field: 'MachineLocation', }, |
|
58 |
{ title: '点检类别', field: 'DIXTypeName', }, |
|
59 |
{ title: '点检频率', field: 'DIXFrequencyName', }, |
|
60 |
{ |
|
61 |
title: '设备状态', width: 80, field: 'MachinaStatu', formatter: function (value, row, index) { |
|
62 |
if (value == '1') { |
|
63 |
return "使用中"; |
|
64 |
} else if (value == '2') { |
|
65 |
return "备用中"; |
|
66 |
} else if (value == '3') { |
|
67 |
return "维修中"; |
|
68 |
} else if (value == '4') { |
|
69 |
return "闲置中"; |
|
70 |
} else if (value == '5') { |
|
71 |
return "报废"; |
|
72 |
} |
|
73 |
}, |
|
74 |
}, |
|
75 |
{ |
|
76 |
title: '点检时间', width: 160, field: 'DIXTime', fixed: true, |
|
77 |
formatter: function (value, row, index) { |
|
78 |
return toDateStr(value); |
|
79 |
}, |
|
80 |
}, |
|
81 |
{ |
|
82 |
title: '总判定', width: 80, field: 'FinalJudge', formatter: function (value, row, index) { |
|
83 |
if (value == 1) { |
|
84 |
return '<span>OK</span>'; |
|
85 |
} else if (value == 2) { |
|
86 |
return '<span style="color:red;font-weight:bold;">NG</span>'; |
|
87 |
} else if (value == 3) { |
|
88 |
return '<span style="color:gray;">维修</span>'; |
|
89 |
} |
|
90 |
}, |
|
91 |
}, |
|
92 |
{ |
|
93 |
title: '状态', width: 80, field: 'Status', formatter: function (value, row, index) { |
|
94 |
if (value == 1) { |
|
95 |
return '已提交'; |
|
96 |
} else if (value == 0) { |
|
97 |
return '未提交'; |
|
98 |
} |
|
99 |
}, |
|
100 |
}, |
|
101 |
]], |
|
102 |
loadFilter: function (data) { |
|
103 |
if (data.Code == 200) { |
|
104 |
return data; |
|
105 |
} else { |
|
106 |
alert(data.Message); |
|
107 |
} |
|
108 |
}, |
|
109 |
onLoadSuccess: function () { |
|
110 |
var selectedList = $('#selectBillInspectFinishedSelected').val(); |
|
111 |
var powerArray = selectedList.split(','); |
|
112 |
for (var i = 0; i < powerArray.length; i++) { |
|
113 |
if (powerArray[i] == '') continue; |
|
114 |
$(this).datagrid('selectRecord', powerArray[i]); |
|
115 |
} |
|
116 |
}, |
|
117 |
onCheck: function (index, row) { |
|
118 |
var selectedList = $('#selectBillInspectFinishedSelected').val(); |
|
119 |
var oldStr = ',' + row.Id; |
|
120 |
if (isContainsArr(selectedList, oldStr, ',')) return;//当包含字串时,不再新增 |
|
121 |
selectedList = selectedList + oldStr; |
|
122 |
$('#selectBillInspectFinishedSelected').val(selectedList); |
|
123 |
}, |
|
124 |
onUncheck: function (index, row) { |
|
125 |
var selectedList = $('#selectBillInspectFinishedSelected').val(); |
|
126 |
var oldStr = ',' + row.Id; |
|
127 |
if (isContainsArr(selectedList, oldStr, ',')) selectedList = arrStrRemoveStr(selectedList, oldStr, ','); |
|
128 |
$('#selectBillInspectFinishedSelected').val(selectedList); |
|
129 |
}, |
|
130 |
onSelectAll: function (rows) { |
|
131 |
var selectedList = $('#selectBillInspectFinishedSelected').val(); |
|
132 |
var oldStr = ''; |
|
133 |
for (var i in rows) { |
|
134 |
oldStr = ',' + rows[i].Id; |
|
135 |
if (isContainsArr(selectedList, oldStr, ',')) continue; |
|
136 |
selectedList = selectedList + oldStr; |
|
137 |
} |
|
138 |
$('#selectBillInspectFinishedSelected').val(selectedList); |
|
139 |
}, |
|
140 |
onUnselectAll: function (rows) { |
|
141 |
var selectedList = $('#selectBillInspectFinishedSelected').val(); |
|
142 |
var oldStr = ''; |
|
143 |
for (var i in rows) { |
|
144 |
oldStr = ',' + rows[i].Id; |
|
145 |
if (isContainsArr(selectedList, oldStr, ',')) selectedList = arrStrRemoveStr(selectedList, oldStr, ','); |
|
146 |
} |
|
147 |
$('#selectBillInspectFinishedSelected').val(selectedList); |
|
148 |
}, |
|
149 |
}); |
|
150 |
} |
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
function initBillInspectFinishedClick() { |
|
157 |
|
|
158 |
//点击查询按钮 |
|
159 |
$('#btnBillInspectFinishedSearch').click(function () { |
|
160 |
var param = getBillInspectFinishedSearchParam(); |
7d6280
|
161 |
console.info(param); |
762399
|
162 |
$('#tabBillInspectFinishedTable').datagrid('reload', param); |
A |
163 |
}); |
|
164 |
|
|
165 |
|
|
166 |
//点击流程履历 |
|
167 |
$('#btnBillInspectFinishedProcess').click(function () { |
|
168 |
var rows = $('#tabBillInspectFinishedTable').datagrid('getSelections'); |
|
169 |
if (rows.length != 1) { show('查看流程履历只能选择一行!'); return; } |
|
170 |
var BillId = rows[0].BillId |
|
171 |
var param = { BillId: BillId }; |
|
172 |
var data = ajaxSame('../../GlobalM/WorkList/GetBillProcess', param, 'post', 'json'); |
|
173 |
if (data.Code == 200) { |
|
174 |
//加载履历到dialog上 |
|
175 |
|
|
176 |
var $table = $('<table style="font-weight:bolder;width:100%;"></table>'); |
|
177 |
var $tr = $(''); |
|
178 |
var $td = $(''); |
|
179 |
for (var i in data.rows) { |
|
180 |
//创建tr |
|
181 |
if (data.rows[i].ActionType == 0) { |
|
182 |
$tr = $('<tr style="background-color:gray;color:black;"></tr>'); |
|
183 |
} else if (data.rows[i].ActionType == 1) { |
|
184 |
$tr = $('<tr style="background-color:green;color:white;"></tr>'); |
7d6280
|
185 |
} else if (data.rows[i].ActionType == -1) { |
A |
186 |
$tr = $('<tr style="background-color:red;color:white;"></tr>'); |
762399
|
187 |
} |
A |
188 |
$td = $('<td style="padding:6px;text-align:center;">' + data.rows[i].NodeName + '</td>'); |
|
189 |
$tr.append($td); |
|
190 |
$td = $('<td style="padding:6px;text-align:center;">' + data.rows[i].OrderNo + '</td>'); |
|
191 |
$tr.append($td); |
|
192 |
$td = $('<td style="padding:6px;text-align:center;">' + data.rows[i].UserNo + '</td>'); |
|
193 |
$tr.append($td); |
|
194 |
$td = $('<td style="padding:6px;text-align:center;">' + data.rows[i].UserName + '</td>'); |
|
195 |
$tr.append($td); |
|
196 |
$td = $('<td style="padding:6px;text-align:center;">' + data.rows[i].RoleName + '</td>'); |
|
197 |
$tr.append($td); |
|
198 |
$td = $('<td style="padding:6px;text-align:center;">' + data.rows[i].Remark + '</td>'); |
|
199 |
$tr.append($td); |
|
200 |
$td = $('<td style="padding:6px;text-align:center;">' + (data.rows[i].AppendixUrl == "" ? '' : '<a href="' + data.rows[i].AppendixUrl + '" target="_blank">附件</a>') + '</td>'); |
|
201 |
$tr.append($td); |
|
202 |
$td = $('<td style="padding:6px;text-align:center;">' + data.rows[i].ApproveTimeStr + '</td>'); |
|
203 |
$tr.append($td); |
1bf8ef
|
204 |
$td = $('<td style="padding:6px;text-align:center;">' + data.rows[i].ActiveTimeStr + '</td>'); |
A |
205 |
$tr.append($td); |
762399
|
206 |
//将tr添加到表格 |
A |
207 |
$table.append($tr); |
|
208 |
} |
|
209 |
|
|
210 |
$('#processBillInspectFinished').empty(); |
|
211 |
$('#detailBillInspectFinished').empty(); |
|
212 |
|
|
213 |
$('#processBillInspectFinished').append($table); |
|
214 |
} else { |
|
215 |
alert(data.Message); |
|
216 |
} |
|
217 |
}); |
|
218 |
//点击表单详细 |
|
219 |
$('#btnBillInspectFinishedDetail').click(function () { |
|
220 |
var rows = $('#tabBillInspectFinishedTable').datagrid('getSelections'); |
|
221 |
if (rows.length != 1) { show('查看表单只能选择一行!'); return; } |
|
222 |
var BookId = rows[0].Id |
fb7589
|
223 |
var param = { InspectBookId: BookId, ShowBtn: 1 }; |
7d6280
|
224 |
var data = ajaxSame('../../GlobalM/Bill/InspectFalseDetail', param, 'post', 'html'); |
762399
|
225 |
|
A |
226 |
$('#processBillInspectFinished').empty(); |
|
227 |
$('#detailBillInspectFinished').empty(); |
|
228 |
|
|
229 |
$('#detailBillInspectFinished').append(data); |
|
230 |
}); |
|
231 |
|
|
232 |
//点击修改履历 |
|
233 |
$('#btnBillInspectFinishedUpdateNote').click(function () { |
|
234 |
var rows = $('#tabBillInspectFinishedTable').datagrid('getSelections'); |
|
235 |
if (rows.length != 1) { show('查看表单只能选择一行!'); return; } |
|
236 |
var BookId = rows[0].Id |
7d6280
|
237 |
var url = '../../GlobalM/Bill/ReckUpdateHistory?InspectBookId=' + BookId + '&FilterType=FALSE'; |
762399
|
238 |
var features2 = ''; |
A |
239 |
window.open(url, "修改履历", features2); //打开新窗口 |
|
240 |
}); |
|
241 |
} |
|
242 |
function getBillInspectFinishedSearchParam() { |
|
243 |
var $div = $('div#divBillInspectFinishedWhere'); |
7d6280
|
244 |
|
A |
245 |
var code = $div.find('input[name=code]').first().val(); |
|
246 |
var areaid = $div.find('select[name=area]').first().val(); |
|
247 |
var typeid = $div.find('select[name=type]').first().val(); |
|
248 |
|
|
249 |
|
762399
|
250 |
var timeBegin = $div.find('input[name=timeBegin]').first().val(); |
A |
251 |
var timeEnd = $div.find('input[name=timeEnd]').first().val(); |
|
252 |
if (timeBegin != '') { |
|
253 |
timeBegin += ':00'; |
|
254 |
} else { |
|
255 |
timeBegin = '1900/01/01 00:00:00'; |
|
256 |
} |
|
257 |
if (timeEnd != '') { |
|
258 |
timeEnd += ':00'; |
|
259 |
} else { |
|
260 |
timeEnd = '1900/01/01 00:00:00'; |
|
261 |
} |
7d6280
|
262 |
var param = { |
A |
263 |
InspectAreaId: areaid, InspectObjectTypeId: typeid, InspectObjectCode: code, |
|
264 |
TimeBegin: timeBegin, TimeEnd: timeEnd |
|
265 |
} |
762399
|
266 |
return param; |
A |
267 |
} |
|
268 |
|
|
269 |
|
|
270 |
|
|
271 |
function initTimeControl() { |
|
272 |
$.datetimepicker.setLocale('zh'); |
|
273 |
$('.some_class').datetimepicker(); |
|
274 |
} |
|
275 |
|
|
276 |
|
|
277 |
function reloadHomeIndexAttention() { |
|
278 |
$.ajax({ |
|
279 |
url: '../../GlobalM/Bill/GetNeedDealtNum', |
|
280 |
data: null, |
|
281 |
type: 'POST', |
|
282 |
dataType: 'json', |
|
283 |
async: true, |
|
284 |
success: function (data) { |
|
285 |
var $span = $('#HomeIndexAttention', window.parent.document); |
|
286 |
$span.empty(); |
|
287 |
console.info(data); |
|
288 |
if (data.Code == 200) { |
|
289 |
var arr = data.Message.split(','); |
|
290 |
var needDealt = parseInt(arr[0]); |
|
291 |
var isRepair = parseInt(arr[1]); |
|
292 |
var $temp = $(''); |
|
293 |
if (needDealt > 0) { |
|
294 |
$temp = $('<span> 需待办:<span style="color:red;font-weight:bold;">' + needDealt + '<span><span>'); |
|
295 |
} else { |
|
296 |
$temp = $('<span> 需待办:<span>' + needDealt + '<span><span>'); |
|
297 |
} |
|
298 |
$span.append($temp); |
|
299 |
if (isRepair > 0) { |
|
300 |
$temp = $('<span> 需维修:<span style="color:red;font-weight:bold;">' + isRepair + '<span><span>'); |
|
301 |
} else { |
|
302 |
$temp = $('<span> 需维修:<span>' + isRepair + '<span><span>'); |
|
303 |
} |
|
304 |
$span.append($temp); |
|
305 |
} else { |
|
306 |
|
|
307 |
} |
|
308 |
}, |
|
309 |
error: function (data) { |
|
310 |
result = data; |
|
311 |
}, |
|
312 |
}); |
|
313 |
} |