Browse Source

[fix]

销售管理 客户资料 客户基本信息
修改service接口,更新数据新增按币种标识列表设置数据库字段方法;
修改controller编辑接口,根据查询得到对象币种标识设置复选框显示字段值;
修改客户基本信息编辑页面,两组单选按钮合为一组复选框按钮,根据后台币种列表字段设置选中状态;
[feat]
新增编辑页面监听复选框改变方法和校验必填方法;
dev
王晓迪 4 months ago
parent
commit
9f0323ecef
  1. 8
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java
  2. 24
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java
  3. 80
      ruoyi-admin/src/main/resources/templates/system/customer/edit.html

8
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java

@ -201,6 +201,14 @@ public class SysCustomerController extends BaseController
public String edit(@PathVariable("id")Long id, ModelMap mmap)
{
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(id);
List<String> currency = new ArrayList<>();
if(sysCustomer.getRmbFlag().equals("1")){
currency.add("1");
}
if(sysCustomer.getUsdFlag().equals("1")){
currency.add("2");
}
sysCustomer.setCurrency(currency);
mmap.put("sysCustomer", sysCustomer);
return prefix + "/edit";
}

24
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java

@ -215,17 +215,6 @@ public class SysCustomerServiceImpl implements ISysCustomerService
String loginName = ShiroUtils.getLoginName();
sysCustomerVo.setUpdateBy(loginName);
sysCustomerVo.setUpdateTime(DateUtils.getNowDate());
// List<String> currency = sysCustomerVo.getCurrency();
// if(currency.contains("1")){
// sysCustomerVo.setRmbFlag("1");
// }else {
// sysCustomerVo.setRmbFlag("0");
// }
// if(currency.contains("2")){
// sysCustomerVo.setUsdFlag("1");
// }else {
// sysCustomerVo.setUsdFlag("0");
// }
return sysCustomerMapper.updateSysCustomer(sysCustomerVo);
}
@ -239,6 +228,17 @@ public class SysCustomerServiceImpl implements ISysCustomerService
sysCustomer.setApplyTime(DateUtils.getNowDate());
sysCustomer.setUpdateBy(user.getLoginName());
sysCustomer.setUpdateTime(DateUtils.getNowDate());
List<String> currency = sysCustomer.getCurrency();
if(currency.contains("1")){
sysCustomer.setRmbFlag("1");
}else {
sysCustomer.setRmbFlag("0");
}
if(currency.contains("2")){
sysCustomer.setUsdFlag("1");
}else {
sysCustomer.setUsdFlag("0");
}
// 启动流程
return sysCustomerMapper.updateSysCustomer(sysCustomer);
}
@ -404,6 +404,8 @@ public class SysCustomerServiceImpl implements ISysCustomerService
sysCustomer.setApplyTime(DateUtils.getNowDate());
if (sysCustomer.getId() == null){
insertSysCustomer(sysCustomer);
}else {
updateSysCustomerVo(sysCustomer);
}
// 启动流程
String applyTitle = user.getUserName()+"发起了客户信息提交审批-"+DateUtils.dateTimeNow();

80
ruoyi-admin/src/main/resources/templates/system/customer/edit.html

@ -116,10 +116,15 @@
<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}" th:field="*{commonCurrency}">
<label th:for="${'commonCurrency_' + dict.dictCode}" th:text="${dict.dictLabel}" ></label>
<div class="checkbox">
<label>
<input type="checkbox" id="rmb" name="currency" value="1" th:field="*{currency}" th:checked="${currency != null and #lists.contains(currency, '1')}"/> rmb/含税
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="usd" name="currency" value="2" th:field="*{currency}" th:checked="${currency != null and #lists.contains(currency, '2')}"/> 美元/不含税
</label>
</div>
</div>
</div>
@ -132,18 +137,8 @@
</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}" th:field="*{confirmTax}"></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="taxLabel">国内税率:</label>
<div class="col-sm-6">
<div class="input-group">
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text" required />
@ -281,6 +276,59 @@
}
}
$(function(){
// 监听 change 事件
$('input[name=currency]').on('change', function() {
var taxLable = $('#taxLabel')[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",
autoclose: true
});
$("#form-customer-edit").validate({
focusCleanup: true,
//配置验证规则,key就是被验证的dom对象,value就是调用验证的方法(也是json格式)
rules: {
//这里的customerPurser 指的是上面标签的name属性
customerPurser: {
required: true,
},
taxRate: {
required: function () {
if ($('input[value=1]:checked').length > 0) {
console.log('选框 1 已经被选中');
return true;
} else {
return false;
}
},
}
},
// 验证失败的提示信息
messages: {
customerPurser: {
required: "必填" //自定义required的错误信息内容
},
taxRate: {
required: "必填",
}
},
});
$.ajax({
url: ctx + 'system/salesOrder/getBinessMembers',
type: 'get',
@ -298,7 +346,7 @@
}
}
});
})
});
$("input[name='establishedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",

Loading…
Cancel
Save