提交 2a6965b5 编写于 作者: doc_wei's avatar doc_wei

feat: 商品库存显示添加仓库查询条件

上级 0236aae5
......@@ -13,10 +13,10 @@ layui.config({
// 加载当前用户所属车间
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryStaffBelongFarmList", params: {}, type: 'json', method: "GET", callback: function(json) {
$("#workshopId").html(getDataUseHandlebars(selTemplate, json));
form.render('select');
initTable();
}, async: false});
$("#workshopId").html(getDataUseHandlebars(selTemplate, json));
form.render('select');
initTable();
}, async: false});
var workshopId = "";
form.on('select(workshopId)', function(data) {
......@@ -25,7 +25,7 @@ layui.config({
loadTable();
});
//车间任务
// 车间任务
function initTable() {
table.render({
id: 'messageTable',
......@@ -39,78 +39,36 @@ layui.config({
limit: getLimit(),
cols: [[
{title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers', rowspan: '2'},
{
field: 'oddNumber', title: '单号', rowspan: '2', width: 200, align: 'center', templet: function (d) {
var str = '<a lay-event="details" class="notice-title-click">' + d.oddNumber + '</a>';
if (!isNull(d.fromId)) {
str += '<span class="state-new">[转]</span>';
}
return str;
{field: 'oddNumber', title: '单号', rowspan: '2', width: 200, align: 'center', templet: function (d) {
var str = '<a lay-event="details" class="notice-title-click">' + d.oddNumber + '</a>';
if (!isNull(d.fromId)) {
str += '<span class="state-new">[转]</span>';
}
},
return str;
} },
{field: 'operTime', title: '单据日期', rowspan: '2', align: 'center', width: 140},
{colspan: '2', title: '来源单据信息', align: 'center'},
{
field: 'processInstanceId', title: '流程ID', rowspan: '2', width: 100, templet: function (d) {
return '<a lay-event="processDetails" class="notice-title-click">' + getNotUndefinedVal(d.processInstanceId) + '</a>';
}
},
{
field: 'state', title: '状态', rowspan: '2', width: 90, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("erpOrderStateEnum", 'id', d.state, 'name');
}
},
{
field: 'otherState', title: '出库状态', rowspan: '2', width: 90, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("outLetState", 'id', d.otherState, 'name');
}
},
{
field: 'createName',
title: systemLanguage["com.skyeye.createName"][languageType],
rowspan: '2',
width: 120
},
{
field: 'createTime',
title: systemLanguage["com.skyeye.createTime"][languageType],
rowspan: '2',
align: 'center',
width: 150
},
{
field: 'lastUpdateName',
title: systemLanguage["com.skyeye.lastUpdateName"][languageType],
rowspan: '2',
align: 'left',
width: 120
},
{
field: 'lastUpdateTime',
title: systemLanguage["com.skyeye.lastUpdateTime"][languageType],
rowspan: '2',
align: 'center',
width: 150
},
{
title: systemLanguage["com.skyeye.operation"][languageType],
rowspan: '2',
fixed: 'right',
align: 'center',
width: 200,
toolbar: '#tableBar'
}
{field: 'processInstanceId', title: '流程ID', rowspan: '2', width: 100, templet: function (d) {
return '<a lay-event="processDetails" class="notice-title-click">' + getNotUndefinedVal(d.processInstanceId) + '</a>';
}},
{field: 'state', title: '状态', rowspan: '2', width: 90, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("erpOrderStateEnum", 'id', d.state, 'name');
}},
{field: 'otherState', title: '出库状态', rowspan: '2', width: 90, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("outLetState", 'id', d.otherState, 'name');
}},
{field: 'createName', title: systemLanguage["com.skyeye.createName"][languageType], rowspan: '2', width: 120 },
{field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], rowspan: '2', align: 'center', width: 150 },
{field: 'lastUpdateName', title: systemLanguage["com.skyeye.lastUpdateName"][languageType], rowspan: '2', align: 'left', width: 120 },
{field: 'lastUpdateTime', title: systemLanguage["com.skyeye.lastUpdateTime"][languageType], rowspan: '2', align: 'center', width: 150 },
{title: systemLanguage["com.skyeye.operation"][languageType], rowspan: '2', fixed: 'right', align: 'center', width: 200, toolbar: '#tableBar' }
], [
{
field: 'fromTypeId', title: '来源类型', width: 150, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("pickFromType", 'id', d.fromTypeId, 'name');
}
},
{
field: 'fromId', title: '单据编号', width: 200, templet: function (d) {
return getNotUndefinedVal(d.fromMation?.oddNumber);
}
}
{field: 'fromTypeId', title: '来源类型', width: 150, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("pickFromType", 'id', d.fromTypeId, 'name');
}},
{field: 'fromId', title: '单据编号', width: 200, templet: function (d) {
return getNotUndefinedVal(d.fromMation?.oddNumber);
}}
]],
done: function (json) {
matchingLanguage();
......@@ -139,9 +97,9 @@ layui.config({
id: data.id,
};
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "receiveMachinProcedureFarm", params: params, type: 'json', method: 'POST', callback: function (json) {
winui.window.msg("接收成功", {icon: 1, time: 2000});
loadTable();
}});
winui.window.msg("接收成功", {icon: 1, time: 2000});
loadTable();
}});
});
});
}
......@@ -153,9 +111,9 @@ layui.config({
id: data.id,
};
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "receptionReceiveMachinProcedureFarm", params: params, type: 'json', method: 'POST', callback: function (json) {
winui.window.msg("反接收成功", {icon: 1, time: 2000});
loadTable();
}});
winui.window.msg("反接收成功", {icon: 1, time: 2000});
loadTable();
}});
});
});
}
......
......@@ -10,16 +10,29 @@ layui.config({
form = layui.form,
table = layui.table,
soulTable = layui.soulTable;
var selTemplate = getFileContent('tpl/template/select-option.tpl');
var categoryId = "";
sysDictDataUtil.showDictDataListByDictTypeCode(sysDictData["erpMaterialCategory"]["key"], 'selectTree', "materialCategoryType", '', form, function () {
initTable();
// 加载当前用户所属仓库
let depotHtml = '';
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryStaffBelongDepotList", params: {}, type: 'json', method: "GET", callback: function(json) {
depotHtml = getDataUseHandlebars(selTemplate, json);
}, async: false});
initTable(depotHtml);
}, function (chooseId) {
categoryId = chooseId;
refreshTable();
});
function initTable(){
var depotId = "";
form.on('select(depotId)', function(data) {
var thisRowValue = data.value;
depotId = isNull(thisRowValue) ? "" : thisRowValue;
loadTable();
});
function initTable(depotHtml){
table.render({
id: 'messageTable',
elem: '#messageTable',
......@@ -58,9 +71,22 @@ layui.config({
return "";
}
$.each(d.materialNorms, function(i, item) {
if (!isNull(item.overAllStock)) {
str += '<span class="layui-badge layui-bg-blue">' + item.name + '' + item.overAllStock.allStock + '】</span><br>';
str += '<span class="layui-badge layui-bg-blue">' + item.name + '';
// 如果仓库ID为空,则显示所有仓库的库存,否则显示当前仓库的库存
if (isNull(depotId)) {
if (!isNull(item.overAllStock)) {
str += item.overAllStock.allStock
} else {
str += 0;
}
} else {
if (!isNull(item.depotTock)) {
str += item.depotTock.allStock;
} else {
str += 0
}
}
str += '】</span><br>';
});
return str;
}},
......@@ -74,7 +100,10 @@ layui.config({
initTableSearchUtil.initAdvancedSearch(this, json.searchFilter, form, "请输入商品名称,型号", function () {
table.reloadData("messageTable", {page: {curr: 1}, where: getTableParams()});
});
}, `<label class="layui-form-label">仓库</label><div class="layui-input-inline">
<select id="depotId" name="depotId" lay-filter="depotId" lay-search="">
${depotHtml}
</select></div>`);
}
});
}
......@@ -93,7 +122,11 @@ layui.config({
}
function getTableParams() {
return $.extend(true, {categoryId: categoryId}, initTableSearchUtil.getSearchValue("messageTable"));
let params = {
depotId: depotId,
categoryId: categoryId
};
return $.extend(true, params, initTableSearchUtil.getSearchValue("messageTable"));
}
exports('materialReserveList', {});
......
......@@ -19,15 +19,17 @@ var initTableSearchUtil = {
* @param form form表单对象
* @param keywordPlaceholder 关键字搜索的提示语
* @param callback 搜索条件点击确定时的回调,用来刷新表格
* @param otherDom 其他dom对象,用来展示其他的元素
*/
initAdvancedSearch: function ($table, searchParams, form, keywordPlaceholder, callback) {
initAdvancedSearch: function ($table, searchParams, form, keywordPlaceholder, callback, otherDom) {
var tableId = $table.id;
// 同一个表格只加载一次
if(isNull(initTableSearchUtil.tableMap[tableId])){
if (isNull(initTableSearchUtil.tableMap[tableId])) {
initTableSearchUtil.tableMap[tableId] = {
table: $table,
searchParams: searchParams,
keywordPlaceholder: keywordPlaceholder,
otherDom: isNull(otherDom) ? '' : otherDom,
callback: callback
};
// 加载筛选条件展示框
......@@ -35,7 +37,7 @@ var initTableSearchUtil = {
// 初始化监听事件
initTableSearchUtil.initEvent(form);
// 加载表格对应的关键字搜索信息
initTableSearchUtil.initTableKeyWordSearch(tableId, keywordPlaceholder);
initTableSearchUtil.initTableKeyWordSearch(tableId, keywordPlaceholder, form, otherDom);
}
if (isNull(searchParams)) {
return;
......@@ -87,12 +89,15 @@ var initTableSearchUtil = {
*
* @param tableId 表格id
* @param keywordPlaceholder 关键字搜索的提示语
* @param form form表单对象
* @param otherDom 其他dom对象,用来展示其他的元素
*/
initTableKeyWordSearch: function (tableId, keywordPlaceholder) {
initTableKeyWordSearch: function (tableId, keywordPlaceholder, form, otherDom) {
if (isNull(keywordPlaceholder) || keywordPlaceholder == "暂不支持搜索") {
return false;
}
var str;
let searchFormDom = '';
if (typeof keywordPlaceholder === 'object') {
str = '<div class="keyword-box">' +
'<input type="text" id="' + tableId + 'KeyWord" placeholder="' + keywordPlaceholder.value + '" class="layui-input search-input-keyword" />' +
......@@ -107,6 +112,14 @@ var initTableSearchUtil = {
'</div>';
}
$(".winui-tool").append(str);
searchFormDom += isNull(otherDom) ? '' : '<div style="margin: 0 auto; padding: 10px 0px 0px 10px;">' +
'<form class="layui-form layui-form-pane" action="" autocomplete="off">' +
'<div class="layui-form-item"><div class="layui-inline">' + otherDom;
searchFormDom += isNull(otherDom) ? '' : '</div></div></form></div>';
$(".winui-tool").parent().before(searchFormDom);
form.render();
// 当对输入框有要求时
if (typeof keywordPlaceholder === 'object') {
// 是否有默认值
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册