btxtgxq-system-city/src/main/resources/static/route/specialreportcase/save.html
wans 01ca20b474 修改所有片长为网格长 所有N员为专管员
修改地图首页点击网格查看详情数据为空的问题
2021-07-05 12:54:56 +08:00

549 lines
25 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<base href="/servicecity/">
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<style>
.input-border-skin{
border: 1px solid #e6e6e6;
}
.photo-show{border: 1px solid #e6e6e6;}
.photo-show .photo-show-wrap{margin-right:10px;}
.photo-show .photo-show-wrap .photo-wrap{display:inline-block;background-color:white;padding:5px;margin-bottom:5px;position:relative;}
.photo-show .photo-show-wrap .photo-wrap img{height:100px;}
.photo-show .photo-show-wrap .photo-wrap a{position:absolute;top:0px;right:0px;border-color:#CCC;background-color: #ff3939;
height: 20px;
width: 20px;
text-align: center;
line-height: 20px;
border-radius: 5px;
color: #fff;}
.audio-a{position: absolute;top: 40px;right: 0px;border-color: #CCC;background-color: #ff3939;height: 20px;width: 20px;text-align: center;line-height: 20px;border-radius: 5px;color: #fff;}
</style>
</head>
<body>
<div class="layui-anim layui-anim-fadein" style="padding: 5px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-row">
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label">地区名称</label>
<div class="layui-input-block">
<input type="text" id="areaName" name="areaName" autocomplete="off" style="cursor:pointer;"
class="layui-input" value="" placeholder="请选择地区" readonly="readonly" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label">社区名称</label>
<div class="layui-input-block">
<input type="text" id="communityName" name="communityName" autocomplete="off" style="cursor: pointer"
class="layui-input" value="" placeholder="请选择社区" readonly="readonly" lay-verify="required">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">案件类型</label>
<div class="layui-input-block">
<input type="text" id="caseTypeName" name="caseTypeName" autocomplete="off" style="cursor: pointer"
class="layui-input" value="" placeholder="请选择案件类型" readonly="readonly" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">处理人</label>
<div class="layui-input-block" id="acceptUserTemplateBox"></div>
<script type="text/html" id="acceptUserTemplate">
<select id="handleUserId" name="handleUserId" lay-verify="required">
<option value="">选择处理人</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.userId}}">{{item.userName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">来源</label>
<div class="layui-input-block">
<select id="caseSource" name="caseSource" lay-verify="required">
<option value="">选择来源</option>
<option value="1">群众举报</option>
<option value="2">巡检采集</option>
<option value="3">专管员上报</option>
</select>
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12 layui-col-sm12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">内容</label>
<div class="layui-input-block">
<input id="caseContent" name="caseContent" autocomplete="off" placeholder="请输入内容" class="layui-input" lay-verify="required">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12 layui-col-sm12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">案件图片</label>
<div class="photo-show" id="casePhotosSelectTemplateBox"></div>
<script id="casePhotosSelectTemplate" type="text/html">
{{# for(var i = 0, item; item = d[i++];) { }}
<span class="photo-show-wrap">
<span class="photo-wrap">
<img src="route/file/downloadfile/true/{{item}}"/>
<a href="javascript:void(0)" data-id="{{item}}" class="btn btn-danger btn-xs delSelectImageBtn"><i class="fa fa-trash"></i></a>
</span>
</span>
{{# } }}
{{# if(d.length < 6){ }}
<span>
<a href="javascript:void(0)" id="selectImageBtn"><i class="fa fa-plus-square-o fa-5x"></i></a>
</span>
{{# } }}
</script>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12 layui-col-sm12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">案件音频</label>
<div class="photo-show" id="caseAudioSelectTemplateBox"></div>
<script id="caseAudioSelectTemplate" type="text/html">
<span class="photo-wrap">
{{# if(d != null && d.length != '' && d.length > 0 ) { }}
<span class="photo-show-wrap">
<audio id="caseAudio" controls="true" style="width: 98%">
<source src="route/file/downloadfile/true/{{d}}" type="audio/mpeg">
<source src="route/file/downloadfile/true/{{d}}" type="audio/wav">
<source src="route/file/downloadfile/true/{{d}}" type="audio/ogg">
您的浏览器不支持 audio 标签
</audio>
</span>
<a href="javascript:void(0)" class="btn btn-danger btn-xs audio-a delSelectAudioBtn"><i class="fa fa-trash"></i></a>
</span>
{{# } else { }}
<span>
<a href="javascript:void(0)" id="selectAudioBtn"><i class="fa fa-plus-square-o fa-5x"></i></a>
</span>
{{# } }}
</script>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label">经度</label>
<div class="layui-input-block">
<input type="text" id="caseLongitude" name="caseLongitude" placeholder="点击地图选择" autocomplete="off" style="cursor:pointer;"
class="layui-input" value="" readonly="readonly" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label">纬度</label>
<div class="layui-input-block">
<input type="text" id="caseLatitude" name="caseLatitude" placeholder="点击地图选择" autocomplete="off" style="cursor: pointer"
class="layui-input" value="" readonly="readonly" lay-verify="required">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12 layui-col-sm12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">位置</label>
<div class="layui-input-block">
<input id="casePosition" name="casePosition" autocomplete="off" placeholder="请输入内容" class="layui-input" lay-verify="required">
</div>
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12 layui-col-sm12" style="padding: 0 15px;">
<div id="mapContainer" style="width: 100%;height: 350px;"></div>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">保存</button>
<button type="button" class="layui-btn layui-btn-primary close">取消</button>
</div>
</div>
</div>
</div>
</form>
</div>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=oWU9RD4ihDHAafexgI6XOrTK8lDatRju"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'form','laydate', 'laytpl'], function() {
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var areaId = '';
var areaName = '';
var communityId = '';
var communityName = '';
var caseTypeId = '';
var caseTypeName = '';
var caseSource = '';
var isSelf = '1';
var casePhotos = [];
var caseAudio = [];
var caseLongitude = '';
var caseLatitude = '';
// 选择地区
function selectArea() {
top.dialog.tree({
title: '所属地区',
apiUri: 'api/dict/listztreedict',
width: '200px',
height: '400px',
defaultParams: {id: '9d179f05-3ea0-48f7-853c-d3b7124b791c'},
selectedNodes: [
{
id: areaId,
name: areaName,
title: areaName
}
],
onClose: function() {
var selectNodes = top.dialog.dialogTreeData.selectedNodes;
if(typeof(selectNodes) != 'undefined' && selectNodes != null) {
if(selectNodes.length > 0) {
var selectedNode = selectNodes[0];
areaId = selectedNode.id;
areaName = selectedNode.name;
} else {
areaId = '';
areaName = '';
}
$('#areaName').val(areaName);
communityId = '';
communityName = '';
$('#communityName').val('');
}
}
});
}
$(document).on('click','#areaName',function(){
selectArea();
});
// 选择社区
function selectCommunity () {
if(areaId == '' || 'undefined' === typeof (areaId)) {
layer.msg('请先选择地区');
return;
}
top.dialog.tree({
title: '选择社区',
apiUri: 'api/community/listcommunity',
width: '200px',
height: '400px',
otherParams: {
areaId: areaId
},
dataFilter: function(treeId, parentNode, childNodes) {
for(var i = 0, item = childNodes[i]; item = childNodes[i++];) {
item.id = item.communityId;
item.name = item.communityName;
}
return childNodes;
},
selectedNodes: [{
id: communityId,
name: communityName,
title: communityName
}],
onClose: function() {
var selectNodes = top.dialog.dialogTreeData.selectedNodes;
if(typeof(selectNodes) != 'undefined' && selectNodes != null) {
if(selectNodes.length > 0) {
var selectedNode = selectNodes[0];
communityId = selectNodes[0].id;
communityName = selectNodes[0].name;
} else {
communityId = '';
communityName = '';
}
$('#communityName').val(communityName);
}
}
});
}
$(document).on('click','#communityName',function(){
selectCommunity();
});
// 选择案件类型
function selectCaseType () {
top.dialog.tree({
title: '案件类型',
apiUri: 'api/dict/listztreedict',
width: '200px',
height: '400px',
defaultParams: {id: '46d108b2-4ef9-4f6f-b30c-0c700e3ee852'},
selectedNodes: [
{
id: caseTypeId,
name: caseTypeName,
title: caseTypeName
}
],
onClose: function() {
var selectNodes = top.dialog.dialogTreeData.selectedNodes;
if(typeof(selectNodes) != 'undefined' && selectNodes != null) {
if(selectNodes.length > 0) {
var selectedNode = selectNodes[0];
caseTypeId = selectedNode.id;
caseTypeName = selectedNode.name;
} else {
caseTypeId = '';
caseTypeName = '';
}
$('#caseTypeName').val(caseTypeName);
if(caseTypeId != ''){
initNUsers(caseTypeId);
}
}
}
});
}
$(document).on('click','#caseTypeName',function(){
selectCaseType();
});
//初始化处理人员
function initNUsers(caseTypeId){
if(caseTypeId == ''){
laytpl(document.getElementById('acceptUserTemplate').innerHTML).render([], function(html) {
document.getElementById('acceptUserTemplateBox').innerHTML = html;
});
form.render('select');
return;
}
top.restAjax.get('api/bindingdepartment/getcasetypedepartmentusers/' + caseTypeId, {}, null, function(code, data) {
laytpl(document.getElementById('acceptUserTemplate').innerHTML).render(data, function(html) {
document.getElementById('acceptUserTemplateBox').innerHTML = html;
});
form.render('select');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
initNUsers('');
// 初始化案件图片
function initCasePhotos(){
if(casePhotos == null ||casePhotos.length == 0 || casePhotos[0] == '' ){
casePhotos = [];
}
laytpl(document.getElementById('casePhotosSelectTemplate').innerHTML).render(casePhotos, function(html) {
document.getElementById('casePhotosSelectTemplateBox').innerHTML = html;
});
}
initCasePhotos();
// 选择图片
function selectImage() {
top.dialog.file({
type: 'image',
title: '选择图片',
width: '600px',
height: '420px',
maxFileCount: (6 - casePhotos.length),
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
for(var i = 0, item = uploadFileArray[i]; item = uploadFileArray[i++];) {
casePhotos.push(item.data);
}
}
initCasePhotos();
}
});
}
$(document).on('click','#selectImageBtn',function(){
selectImage();
});
// 删除图片
function removeImage(fileId) {
for(var i = 0; i < casePhotos.length; i++) {
var item = casePhotos[i]
if(item == fileId) {
casePhotos.splice(i, 1);
break;
}
}
initCasePhotos();
}
$(document).on('click','.delSelectImageBtn',function(){
removeImage($(this).attr('data-id'));
});
// 初始化案件音频
function initCaseAudio(){
if(caseAudio == null ||caseAudio.length == 0 || caseAudio[0] == '' ){
caseAudio = [];
}
laytpl(document.getElementById('caseAudioSelectTemplate').innerHTML).render(caseAudio, function(html) {
document.getElementById('caseAudioSelectTemplateBox').innerHTML = html;
});
}
initCaseAudio();
// 选择音频
function selectAudio () {
top.dialog.file({
type: 'audio',
title: '选择音频',
width: '600px',
height: '420px',
maxFileCount: 1,
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
caseAudio = uploadFileArray[0].data;
}
initCaseAudio();
}
});
}
$(document).on('click','#selectAudioBtn',function(){
selectAudio();
});
// 删除音频
function removeAudio() {
caseAudio = [];
initCaseAudio();
}
$(document).on('click','.delSelectAudioBtn',function(){
removeAudio();
});
//初始化地图
function initMap() {
var map = new BMap.Map('mapContainer', {enableMapClick: false});
var point = new BMap.Point('109.85017859252311', '40.66017700460503');
//mapMarkPoint(map, point);
map.centerAndZoom(point, 12);
map.addControl(new BMap.NavigationControl());
map.addControl(new BMap.ScaleControl());
map.addControl(new BMap.OverviewMapControl());
map.addControl(new BMap.MapTypeControl());
// 点击获取地址
var geocoder= new BMap.Geocoder();
map.addEventListener("click", function(e) {
map.clearOverlays();
caseLongitude = e.point.lng;
caseLatitude = e.point.lat;
$('#caseLongitude').val(e.point.lng);
$('#caseLatitude').val(e.point.lat);
point = new BMap.Point(caseLongitude, caseLatitude);
mapMarkPoint(map, point);
geocoder.getLocation(e.point, function(rs) {
$('#casePosition').val(rs.address);
});
});
}
initMap();
function mapMarkPoint(map, point) {
var marker = new BMap.Marker(point);
map.addOverlay(marker);
}
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
$('.close').on('click', function() {
closeBox();
});
form.on('submit(submitForm)', function(formData) {
//封装数据
var formObject = {};
formObject['areaId'] = areaId;
formObject['areaName'] = areaName;
formObject['casePhotos'] = casePhotos.toString();
formObject['caseAudio'] = caseAudio.toString();
formObject['communityId'] = communityId;
formObject['communityName'] = communityName;
formObject['caseSource'] = formData.field['caseSource'];
formObject['isSelf'] = formData.field['isSelf'];
formObject['caseTypeId'] = caseTypeId;
formObject['caseTypeName'] = caseTypeName;
formObject['caseContent'] = formData.field['caseContent'];
formObject['caseLongitude'] = formData.field['caseLongitude'];
formObject['caseLatitude'] = formData.field['caseLatitude'];
formObject['casePosition'] = formData.field['casePosition'];
formObject['handleUserId'] = formData.field['handleUserId'];
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/specialreportcase/savespecialreportcase', []), formObject, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function() {
top.dialog.close(layerIndex);
//window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
})
});
</script>
</body>
</html>