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.
702 lines
26 KiB
702 lines
26 KiB
$(document).ready(function () {
|
|
//$('.input-daterange').datepicker({
|
|
// language: 'zh-CN',//显示中文
|
|
// format: 'yyyy-mm-dd HH:ii',
|
|
//});
|
|
//$('#txtEndtime').val(moment().format("YYYY-MM-DD") + "07:20:00");
|
|
//$('#txtBegintime').val(moment().subtract(1, 'days').format("YYYY-MM-DD"));
|
|
Daterangeini();
|
|
//console.log($('#rangetime').val().split(' - ')[1]);
|
|
//console.log($('#rangetime').val().substr(0, 19))
|
|
QueryddlWorkshop();
|
|
$('#ddlStation').val('');
|
|
$('#ddlStation').select2({
|
|
placeholder: "站点",
|
|
allowClear: true
|
|
});
|
|
|
|
|
|
//1.初始化Table
|
|
})
|
|
function QueryddlWorkshop() {
|
|
var promiseweld = $.ajax({
|
|
url: '/api/Orders/QueryWorkshop', //'/api/QC/QueryStatus'
|
|
type: 'post',
|
|
cache: true,
|
|
async: true,
|
|
});
|
|
promiseweld.done(function (r) {
|
|
console.log(r);
|
|
$.each(r.info, function (index, value) {
|
|
console.log(index);
|
|
$("#ddlWorkshop").append("<option value='" + value.area_code + "'>" + value.descriptions + "</option>");
|
|
})
|
|
$('#ddlWorkshop').val('');
|
|
$('#ddlWorkshop').select2({
|
|
placeholder: "车间",
|
|
allowClear: true
|
|
});
|
|
$('#ddlWorkshop').on('select2:select', function (e) {
|
|
QueryddlStatus();
|
|
});
|
|
});
|
|
promiseweld.fail(function (error) {
|
|
console.log(error)
|
|
alert(error);
|
|
});
|
|
}
|
|
function Daterangeini() {
|
|
$('#rangetime').val(moment().subtract('hours', 0).format('YYYY-MM-DD') + ' 07:20:00' + ' - ' + moment().format('YYYY-MM-DD') + ' 19:20:00');
|
|
|
|
|
|
$('#rangetime').daterangepicker(
|
|
{
|
|
//autoUpdateInput: false,
|
|
timePicker: true,
|
|
timePicker24Hour: true,
|
|
"opens": "center",
|
|
'locale': {
|
|
"format": 'YYYY-MM-DD HH:mm:ss',
|
|
"separator": " - ",
|
|
"applyLabel": "确定",
|
|
"cancelLabel": "取消",
|
|
"fromLabel": "起始时间",
|
|
"toLabel": "结束时间'",
|
|
"customRangeLabel": "自定义",
|
|
"weekLabel": "W",
|
|
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
|
|
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
|
"firstDay": 1,
|
|
//"cancelLabel": '清除'
|
|
}
|
|
});
|
|
//$('#rangetime').val('');
|
|
$('#rangetime').on('cancel.daterangepicker', function (ev, picker) {
|
|
$(this).val('');
|
|
});
|
|
}
|
|
function QueryStorageMachineByStatus(processcode, areacode) {
|
|
var promise = $.ajax({
|
|
url: '/api/Orders/QueryMachineByStatus',
|
|
type: 'post',
|
|
cache: true,
|
|
async: true,
|
|
contentType: "application/json",
|
|
data: JSON.stringify({
|
|
processcode: processcode,
|
|
areacode: areacode
|
|
})
|
|
});
|
|
promise.done(function (r) {
|
|
console.log(r)
|
|
var options = '';
|
|
$.each(r.info, function (index, v) {
|
|
options += "<option value='" + v.wks_id + "'>" + v.wks_desc + "</option>";
|
|
});
|
|
$('#ddlMachine').html(options);
|
|
$('#ddlMachine').val('');
|
|
$('#ddlMachine').select2({
|
|
placeholder: "选择机台号",
|
|
allowClear: true
|
|
});
|
|
|
|
});
|
|
promise.fail(function (error) {
|
|
console.log(error)
|
|
alert(error);
|
|
});
|
|
}
|
|
function QueryddlStatus() {
|
|
var promiseweld = $.ajax({
|
|
url: '/api/PackOutput/QueryStatus',
|
|
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
|
|
});
|
|
$('#ddlStation').on('select2:select', function (e) {
|
|
console.log($(this).val());
|
|
var selectvalue1 = $(this).val();
|
|
var selectvalue2 = $('#ddlWorkshop').val()
|
|
QueryStorageMachineByStatus(selectvalue1, selectvalue2);
|
|
});
|
|
});
|
|
promiseweld.fail(function (error) {
|
|
console.log(error)
|
|
alert(error);
|
|
});
|
|
}
|
|
|
|
|
|
$('#btnAllQuery').click(function () {
|
|
if ($('#ddlWorkshop').val() == null && $('#rangetime').val() == '' && $('#ddlStation').val() == null) {
|
|
alert('请输入查询参数');
|
|
return;
|
|
}
|
|
$("#tbqj").bootstrapTable('destroy');//消失各机台
|
|
$("#tbqc").bootstrapTable('destroy');
|
|
var oTable1 = new TableInit1();
|
|
oTable1.Init();
|
|
//修改条件同时进行获取数据
|
|
//$('#ddlWorkshop').on('change', function () {
|
|
// $("#tbqc").bootstrapTable('destroy');
|
|
// var oTable1 = new TableInit1();
|
|
// oTable1.Init();
|
|
//})
|
|
//$('#ddlStation').on('change', function () {
|
|
// $("#tbqc").bootstrapTable('destroy');
|
|
// var oTable1 = new TableInit1();
|
|
// oTable1.Init();
|
|
//})
|
|
})
|
|
|
|
//var TableInit1 = function () {
|
|
// var oTableInit = new Object();
|
|
// //初始化Table
|
|
// oTableInit.Init = function () {
|
|
// $('#tbqc').bootstrapTable({
|
|
// url: '/api/ProductionReport/StationDetailed', //请求后台的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: 15, //每页的记录行数(*)
|
|
// 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'],
|
|
|
|
// onClickRow: function (row) {
|
|
// if (template.defaults.imports.hasPermission('/payment_manager/payment_detail')) {
|
|
// EditBook(row.id);
|
|
// }
|
|
// },
|
|
|
|
// 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: 'descriptions',
|
|
// title: '车间'
|
|
// }, {
|
|
// field: 'process_code',
|
|
// title: '站点'
|
|
// }, {
|
|
// field: 'serial_nbr',
|
|
// title: '序列号'
|
|
// }, {
|
|
// field: 'workorder',
|
|
// title: '工单'
|
|
// }, {
|
|
// field: 'wks_id',
|
|
// title: '机台'
|
|
// }
|
|
// , {
|
|
// field: 'el_grade',
|
|
// title: 'EL等级'
|
|
// }, {
|
|
// field: 'final_grade',
|
|
// title: '最终等级'
|
|
// }, {
|
|
// field: 'wks_visit_date',
|
|
// title: '过站时间'
|
|
// }, {
|
|
// field: 'operator',
|
|
// title: '操作人员'
|
|
// }, {
|
|
// field: 'ZT',
|
|
// title: '状态'
|
|
// }, {
|
|
// field: 'MS',
|
|
// title: '不良描述'
|
|
// }
|
|
|
|
// ]
|
|
// });
|
|
// };
|
|
|
|
// ////表格超链接方法
|
|
// //function aFormatter(value, row, index) {
|
|
// // return [
|
|
// // '<a href="#" >链接</a>'
|
|
// // ].join("")
|
|
// //}
|
|
|
|
//得到查询的参数
|
|
// oTableInit.queryParams = function (params) {
|
|
// var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
|
// limit: params.limit, //页面大小
|
|
// offset: params.offset, //页码
|
|
// //departmentname: $("#txt_search_departmentname").val(),
|
|
// //statu: $("#txt_search_statu").val()
|
|
// //behintime: $('#txtBegintime').val(),
|
|
// //endtime: $('#txtEndtime').val(),
|
|
// behintime: $('#rangetime').val().substr(0, 19),//$('#txtBegintime').val(),
|
|
// endtime: $('#rangetime').val().split(' - ')[1],
|
|
// workshop: $('#ddlWorkshop').val(),
|
|
// station: $('#ddlStation').val(),
|
|
// // wks_id: $('#ddlMachine').val(),
|
|
// workorder: $('#workorder').val(),
|
|
// // saleorder: $('#saleorder').val(),
|
|
|
|
// };
|
|
// return temp;
|
|
// };
|
|
// return oTableInit;
|
|
//}
|
|
//查询按钮
|
|
|
|
$('#btnQuery').click(function ()
|
|
{
|
|
if ($('#ddlWorkshop').val() == null && $('#rangetime').val() == '' && $('#ddlStation').val() == null && $('#workorder').val() == '') {
|
|
alert('请输入查询参数');
|
|
return;
|
|
} else if ($('#ddlStation').val() == null) {
|
|
alert('请优先输入站站点信息')
|
|
return;
|
|
}
|
|
console.log($('#ddlWorkshop').val())
|
|
$("#tbqc").bootstrapTable('destroy');
|
|
var oTable = new TableInit();
|
|
oTable.Init();
|
|
//var $workshop = $('#ddlWorkshop').val();
|
|
//var $station = $('#ddlStation').val();
|
|
//console.log($workshop);
|
|
//if ($workshop != null && $station != null) {
|
|
// $("#tbqj").bootstrapTable('refresh');
|
|
// var oTable2 = new TableInit2();
|
|
// oTable2.Init();
|
|
//} else {
|
|
// $("#tbqj").bootstrapTable('destroy');
|
|
//}
|
|
//修改值
|
|
//$('#ddlWorkshop').on('change', function () {changes()})
|
|
//$('#ddlStation').on('change', function () { changes() })
|
|
})
|
|
//按条件来进行刷新
|
|
//var changes = function () {
|
|
// var $workshop = $('#ddlWorkshop').val();
|
|
// var $station = $('#ddlStation').val();
|
|
// if ($workshop != null || $station != null) {
|
|
// $("#tbqj").bootstrapTable('destroy');
|
|
// var oTable2 = new TableInit2();
|
|
// oTable2.Init();
|
|
// $("#tbqc").bootstrapTable('destroy');
|
|
// var oTable = new TableInit();
|
|
// oTable.Init();
|
|
// } else {
|
|
// $("#tbqj").bootstrapTable('destroy');
|
|
// $("#tbqc").bootstrapTable('destroy');
|
|
// var oTable = new TableInit();
|
|
// oTable.Init();
|
|
// }
|
|
|
|
|
|
//}
|
|
//查询按钮
|
|
var TableInit = function () {
|
|
var oTableInit = new Object();
|
|
//初始化Table
|
|
oTableInit.Init = function () {
|
|
$('#tbqc').bootstrapTable({
|
|
url: '/api/ShiftProduction/ShiftProduction', //请求后台的URL(*)
|
|
method: 'post', //请求方式(*)
|
|
toolbar: '#toolbar', //工具按钮用哪个容器
|
|
striped: true, //是否显示行间隔色
|
|
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
pagination: false, //是否显示分页(*)
|
|
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'));
|
|
//for (var i = 0; i < 2; i++) {
|
|
// mergeCells(data, Object.keys(data[0])[i], 1, $('#tbqc'));
|
|
//}
|
|
//console.log(data);
|
|
},
|
|
columns: [{
|
|
checkbox: true
|
|
}, {
|
|
field: 'shift_type',
|
|
title: '班组编号',
|
|
align:'center'
|
|
//formatter: aFormatter //添加超链接的方法
|
|
},
|
|
{
|
|
field: 'shift_name',
|
|
title: '班组名称',
|
|
align: 'center'
|
|
}, {
|
|
field: 'mod_spec_value',
|
|
title: '计划规格',
|
|
align: 'center'
|
|
}, {
|
|
field: 'qty',
|
|
title: '数量',
|
|
align: 'center',
|
|
cellStyle: { css: { 'background-color': '#dcdcdc' } }
|
|
}
|
|
|
|
],
|
|
onClickRow: function (row, $element, field) {
|
|
index = $element.data('index');
|
|
console.log(index);
|
|
console.log(field);
|
|
console.log(row);
|
|
if (field == 'qty') {
|
|
//var workorder = row.workorder;
|
|
var station = null;
|
|
switch (field) {
|
|
case 'qty': station = '数量'
|
|
break;
|
|
}
|
|
|
|
} else {
|
|
return;
|
|
}
|
|
console.log(field);
|
|
console.log(row[field]);
|
|
var value = row[field];
|
|
if (value != 0) {
|
|
var workorder = $('#workorder').val();
|
|
var workshop = $('#ddlWorkshop').val();
|
|
//var saleorder = $('#saleorder').val();
|
|
var type = row.shift_type;
|
|
var mod = row.mod_spec_value;
|
|
var begintime = $('#rangetime').val().substr(0, 19);
|
|
var endtime = $('#rangetime').val().split(' - ')[1];
|
|
var station = $('#ddlStation').val();
|
|
if (begintime == "") {
|
|
begintime = "";
|
|
endtime = "";
|
|
}
|
|
//console.log(workorder + '--' + workshop + '--' + field);
|
|
$('#RoleModal').modal({ backdrop: 'static', keyboard: false });
|
|
dataline(workshop, workorder,station, begintime, endtime, type,mod);
|
|
$('#detaInfoExcel').on('click', function () { excel(workshop, workorder, station, begintime, endtime,type,mod) });
|
|
|
|
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
////表格超链接方法
|
|
//function aFormatter(value, row, index) {
|
|
// return [
|
|
// '<a href="#" >链接</a>'
|
|
// ].join("")
|
|
//}
|
|
|
|
//得到查询的参数
|
|
oTableInit.queryParams = function (params) {
|
|
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
|
limit: params.limit, //页面大小
|
|
offset: params.offset, //页码
|
|
//departmentname: $("#txt_search_departmentname").val(),
|
|
//statu: $("#txt_search_statu").val()
|
|
//behintime: $('#txtBegintime').val(),
|
|
//endtime: $('#txtEndtime').val(),
|
|
begintime: $('#rangetime').val().substr(0, 19),//$('#txtBegintime').val(),
|
|
endtime: $('#rangetime').val().split(' - ')[1],
|
|
workshop: $('#ddlWorkshop').val(),
|
|
station: $('#ddlStation').val(),
|
|
workorder: $('#workorder').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;
|
|
}
|
|
}
|
|
//弹框查明细以及导出
|
|
|
|
function dataline(workshop, workorder, station, begintime, endtime,type,mod) {
|
|
//console.log(workorder + '--' + workshop + '--' + field)
|
|
$('#smalltable').bootstrapTable('destroy').bootstrapTable({
|
|
striped: true,
|
|
url: '/api/ShiftProduction/ShiftProduction',
|
|
method: 'post', //请求方式(*)
|
|
toolbar: '#toolbar', //工具按钮用哪个容器
|
|
striped: true, //是否显示行间隔色
|
|
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
sortable: false, //是否启用排序
|
|
sortOrder: "asc", //排序方式
|
|
height: 500,
|
|
queryParams: queryParams,//传递参数(*)
|
|
sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
|
|
contentType: 'application/json',
|
|
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
|
strictSearch: true,
|
|
minimumCountColumns: 2, //最少允许的列数
|
|
clickToSelect: false, //是否启用点击选中行
|
|
exportDataType: "all", //basic', 'all', 'selected'.
|
|
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
|
|
onLoadSuccess: function (data) { console.log(data) },
|
|
columns: [{
|
|
title: '序号',
|
|
align: 'center',
|
|
formatter: function (value, row, index) {
|
|
return ++index;
|
|
}
|
|
},
|
|
{
|
|
field: 'descriptions',
|
|
title: '车间',
|
|
align: 'center'
|
|
}, {
|
|
field: 'shift_name',
|
|
title: '班组',
|
|
align: 'center'
|
|
}, {
|
|
field: 'serial_nbr',
|
|
title: '序列号',
|
|
align: 'center'
|
|
}, {
|
|
field: 'mod_spec_value',
|
|
title: '版型',
|
|
align: 'center'
|
|
}, {
|
|
field: 'process_desc',
|
|
title: '站点',
|
|
align: 'center'
|
|
}, {
|
|
field: 'wks_desc',
|
|
title: '机台号',
|
|
align: 'center'
|
|
}, {
|
|
field: 'wks_visit_date',
|
|
title: '过站时间',
|
|
align: 'center'
|
|
},
|
|
{
|
|
field: 'workorder',
|
|
title: '工单号',
|
|
align: 'center'
|
|
},
|
|
{
|
|
field: 'product_code',
|
|
title: '产品型号',
|
|
align: 'center'
|
|
},
|
|
{
|
|
field: 'lot_nbr',
|
|
title: '批号',
|
|
align: 'center'
|
|
},
|
|
{
|
|
field: 'supplier_code',
|
|
title: '供应商编号',
|
|
align: 'center'
|
|
},
|
|
{
|
|
field: 'supplier_desc',
|
|
title: '供应商名称',
|
|
align: 'center'
|
|
},
|
|
{
|
|
field: 'final_grade',
|
|
title: '最终等级',
|
|
align: 'center'
|
|
}
|
|
|
|
]
|
|
});
|
|
//queryParams(workshop, workorder, field);
|
|
function queryParams(params) {
|
|
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
|
limit: params.limit, //页面大小
|
|
offset: params.offset, //页码
|
|
workshop: workshop,
|
|
workorder: workorder,
|
|
//worktime:worktime,
|
|
station: station,
|
|
begintime: begintime,
|
|
endtime: endtime,
|
|
type: type,
|
|
mod:mod
|
|
|
|
};
|
|
return temp;
|
|
};
|
|
|
|
}
|
|
|
|
//弹框
|
|
//弹框导出
|
|
function excel(workshop, workorder, station, bt, et, type,mod) {
|
|
//console.log(workorder + '--' + workshop + '--' + field);
|
|
doPost('/Report/ShiftDataExcel', [
|
|
workshop = workshop,
|
|
workorder = workorder,
|
|
//saleorder = saleorder,
|
|
station = station,
|
|
bt = bt,
|
|
et = et,
|
|
type = type,
|
|
mod=mod
|
|
])
|
|
}
|
|
//各站点机台过站数弹框导出
|
|
function excel2(workshop, workorder, saleorder, station, wksid, bt, et, field) {
|
|
console.log(workorder + '--' + workshop + '--' + field);
|
|
doPost('/Report/WksDataExcel', [
|
|
workshop = workshop,
|
|
workorder = workorder,
|
|
saleorder = saleorder,
|
|
station = station,
|
|
wksid = wksid,
|
|
bt = bt,
|
|
et = et,
|
|
field = field])
|
|
}
|
|
function doPost(to, p) { // to:提交动作(action),p:参数
|
|
var myForm = document.createElement("form");
|
|
myForm.method = "post";
|
|
myForm.action = to;
|
|
for (var i in p) {
|
|
var myInput = document.createElement("input");
|
|
myInput.setAttribute("name", "para"); // 为input对象设置name
|
|
myInput.setAttribute("value", p[i]); // 为input对象设置value
|
|
myForm.appendChild(myInput);
|
|
}
|
|
document.body.appendChild(myForm);
|
|
myForm.submit();
|
|
document.body.removeChild(myForm); // 提交后移除创建的form
|
|
}
|
|
|
|
//导出excel
|
|
$('#btnExportExcel').click(function () {
|
|
console.log("clicked");
|
|
if ($('#ddlWorkshop').val() == null && $('#rangetime').val() == '' && $('#ddlStation').val() == null && $('#workorder').val() == '' && $('#saleorder').val() == '') {
|
|
alert('请输入查询参数');
|
|
return;
|
|
}
|
|
var bt = $('#rangetime').val().substr(0, 19);
|
|
var et = $('#rangetime').val().split(' - ')[1];
|
|
if (bt == '') {
|
|
et = '';
|
|
} else {
|
|
et = $('#rangetime').val().split(' - ')[1];
|
|
}
|
|
var a = $("<a href='/Report/ShiftProductionExcel/"
|
|
+ (!$('#ddlWorkshop').val() ? "Null" : $('#ddlWorkshop').val()) + "/"
|
|
+ (bt == '' ? 'Null' : encodeURI(bt)) + "/"
|
|
+ (et == '' ? 'Null' : encodeURI(et)) + "/"
|
|
+ (!$('#ddlStation').val() ? "Null" : $('#ddlStation').val()) + "/"
|
|
+ (!$('#workorder').val() ? "Null" : $('#workorder').val())
|
|
+ "'target='_blank'></a>").get(0);
|
|
var e = document.createEvent('MouseEvents');
|
|
e.initEvent('click', true, true);
|
|
a.dispatchEvent(e);
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|