基于javaweb+jsp的客户关系管理系统CRM
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript idea eclipse MyEclipse Servlet SSM Maven …
部分代码实现JSP
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>待办 管理</title> <link rel="stylesheet" href="css/bootstrap.css">
<!-- add --> <div class="modal fade" id="modal-add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <form action="DaibanServlet" onsubmit="return addCheck()"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button>
<form> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title">待办 </h4> </div> <div class="modal-body"> <table class="table table-striped table-hover" style="font-size: 15px;"> <tr> <td style="width: 15%;">主题:</td> <td><b id="info-daibanName"></b></td> </tr> <tr> <td style="width: 15%;">客户:</td>
} if (document.getElementById("add-daibanRen").value.trim().length == 0) { alert("负责人不能为空"); return false; } if (document.getElementById("add-daibanShi").value.trim().length == 0) { alert("时间不能为空"); return false; } return true; } //编辑表单提交之前进行检查,如果return false,则不允许提交 function editCheck() { //根据ID获取值 if (document.getElementById("edit-daibanName").value.trim().length == 0) { alert("主题不能为空"); return false; } if (document.getElementById("edit-daibanClient").value.trim().length == 0) { alert("客户不能为空"); return false;
<input type="text" class="form-control" name="action" value="edit"> <input type="text" readonly class="form-control" name="id" id="edit-id"> </div> <div class="form-group"> <label for="edit-daibanName" class="control-label">主题:</label> <input type="text" class="form-control" name="daibanName" id="edit-daibanName"> </div> <div class="form-group"> <label for="edit-daibanClient" class="control-label">客户:</label> <input type="text" class="form-control" name="daibanClient" id="edit-daibanClient"> </div> <div class="form-group"> <label for="edit-daibanText" class="control-label">内容:</label> <textarea style="height: 100px;" class="form-control" name="daibanText" id="edit-daibanText"></textarea> </div> <div class="form-group"> <label for="edit-daibanRen" class="control-label">负责人:</label> <input type="text" class="form-control" name="daibanRen" id="edit-daibanRen"> </div> <div class="form-group"> <label for="edit-daibanShi" class="control-label">时间:</label>
</div> <div class="form-group hidden"> <label for="edit-createTime" class="control-label">创建时间:</label> <input type="text" class="form-control" name="createTime" id="edit-createTime"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-line btn-rect btn-success" data-dismiss="modal">取消</button> <button type="submit" class="btn btn-line btn-rect btn-danger">提交</button> </div> </form> </div>
</tr> <tr> <td style="width: 15%;">内容:</td> <td><b id="info-daibanText"></b></td> </tr> <tr> <td style="width: 15%;">负责人:</td> <td><b id="info-daibanRen"></b></td> </tr> <tr> <td style="width: 15%;">时间:</td> <td><b id="info-daibanShi"></b></td> </tr> </table> <br> </div> <div class="modal-footer">
} }) }) function searchList() { window.location.href = "DaibanServlet?action=list&searchColumn="+document.getElementById("searchColumn").value+"&keyword=" + document.getElementById("search_keyword").value; } //增加表单提交之前进行检查,如果return false,则不允许提交 function addCheck() { //根据ID获取值 if (document.getElementById("add-daibanName").value.trim().length == 0) { alert("主题不能为空"); return false; } if (document.getElementById("add-daibanClient").value.trim().length == 0) { alert("客户不能为空");
</div> </form> </div> </div> </div> <!-- edit --> <div class="modal fade" id="modal-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <form action="DaibanServlet" onsubmit="return editCheck()"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title">更新待办 </h4> </div> <div class="modal-body"> <div class="form-group hidden">
if (document.getElementById("edit-daibanRen").value.trim().length == 0) { alert("负责人不能为空"); return false; } if (document.getElementById("edit-daibanShi").value.trim().length == 0) { alert("时间不能为空"); return false; } return true; } </script>
<div class="container-fluid"> <div class="row"> <div class="col-sm-3 col-md-2 sidebar"> <!-- 侧边栏 --> <jsp:include page="menu.jsp"> <jsp:param value="active" name="Daiban_active"/> </jsp:include> </div> <br> <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> <div class="row"> <div class="col-sm-7"> <div class="input-group">
<script src="js/jquery-3.5.1.js"></script> <script src="js/bootstrap.js"></script> </head> <body> <nav class="navbar navbar-inverse navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">客户关系管理系统CRM</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">客户关系管理系统CRM</a> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="#">欢迎:<span style="color: yellow">${loginUser.username}</span></a></li> <li><a href="AuthServlet?action=logout">退出</a></li> </ul> </div> </div>
</div> <div class="modal-body"> <div class="form-group hidden"> <label class="control-label">(hidden)</label> <input type="text" class="form-control" name="action" value="add"> </div> <div class="form-group"> <label for="add-daibanName" class="control-label">主题:</label> <input type="text" class="form-control" name="daibanName" id="add-daibanName"> </div> <div class="form-group"> <label for="add-daibanClient" class="control-label">客户:</label> <input type="text" class="form-control" name="daibanClient" id="add-daibanClient"> </div> <div class="form-group"> <label for="add-daibanText" class="control-label">内容:</label> <textarea style="height: 100px;" class="form-control" name="daibanText" id="add-daibanText"></textarea> </div> <div class="form-group">
<input class="form-control" type="text" id="search_keyword" name="search_keyword" placeholder="主题"/> <span class="input-group-btn"><button class="btn btn-line btn-rect btn-danger" type="button" onclick="searchList()">搜索</button></span> </div> </div> <div class="col-sm-5"> <button type="button" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> class="btn btn-line btn-rect btn-danger" data-toggle="modal" data-target="#modal-add">添加待办 </button> </div> </div> <br> <br> <div class="table-responsive"> <table class="table table-striped table-hover"> <thead> <tr> <th>主题</th>
<input type="text" class="form-control" name="daibanRen" id="add-daibanRen"> </div> <div class="form-group"> <label for="add-daibanShi" class="control-label">时间:</label> <input type="text" class="form-control" name="daibanShi" id="add-daibanShi"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-line btn-rect btn-success" data-dismiss="modal">取消</button> <button type="submit" class="btn btn-line btn-rect btn-danger">提交</button> </div> </form> </div> </div> </div> <!-- info --> <div class="modal fade" id="modal-info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document">
modal.find('#edit-daibanRen').val(vo.daibanRen); modal.find('#edit-daibanShi').val(vo.daibanShi); } }) }) $('#modal-info').on('show.bs.modal', function (event) { let button = $(event.relatedTarget); let id = button.data('id'); let modal = $(this); $.ajax({ url: 'DaibanServlet?action=get&id=' + id, type: "get", success: function (voString) { let vo = eval('(' + voString + ')'); modal.find('#info-daibanName').text(vo.daibanName); modal.find('#info-daibanClient').text(vo.daibanClient); modal.find('#info-daibanText').text(vo.daibanText); modal.find('#info-daibanRen').text(vo.daibanRen);
<button class="btn btn-line btn-rect btn-default btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> data-id="${vo.id}" data-toggle="modal" data-target="#modal-edit">编辑 </button> <button class="btn btn-line btn-rect btn-info btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> data-id="${vo.id}" data-toggle="modal" data-target="#modal-delete">删除 </button> </th> </tr> </c:forEach> </tbody> </table> </div> <div style="float: right;padding-right: 10px;color: #515151;"><jsp:include page="split.jsp"/></div> </div> </div>
</div> <!-- delete --> <div class="modal fade" id="modal-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <form action="DaibanServlet"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title">删除待办 </h4> </div> <div class="modal-body"> 确认要删除该待办 记录吗? <div class="form-group hidden"> <label class="control-label">(hidden)</label>
<th>负责人</th> <th>时间</th> <th style="text-align: center;">操作</th> </tr> </thead> <tbody> <c:forEach items="${list}" var="vo"> <tr> <td>${vo.daibanName}</td> <td>${vo.daibanClient}</td> <td>${vo.daibanRen}</td> <td>${vo.daibanShi}</td> <th style="text-align: center;"> <button class="btn btn-line btn-rect btn-primary btn-sm" data-id="${vo.id}" data-toggle="modal" data-target="#modal-info">详情
<input type="text" class="form-control" name="id" id="delete-id"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-line btn-rect btn-success" data-dismiss="modal">取消</button> <button type="submit" class="btn btn-line btn-rect btn-info">删除</button> </div> </form> </div> </div> </div> </body> <script>
let button = $(event.relatedTarget); let id = button.data('id'); let modal = $(this); modal.find('#delete-id').val(id); }) $('#modal-edit').on('show.bs.modal', function (event) { let button = $(event.relatedTarget); let id = button.data('id'); let modal = $(this); $.ajax({ url: 'DaibanServlet?action=get&id=' + id, type: "get", success: function (voString) { let vo = eval('(' + voString + ')'); modal.find('#edit-id').val(vo.id); modal.find('#edit-daibanName').val(vo.daibanName); modal.find('#edit-daibanClient').val(vo.daibanClient);
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
idea/eclipse/MyEclipse
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript idea eclipse MyEclipse Servlet SSM Maven …
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、待办模块、客户模块的增删改查管理