first commit
This commit is contained in:
318
WebRoot/jsp/visit/safeAreaEdit.jsp
Normal file
318
WebRoot/jsp/visit/safeAreaEdit.jsp
Normal file
@ -0,0 +1,318 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<%@page import="com.sipai.entity.visit.VisitCommString"%>
|
||||
<%request.setAttribute("START", VisitCommString.STATUS_VISIT_START); %>
|
||||
<%request.setAttribute("AUDIT", VisitCommString.STATUS_VISIT_AUDIT); %>
|
||||
<%request.setAttribute("REJECT", VisitCommString.STATUS_VISIT_REJECT); %>
|
||||
<%request.setAttribute("EXECUTE", VisitCommString.STATUS_VISIT_EXECUTE); %>
|
||||
<%request.setAttribute("FINISH", VisitCommString.STATUS_VISIT_FINISH); %>
|
||||
<%request.setAttribute("REVOKE", VisitCommString.STATUS_VISIT_REVOKE); %>
|
||||
<%request.setAttribute("VISIT", VisitCommString.STATUS_VISIT); %>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single{
|
||||
height:34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.select2-selection__arrow{
|
||||
margin-top:3px;
|
||||
}
|
||||
.box {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.mapTool{
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
top: 5px;
|
||||
left: 20px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function doupdate() {
|
||||
if($("#bizId").val()==null || $("#bizId").val()==''){
|
||||
$("#bizId").val(unitId);
|
||||
}
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/visit/safeArea/doupdate.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
//输入框验证
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '安全区域名称不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
securityLevel: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '安全区域级别不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
var showUser4SelectsFun = function(hiddenId,textId) {
|
||||
var userIds= $("#"+hiddenId).val();
|
||||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:hiddenId,textId:textId,userIds:userIds} , function(data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
//提交时先验证审核人不能为空,保存时审核人可以为空
|
||||
function submitFun(){
|
||||
//新增的输入框添加验证
|
||||
$("#subForm").data('bootstrapValidator').addField('auditMan',{
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '审核人不能为空'
|
||||
},
|
||||
}
|
||||
});
|
||||
dosubmit();
|
||||
}
|
||||
|
||||
function dosubmit(){
|
||||
$("#state").val('${AUDIT}');
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/visit/safeArea/startProcess.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1){
|
||||
closeModal('subModal');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else if(data.res == 2){
|
||||
showAlert('d','未检测到审核流程,请先部署流程!');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
|
||||
var dodel = function(id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(willDelete =>{
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/visit/safeArea/dodelete.do', {id : id}, function(data) {
|
||||
if(data==1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
$("#contentBox").empty();
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var map;
|
||||
var zoom = 12;
|
||||
var polygon;
|
||||
var handler;
|
||||
//显示多边形
|
||||
function showPolygonTool() {
|
||||
var safeAreaId = $("#id").val();
|
||||
$.post(ext.contextPath + '/visit/safeArea/getLngLats.do', {safeAreaId : safeAreaId}, function(data) {
|
||||
data = $.parseJSON(data);
|
||||
var res = data.res;
|
||||
if(res>0){
|
||||
console.log(res);
|
||||
var points = [];
|
||||
var lngLats = data.lngLats;
|
||||
$.each(lngLats,function(n,value){
|
||||
points.push(new T.LngLat(value.longitude, value.latitude));
|
||||
}
|
||||
);
|
||||
//创建面对象
|
||||
polygon = new T.Polygon(points,{
|
||||
color: "blue", weight: 3, opacity: 0.5, fillColor: "#FFFFFF", fillOpacity: 0.5
|
||||
});
|
||||
//向地图上添加面
|
||||
map.addOverLay(polygon);
|
||||
//编辑面
|
||||
enableEdit();
|
||||
}else{
|
||||
openPolygonTool();
|
||||
}
|
||||
});
|
||||
}
|
||||
//注册多边形工具
|
||||
function openPolygonTool() {
|
||||
if (handler) handler.close();
|
||||
handler = new T.PolygonTool(map);
|
||||
handler.open();
|
||||
//用户双击完成一次折线绘制时触发事件。
|
||||
handler.addEventListener("draw", overlay_style);
|
||||
}
|
||||
//获取marker的属性
|
||||
function overlay_style(e) {
|
||||
polygon = e.currentPolygon;
|
||||
enableEdit();
|
||||
}
|
||||
//编辑多边形
|
||||
function enableEdit() {
|
||||
polygon.enableEdit();
|
||||
}
|
||||
//结束编辑多边形
|
||||
function endDraw() {
|
||||
//获取点数组
|
||||
var LngLats = polygon.getLngLats();
|
||||
//嵌套数组
|
||||
LngLats = LngLats[0];
|
||||
//禁用编辑
|
||||
polygon.disableEdit();
|
||||
if(LngLats.length>0){
|
||||
var safeAreaId = $("#id").val();
|
||||
var bizId = $("#bizId").val();
|
||||
var centerLng = map.getCenter().getLng();
|
||||
var centerLat = map.getCenter().getLat();
|
||||
$("#longitude").val(centerLng);
|
||||
$("#latitude").val(centerLat);
|
||||
$.post(ext.contextPath + '/visit/safeArea/setLngLats.do', {LngLats : JSON.stringify(LngLats),safeAreaId : safeAreaId,bizId : bizId,centerLng : centerLng, centerLat : centerLat}, function(data) {
|
||||
if(data.res>0){
|
||||
}else{
|
||||
showAlert('d','保存失败','mainAlertdiv');
|
||||
}
|
||||
enableEdit();
|
||||
});
|
||||
}
|
||||
}
|
||||
//清除绘制内容
|
||||
function clearOverLays() {
|
||||
map.clearOverLays();
|
||||
openPolygonTool();
|
||||
}
|
||||
$(function(){
|
||||
var height = $(window).height();
|
||||
if(height<100){
|
||||
height = window.screen.height-150;
|
||||
}
|
||||
$("#mapDiv").height((height-270)+"px");
|
||||
|
||||
//类型
|
||||
var selelct_type = $("#type").select2({
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
selelct_type.val('${safeArea.type}').trigger("change");
|
||||
|
||||
var Lng = $("#longitude").val();
|
||||
var Lat = $("#latitude").val();
|
||||
if(Lng==null || Lng==''){
|
||||
Lng = 121.47081;
|
||||
}
|
||||
if(Lat==null || Lat==''){
|
||||
Lat = 31.23268;
|
||||
}
|
||||
map = new T.Map('mapDiv', {
|
||||
projection: 'EPSG:4326'
|
||||
});
|
||||
map.centerAndZoom(new T.LngLat(Lng,Lat), zoom);
|
||||
//
|
||||
showPolygonTool();
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">编辑信息</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<%--<button type="button" class="btn btn-info" onclick="submitFun()" id="btn_submit">提交审核</button>--%>
|
||||
<a onclick="doupdate()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
<a onclick="dodel()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
||||
class="glyphicon glyphicon-trash"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<!-- 新增界面formid强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<input id="id" name="id" type="hidden" value="${safeArea.id}"/>
|
||||
<input id="bizId" name="bizId" type="hidden" value="${safeArea.bizId}"/>
|
||||
<input type="hidden" class="form-control" id="longitude" name="longitude" value="${safeArea.longitude}">
|
||||
<input type="hidden" class="form-control" id="latitude" name="latitude" value="${safeArea.latitude}">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*安全区域名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="name" name ="name" placeholder="安全区域名称"
|
||||
value="${safeArea.name}"/>
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*安全级别</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" class="form-control" id="securityLevel" name ="securityLevel" placeholder="安全级别"
|
||||
value="${safeArea.securityLevel}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*人群类型</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2" id="type"
|
||||
name="type" style="width: 100%;">
|
||||
<option value="adult">成人</option>
|
||||
<option value="children">青少年</option>
|
||||
</select>
|
||||
</div>
|
||||
<%--<label class="col-sm-2 control-label">状态</label>
|
||||
<div class="col-sm-4">
|
||||
<p class="form-control-static">${safeArea.stateName}</p>
|
||||
<input id="state" name="state" type="hidden" value="${START}"/>
|
||||
</div>--%>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">备注</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" rows="2" id ="remark" name ="remark" placeholder="备注...">${safeArea.remark}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="mapTool">
|
||||
<button type="button" class="btn btn-primary btn-sm" onclick="endDraw();">保存绘制</button>
|
||||
<button type="button" class="btn btn-warning btn-sm" onclick="clearOverLays();">重新绘制</button>
|
||||
</div>
|
||||
<div class="mapDiv" id="mapDiv"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user