优化报表的查询

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);
}
},
//此处添加错误处理