Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/work/channelPortConfigAdd.jsp
2026-01-16 14:13:44 +08:00

249 lines
9.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" pageEncoding="UTF-8"%>
<script type="text/javascript">
var filelist = new Array();
//初始化fileinput控件第一次初始化
function initFileInput(ctrlName, uploadUrl) {
control = $('#' + ctrlName);
control.fileinput({
language: 'zh', //设置语言
uploadUrl: uploadUrl, //上传的地址
uploadAsync: true,
allowedFileExtensions : ['jpg', 'png', 'svg', 'jpeg', 'gif'],//接收的文件后缀
showUpload: false, //是否显示上传按钮
showRemove: false,
showCaption: true,//是否显示标题
showClose:false,//右上角关闭按钮
browseClass: "btn btn-primary", //按钮样式
maxFileCount: 2, //表示允许同时上传的最大文件个数
maxFileSize: 1048576,
enctype: 'multipart/form-data',
dropZoneEnabled: false ,//是否显示拖拽区域
validateInitialCount:true,
previewFileIcon: "<i class='fa fa-file'></i>",
preferIconicPreview: true,//是否强制相关文件展示icon
initialPreviewAsData: true,
previewFileIconSettings: {
'doc': '<i class="fa fa-file-word-o" style="color:#3c8dbc;"></i>',
'docx': '<i class="fa fa-file-word-o" style="color:#3c8dbc;"></i>',
'xls': '<i class="fa fa-file-excel-o" style="color:#00a65a ;"></i>',
'xlsx': '<i class="fa fa-file-excel-o" style="color:#00a65a ;"></i>',
'pptx': '<i class="fa fa-file-powerpoint-o" style="color:#f39c12; "></i>',
'ppt': '<i class="fa fa-file-powerpoint-o" style="color:#f39c12; "></i>',
//'jpg': '<i class="fa fa-file-image-o" style="color:#00a65a "></i>',
'pdf': '<i class="fa fa-file-pdf-o" style="color:#dd4b39 ;"></i>',
'zip': '<i class="fa fa-file-zip-o" ></i>',
},
uploadExtraData:function (previewId, index) {
//var editorText = editor.txt.html();
//传参
var data = {
"masterId": '${id}', //此处自定义传参
"tbName": 'tb_doc_file',
"nameSpace": 'Document',
//"wName":$("#wName").val(),
//"wContent": editorText
};
return data;
},
//设置缩略图上的按钮,为空不显示,默认显示
layoutTemplates:{
//actionDelete:'',
actionUpload:''
},
slugCallback: function (data,data2) {
console.log(data2);
return data;
},
});
/* control.on("filebatchselected", function (event, data, previewId, index) {
$(this).fileinput("upload");
}); */
//导入文件上传完成之后的事件
control.on("fileuploaded", function (event, data, previewId, index) {
if(!data.response.pdf) {
closeModal('fileInputModal');
$("#fileTable").bootstrapTable('refresh');
showAlert('d','上传的文件转换为预览PDF格式失败');
}
});
}
function dosave() {
$("#subForm").bootstrapValidator('validate');//提交验证
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/work/channelPortConfig/doSave.do", $("#subForm").serialize(), function(data) {
if (data.res == 1) {
control.fileinput("upload");
closeModal('subModal')
$("#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: '用户名不能为空'
}
}
},
// processid: {
// validators: {
// notEmpty: {
// message: '请选择工艺段'
// }
// }
// },
status: {
validators: {
notEmpty: {
message: '请选择状态'
}
}
},
}
});
var getProcessList = function() {
$.post(ext.contextPath + "/user/processSection/getSelectList.do", {}, function (data) {
$("#processsectionCode").empty();
var selelct_ = $("#processsectionCode").select2({
data: data,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
});
selelct_.val('').trigger("change");
selelct_.on('change', function (e) {
$('#processid').val(e.target.value);
})
}, 'json');
};
//获取巡检区域
var selectAreaFun = function () {
$.post(ext.contextPath + '/timeEfficiency/patrolPoint/selectAreaLayer.do', {
}, function (data) {
$("#areaSubDiv").html(data);
openModal('areaSubModal');
});
};
$(function(){
$("#unitid").val(unitId)
getProcessList();
initFileInput("filelist",ext.contextPath+ "/document/inputFile.do");
});
</script>
<div class="modal fade" id="subModal">
<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">&times;</span></button>
<h4 class="modal-title">新增出入口配置</h4>
</div>
<div class="modal-body">
<!-- 新增界面formid强制为subForm -->
<form class="form-horizontal" id="subForm">
<!-- 界面提醒div强制id为alertDiv -->
<div id="alertDiv"></div>
<input type="hidden" id="unitid" name="unitid">
<input type="hidden" id="id" name="id" value="${id}">
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-4">
<input type="text" id="name" name="name" class="form-control pull-right" placeholder="请输入">
</div>
<label class="col-sm-2 control-label">类型</label>
<div class="col-sm-4">
<select type="text" id="type" class="form-control pull-right" name="type" >
<option value="1" selected>安全出入口</option>
<option value="2">出入口</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">启用状态</label>
<div class="col-sm-4">
<select type="text" id="status" class="form-control pull-right" name="status" >
<option value="1" selected>启用</option>
<option value="0">禁用</option>
</select>
</div>
<label class="col-sm-2 control-label">排序</label>
<div class="col-sm-4">
<input type="text" id="sort" name="sort" class="form-control pull-right" oninput="value=value.replace(/[^\d]/g,'')">
</div>
</div>
<%-- <div class="form-group">--%>
<%-- <label class="col-sm-2 control-label">工艺段</label>--%>
<%-- <div class="col-sm-10">--%>
<%-- <select class="form-control select2" id="processsectionCode" name="processsectionCode"></select>--%>
<%-- <input type="hidden" class="form-control" id="processid" name="processid" value=""/>--%>
<%-- </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="areaName" name="areaName"
onclick="selectAreaFun()" placeholder="点击选择">
<input type="hidden" class="form-control" id="address" name="address">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">出入口描述</label>
<div class="col-sm-10">
<textarea maxlength="200" class="form-control " id="describe" name="describe" rows="2" placeholder="出入口描述"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">图片坐标</label>
<div class="col-sm-10">
<input type="text" id="remarks" name="remarks" class="form-control pull-right" value="${channelPortConfig.remarks}">
<%--<textarea maxlength="200" class="form-control " id="remarks" name="remarks" rows="2" placeholder="备注"></textarea>--%>
</div>
</div>
<div class="form-group" >
<label class="col-sm-2 control-label">上传图片</label>
<div class="col-sm-10">
<input type="file" name="filelist" id="filelist" multiple class="file-loading" />
</div>
</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="dosave()" id="btn_save">保存</button>
</div>
</div>
</div>
</div>