From 56ecbc13ad906b29638d3c8d73127279a2b30a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LAPTOP-NDCM9L6Q=5C=E7=8E=8B=E4=B8=BD=E9=9B=85?= <1970384016@qq.com> Date: Mon, 22 Jul 2024 10:14:38 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=E4=BF=AE=E6=94=B9=E7=94=98?= =?UTF-8?q?=E7=89=B9=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/departmentMachining/arrange.js | 151 +++++++++++++++++ .../departmentMachining/arrangeFarmChoose.js | 155 ++++++++++++++++++ .../js/departmentMachining/machiningGantt.js | 4 +- .../preProductionTurnToProduction.js | 1 - .../template/js/processOut/processOutList.js | 0 .../workshopTaskArrangementList.js | 0 .../tpl/departmentMachining/arrange.html | 72 ++++++++ .../arrangeFarmChoose.html | 28 ++++ .../tpl/processOut/processOutList.html | 10 -- .../workshopTaskArrangementList.html | 10 -- 10 files changed, 409 insertions(+), 22 deletions(-) create mode 100644 erp-produce/src/main/resources/template/js/departmentMachining/arrange.js create mode 100644 erp-produce/src/main/resources/template/js/departmentMachining/arrangeFarmChoose.js delete mode 100644 erp-produce/src/main/resources/template/js/processOut/processOutList.js delete mode 100644 erp-produce/src/main/resources/template/js/workshopTaskArrangement/workshopTaskArrangementList.js create mode 100644 erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html create mode 100644 erp-produce/src/main/resources/template/tpl/departmentMachining/arrangeFarmChoose.html delete mode 100644 erp-produce/src/main/resources/template/tpl/processOut/processOutList.html delete mode 100644 erp-produce/src/main/resources/template/tpl/workshopTaskArrangement/workshopTaskArrangementList.html diff --git a/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js b/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js new file mode 100644 index 000000000..a5df66c64 --- /dev/null +++ b/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js @@ -0,0 +1,151 @@ + +// 已经选择的资产集合key:表格的行trId,value:资产信息 +// 改 +var allChooseFarm = {}; + +layui.config({ + base: basePath, + version: skyeyeVersion +}).extend({ + window: 'js/winui.window' +}).define(['window', 'table','jquery', 'winui', 'form'], function (exports) { + winui.renderColor(); + var index = parent.layer.getFrameIndex(window.name); + var $ = layui.$, + form = layui.form, + table = layui.table; + var selTemplate = getFileContent('tpl/template/select-option.tpl'); + let farmId = getNotUndefinedVal(GetUrlParam("id")); + // 改 + let assetMap = {}; + + initTableChooseUtil.initTable({ + id: "arrangeList", + cols: [ + {id: 'workshopId', title: '安排车间', formType: 'input', width: '150', verify: 'required'}, + {id: 'operNumber', title: '安排任务数量', formType: 'input', width: '140', verify: 'required|number'} + ], + deleteRowCallback: function (trcusid) { + delete allChooseFarm[trcusid]; + }, + addRowCallback: function (trcusid) { + if (!isNull(farmId)) { + if (isNull(assetMap[farmId])) { + AjaxPostUtil.request({url: sysMainMation.admBasePath + "queryAssetById", params: {"id": farmId}, type: 'json', method: 'GET', callback: function (json) { + assetMap[farmId] = json.bean + }, async: false}); + } + let chooseAssetMation = assetMap[farmId] + // 获取表格行号 + var thisRowKey = trcusid.replace("tr", ""); + // 资产名称赋值 + $("#farmId" + thisRowKey).val(chooseAssetMation.name); + $("#farmId" + thisRowKey).attr(initTableChooseUtil.chooseInputDataIdKey, chooseAssetMation.id); + // 资产赋值 + // 车间赋值 + allChooseFarm[trcusid] = chooseAssetMation; + } + }, + form: form, + minData: 1 + }); + + $("body").on("click", "farmId", function (e) { + // 查询车间列表 + AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page:1,limit:30}, type: 'json', method: "POST", callback: function(json) { + console.log(666,json) + // $("#workshopId").html(getDataUseHandlebars(selTemplate, json)); + // form.render('select'); + // initTable(); + }, async: false}); + }); + + var workshopId = ""; + form.on('select(workshopId)', function(data) { + var thisRowValue = data.value; + workshopId = isNull(thisRowValue) ? "" : thisRowValue; + loadTable(); + }); + + // AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page: page, limit: 15}, type: 'json', method: 'POST', callback: function (json) { + // parent.layer.close(index); + // parent.refreshCode = '0'; + // }}); + + matchingLanguage(); + form.render(); + form.on('submit(formAddBean)', function (data) { + if (winui.verifyForm(data.elem)) { + var result = initTableChooseUtil.getDataList('arrangeList'); + if (!result.checkResult) { + return false; + } + var noError = false; + var tableData = []; + $.each(result.dataList, function(i, item) { + // 获取行编号 + var thisRowKey = item["trcusid"].replace("tr", ""); + if (parseInt(item.operNumber) == 0) { + $("#operNumber" + thisRowKey).addClass("layui-form-danger"); + $("#operNumber" + thisRowKey).focus(); + winui.window.msg('数量不能为0', {icon: 2, time: 2000}); + noError = true; + return false; + } + // 车间对象 + // 更换下面两个 + // assert + // allChooseAsset + // inTableDataArrayByAssetarId + var farm = allChooseFarm["tr" + thisRowKey]; + if (inTableDataArrayByAssetarId(farm.id, tableData)) { + winui.window.msg('一张单中不允许出现相同的资产信息.', {icon: 2, time: 2000}); + noError = true; + return false; + } + item["farmId"] = farm.id; + tableData.push(item); + }); + if (noError) { + return false; + } + + var params = { + list: JSON.stringify(tableData), + }; + AjaxPostUtil.request({url: sysMainMation.admBasePath + "insertAssetReport", params: params, type: 'json', method: 'POST', callback: function (json) { + parent.layer.close(index); + parent.refreshCode = '0'; + }}); + } + return false; + }); + + // 判断选中的资产是否也在数组中 + function inTableDataArrayByAssetarId(farmId, array) { + var isIn = false; + $.each(array, function(i, item) { + if(item.farmId === farmId) { + isIn = true; + return false; + } + }); + return isIn; + } + + $("body").on("click", "#cancle", function() { + parent.layer.close(index); + }); + + function loadTable() { + table.reloadData("messageTable", {where: getTableParams()}); + } + + function getTableParams() { + var params = { + type: 'farm', + objectId: workshopId + } + return $.extend(true, params, initTableSearchUtil.getSearchValue("messageTable")); + } +}); \ No newline at end of file diff --git a/erp-produce/src/main/resources/template/js/departmentMachining/arrangeFarmChoose.js b/erp-produce/src/main/resources/template/js/departmentMachining/arrangeFarmChoose.js new file mode 100644 index 000000000..5aa03f2db --- /dev/null +++ b/erp-produce/src/main/resources/template/js/departmentMachining/arrangeFarmChoose.js @@ -0,0 +1,155 @@ + +var rowId = ""; + +layui.config({ + base: basePath, + version: skyeyeVersion +}).extend({ + window: 'js/winui.window' +}).define(['window', 'table', 'jquery', 'winui', 'form', 'tableCheckBoxUtil'], function (exports) { + winui.renderColor(); + var index = parent.layer.getFrameIndex(window.name); + var $ = layui.$, + form = layui.form, + table = layui.table, + tableCheckBoxUtil = layui.tableCheckBoxUtil; + + // 选择类型,默认单选,true:多选,false:单选 + // var assetCheckType = isNull(parent.adminAssistantUtil.assetCheckType) ? false : parent.adminAssistantUtil.assetCheckType; + + // 设置提示信息 + var s = '资产选择规则:'; + if(assetCheckType){ + s += '1.多选;如没有查到要选择的资产,请检查资产信息是否满足当前规则。'; + // 多选保存的资产对象信息 + var checkAssetMation = [].concat(parent.adminAssistantUtil.checkAssetMation); + // 初始化值 + var ids = []; + $.each(checkAssetMation, function(i, item) { + ids.push(item.id); + }); + tableCheckBoxUtil.setIds({ + gridId: 'messageTable', + fieldName: 'id', + ids: ids + }); + tableCheckBoxUtil.init({ + gridId: 'messageTable', + filterId: 'messageTable', + fieldName: 'id' + }); + } else { + s += '双击要选择的数据即可选中'; + $("#saveCheckBox").hide(); + } + $("#showInfo").html(s); + + table.render({ + id: 'messageTable', + elem: '#messageTable', + method: 'post', + url: sysMainMation.erpBasePath + 'erpfarm001', + where: getTableParams(), + even: true, + page: true, + limits: getLimits(), + limit: getLimit(), + cols: [[ + { type: assetCheckType ? 'checkbox' : 'radio', fixed: 'left'}, + { title: systemLanguage["com.skyeye.serialNumber"][languageType], fixed: 'left', type: 'numbers' }, + { field: 'name', title: '车间名称', width: 120 }, + + // { field: 'assetImg', title: '图片', align: 'center', width: 60, templet: function (d) { + // return ''; + // }}, + // { field: 'typeId', title: '资产类型', width: 100, templet: function(d) { + // return sysDictDataUtil.getDictDataNameByCodeAndKey("ADM_ASSET_TYPE", d.typeId); + // }}, + // { field: 'numberPrefix', title: '资产编号前缀', width: 140 }, + // { field: 'readPrice', title: '参考价', width: 80 }, + ]], + done: function(res) { + matchingLanguage(); + + initTableSearchUtil.initAdvancedSearch(this, res.searchFilter, form, "请输入资产名称", function () { + table.reloadData("messageTable", {page: {curr: 1}, where: getTableParams()}); + }); + if (assetCheckType) { + // 设置选中 + tableCheckBoxUtil.checkedDefault({ + gridId: 'messageTable', + fieldName: 'id' + }); + } else { + $('#messageTable').next().find('.layui-table-body').find("table" ).find("tbody").children("tr").on('dblclick',function() { + var dubClick = $('#messageTable').next().find('.layui-table-body').find("table").find("tbody").find(".layui-table-hover"); + dubClick.find("input[type='radio']").prop("checked", true); + form.render(); + var chooseIndex = JSON.stringify(dubClick.data('index')); + var obj = res.rows[chooseIndex]; + parent.adminAssistantUtil.checkAssetMation = obj; + + parent.refreshCode = '0'; + parent.layer.close(index); + }); + + $('#messageTable').next().find('.layui-table-body').find("table" ).find("tbody").children("tr").on('click',function() { + var click = $('#messageTable').next().find('.layui-table-body').find("table").find("tbody").find(".layui-table-hover"); + click.find("input[type='radio']").prop("checked", true); + form.render(); + }); + } + } + }); + + table.on('tool(messageTable)', function (obj) { + var data = obj.data; + var layEvent = obj.event; + if (layEvent === 'assetlistdetails') { // 详情 + assetlistdetails(data); + } else if (layEvent === 'assetImg') { // 图片预览 + systemCommonUtil.showPicImg(systemCommonUtil.getFilePath(data.assetImg)); + } + }); + + // 详情 + function assetlistdetails(data) { + rowId = data.id; + _openNewWindows({ + url: "../../tpl/assetManage/assetManageDetails.html", + title: systemLanguage["com.skyeye.detailsPageTitle"][languageType], + pageId: "assetManageDetails", + area: ['90vw', '90vh'], + callBack: function (refreshCode) { + }}); + } + + // 保存 + $("body").on("click", "#saveCheckBox", function() { + var selectedData = tableCheckBoxUtil.getValueList({ + gridId: 'messageTable' + }); + if (selectedData.length == 0) { + winui.window.msg("请选择资产", {icon: 2, time: 2000}); + return false; + } + parent.adminAssistantUtil.checkAssetMation = [].concat(selectedData); + parent.layer.close(index); + parent.refreshCode = '0'; + }); + + form.render(); + $("body").on("click", "#reloadTable", function() { + loadTable(); + }); + + function loadTable() { + table.reloadData("messageTable", {where: getTableParams()}); + } + + function getTableParams() { + return $.extend(true, {}, initTableSearchUtil.getSearchValue("messageTable")); + } + + exports('assetManageChoose', {}); +}); \ No newline at end of file diff --git a/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js b/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js index 3a7ddde42..55600b66e 100644 --- a/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js +++ b/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js @@ -100,11 +100,13 @@ layui.config({ if (item.types != "project") { console.log(item) _openNewWindows({ - url: systemCommonUtil.getUrl('FP2023100300003&id=' + '7b0d17eb2e334bc0b0b51e33425cb29d', null), + url: "../../tpl/departmentMachining/arrange.html?id=" + id, title: "车间任务安排", pageId: "workshopTaskArrangement", area: ['90vw', '90vh'], callBack: function (refreshCode) { + winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); + loadTable(); }}); } // 返回true以允许默认行为继续,返回false可以阻止默认行为 diff --git a/erp-produce/src/main/resources/template/js/erpPreProductionPlan/preProductionTurnToProduction.js b/erp-produce/src/main/resources/template/js/erpPreProductionPlan/preProductionTurnToProduction.js index fd2bf9592..f3ad5e9a1 100644 --- a/erp-produce/src/main/resources/template/js/erpPreProductionPlan/preProductionTurnToProduction.js +++ b/erp-produce/src/main/resources/template/js/erpPreProductionPlan/preProductionTurnToProduction.js @@ -18,7 +18,6 @@ layui.config({ // 预生产计划 转 生产计划 AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryProductionPlanTransById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) { let data = json.bean; - // 因为要调生产计划的编辑布局,所以把预生产计划里的productionPlanChildList给到生产计划里的productionChildList data.productionChildList = data.productionPlanChildList // 生产计划的【编辑布局】 dsFormUtil.initEditPageForStatic('content', 'FP2023092200002', data, { diff --git a/erp-produce/src/main/resources/template/js/processOut/processOutList.js b/erp-produce/src/main/resources/template/js/processOut/processOutList.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/erp-produce/src/main/resources/template/js/workshopTaskArrangement/workshopTaskArrangementList.js b/erp-produce/src/main/resources/template/js/workshopTaskArrangement/workshopTaskArrangementList.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html b/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html new file mode 100644 index 000000000..ae8faa08d --- /dev/null +++ b/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html @@ -0,0 +1,72 @@ + + +
+ + + + + +