基于javaweb+jsp的汽车租赁管理系统
Posted qq_1742826239
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于javaweb+jsp的汽车租赁管理系统相关的知识,希望对你有一定的参考价值。
基于javaweb+jsp的汽车租赁管理系统
JavaWeb JavaBean JSP MVC mysql Tomcat javascript idea eclipse MyEclipse Servlet SSM Maven …
部分代码实现JSP
<div class="layui-form-item">
<label class="layui-form-label">状态:</label>
<div class="layui-input-block">
<input name="carStatus" type="radio" value="未出租" checked="checked" class="layui-input" title="未出租"/>
<input name="carStatus" type="radio" value="已出租" class="layui-input" title="已出租"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">简介:</label>
<div class="layui-input-block">
<textarea type="text" name="carText" class="layui-input" style="height: 100px;padding-left: 10px;" placeholder="请输入内容......"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="submit" class="layui-btn" lay-submit="" lay-filter="submit-button">添加</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
<script src="js/layui/layui.js" charset="utf-8"></script>
align: 'center',
fixed: 'right',
title: '操作',
width: 130,
templet: vo =>
let flag = $loginUser.userType == '管理员';
return flag ? '<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>' : '';
]
],
);
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">型号:</label>
<div class="layui-input-block" style="padding: 9px 15px;">
$vo.carName
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">价值(万元):</label>
<div class="layui-input-block" style="padding: 9px 15px;">
$vo.carWorth
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">里程:</label>
</div>
<div class="layui-form-item">
<label class="layui-form-label">简介:</label>
<div class="layui-input-block">
<textarea type="text" name="carText" disabled="disabled" class="layui-input" style="height: 100px;padding-left: 10px;" placeholder="请输入内容......">$vo.carText</textarea>
</div>
</div>
</form>
<script src="js/layui/layui.js" charset="utf-8"></script>
<script>
layui.use(['form', 'layedit', 'laydate'], function ()
let form = layui.form, layer = layui.layer, layedit = layui.layedit;
//创建一个编辑器
let editIndex = layedit.build('LAY_demo_editor');
);
</script>
<button class="layui-btn" data-type="reload">搜索</button>
</div>
</div>
<!-- 内容主体区域 -->
<table class="layui-hide" id="myData" lay-filter="myTable"></table>
</div>
</div>
<script src="js/layui/layui.js"/>
<script>
//JavaScript代码区域
layui.use('element', function ()
let element = layui.element;
);
</script>
<script type="text/html" id="myToolbar">
<div class="layui-btn-container">
<c:if test="$loginUser.userType == '管理员'"><button class='layui-btn layui-btn-sm' lay-event='add'>添加</button></c:if>
</div>
</script>
<script>
layui.use(['form', 'layedit', 'laydate'], function ()
let form = layui.form, layer = layui.layer, layedit = layui.layedit;
//创建一个编辑器
let editIndex = layedit.build('LAY_demo_editor');
//自定义验证规则
form.verify(
content: function (value)
layedit.sync(editIndex);
);
//监听提交
form.on('submit(submit-button)', function (data)
$.post("carAdd", data.field, function ()
let index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index); //再执行关闭
parent.location.reload();//刷新父级页面
, "text");//这里用的是post提交,如果不懂可以参考JQuery中ajax提
return false;
<label class="layui-form-label">车牌:</label>
<div class="layui-input-block">
<input type="text" name="carPai" lay-verify="required|carPai" class="layui-input" value="$vo.carPai">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">型号:</label>
<div class="layui-input-block">
<input type="text" name="carName" lay-verify="required|carName" class="layui-input" value="$vo.carName">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">价值(万元):</label>
<div class="layui-input-block">
<input type="text" name="carWorth" lay-verify="required|carWorth" class="layui-input" value="$vo.carWorth">
<script>
layui.use(['form', 'layedit', 'laydate'], function ()
let form = layui.form, layer = layui.layer, layedit = layui.layedit;
//创建一个编辑器
let editIndex = layedit.build('LAY_demo_editor');
//自定义验证规则
form.verify(
content: function (value)
layedit.sync(editIndex);
);
//监听提交
form.on('submit(submit-button)', function (data)
$.post("carEdit", data.field, function ()
table.on('tool(myTable)', function (obj) //注:tool 是工具条事件名,myTable 是 table 原始容器的属性 lay-filter="对应的值"
let data = obj.data; //获得当前行数据
let layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
if (layEvent === 'del') //删除
// layer.confirm('删除' + data.carName + "?", function (index)
$.ajax(
type: "GET",
dataType: "text",
url: "carDelete?id=" + data.id,
success: function ()
console.log("已删除!");
);
obj.del(); //删除对应行(tr)的DOM结构,并更新缓存
//parent.location.reload();//刷新父级页面
// layer.close(index);
//parent.location.reload();//刷新父级页面
layer.msg(data.carName + ' 删除成功!');
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态:</label>
<div class="layui-input-block">
<input name="carStatus" type="radio" value="未出租" $vo.carStatus=='未出租'?'checked':'' class="layui-input" title="未出租"/>
<input name="carStatus" type="radio" value="已出租" $vo.carStatus=='已出租'?'checked':'' class="layui-input" title="已出租"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">简介:</label>
<div class="layui-input-block">
<textarea type="text" name="carText" class="layui-input" style="height: 100px;padding-left: 10px;" placeholder="请输入内容......">$vo.carText</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="submit" class="layui-btn" lay-submit="" lay-filter="submit-button">保存</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
title: '车牌',
,
field: 'carName',
title: '型号',
templet: vo => (vo = vo.carName) ? '<a href="#" style="color: #009688;">' + vo + '</a>' : '',
event: 'info',
,
field: 'carWorth',
title: '价值(万元)',
,
"msg": '', //解析提示文本
"count": res.length, //解析数据长度(集合个数)
"data": result //解析数据列表
;
,
page: //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'], //自定义分页布局
groups: 1, //只显示 1 个连续页码
first: false, //不显示首页
last: false, //不显示尾页
,
toolbar: '#myToolbar', //开启头部工具栏,并为其绑定左侧模板
defaultToolbar: ['filter', 'exports', 'print', //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
title: '提示',
layEvent: 'LAYTABLE_TIPS',
icon: 'layui-icon-tips'
],
title: '汽车列表',
cols: [
[
<label class="layui-form-label">里程:</label>
<div class="layui-input-block">
<input type="text" name="carCheng" lay-verify="required" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">租金:</label>
<div class="layui-input-block">
<input type="text" name="carPrice" lay-verify="required" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">押金:</label>
<div class="layui-input-block">
<input type="text" name="carYajin" lay-verify="required" class="layui-input">
</divJavaWeb房屋租赁管理系统(servlet+jsp+mysql)