Browse Source

[fix]

销售管理 客户资料 客户基本信息
修改添加客户基本信息页面币种标签样式为必填;
修改添加客户基本信息页面币种和含税输入部分,合为两个多选按钮;
添加监听多选框change方法,选择rmb时将国内税率标签设置为必填,否则去除必填类名;
修改验证是否含税方法,判断复选框是否选中设置税率必填;
修改表单验证规则,将验证方法改为回调函数的部分;
dev
王晓迪 4 months ago
parent
commit
ecbb1f11f7
  1. 70
      ruoyi-admin/src/main/resources/templates/system/customer/add.html

70
ruoyi-admin/src/main/resources/templates/system/customer/add.html

@ -117,9 +117,19 @@
<div class="form-group">
<label class="col-sm-6 control-label is-required">报价币种:</label>
<div class="col-sm-6">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_common_currency')}">
<input required type="radio" th:id="${'commonCurrency_' + dict.dictCode}" name="commonCurrency" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'commonCurrency_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
<!-- <div class="radio-box" th:each="dict : ${@dict.getType('sys_common_currency')}">-->
<!-- <input required type="radio" th:id="${'commonCurrency_' + dict.dictCode}" name="commonCurrency" th:value="${dict.dictValue}" th:checked="${dict.default}">-->
<!-- <label th:for="${'commonCurrency_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
<!-- </div>-->
<div class="checkbox">
<label>
<input type="checkbox" id="rmb" name="currency" value="1" /> rmb/含税
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="usd" name="currency" value="2" /> 美元/不含税
</label>
</div>
</div>
</div>
@ -133,17 +143,17 @@
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-6 control-label is-required">是否含税:</label>-->
<!-- <div class="col-sm-6">-->
<!-- <div class="radio-box" th:each="dict : ${@dict.getType('sys_confirm_tax')}">-->
<!-- <input required type="radio" th:id="${'confirmTax_' + dict.dictCode}" name="confirmTax" th:value="${dict.dictValue}" th:checked="${dict.default}">-->
<!-- <label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-6 control-label is-required">是否含税:</label>
<div class="col-sm-6">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_confirm_tax')}">
<input required type="radio" th:id="${'confirmTax_' + dict.dictCode}" name="confirmTax" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-6 control-label is-required" >国内税率:</label>
<label class="col-sm-6 control-label is-required" id="taxLable">国内税率:</label>
<div class="col-sm-6">
<input name="taxRate" class="form-control" placeholder="%" type="text" required/>
</div>
@ -282,12 +292,31 @@
$("select[name='businessMembers']").append("<option value='" + loginName + "'>" + userName + "</option>");
//验证是否含税,含税的话税率要填写。
function isTaxRate() {
if ($("#confirmTax").val() == 1) {
if ($('input[value=1]:checked').length > 0) {
console.log('选框 1 已经被选中');
return true;
} else {
} else {
return false;
}
}
// 监听 change 事件
$('input[name=currency]').on('change', function() {
var taxLable = $('#taxLable')[0];
var oldClass = taxLable.className.split(' ');
if ($('input[value=1]:checked').length > 0){
// $('input[name=taxRate]').prop('required',true);
if (!oldClass.includes('is-required')) {
taxLable.classList.add('is-required');
}
}else{
// $('input[name=taxRate]').prop('required',false);
for (var i = 0; i < oldClass.length; i++) {
if (oldClass[i].includes('is-required')) {
taxLable.classList.remove(oldClass[i]);
}
}
}
});
$("input[name='establishedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
@ -304,9 +333,15 @@
required: true,
},
taxRate: {
required: isTaxRate(),
required: function () {
if ($('input[value=1]:checked').length > 0) {
console.log('选框 1 已经被选中');
return true;
} else {
return false;
}
},
}
},
// 验证失败的提示信息
messages: {
@ -322,6 +357,7 @@
function submitHandler() {
if ($.validate.form()) {
$("select[name='businessMembers']").removeAttr("disabled");
console.log( $('#form-customer-add').serialize());
$.operate.save(prefix + "/add", $('#form-customer-add').serialize());
}
}

Loading…
Cancel
Save