旧版报表、仓库
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.
 
 
 
 
 

234 lines
8.3 KiB

let productsinfo = new Vue({
el: '#PackCapacity',
components: {
'BootstrapTable': BootstrapTable
},
data: {
columns: [{
field: 'no',
title: '序号',
sortable: true,
align: "center",
width: 40,
formatter: function (value, row, index) {
//获取每页显示的数量
var pageSize = $('#asd').bootstrapTable('getOptions').pageSize;
//获取当前是第几页
var pageNumber = $('#asd').bootstrapTable('getOptions').pageNumber;
//返回序号,注意index是从0开始的,所以要加上1
return pageSize * (pageNumber - 1) + index + 1;
}
}, {
field: 'descriptions',
title: '车间',
align: 'center'
}, {
field: 'workorder',
title: '工单号',
align: 'center'
}, {
field: 'sale_order',
title: '订单号',
align: 'center'
}, {
field: 'number',
title: '投产数量', //取叠层过站数量
align: 'center'
}, {
field: 'pack',
title: '包装数量',
align: 'center'
}, {
field: 'prop',
title: '包装完成率', // 包装/投产数量
align: 'center'
}],
data: [],
txtSales: '',
txtWO: '',
options: {
pagination: true, //是否显示分页(*)
pageSize: 12, //每页的记录行数(*)
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,
strictSearch: true,
//showColumns: true, //是否显示所有的列
showRefresh: true,
//height: 580,
//onClickRow: function (row, $element, field) {
// console.log(row);
// var flow = row.flow;
// console.log(flow);
// productsinfo.requestApi({
// modulename: "Orders",
// funname: "QueryWorkshop", //BatchRate
// para: { flow: flow },
// success: (res) => {
// console.log(res);
// productsinfo.stations = res;
// //显示工艺流程
// //clearTimeout(produstsinfo.hide);
// $("#flow").slideDown('slow');
// console.log(productsinfo.hide);
// productsinfo.hide = setTimeout(function () { $("#flow").slideUp('slow'); }, 6000);
// $("#flow").mouseover(function () {
// clearTimeout(productsinfo.hide);
// console.log(productsinfo.hide);
// $("#flow").stop(false, true);
// });
// $("#flow").mouseleave(function () {
// $("#flow").slideUp('slow');
// });
// },
// fail: (ex) => {
// console.log(ex);
// }
// })
//}
}
},
created() {
},
mounted() {
var self = this;
self.QueryddlWorkshop();
},
methods: {
//查询表格数据
inquireinfo: function () {
var self = this;
console.log($('#ddlWorkshop').val());
if ($('#ddlWorkshop').val() == null && self.txtWO == '' && self.txtSales == '') {
toastr.warning('请输入查询参数', '', { progressBar: true });
return;
}
var workshop;
if ($('#ddlWorkshop').val() == null) {
workshop = '';
} else {
workshop = $('#ddlWorkshop').val();
};
self.requestApi({
modulename: "DayPackComplete",
funname: "DayPackComplete", //BatchRate
para: { workshop: $('#ddlWorkshop').val(), workorder: self.txtWO, saleorder: self.txtSales },
success: (res) => {
console.log(res);
self.data = res;
},
fail: (ex) => {
console.log(ex);
}
})
},
QueryddlWorkshop: function () {
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
});
});
promiseweld.fail(function (error) {
console.log(error)
alert(error);
});
},
//excel: function () {
// var self = this;
// if ($('#ddlWorkshop').val() == null && self.txtWO == '' && self.txtSales == '') {
// toastr.warning('请输入查询参数', '', { progressBar: true });
// return;
// }
// self.doPost('/Report/PackCapacityExcel', [
// workshop= $('#ddlWorkshop').val(),
// workorder= self.txtWO,
// saleorder= self.txtSales
// ])
//},
//Daterangeini: function () {
// jeDate("#jedatetime", {
// onClose: false,
// theme: { bgcolor: "#00A1CB", color: "#ffffff", pnColor: "#00CCFF" },
// format: "YYYY-MM",
// isinitVal: true,
// })
//},
requestApi: function (config) {//modulename, funname, para, success, fail) {
fetch("/api/" + config.modulename + "/" + config.funname + "", {
method: "post",
headers: {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json"
},
body: JSON.stringify(config.para)
}).then(
(res) => { return res.json() }
).then(
(res) => { config.success(res) }
).catch(
(ex) => { config.fail(ex) }
)
},
form: function (config) {
fetch("/" + config.modulename + "/" + config.funname + "", {
method: "post",
headers: {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json"
},
body: JSON.stringify(config.para)
}).then(
(res) => { return res.json() }
).then(
(res) => { config.success(res) }
).catch(
(ex) => { config.fail(ex) }
)
}
}
});
$('#btnExportExcel').click(function () {
if ($('#ddlWorkshop').val() == null && $('#txtWO').val() == '' && $('#txtSales').val() == '') {
toastr.warning('请输入查询参数', '', { progressBar: true });
return;
}
doPost('/Report/DayPackCompleteExcel', [
workshop = $('#ddlWorkshop').val(),
workorder = $('#txtWO').val(),
saleorder = $('#txtSales').val()
])
})
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
}