优化报表的查询

This commit is contained in:
季圣华
2020-06-05 00:02:55 +08:00
parent c46ab52362
commit e8e43675fb
14 changed files with 225 additions and 394 deletions

View File

@@ -29,6 +29,18 @@
class="txt Wdate width-160" style="height: 30px;border: 1px solid #95B8E7;border-radius:5px;"/>
</div>
</div>
<div class="form-group">
<label class="control-label">名称:</label>
<div class="control-inline">
<input name="mName" id="mName" style="width:100px;"></input>
</div>
</div>
<div class="form-group">
<label class="control-label">型号:</label>
<div class="control-inline">
<input type="text" name="mModel" id="mModel" class="easyui-textbox" style="width:100px;"></input>
</div>
</div>
<div class="form-group">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>&nbsp;
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-print" id="printBtn">打印</a>
@@ -43,6 +55,7 @@
$(function () {
var thisDate = getNowFormatMonth(); //当前月份
$("#searchMonth").val(thisDate);
initMaterialNameList();
initMProperty(); //初始化商品属性
initTableData();
ininPager();
@@ -50,6 +63,21 @@
print();
});
//初始化商品名称模糊匹配
function initMaterialNameList() {
$('#mName').combobox({
method:"get",
url: "/material/getMaterialNameList",
valueField: 'value',
textField: 'text',
hasDownArrow: false,
filter: function(q, row){
var opts = $(this).combobox('options');
return row[opts.textField].indexOf(q) >-1;
}
});
}
//初始化商品属性
function initMProperty() {
$.ajax({
@@ -184,64 +212,20 @@
function showDetails(pageNo, pageSize) {
$.ajax({
type: "get",
url: "/depotHead/findByMonth",
type: "post",
url: "/depotItem/buyIn",
dataType: "json",
data: ({
monthTime: $("#searchMonth").val()
currentPage: pageNo,
pageSize: pageSize,
monthTime: $("#searchMonth").val(),
name: $("#mName").combobox("getValue"),
model: $("#mModel").textbox("getValue"),
mpList: mPropertyList
}),
success: function (res) {
if(res && res.code === 200 && res.data) {
var HeadIds = res.data.HeadIds;
if (HeadIds) {
//获取排序后的产品ID
$.ajax({
type: "get",
url: "/material/findByOrder",
dataType: "json",
success: function (res) {
if(res && res.code === 200 && res.data) {
var mIds = res.data.mIds;
if (mIds) {
$.ajax({
type: "post",
url: "/depotItem/buyIn",
dataType: "json",
data: ({
currentPage: pageNo,
pageSize: pageSize,
monthTime: $("#searchMonth").val(),
headIds: HeadIds,
materialIds: mIds,
mpList: mPropertyList
}),
success: function (res) {
if (res && res.code === 200 && res.data) {
$("#tableData").datagrid('loadData', res.data);
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
}
else {
$.messager.alert('查询提示', '本月无数据!', 'error');
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
}
else {
$.messager.alert('查询提示', '本月无数据!', 'error');
}
if (res && res.code === 200 && res.data) {
$("#tableData").datagrid('loadData', res.data);
}
},
//此处添加错误处理

View File

@@ -316,112 +316,69 @@
});
function showEachDetails(pageNo, pageSize) {
$.ajax({
type: "get",
url: "/depotHead/findByMonth",
dataType: "json",
data: ({
monthTime: $("#searchMonth").val()
}),
success: function (res) {
if(res && res.code === 200 && res.data) {
var HeadIds = res.data.HeadIds;
if (HeadIds) {
//获取排序后的产品ID
$.ajax({
type: "get",
url: "/material/findByOrder",
dataType: "json",
data: ({
name: $("#mName").combobox("getValue"),
model: $("#mModel").textbox("getValue")
}),
success: function (res) {
if(res && res.code === 200 && res.data) {
var mIds = res.data.mIds;
if (mIds) {
if (pageSize === 3000) {
window.location.href = "/depotItem/exportExcel?browserType=" + getOs() + "&currentPage=" + pageNo + "&pageSize=" + pageSize + "&depotId=" + $.trim($("#searchProjectId").val()) + "&monthTime=" + $("#searchMonth").val() + "&headIds=" + HeadIds + "&materialIds=" + mIds;
}
else {
$.ajax({
type: "post",
url: "/depotItem/findByAll",
dataType: "json",
data: ({
currentPage: pageNo,
pageSize: pageSize,
depotId: $.trim($("#searchProjectId").val()),
monthTime: $("#searchMonth").val(),
headIds: HeadIds,
materialIds: mIds,
mpList: mPropertyList
}),
success: function (res) {
if(res && res.code === 200) {
$("#tableData").datagrid('loadData', res.data);
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
//总金额
$.ajax({
type: "post",
url: "/depotItem/totalCountMoney",
dataType: "json",
data: ({
depotId: $.trim($("#searchProjectId").val()),
monthTime: $("#searchMonth").val(),
headIds: HeadIds,
materialIds: mIds
}),
success: function (res) {
if(res && res.code === 200) {
if(res.data && res.data.totalCount) {
var count = res.data.totalCount.toString();
if (count.lastIndexOf('.') > -1) {
count = count.substring(0, count.lastIndexOf('.') + 3);
}
$("#tablePanel .total-count").text("本月合计金额:" + count + "");//本月合计金额
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
}
}
else {
$.messager.alert('查询提示', '本月无数据!', 'error');
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
}
else {
$.messager.alert('查询提示', '本月无数据!', 'error');
if (pageSize === 3000) {
window.location.href = "/depotItem/exportExcel?browserType=" + getOs()
+ "&currentPage=" + pageNo + "&pageSize=" + pageSize
+ "&depotId=" + $.trim($("#searchProjectId").val())
+ "&monthTime=" + $("#searchMonth").val()
+ "&name=" + $("#mName").combobox("getValue")
+ "&model=" + $("#mModel").textbox("getValue");
}
else {
$.ajax({
type: "post",
url: "/depotItem/findByAll",
dataType: "json",
data: ({
currentPage: pageNo,
pageSize: pageSize,
depotId: $.trim($("#searchProjectId").val()),
monthTime: $("#searchMonth").val(),
name: $("#mName").combobox("getValue"),
model: $("#mModel").textbox("getValue"),
mpList: mPropertyList
}),
success: function (res) {
if(res && res.code === 200) {
$("#tableData").datagrid('loadData', res.data);
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
});
//总金额
$.ajax({
type: "post",
url: "/depotItem/totalCountMoney",
dataType: "json",
data: ({
depotId: $.trim($("#searchProjectId").val()),
monthTime: $("#searchMonth").val(),
name: $("#mName").combobox("getValue"),
model: $("#mModel").textbox("getValue")
}),
success: function (res) {
if(res && res.code === 200) {
if(res.data && res.data.totalCount) {
var count = res.data.totalCount.toString();
if (count.lastIndexOf('.') > -1) {
count = count.substring(0, count.lastIndexOf('.') + 3);
}
$("#tablePanel .total-count").text("本月合计金额:" + count + "");//本月合计金额
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
}
}
//报表打印

View File

@@ -29,6 +29,18 @@
class="txt Wdate width-160" style="height: 30px;border: 1px solid #95B8E7;border-radius:5px;"/>
</div>
</div>
<div class="form-group">
<label class="control-label">名称:</label>
<div class="control-inline">
<input name="mName" id="mName" style="width:100px;"></input>
</div>
</div>
<div class="form-group">
<label class="control-label">型号:</label>
<div class="control-inline">
<input type="text" name="mModel" id="mModel" class="easyui-textbox" style="width:100px;"></input>
</div>
</div>
<div class="form-group">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>&nbsp;
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-print" id="printBtn">打印</a>
@@ -47,6 +59,7 @@
$("#searchTable .tip").css("padding-left", "15px").css("color", "red");
var thisDate = getNowFormatMonth(); //当前月份
$("#searchMonth").val(thisDate);
initMaterialNameList();
initMProperty(); //初始化商品属性
initTableData();
ininPager();
@@ -54,6 +67,21 @@
print();
});
//初始化商品名称模糊匹配
function initMaterialNameList() {
$('#mName').combobox({
method:"get",
url: "/material/getMaterialNameList",
valueField: 'value',
textField: 'text',
hasDownArrow: false,
filter: function(q, row){
var opts = $(this).combobox('options');
return row[opts.textField].indexOf(q) >-1;
}
});
}
//初始化商品属性
function initMProperty() {
$.ajax({
@@ -191,72 +219,28 @@
function showDetails(pageNo, pageSize) {
$.ajax({
type: "get",
url: "/depotHead/findByMonth",
type: "post",
url: "/depotItem/saleOut",
dataType: "json",
data: ({
monthTime: $("#searchMonth").val()
currentPage: pageNo,
pageSize: pageSize,
monthTime: $("#searchMonth").val(),
name: $("#mName").combobox("getValue"),
model: $("#mModel").textbox("getValue"),
mpList: mPropertyList
}),
success: function (res) {
if(res && res.code === 200 && res.data) {
var HeadIds = res.data.HeadIds;
if (HeadIds) {
//获取排序后的产品ID
$.ajax({
type: "get",
url: "/material/findByOrder",
dataType: "json",
success: function (res) {
if (res && res.code === 200 && res.data) {
var mIds = res.data.mIds;
if (mIds) {
$.ajax({
type: "post",
url: "/depotItem/saleOut",
dataType: "json",
data: ({
currentPage: pageNo,
pageSize: pageSize,
monthTime: $("#searchMonth").val(),
headIds: HeadIds,
materialIds: mIds,
mpList: mPropertyList
}),
success: function (res) {
if (res && res.code === 200) {
$("#tableData").datagrid('loadData', res.data);
}
var total = 0;
res.data.rows.forEach(function(value, index, array){
//执行某些操作
total += value.OutInSumPrice;
})
$(".first-total").text(total); //当前总余额
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
}
else {
$.messager.alert('查询提示', '本月无数据!', 'error');
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
}
else {
$.messager.alert('查询提示', '本月无数据!', 'error');
}
if (res && res.code === 200) {
$("#tableData").datagrid('loadData', res.data);
}
var total = 0;
res.data.rows.forEach(function(value, index, array){
//执行某些操作
total += value.OutInSumPrice;
})
$(".first-total").text(total); //当前总余额
},
//此处添加错误处理
error: function () {