产品信息修改

master
wangjiuyun 2025-05-20 15:56:14 +08:00
parent 0198254927
commit fa3c8634c2
2 changed files with 27 additions and 7 deletions

View File

@ -51,18 +51,17 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">产品类型:</label>
<div class="col-sm-8">
<select name="type" class="form-control" th:with="type=${@dict.getType('product_type')}" required>
<select name="type" class="form-control" th:with="type=${@dict.getType('product_type')}" onchange="changeType()" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="col-xs-12" id="valueBox" style="display: none">
<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">
<input name="value" class="form-control" type="number" required>
</div>
</div>
</div>
@ -107,6 +106,14 @@
minView: "month",
autoclose: true
});
function changeType(){
let type=$('[name="type"]').val()
if(type=='11'||type=='22'){
$('#valueBox').show()
}else{
$('#valueBox').hide()
}
}
</script>
</body>
</html>

View File

@ -51,15 +51,15 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">产品类型:</label>
<div class="col-sm-8">
<select th:field="*{type}" name="type" class="form-control" th:with="type=${@dict.getType('product_type')}" required>
<select th:field="*{type}" name="type" class="form-control" th:with="type=${@dict.getType('product_type')}" onchange="changeType()" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="col-xs-12" id="valueBox">
<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">
<input name="value" th:field="*{value}" class="form-control" type="number" required>
</div>
@ -87,6 +87,19 @@
$.operate.save(prefix + "/edit", $('#form-product-edit').serialize());
}
}
function changeType(){
let type=$('[name="type"]').val()
if(type=='11'||type=='22'){
$('#valueBox').show()
}else{
$('#valueBox').hide()
}
}
$(function (){
if([[${productInfo.type}]]!=11&&[[${productInfo.type}]]!=22){
$('#valueBox').hide()
}
})
</script>
</body>
</html>