first commit
This commit is contained in:
207
WebRoot/jsp/structure/structureCardPictureAdd.jsp
Normal file
207
WebRoot/jsp/structure/structureCardPictureAdd.jsp
Normal file
@ -0,0 +1,207 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single{
|
||||
height:34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.select2-selection__arrow{
|
||||
margin-top:3px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var masterId=$('#pictureId').val();
|
||||
var tbName='TB_EM_StructureCard_picture_file'; //数据表
|
||||
var nameSpace='StructureCardPicture';//保存文件夹
|
||||
var previews = new Array();
|
||||
var previewConfigs = new Array();
|
||||
|
||||
function initFileInput_single(ctrlName, uploadUrl) {
|
||||
var control = $('#' + ctrlName);
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
uploadUrl: uploadUrl, //上传的地址
|
||||
uploadAsync:true,
|
||||
allowedFileExtensions : ['jpg', 'png','gif'],//接收的文件后缀
|
||||
showUpload: false, //是否显示上传按钮
|
||||
showRemove:false,
|
||||
showCaption: false,//是否显示标题
|
||||
showClose:false,//右上角关闭按钮
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
maxFileCount: 1, //表示允许同时上传的最大文件个数
|
||||
enctype: 'multipart/form-data',
|
||||
validateInitialCount:true,
|
||||
previewFileIcon: "<i class='fa fa-file'></i>",
|
||||
preferIconicPreview: true,//是否强制相关文件展示icon
|
||||
initialPreviewAsData: true,
|
||||
autoReplace:true,
|
||||
dropZoneTitle:'可拖拽文件到选区',
|
||||
uploadExtraData:function (previewId, index) { //传参
|
||||
//var data = $("#subForm_floor").serialize();
|
||||
//console.info(data)
|
||||
var data = {
|
||||
"masterId": masterId, //此处自定义传参
|
||||
"tbName": tbName,
|
||||
"nameSpace": nameSpace
|
||||
};
|
||||
return data;
|
||||
},
|
||||
layoutTemplates:{
|
||||
actionDelete:''
|
||||
},
|
||||
});
|
||||
control.on("filebatchselected", function (event, data, previewId, index) {
|
||||
|
||||
});
|
||||
//导入文件上传完成之后的事件
|
||||
control.on("fileuploaded", function (event, data, previewId, index) {
|
||||
console.info(data)
|
||||
if(data.response.suc) {
|
||||
closeModal('subModal_floor');
|
||||
}
|
||||
});
|
||||
}
|
||||
function doSaveFloor() {
|
||||
$("#subForm_floor").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm_floor").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/structure/structureCardPicture/save.do", $("#subForm_floor").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
$("#filelist").fileinput("upload");
|
||||
closeModal('subModal_floor')
|
||||
$("#table_picture").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败','alertDiv_floor');
|
||||
}else{
|
||||
showAlert('d',data.res,'alertDiv_floor');
|
||||
}
|
||||
},'json');
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
$("#subForm_floor").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
floor: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '楼层不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
morder: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '顺序不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$(function(){
|
||||
initFileInput_single('filelist',ext.contextPath+ "/base/inputFile.do");
|
||||
|
||||
$("#type").change(function(){
|
||||
if(this.value=="line"){
|
||||
$("#safeLevelLabel").hide();
|
||||
$("#safeLevelDiv").hide();
|
||||
$("#safeContentDiv").hide();
|
||||
}else if(this.value=="area"){
|
||||
$("#safeLevelLabel").show();
|
||||
$("#safeLevelDiv").show();
|
||||
$("#safeContentDiv").show();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="subModal_floor">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">新增底图界面</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- 新增界面formid强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm_floor" enctype="multipart/form-data">
|
||||
<input name="id" id="pictureId" type="hidden" value="${id}"/>
|
||||
<input name="unitId" type="hidden" value="${param.unitId}"/>
|
||||
<input name="structureId" id="structureId" type="hidden" value="${structureId}">
|
||||
<!-- <input name="patrolAreaId" type="hidden" value="${param.patrolAreaId}"/> -->
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv_floor"></div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*名称</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="name" name ="name" placeholder="名称" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">楼层</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="floor" name ="floor" placeholder="楼层" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*顺序</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="number" class="form-control" id="morder" name ="morder" placeholder="顺序" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">类型</label>
|
||||
<div class="col-sm-4">
|
||||
<select id ="type" name="type" class="form-control select2">
|
||||
<option value="line" >巡检路线</option>
|
||||
<option value="area" >安全区域</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label id="safeLevelLabel" class="col-sm-2 control-label" style="display: none;">安全等级</label>
|
||||
<div id="safeLevelDiv" class="col-sm-4" style="display: none;">
|
||||
<select id ="safeLevel" name="safeLevel" class="form-control select2">
|
||||
<option value="A" >A级</option>
|
||||
<option value="B" >B级</option>
|
||||
<option value="C" >C级</option>
|
||||
<option value="D" >D级</option>
|
||||
<option value="S" >施工</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="safeContentDiv" class="form-group" style="display: none;">
|
||||
<label class="col-sm-2 control-label">安全备注</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" rows="2" id ="safeContent" name ="safeContent" placeholder="安全备注..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group" style="margin:8px">
|
||||
<button type="button" class="btn btn-default btn-file btn-sm" onclick="fileinput()" id="btn_save"><i class="fa fa-paperclip"></i> 上传图片</button>
|
||||
</div> -->
|
||||
<div class="form-group" style="margin:8px;">
|
||||
<input type="file" name="filelist" id="filelist" multiple class="file-loading" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSaveFloor()" >保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user