From 2a6965b59a402b41ce0987f004c9c9359dcb0dba Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Sun, 21 Jul 2024 21:37:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=95=86=E5=93=81=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=B7=BB=E5=8A=A0=E4=BB=93=E5=BA=93=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/workshopTasks/workshopTasksList.js | 116 ++++++------------ .../js/material/materialReserveList.js | 45 ++++++- .../customer/tableUtil/initTableSearchUtil.js | 21 +++- 3 files changed, 93 insertions(+), 89 deletions(-) diff --git a/erp-produce/src/main/resources/template/js/workshopTasks/workshopTasksList.js b/erp-produce/src/main/resources/template/js/workshopTasks/workshopTasksList.js index ad492c042..19739dce2 100644 --- a/erp-produce/src/main/resources/template/js/workshopTasks/workshopTasksList.js +++ b/erp-produce/src/main/resources/template/js/workshopTasks/workshopTasksList.js @@ -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 = '' + d.oddNumber + ''; - if (!isNull(d.fromId)) { - str += '[转]'; - } - return str; + {field: 'oddNumber', title: '单号', rowspan: '2', width: 200, align: 'center', templet: function (d) { + var str = '' + d.oddNumber + ''; + if (!isNull(d.fromId)) { + str += '[转]'; } - }, + 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 '' + getNotUndefinedVal(d.processInstanceId) + ''; - } - }, - { - 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 '' + getNotUndefinedVal(d.processInstanceId) + ''; + }}, + {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(); + }}); }); }); } diff --git a/erp/src/main/resources/template/js/material/materialReserveList.js b/erp/src/main/resources/template/js/material/materialReserveList.js index c5eccf2e1..d2707c2e9 100644 --- a/erp/src/main/resources/template/js/material/materialReserveList.js +++ b/erp/src/main/resources/template/js/material/materialReserveList.js @@ -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 += '' + item.name + '【' + item.overAllStock.allStock + '】
'; + str += '' + 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 += '】
'; }); return str; }}, @@ -74,7 +100,10 @@ layui.config({ initTableSearchUtil.initAdvancedSearch(this, json.searchFilter, form, "请输入商品名称,型号", function () { table.reloadData("messageTable", {page: {curr: 1}, where: getTableParams()}); - }); + }, `
+
`); } }); } @@ -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', {}); diff --git a/web/src/main/resources/template/assets/lib/layui/customer/tableUtil/initTableSearchUtil.js b/web/src/main/resources/template/assets/lib/layui/customer/tableUtil/initTableSearchUtil.js index 181488ece..76ec0d81e 100644 --- a/web/src/main/resources/template/assets/lib/layui/customer/tableUtil/initTableSearchUtil.js +++ b/web/src/main/resources/template/assets/lib/layui/customer/tableUtil/initTableSearchUtil.js @@ -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 = '
' + '' + @@ -107,6 +112,14 @@ var initTableSearchUtil = { '
'; } $(".winui-tool").append(str); + + searchFormDom += isNull(otherDom) ? '' : '
' + + '
' + + '
' + otherDom; + searchFormDom += isNull(otherDom) ? '' : '
'; + $(".winui-tool").parent().before(searchFormDom); + + form.render(); // 当对输入框有要求时 if (typeof keywordPlaceholder === 'object') { // 是否有默认值 -- GitLab