Browse Source

[fix]

工程管理 物料信息
修改添加页面料号输入框监听函数,根据输入第一位数字设置加工方式下拉框选项;
新增重新加载加工方式下拉框选项方法;
修改物料详情页面下拉框为disabled;
dev
王晓迪 1 month ago
parent
commit
203d8ab09f
  1. 92
      ruoyi-admin/src/main/resources/templates/erp/material/add.html
  2. 8
      ruoyi-admin/src/main/resources/templates/erp/material/detail.html

92
ruoyi-admin/src/main/resources/templates/erp/material/add.html

@ -23,7 +23,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">物料类型:</label> <label class="col-sm-3 control-label is-required">物料类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}" required> <select disabled id="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}" required>
<optgroup th:each="child: ${childList}" th:label="${child.name}"> <optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option> <option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup> </optgroup>
@ -177,6 +177,8 @@
var prefix = ctx + "erp/material"; var prefix = ctx + "erp/material";
var userName = [[${@permission.getPrincipalProperty('userName')}]]; var userName = [[${@permission.getPrincipalProperty('userName')}]];
var loginName = [[${@permission.getPrincipalProperty('loginName')}]]; var loginName = [[${@permission.getPrincipalProperty('loginName')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
//获取工程员 //获取工程员
$(function(){ $(function(){
var options = { var options = {
@ -228,18 +230,26 @@
$("#add-process").hide(); $("#add-process").hide();
$("#materialNo").on('input', function (event) { $("#materialNo").on('input', function (event) {
var value = $(this).val(); var value = $(this).val();
reloadSelections();
// 检查输入是否为空 // 检查输入是否为空
if (value) { if (value) {
// 截取第一个字符 // 截取第一个字符
var firstChar = value.charAt(0); var firstChar = value.charAt(0);
if (firstChar >= '1' && firstChar <= '9') { if (firstChar >= '1' && firstChar <= '9') {
var materialType; var materialType;
var $processMethodSelect = $("select[name='processMethod']");
switch (firstChar) { switch (firstChar) {
case '1': case '1':
materialType = 'jgmpyl'; materialType = 'jgmpyl';
$processMethodSelect.find('option[value="1"]').remove();
$processMethodSelect.find('option[value="2"]').remove();
$processMethodSelect.find('option[value="3"]').remove();
break; break;
case '2': case '2':
materialType = 'bzjgj'; materialType = 'bzjgj';
$processMethodSelect.find('option[value="1"]').remove();
$processMethodSelect.find('option[value="2"]').remove();
$processMethodSelect.find('option[value="3"]').remove();
break; break;
case '3': case '3':
materialType = 'scy'; materialType = 'scy';
@ -249,9 +259,13 @@
break; break;
case '5': case '5':
materialType = 'dbmcljgj'; materialType = 'dbmcljgj';
$processMethodSelect.find('option[value="1"]').remove();
$processMethodSelect.find('option[value="3"]').remove();
break; break;
case '6': case '6':
materialType = 'lj'; materialType = 'lj';
$processMethodSelect.find('option[value="1"]').remove();
$processMethodSelect.find('option[value="3"]').remove();
break; break;
case '7': case '7':
materialType = 'zhj'; materialType = 'zhj';
@ -260,7 +274,7 @@
materialType = 'chcpsb'; materialType = 'chcpsb';
break; break;
case '9': case '9':
materialType = 'qt'; materialType = 'qtyflswl';
break; break;
default: default:
materialType = ''; // 默认情况下不设置 materialType = ''; // 默认情况下不设置
@ -276,6 +290,12 @@
}) })
function reloadSelections(){
$("select[name='processMethod']").empty();
processMethodDatas.forEach(function (process){
$("select[name='processMethod']").append('<option value="' + process.dictValue + '">' + process.dictLabel + '</option>');
})
}
function engineer(){ function engineer(){
$.ajax({ $.ajax({
url: ctx + 'erp/material/getEngineerList', url: ctx + 'erp/material/getEngineerList',
@ -468,40 +488,40 @@
// 数字7开头的为半成品-组合件; // 数字7开头的为半成品-组合件;
// 数宇8开头的为成品: // 数宇8开头的为成品:
// 缴字9开头的为其它 // 缴字9开头的为其它
$("#materialNo").on("change", function () { // $("#materialNo").on("change", function () {
var val = $(this).val(); // var val = $(this).val();
if (val.length == 10) { // if (val.length == 10) {
switch (val.substring(0, 1)) { // switch (val.substring(0, 1)) {
case '1': // case '1':
$("#selectMaterialType").val("jgmpyl").trigger("change"); // $("#selectMaterialType").val("jgmpyl").trigger("change");
break; // break;
case '2': // case '2':
$("#selectMaterialType").val("bzjgj").trigger("change"); // $("#selectMaterialType").val("bzjgj").trigger("change");
break; // break;
case '3': // case '3':
$("#selectMaterialType").val("scy").trigger("change"); // $("#selectMaterialType").val("scy").trigger("change");
break; // break;
case '4': // case '4':
$("#selectMaterialType").val("fscy").trigger("change"); // $("#selectMaterialType").val("fscy").trigger("change");
break; // break;
case '5': // case '5':
$("#selectMaterialType").val("dbmcljgj").trigger("change"); // $("#selectMaterialType").val("dbmcljgj").trigger("change");
break; // break;
case '6': // case '6':
$("#selectMaterialType").val("lj").trigger("change"); // $("#selectMaterialType").val("lj").trigger("change");
break; // break;
case '7': // case '7':
$("#selectMaterialType").val("zhj").trigger("change"); // $("#selectMaterialType").val("zhj").trigger("change");
break; // break;
case '8': // case '8':
$("#selectMaterialType").val("chcpsb").trigger("change"); // $("#selectMaterialType").val("chcpsb").trigger("change");
break; // break;
case '9': // case '9':
$("#selectMaterialType").val("qt").trigger("change"); // $("#selectMaterialType").val("qtyflswl").trigger("change");
break; // break;
} // }
} // }
}); // });
</script> </script>
</body> </body>
</html> </html>

8
ruoyi-admin/src/main/resources/templates/erp/material/detail.html

@ -24,7 +24,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">物料类型:</label> <label class="col-sm-3 control-label">物料类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select readonly id="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}"> <select disabled readonly id="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}">
<optgroup> <optgroup>
<option value="">请选择</option> <option value="">请选择</option>
</optgroup> </optgroup>
@ -38,7 +38,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">加工方式:</label> <label class="col-sm-3 control-label">加工方式:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select readonly name="processMethod" class="form-control m-b" th:with="type=${@dict.getType('processMethod')}"> <select disabled readonly name="processMethod" class="form-control m-b" th:with="type=${@dict.getType('processMethod')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{processMethod}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{processMethod}"></option>
</select> </select>
</div> </div>
@ -46,7 +46,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">单位:</label> <label class="col-sm-3 control-label">单位:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select readonly name="unit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}"> <select disabled readonly name="unit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{unit}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{unit}"></option>
</select> </select>
</div> </div>
@ -66,7 +66,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">入库部门:</label> <label class="col-sm-3 control-label">入库部门:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select readonly name="warehouseDept" class="form-control m-b" th:with="type=${@dict.getType('warehouseDept')}"> <select disabled readonly name="warehouseDept" class="form-control m-b" th:with="type=${@dict.getType('warehouseDept')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseDept}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseDept}"></option>
</select> </select>
</div> </div>

Loading…
Cancel
Save