var dataOIDECharts = []; $(function () { //initOIDHeight() initOIDTime(); initOIDClick(); }); function initOIDHeight(){ var pageHeight = $('#page', window.parent.document).height(); var whereHeight = $('#tabOIDSearch').height(); var showHeight = parseInt(pageHeight) - parseInt(whereHeight) - 50; $('#tabOIDTable').datagrid({ height: showHeight, }); } function initOIDTime() { var date = new Date(); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var dateBeginStr = year + '-' + (month >= 10 ? '' : '0') + month + '-01'; var dateEndStr = year + '-' + (month >= 10 ? '' : '0') + month + '-' + (day >= 10 ? '' : '0') + day; $('#searchOIDtimeBegin').val(dateBeginStr); $('#searchOIDtimeEnd').val(dateEndStr); } function initOIDTable() { $('#tabOIDTable').empty(); var param = getOIDSearchParam(); console.info(param); var data = ajaxSame('../../GlobalM/Statement/GetItemNameByObjectCode', param, 'POST', 'JSON'); if (data.Code != 200) { alert(data.Message); return; } var columns = getColumnsOID(data.Message); debugger; $('#tabOIDTable').datagrid({ singleSelect: true, url: '../../GlobalM/Statement/GetObjectInspectDetail', singleSelect: true, queryParams: param, idField: 'InspectBookId', animate: true, pagination: true, rownumbers: true, pagePosition: 'bottom', pageSize: 100, pageNumber: 1, fitColumns: true, columns: columns, pageList: [20, 50, 100, 200, 500, 1000, 10000], //toolbar: '#tabOIDSearch', loadFilter: function (data) { if (data.Code == 200) { return data; } else { alert(data.Message); return null; } }, }); initOIDHeight(); } function getColumnsOID(colArr) { var title = [ { field: "InspectBookId", title: "InspectBookId", hidden: true, }, { field: "InspectObjectCode", title: "编号",}, { field: "InspectTime", title: "点检时间", }, { field: "Judge", title: "点检结果", formatter: function (value, row, index) { if (value == 'OK') { return 'OK'; } else if (value == 'NG') { return 'NG'; } } }, ]; var arr = colArr.split(','); for (var i = 0; i < arr.length; i++) { title.push({ field: arr[i] + '_Value', title: arr[i], }); title.push({ field: arr[i] + '_CheckType', title: '基准', }); title.push({ field: arr[i] + '_Judge', title: '判定', formatter: function (value, row, index) { if (value == 'OK') { return 'OK'; } else if (value == 'NG') { return 'NG'; } } }); } return [title]; } function initOIDClick() { //点击查询按钮 $('#btnOIDSearch').click(function () { initOIDTable(); }); } function getOIDSearchParam() { var timeBegin = $('#searchOIDtimeBegin').val(); var timeEnd = $('#searchOIDtimeEnd').val(); var InspectObjectCode = $('#searchOIDInspectObjectCode').val(); var param = { InspectObjectCode: InspectObjectCode, TimeBegin: timeBegin, TimeEnd: timeEnd } return param; }