diff --git a/ruoyi-admin/src/main/resources/templates/erp/material/add.html b/ruoyi-admin/src/main/resources/templates/erp/material/add.html index 713bbd0a..2de03749 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/material/add.html +++ b/ruoyi-admin/src/main/resources/templates/erp/material/add.html @@ -226,6 +226,54 @@ engineer(); $("#add-process-text").hide(); $("#add-process").hide(); + $("#materialNo").on('input', function (event) { + var value = $(this).val(); + // 检查输入是否为空 + if (value) { + // 截取第一个字符 + var firstChar = value.charAt(0); + if (firstChar >= '1' && firstChar <= '9') { + var materialType; + switch (firstChar) { + case '1': + materialType = 'jgmpyl'; + break; + case '2': + materialType = 'bzjgj'; + break; + case '3': + materialType = 'scy'; + break; + case '4': + materialType = 'fscy'; + break; + case '5': + materialType = 'dbmcljgj'; + break; + case '6': + materialType = 'lj'; + break; + case '7': + materialType = 'zhj'; + break; + case '8': + materialType = 'chcpsb'; + break; + case '9': + materialType = 'qt'; + break; + default: + materialType = ''; // 默认情况下不设置 + break; + } + $("#selectMaterialType").val(materialType).trigger('change'); + } + } else { + // 如果输入框为空,清空下拉框的值 + $("#selectMaterialType").val('').trigger('change'); + } + }); + }) function engineer(){