From 52cf293768138e358db7a38549622f4b082b32bd 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 14:18:31 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=E7=94=98=E7=89=B9=E5=9B=BE?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/departmentMachining/arrange.js | 139 +++++++++++++----- .../tpl/departmentMachining/arrange.html | 2 +- 2 files changed, 101 insertions(+), 40 deletions(-) diff --git a/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js b/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js index a5df66c64..d30f980e9 100644 --- a/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js +++ b/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js @@ -14,58 +14,119 @@ layui.config({ var $ = layui.$, form = layui.form, table = layui.table; - var selTemplate = getFileContent('tpl/template/select-option.tpl'); + // var selTemplate = getFileContent('tpl/template/select-option.tpl'); let farmId = getNotUndefinedVal(GetUrlParam("id")); // 改 - let assetMap = {}; + // 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'} + {id: 'workshopId', title: '安排车间', formType: 'select', width: '150', verify: 'required',templet: function(d) { + var options = queryWorkshopList(); + return ''; + } + }, + {id: 'taskNumber', 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; - } + // 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 }); + // + // var workshopId = ""; + // form.on('select(workshopId)', function(data) { + // console.log(555,data) + // // var thisRowValue = data.value; + // // workshopId = isNull(thisRowValue) ? "" : thisRowValue; + // aaa(); + // }); + // 渲染表格 +// function aaa(){ +// table.render({ +// id: 'arrangeList',//表格 +// elem: '#workshopId', //表格里的元素 +// method: 'post', +// url: sysMainMation.erpBasePath + 'erpfarm001', +// where: getTableParams(), +// even: true, +// page: true, +// limits: getLimits(), +// limit: getLimit(), +// done: function(json){ +// // 表格渲染完成后的回调 +// // 在这里添加事件监听 +// $('select[name="workshop"]').on('change', function(){ +// console.log('Workshop selected', $(this).val()); +// // 如果需要,可以在这里打印'123'或进行其他操作 +// }); +// +// $('input[name="taskNumber"]').on('click', function(){ +// console.log('taskNumber input clicked'); +// // 打印'123'或其他操作 +// }); +// } +// // done: function(json){ +// // console.log(json) +// // // matchingLanguage(); +// // // $('select[name="workshop"]').each(function(){ +// // // $(this).empty(); +// // // workshopData.forEach(function(item){ +// // // $(this).append(''); +// // // }, $(this)); +// // // }); +// // } +// }); +// } - $("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}); - }); + function queryWorkshopList() { + // 假设您有一个函数可以处理Ajax请求 + AjaxPostUtil.request({ + url: sysMainMation.erpBasePath + "erpfarm001", + params: {page: 1, limit: 30}, + type: 'json', + method: "POST", + callback: function(json) { + console.log(666, json); + } + }); + } - var workshopId = ""; - form.on('select(workshopId)', function(data) { - var thisRowValue = data.value; - workshopId = isNull(thisRowValue) ? "" : thisRowValue; - loadTable(); - }); +// $("body").on("click", "workshopId", 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); @@ -85,9 +146,9 @@ layui.config({ $.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(); + if (parseInt(item.taskNumber) == 0) { + $("#taskNumber" + thisRowKey).addClass("layui-form-danger"); + $("#taskNumber" + thisRowKey).focus(); winui.window.msg('数量不能为0', {icon: 2, time: 2000}); noError = true; return false; @@ -138,7 +199,7 @@ layui.config({ }); function loadTable() { - table.reloadData("messageTable", {where: getTableParams()}); + table.reloadData("arrangeList", {where: getTableParams()}); } function getTableParams() { diff --git a/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html b/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html index ae8faa08d..c10f10e2b 100644 --- a/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html +++ b/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html @@ -27,7 +27,7 @@ -
+
-- GitLab