From d8b26e61cf120b12edc5d32d240920840eea7119 Mon Sep 17 00:00:00 2001 From: dshclm <3321914460@qq.com> Date: Wed, 14 Aug 2024 14:32:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=BA=E6=89=80=E5=87=BA=E5=85=A5=E7=99=BB?= =?UTF-8?q?=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/manager/TdPlaceManager.java | 3 + .../controller/place/TdPlaceController.java | 20 +- .../templates/system/placeRegist/add.html | 185 +++++++++++++++++ .../templates/system/placeRegist/detail.html | 194 ++++++++++++++++++ .../templates/system/placeRegist/edit.html | 194 ++++++++++++++++++ .../system/placeRegist/placeRegist.html | 176 ++++++++++++++++ 6 files changed, 770 insertions(+), 2 deletions(-) create mode 100644 ruoyi-admin/src/main/resources/templates/system/placeRegist/add.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/placeRegist/detail.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/placeRegist/edit.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/placeRegist/placeRegist.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/TdPlaceManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/TdPlaceManager.java index 95afe8ca..d8f6586e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/TdPlaceManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/TdPlaceManager.java @@ -58,4 +58,7 @@ public class TdPlaceManager { public List<TdPlace> selectList() { return placeService.lambdaQuery().list(); } + public TdPlace selectById(Long id) { + return placeService.getById(id); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/place/TdPlaceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/place/TdPlaceController.java index 38977e5e..09f977d6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/place/TdPlaceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/place/TdPlaceController.java @@ -122,10 +122,26 @@ public class TdPlaceController extends BaseController { * 查询所有场所 * @return com.ruoyi.common.core.domain.AjaxResult */ +// @PostMapping("/getList") +// @ResponseBody +// public AjaxResult getList() { +// return AjaxResult.success(placeManager.selectList()); +// } @PostMapping("/getList") @ResponseBody - public AjaxResult getList() { - return AjaxResult.success(placeManager.selectList()); + public AjaxResult getList(@RequestParam(value = "id", required = false) Long id) { + if (id == null) { + // 如果 id 为空,则查询所有数据 + return AjaxResult.success(placeManager.selectList()); + } else { + // 否则,根据 id 查询单条数据 + TdPlace place = placeManager.selectById(id); + if (place != null) { + return AjaxResult.success(place); + } else { + return AjaxResult.error("数据不存在"); + } + } } diff --git a/ruoyi-admin/src/main/resources/templates/system/placeRegist/add.html b/ruoyi-admin/src/main/resources/templates/system/placeRegist/add.html new file mode 100644 index 00000000..8e296c8c --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/placeRegist/add.html @@ -0,0 +1,185 @@ +<!DOCTYPE html> +<html lang="zh" xmlns:th="http://www.thymeleaf.org" > +<head> + <th:block th:include="include :: header('场所出入登记')" /> + <th:block th:include="include :: datetimepicker-css" /> + <th:block th:include="include :: select2-css" /> + <th:block th:include="include :: bootstrap-select-css" /> +</head> +<body class="white-bg"> +<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app"> + <form class="form-horizontal m" id="form-placeRegist-add"> + <input name="deptId" type="hidden" id="treeId"/> + <input name="placeId" type="hidden"/> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">场所名称:</label> + <div class="col-sm-8"> + <select id="placeName" name="placeName" onchange="doPlaceName()" required class="form-control"> + <option value="">请选择场所名称</option> + </select> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">登记人员:</label> + <div class="col-sm-8"> + <input name="registName" required placeholder="请输入登记人员" class="form-control" type="text"> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">登记日期:</label> + <div class="col-sm-8"> + <div class="input-group date"> + <input name="registTime" required class="form-control m-b" id="datetimepicker-demo-3" placeholder="yyyy-MM-dd HH:mm" type="text"> + <span class="input-group-addon"><i class="fa fa-calendar"></i></span> + </div> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">陪同人员:</label> + <div class="col-sm-8"> + <input name="entourageName" required placeholder="请输入陪同人员" class="form-control"></input> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">进入时间:</label> + <div class="col-sm-8"> + <div class="input-group date"> + <input name="accessTime" required class="form-control m-b" placeholder="yyyy-MM-dd HH:mm" type="text"> + <span class="input-group-addon"><i class="fa fa-calendar"></i></span> + </div> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">离开时间:</label> + <div class="col-sm-8"> + <div class="input-group date"> + <input name="leaveTime" required class="form-control m-b" placeholder="yyyy-MM-dd HH:mm" type="text"> + <span class="input-group-addon"><i class="fa fa-calendar"></i></span> + </div> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-2 control-label is-required" >所属单位:</label> + <div class="col-sm-10"> + <div class="input-group"> + <input name="deptName" required onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择所属单位" class="form-control m-b"> + <span class="input-group-addon"><i class="fa fa-search"></i></span> + </div> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-2 control-label is-required">进入事由:</label> + <div class="col-sm-10"> + <textarea name="subjectMatter" required rows="4" placeholder="请输入进入事由" class="form-control"></textarea> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-2 control-label">备注:</label> + <div class="col-sm-10"> + <textarea name="remark" rows="4" placeholder="请输入备注" class="form-control"></textarea> + </div> + </div> + </div> + </div> + </form> +</div> +<th:block th:include="include :: footer" /> +<th:block th:include="include :: datetimepicker-js" /> +<th:block th:include="include :: select2-js" /> +<th:block th:include="include :: bootstrap-select-js" /> +<script th:inline="javascript"> + var prefix = ctx + "system/placeRegist" + $("#form-placeRegist-add").validate({ + focusCleanup: true + }); + $("input[name='registTime']").datetimepicker({ + format: "yyyy-mm-dd hh:ii", + autoclose: true + }); + $("input[name='accessTime']").datetimepicker({ + format: "yyyy-mm-dd hh:ii", + autoclose: true + }); + $("input[name='leaveTime']").datetimepicker({ + format: "yyyy-mm-dd hh:ii", + autoclose: true + }); + $(document).ready(function() { + var apiUrl = ctx + 'system/place/getList' + $.ajax({ + url: apiUrl, + method: 'POST', + dataType: 'json', + success: function(data){ + $('#placeName').empty(); + $('#placeName').append('<option value="">请选择场所名称</option>'); + $.each(data.data, function(index, item) { + $('#placeName').append('<option value="' + item.id + '">' + item.placeName + '</option>'); + }); + }, + error: function(xhr, status, error) { + console.error('获取数据失败:', error); + } + }); + }); + function doPlaceName(){ + var selectedOption = $('#placeName option:selected'); + var placeId = selectedOption.val(); + $("input[name='placeId']").val(placeId); + } + function selectDeptTree() { + var treeId = $("#treeId").val(); + var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val(); + var url = ctx + "system/user/selectDeptTree/" + deptId; + var options = { + title: '选择部门', + width: "380", + url: url, + callBack: doSubmit + }; + $.modal.openOptions(options); + } + + function doSubmit(index, layero){ + var body = $.modal.getChildFrame(index); + $("#treeId").val(body.find('#treeId').val()); + $("#treeName").val(body.find('#treeName').val()); + $.modal.close(index); + } + function submitHandler() { + if ($.validate.form()) { + $.operate.save(prefix + "/add", $('#form-placeRegist-add').serialize()); + console.log($('#form-placeRegist-add').serialize()); + } + } +</script> +</body> +</html> diff --git a/ruoyi-admin/src/main/resources/templates/system/placeRegist/detail.html b/ruoyi-admin/src/main/resources/templates/system/placeRegist/detail.html new file mode 100644 index 00000000..b06440e8 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/placeRegist/detail.html @@ -0,0 +1,194 @@ +<!DOCTYPE html> +<html lang="zh" xmlns:th="http://www.thymeleaf.org" > +<head> + <th:block th:include="include :: header('场所出入详情')" /> + <th:block th:include="include :: datetimepicker-css" /> + <th:block th:include="include :: select2-css" /> + <th:block th:include="include :: bootstrap-select-css" /> +</head> +<body class="white-bg"> +<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app"> + <form class="form-horizontal m" id="form-placeRegist-edit" th:object="${tdPlaceRegist}"> + <input name="id" th:field="*{id}" type="hidden"> + <input name="deptId" type="hidden" id="treeId" th:field="*{deptId}"/> + <input name="placeId" type="hidden" th:field="*{placeId}"/> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">场所名称:</label> + <div class="col-sm-8"> + <select id="placeName" disabled name="placeName" onchange="doPlaceName()" required class="form-control"> + <option value="">请选择场所名称</option> + </select> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">登记人员:</label> + <div class="col-sm-8"> + <input name="registName" disabled th:field="*{registName}" required placeholder="请输入登记人员" class="form-control" type="text"> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">登记日期:</label> + <div class="col-sm-8"> + <div class="input-group date"> + <input name="registTime" disabled th:value="${#dates.format(tdPlaceRegist.registTime, 'yyyy-MM-dd HH:mm')}" required class="form-control m-b" id="datetimepicker-demo-3" placeholder="yyyy-MM-dd HH:mm" type="text"> + <span class="input-group-addon"><i class="fa fa-calendar"></i></span> + </div> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">陪同人员:</label> + <div class="col-sm-8"> + <input name="entourageName" disabled th:field="*{entourageName}" required placeholder="请输入陪同人员" class="form-control"></input> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">进入时间:</label> + <div class="col-sm-8"> + <div class="input-group date"> + <input name="accessTime" disabled th:value="${#dates.format(tdPlaceRegist.accessTime, 'yyyy-MM-dd HH:mm')}" required class="form-control m-b" placeholder="yyyy-MM-dd HH:mm" type="text"> + <span class="input-group-addon"><i class="fa fa-calendar"></i></span> + </div> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">离开时间:</label> + <div class="col-sm-8"> + <div class="input-group date"> + <input name="leaveTime" disabled th:value="${#dates.format(tdPlaceRegist.leaveTime, 'yyyy-MM-dd HH:mm')}" required class="form-control m-b" placeholder="yyyy-MM-dd HH:mm" type="text"> + <span class="input-group-addon"><i class="fa fa-calendar"></i></span> + </div> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-2 control-label is-required" >所属单位:</label> + <div class="col-sm-10"> + <div class="input-group"> + <input name="deptName" disabled th:field="*{deptName}" required onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择所属单位" class="form-control m-b"> + <span class="input-group-addon"><i class="fa fa-search"></i></span> + </div> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-2 control-label is-required">进入事由:</label> + <div class="col-sm-10"> + <textarea name="subjectMatter" disabled th:field="*{subjectMatter}" required rows="4" placeholder="请输入进入事由" class="form-control"></textarea> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-2 control-label">备注:</label> + <div class="col-sm-10"> + <textarea th:field="*{remark}" disabled name="remark" rows="4" placeholder="请输入备注" class="form-control"></textarea> + </div> + </div> + </div> + </div> + </form> +</div> +<th:block th:include="include :: footer" /> +<th:block th:include="include :: datetimepicker-js" /> +<th:block th:include="include :: select2-js" /> +<th:block th:include="include :: bootstrap-select-js" /> +<script th:inline="javascript"> + var prefix = ctx + "system/placeRegist" + $("#form-placeRegist-edit").validate({ + focusCleanup: true + }); + $("input[name='registTime']").datetimepicker({ + format: "yyyy-mm-dd hh:ii", + autoclose: true + }); + $("input[name='accessTime']").datetimepicker({ + format: "yyyy-mm-dd hh:ii", + autoclose: true + }); + $("input[name='leaveTime']").datetimepicker({ + format: "yyyy-mm-dd hh:ii", + autoclose: true + }); + $(document).ready(function() { + var apiUrl = ctx + 'system/place/getList' + $.ajax({ + url: apiUrl, + method: 'POST', + dataType: 'json', + data:{id:''}, + success: function(data){ + $('#placeName').empty(); + $('#placeName').append('<option value="">请选择场所名称</option>'); + $.each(data.data, function(index, item) { + $('#placeName').append('<option value="' + item.id + '">' + item.placeName + '</option>'); + }); + var placeIdToSelect = [[${tdPlaceRegist.placeId}]]; // 需要设置的值 + $('#placeName').val(placeIdToSelect); + + if ($('#placeName').val()) { + $('#placeName').change(); + } + }, + error: function(xhr, status, error) { + console.error('获取数据失败:', error); + } + }); + }); + + function doPlaceName(){ + var selectedOption = $('#placeName option:selected'); + var placeId = selectedOption.val(); + $("input[name='placeId']").val(placeId); + } + function selectDeptTree() { + var treeId = $("#treeId").val(); + var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val(); + var url = ctx + "system/user/selectDeptTree/" + deptId; + var options = { + title: '选择部门', + width: "380", + url: url, + callBack: doSubmit + }; + $.modal.openOptions(options); + } + + function doSubmit(index, layero){ + var body = $.modal.getChildFrame(index); + $("#treeId").val(body.find('#treeId').val()); + $("#treeName").val(body.find('#treeName').val()); + $.modal.close(index); + } + function submitHandler() { + if ($.validate.form()) { + $.operate.save(prefix + "/edit", $('#form-placeRegist-edit').serialize()); + console.log($('#form-placeRegist-edit').serialize()); + } + } +</script> +</body> +</html> diff --git a/ruoyi-admin/src/main/resources/templates/system/placeRegist/edit.html b/ruoyi-admin/src/main/resources/templates/system/placeRegist/edit.html new file mode 100644 index 00000000..c87312aa --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/placeRegist/edit.html @@ -0,0 +1,194 @@ +<!DOCTYPE html> +<html lang="zh" xmlns:th="http://www.thymeleaf.org" > +<head> + <th:block th:include="include :: header('场所出入修改')" /> + <th:block th:include="include :: datetimepicker-css" /> + <th:block th:include="include :: select2-css" /> + <th:block th:include="include :: bootstrap-select-css" /> +</head> +<body class="white-bg"> +<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app"> + <form class="form-horizontal m" id="form-placeRegist-edit" th:object="${tdPlaceRegist}"> + <input name="id" th:field="*{id}" type="hidden"> + <input name="deptId" type="hidden" id="treeId" th:field="*{deptId}"/> + <input name="placeId" type="hidden" th:field="*{placeId}"/> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">场所名称:</label> + <div class="col-sm-8"> + <select id="placeName" name="placeName" onchange="doPlaceName()" required class="form-control"> + <option value="">请选择场所名称</option> + </select> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">登记人员:</label> + <div class="col-sm-8"> + <input name="registName" th:field="*{registName}" required placeholder="请输入登记人员" class="form-control" type="text"> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">登记日期:</label> + <div class="col-sm-8"> + <div class="input-group date"> + <input name="registTime" th:value="${#dates.format(tdPlaceRegist.registTime, 'yyyy-MM-dd HH:mm')}" required class="form-control m-b" id="datetimepicker-demo-3" placeholder="yyyy-MM-dd HH:mm" type="text"> + <span class="input-group-addon"><i class="fa fa-calendar"></i></span> + </div> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">陪同人员:</label> + <div class="col-sm-8"> + <input name="entourageName" th:field="*{entourageName}" required placeholder="请输入陪同人员" class="form-control"></input> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">进入时间:</label> + <div class="col-sm-8"> + <div class="input-group date"> + <input name="accessTime" th:value="${#dates.format(tdPlaceRegist.accessTime, 'yyyy-MM-dd HH:mm')}" required class="form-control m-b" placeholder="yyyy-MM-dd HH:mm" type="text"> + <span class="input-group-addon"><i class="fa fa-calendar"></i></span> + </div> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="form-group"> + <label class="col-sm-4 control-label is-required">离开时间:</label> + <div class="col-sm-8"> + <div class="input-group date"> + <input name="leaveTime" th:value="${#dates.format(tdPlaceRegist.leaveTime, 'yyyy-MM-dd HH:mm')}" required class="form-control m-b" placeholder="yyyy-MM-dd HH:mm" type="text"> + <span class="input-group-addon"><i class="fa fa-calendar"></i></span> + </div> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-2 control-label is-required" >所属单位:</label> + <div class="col-sm-10"> + <div class="input-group"> + <input name="deptName" th:field="*{deptName}" required onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择所属单位" class="form-control m-b"> + <span class="input-group-addon"><i class="fa fa-search"></i></span> + </div> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-2 control-label is-required">进入事由:</label> + <div class="col-sm-10"> + <textarea name="subjectMatter" th:field="*{subjectMatter}" required rows="4" placeholder="请输入进入事由" class="form-control"></textarea> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + <div class="form-group"> + <label class="col-sm-2 control-label">备注:</label> + <div class="col-sm-10"> + <textarea th:field="*{remark}" name="remark" rows="4" placeholder="请输入备注" class="form-control"></textarea> + </div> + </div> + </div> + </div> + </form> +</div> +<th:block th:include="include :: footer" /> +<th:block th:include="include :: datetimepicker-js" /> +<th:block th:include="include :: select2-js" /> +<th:block th:include="include :: bootstrap-select-js" /> +<script th:inline="javascript"> + var prefix = ctx + "system/placeRegist" + $("#form-placeRegist-edit").validate({ + focusCleanup: true + }); + $("input[name='registTime']").datetimepicker({ + format: "yyyy-mm-dd hh:ii", + autoclose: true + }); + $("input[name='accessTime']").datetimepicker({ + format: "yyyy-mm-dd hh:ii", + autoclose: true + }); + $("input[name='leaveTime']").datetimepicker({ + format: "yyyy-mm-dd hh:ii", + autoclose: true + }); + $(document).ready(function() { + var apiUrl = ctx + 'system/place/getList' + $.ajax({ + url: apiUrl, + method: 'POST', + dataType: 'json', + data:{id:''}, + success: function(data){ + $('#placeName').empty(); + $('#placeName').append('<option value="">请选择场所名称</option>'); + $.each(data.data, function(index, item) { + $('#placeName').append('<option value="' + item.id + '">' + item.placeName + '</option>'); + }); + var placeIdToSelect = [[${tdPlaceRegist.placeId}]]; // 需要设置的值 + $('#placeName').val(placeIdToSelect); + + if ($('#placeName').val()) { + $('#placeName').change(); + } + }, + error: function(xhr, status, error) { + console.error('获取数据失败:', error); + } + }); + }); + + function doPlaceName(){ + var selectedOption = $('#placeName option:selected'); + var placeId = selectedOption.val(); + $("input[name='placeId']").val(placeId); + } + function selectDeptTree() { + var treeId = $("#treeId").val(); + var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val(); + var url = ctx + "system/user/selectDeptTree/" + deptId; + var options = { + title: '选择部门', + width: "380", + url: url, + callBack: doSubmit + }; + $.modal.openOptions(options); + } + + function doSubmit(index, layero){ + var body = $.modal.getChildFrame(index); + $("#treeId").val(body.find('#treeId').val()); + $("#treeName").val(body.find('#treeName').val()); + $.modal.close(index); + } + function submitHandler() { + if ($.validate.form()) { + $.operate.save(prefix + "/edit", $('#form-placeRegist-edit').serialize()); + console.log($('#form-placeRegist-edit').serialize()); + } + } +</script> +</body> +</html> diff --git a/ruoyi-admin/src/main/resources/templates/system/placeRegist/placeRegist.html b/ruoyi-admin/src/main/resources/templates/system/placeRegist/placeRegist.html new file mode 100644 index 00000000..d512298c --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/placeRegist/placeRegist.html @@ -0,0 +1,176 @@ +<!DOCTYPE html> +<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> +<head> + <th:block th:include="include :: header('场所出入登记')" /> +</head> +<body class="gray-bg"> + <div class="container-div" id="app"> + <div class="row"> + <div class="col-sm-12 search-collapse"> + <form id="formId"> + <div class="select-list"> + <ul> + <li> + <label>场所名称:</label> + <input type="text" name="placeName"></input> + </li> + <li> + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a> + </li> + </ul> + </div> + </form> + </div> + + <div class="btn-group-sm" id="toolbar" role="group"> + <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:placeRegist:add"> + <i class="fa fa-plus"></i> 记录 + </a> + <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:placeRegist:edit"> + <i class="fa fa-edit"></i> 修改 + </a> + <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:placeRegist:remove"> + <i class="fa fa-remove"></i> 删除 + </a> + </div> + <div class="col-sm-12 select-table table-striped"> + <table id="bootstrap-table"></table> + </div> + </div> + </div> + <th:block th:include="include :: footer" /> + <script th:inline="javascript"> + var detailFlag = [[${@permission.hasPermi('system:placeRegist:detail')}]]; + var editFlag = [[${@permission.hasPermi('system:placeRegist:edit')}]]; + var removeFlag = [[${@permission.hasPermi('system:placeRegist:remove')}]]; + var prefix = ctx + "system/placeRegist"; + var placeCache = {}; + + // 预加载数据函数 + function loadPlacesData() { + var apiUrl = ctx + 'system/place/getList'; + return $.ajax({ + url: apiUrl, + method: 'POST', + dataType: 'json' + }).done(function(data) { + // 假设返回的数据格式为 { data: [{ id: 1, placeName: '...'}, ...] } + data.data.forEach(function(item) { + placeCache[item.id] = item.placeName; + }); + }).fail(function(xhr, status, error) { + console.error('预加载数据失败:', error); + }); + } + $(function() { + var options = { + url: prefix + "/list", + createUrl: prefix + "/add", + updateUrl: prefix + "/edit/{id}", + detailUrl: prefix + "/detail/{id}", + removeUrl: prefix + "/remove", + modalName: "场所出入登记", + columns: [{ + checkbox: true + }, + { + field: 'id', + title: 'ID', + visible: false + }, + { + field: 'id', + title: '场所ID', + visible: false + }, + { + field: 'placeName', + title: '场所名称', + formatter:function (value, row, index){ + return placeCache[value] || '加载中...'; // 使用缓存数据或显示默认提示 + } + }, + { + field: 'registName', + title: '登记人员', + }, + { + field: 'registTime', + title: '登记日期', + formatter: function(value, row, index) { + if (value !== null){ + var date = new Date(value); + var year = date.getFullYear(); + var month = ('0' + (date.getMonth() + 1)).slice(-2); + var day = ('0' + date.getDate()).slice(-2); + var hours = ('0' + date.getHours()).slice(-2); + var minutes = ('0' + date.getMinutes()).slice(-2); + return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes; + } + } + }, + { + field: 'subjectMatter', + title: '事由', + }, + { + field: 'accessTime', + title: '进入时间', + formatter: function(value, row, index) { + if (value !== null){ + var date = new Date(value); + var year = date.getFullYear(); + var month = ('0' + (date.getMonth() + 1)).slice(-2); + var day = ('0' + date.getDate()).slice(-2); + var hours = ('0' + date.getHours()).slice(-2); + var minutes = ('0' + date.getMinutes()).slice(-2); + return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes; + } + } + }, + { + field: 'leaveTime', + title: '离开时间', + formatter: function(value, row, index) { + if (value !== null){ + var date = new Date(value); + var year = date.getFullYear(); + var month = ('0' + (date.getMonth() + 1)).slice(-2); + var day = ('0' + date.getDate()).slice(-2); + var hours = ('0' + date.getHours()).slice(-2); + var minutes = ('0' + date.getMinutes()).slice(-2); + return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes; + } + } + }, + { + field: 'entourageName', + title: '陪同人员', + }, + { + field: 'deptName', + title: '所属单位', + }, + { + title: '操作', + align: 'center', + formatter: function(value, row, index) { + var actions = []; + actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>详细</a> '); + actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>'); + return actions.join(''); + } + }] + }; + $.table.init(options); + }); + $(document).ready(function() { + loadPlacesData().done(function() { + $('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格以应用新的数据 + }); + }); + </script> +</body> +</html>