旧版报表、仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

208 lines
7.1 KiB

2 years ago
$().ready(function () {
$('.input-daterange').datepicker({
language: 'zh-CN',//��ʾ����
format: 'yyyy-mm-dd',
});
$('#txtEndtime').val(moment().format("YYYY-MM-DD"));
$('#txtBegintime').val(moment().subtract(1, 'days').format("YYYY-MM-DD"));
$('#ddlWorkshop').val('');
$('#ddlWorkshop').select2({
placeholder: "����",
allowClear: true
});
//1.��ʼ��Table
var oTable = new TableInit();
oTable.Init();
})
function QueryddlStatus() {
var promiseweld = $.ajax({
url: '/api/ProductionReport/StationNbrAndGoing',
type: 'post',
cache: true,
async: true,
});
promiseweld.done(function (r) {
$.each(r, function (index, value) {
$("#ddlStatus").append("<option value='" + value.visit_type + "'>" + value.visit_type_desc + "</option>");
})
$('#ddlStatus').val('');
$('#ddlStatus').select2({
placeholder: "����",
allowClear: true
});
});
promiseweld.fail(function (error) {
console.log(error)
alert(error);
});
}
$('#btnQuery').click(function () {
$("#tbqc").bootstrapTable('refresh');
})
var TableInit = function () {
var oTableInit = new Object();
//��ʼ��Table
oTableInit.Init = function () {
$('#tbqc').bootstrapTable({
url: '/api/ProductionReport/StationNbrAndGoing', //������̨��URL��*��
method: 'post', //������ʽ��*��
toolbar: '#toolbar', //���߰�ť���ĸ�����
striped: true, //�Ƿ���ʾ�м���ɫ
cache: false, //�Ƿ�ʹ�û��棬Ĭ��Ϊtrue������һ����������Ҫ����һ���������ԣ�*��
pagination: true, //�Ƿ���ʾ��ҳ��*��
sortable: false, //�Ƿ���������
sortOrder: "asc", //������ʽ
queryParams: oTableInit.queryParams,//���ݲ�����*��
sidePagination: "client", //��ҳ��ʽ��client�ͻ��˷�ҳ��server�����˷�ҳ��*��
contentType: 'application/json',
pageNumber: 1, //��ʼ�����ص�һҳ��Ĭ�ϵ�һҳ
pageSize: 20, //ÿҳ�ļ�¼������*��
pageList: [10, 25, 50, 100], //�ɹ�ѡ����ÿҳ��������*��
search: true, //�Ƿ���ʾ�����������������ǿͻ��������������������ˣ����ԣ����˸о����岻��
strictSearch: true,
showColumns: true, //�Ƿ���ʾ���е���
showRefresh: true, //�Ƿ���ʾˢ�°�ť
minimumCountColumns: 2, //��������������
clickToSelect: true, //�Ƿ����õ���ѡ����
//height: 500, //�иߣ�����û������height���ԣ������Զ����ݼ�¼�������ñ����߶�
//uniqueId: "aiid", //ÿһ�е�Ψһ��ʶ��һ��Ϊ������
showToggle: true, //�Ƿ���ʾ��ϸ��ͼ���б���ͼ���л���ť
cardView: false, //�Ƿ���ʾ��ϸ��ͼ
detailView: false, //�Ƿ���ʾ���ӱ�
showExport: true, //�Ƿ���ʾ����
exportDataType: "all", //basic', 'all', 'selected'.
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
onLoadSuccess: function (data) {
//var data = $('#tbqc').bootstrapTable('getData', true);
////�ϲ���Ԫ��
//mergeCells(data, "serial_nbr", 1, $('#tbqc'));
//mergeCells(data, "schedule_nbr", 1, $('#tbqc'));
},
columns: [{
checkbox: true
}, {
field: 'process_code',
title: 'վ��'
}, {
field: 'area_code',
title: '����'
}, {
field: 'station_nbr',
title: '��վ����'
}, {
field: 'going_nbr',
title: '��������'
}
]
});
};
//�õ���ѯ�IJ���
oTableInit.queryParams = function (params) {
var temp = { //�����ļ������ֺͿ������ı���������һֱ�����߸Ķ���������Ҳ��Ҫ�ij�һ����
limit: params.limit, //ҳ����С
offset: params.offset, //ҳ��
//departmentname: $("#txt_search_departmentname").val(),
//statu: $("#txt_search_statu").val()
StartDateTime: $('#txtBegintime').val(),
EndDateTime: $('#txtEndtime').val(),
WorkShop: $('#ddlWorkshop').val(),
station: $('#txtStation').val(),
wks: $('#txtWks').val(),
state: $('#state').val(),
};
return temp;
};
return oTableInit;
};
var ButtonInit = function () {
var oInit = new Object();
var postdata = {};
oInit.Init = function () {
//��ʼ��ҳ�������İ�ť�¼�
};
return oInit;
};
/**
* ϲԪ
* @param data ԭʼݣڷ
* @param fieldName ϲ
* @param colspan ϲ
* @param target Ŀ
*/
function mergeCells(data, fieldName, colspan, target) {
//����һ��map������ͬ����ֵ��data�������ֵĴ�����
var sortMap = {};
for (var i = 0; i < data.length; i++) {
for (var prop in data[i]) {
if (prop == fieldName) {
var key = data[i][prop]
if (sortMap.hasOwnProperty(key)) {
sortMap[key] = sortMap[key] * 1 + 1;
} else {
sortMap[key] = 1;
}
break;
}
}
}
for (var prop in sortMap) {
console.log(prop, sortMap[prop])
}
var index = 0;
for (var prop in sortMap) {
var count = sortMap[prop] * 1;
$(target).bootstrapTable('mergeCells', { index: index, field: fieldName, colspan: colspan, rowspan: count });
index += count;
}
}
////����excel
//$('#btnExportExcel').click(function () {
// console.log("clicked");
// //var promiseweld = $.ajax({
// // url: '../Report/ExportToExcel',
// // type: 'post',
// // cache: true,
// // async: true,
// //});
// //promiseweld.fail(function (error) {
// // console.log(error)
// // alert(error);
// //});
// //window.open('../Report/ExportToExcel?bt=2018-10-10');
// var a = $("<a href='../Report/PackoutputExcel/"
// + (!$('#ddlWorkshop').val() ? "Null" : $('#ddlWorkshop').val()) + "/"
// + (!$('#txtBegintime').val() ? "Null" : $('#txtBegintime').val()) + "/"
// + (!$('#txtEndtime').val() ? "Null" : $('#txtEndtime').val()) + "/"
// + (!$('#txtLotID').val() ? "Null" : $('#LotID').val()) + "/"
// + (!$('#txtContainerNo').val() ? "Null" : $('#txtContainerNo').val()) + "/"
// + (!$('#txtPalletNo').val() ? "Null" : $('#txtPalletNo').val()) + "/"
// + (!$('#txtCheckNo').val() ? "Null" : $('#txtCheckNo').val()) + "' target='_blank'></a>").get(0);
// var e = document.createEvent('MouseEvents');
// e.initEvent('click', true, true);
// a.dispatchEvent(e);
//})