You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

198 lines
8.7 KiB

<!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" 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);
}
});
});
var placeName = ''
function doPlaceName(){
var selectedOption = $('#placeName option:selected');
var placeId = selectedOption.val();
placeName = selectedOption.text();
$("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()) {
var data = $("#form-placeRegist-edit").serializeArray();
data.push({"name": "placeName", "value": placeName});
$.operate.save(prefix + "/edit",data);
console.log($('#form-placeRegist-edit').serialize());
}
}
</script>
</body>
</html>