first commit
This commit is contained in:
462
WebRoot/jsp/work/scadapic/scadaPicEdit.jsp
Normal file
462
WebRoot/jsp/work/scadapic/scadaPicEdit.jsp
Normal file
@ -0,0 +1,462 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@page import="com.sipai.entity.work.ScadaPic"%>
|
||||
<% request.setAttribute("Type_scadapic_detail", ScadaPic.Type_scadapic_detail);%>
|
||||
<% request.setAttribute("Type_scadapic_brief", ScadaPic.Type_scadapic_brief);%>
|
||||
<% request.setAttribute("Type_scadapic_ps", ScadaPic.Type_scadapic_ps);%>
|
||||
<% request.setAttribute("Type_scadapic_detail_name", ScadaPic.Type_scadapic_detail_name);%>
|
||||
<% request.setAttribute("Type_scadapic_brief_name", ScadaPic.Type_scadapic_brief_name);%>
|
||||
<% request.setAttribute("Type_scadapic_ps_name", ScadaPic.Type_scadapic_ps_name);%>
|
||||
<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 fileinput = function() {
|
||||
//var url='/maintenance/updateProblemFile.do';//保存数据表方法
|
||||
$.post(ext.contextPath + '/base/fileinput.do', {masterId:masterId,tbName:tbName,nameSpace:nameSpace} , function(data) {
|
||||
$("#fileInputDiv").html(data);
|
||||
openModal('fileInputModal');
|
||||
});
|
||||
};
|
||||
var masterId=$('#id').val();
|
||||
var tbName='TB_SCADAPIC_FILE'; //数据表
|
||||
var nameSpace='ScadaPicFile';//保存文件夹
|
||||
var previews = new Array();
|
||||
var previewConfigs = new Array();
|
||||
/* var student = {
|
||||
"caption":"lilei",
|
||||
|
||||
}
|
||||
previewConfigs[0]=student; */
|
||||
//初始化fileinput控件(第一次初始化)
|
||||
function showFileInput(ctrlName) {
|
||||
var control = $('#' + ctrlName);
|
||||
|
||||
control.fileinput('destroy');
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
showUpload: false, //是否显示上传按钮
|
||||
showDownload:true,
|
||||
showRemove:false,
|
||||
showCaption: true,//是否显示标题
|
||||
showBrowse:false,//选择按钮
|
||||
showClose:false,//右上角关闭按钮
|
||||
dropZoneEnabled: false,//是否显示拖拽区域
|
||||
fileActionSettings:{
|
||||
showDrag:false
|
||||
},
|
||||
allowedFileExtensions : ['jpg', 'png'],//接收的文件后缀
|
||||
previewFileType:['image'],
|
||||
otherActionButtons:'<a type="button" onclick="downloadfile(this)" class="kv-file-down btn btn-sm btn-default" {dataKey} title="下载附件"><i class="fa fa-cloud-download"></i></a>',
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
maxFileCount: 1, //表示允许同时上传的最大文件个数
|
||||
enctype: 'multipart/form-data',
|
||||
validateInitialCount:true,
|
||||
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
|
||||
initialPreviewAsData: true,
|
||||
initialPreview: previews,
|
||||
initialPreviewConfig:previewConfigs,
|
||||
layoutTemplates:{
|
||||
actionUpload:'',
|
||||
actionDownload:''
|
||||
},
|
||||
preferIconicPreview: true,//是否强制相关文件展示icon
|
||||
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>',
|
||||
},
|
||||
deleteUrl:ext.contextPath+"/base/deleteInputFile.do",
|
||||
deleteExtraData:function () { //传参
|
||||
var data = {
|
||||
"tbName": tbName
|
||||
};
|
||||
return data;
|
||||
}
|
||||
});
|
||||
$('#kvFileinputModal').on("hidden.bs.modal", function() {
|
||||
$(this).removeData("bs.modal");
|
||||
//modal重复打开会导致前面的滚动条失去作用
|
||||
$('.modal').css("overflow","auto");
|
||||
});
|
||||
}
|
||||
function downloadfile(obj){
|
||||
var key = $(obj).data('key');
|
||||
window.open(ext.contextPath + '/base/downloadFile.do?key='+key+'&tbName='+tbName);
|
||||
}
|
||||
//名称定义不可修改
|
||||
var getFileList = function() {
|
||||
$.post(ext.contextPath + '/base/getInputFileList.do', {masterId:masterId,tbName:tbName} , function(data) {
|
||||
//console.info(data)
|
||||
if(data.length>0){
|
||||
previews=new Array();
|
||||
$('#scadapicfile').show();
|
||||
for(var i=0;i<data.length;i++){
|
||||
var previewConfig = new Object();
|
||||
var path = data[i].abspath;
|
||||
path=path.substring(path.indexOf('webapps')+7,path.length);
|
||||
path =ext.basePath.replace(ext.contextPath,'')+ path.replace(/\\/g,"\/");;
|
||||
previews.push(path);
|
||||
previewConfig['width']= '50px';
|
||||
previewConfig['caption']= data[i].filename;
|
||||
previewConfig['key']= data[i].id;
|
||||
previewConfigs.push(previewConfig);
|
||||
}
|
||||
showFileInput("scadapicfile");
|
||||
}else{
|
||||
$('#scadapicfile').hide();
|
||||
}
|
||||
},'json');
|
||||
|
||||
};
|
||||
getFileList();
|
||||
function doupdate() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
setTimeout(function(){
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/work/scadaPic/update.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1){
|
||||
closeModal('subModal');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败','alertDiv');
|
||||
}else{
|
||||
showAlert('d',data.res,'alertDiv');
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}, 100);
|
||||
|
||||
}
|
||||
//输入框验证
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
mpointid: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '测量点不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
bizid: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '厂区不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
type: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '类型不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
processsectionid: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '工艺段不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
grade: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '重要等级不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
/* processsectionid: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '工艺段不能为空'
|
||||
}
|
||||
}
|
||||
}, */
|
||||
}
|
||||
});
|
||||
//初始化底图类型选择框
|
||||
var refreshTypeSelect = function() {
|
||||
var select = $("#type").select2({
|
||||
data: null,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||||
});
|
||||
select.val('${ScadaPic.type}').trigger("change");
|
||||
select.on("change",function(e){
|
||||
var text = $("#type").find("option:selected").text();
|
||||
$("#text").val(text);
|
||||
if($(this).val()=='${Type_scadapic_ps}'){
|
||||
//alert();
|
||||
$("#psdiv").show();
|
||||
|
||||
}else{
|
||||
$("#processsectionid").val('');
|
||||
$("#psdiv").hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
//初始化工艺段
|
||||
var refreshSelect = function(companyId) {
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
|
||||
$("#processsectionid").empty();
|
||||
var selelct_ =$("#processsectionid").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('${ScadaPic.processsectionid}').trigger("change");
|
||||
selelct_.on("change",function(e){
|
||||
var text = $("#processsectionid").find("option:selected").text();
|
||||
$("#text").val(text);
|
||||
});
|
||||
},'json');
|
||||
|
||||
};
|
||||
|
||||
$(function(){
|
||||
refreshTypeSelect();
|
||||
if($("#type").val()=='${Type_scadapic_ps}'){
|
||||
//alert();
|
||||
$("#psdiv").show();
|
||||
|
||||
}else{
|
||||
$("#processsectionid").val('');
|
||||
$("#psdiv").hide();
|
||||
}
|
||||
/* //选择厂区
|
||||
$.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function(data) {
|
||||
//选择厂区为一个厂时隐藏选择框
|
||||
if(data.length == 1){
|
||||
$("#bizid").css("display", "none");
|
||||
$("#input_bizid").val(data[0].text);
|
||||
$("#hidden_bizid").val(data[0].id);
|
||||
var companyId = data[0].id;
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
|
||||
$("#processsectionid").empty();
|
||||
var selelct_ =$("#processsectionid").select2({
|
||||
data: data,
|
||||
cache : false,
|
||||
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('${ScadaPic.processsectionid}').trigger("change");
|
||||
selelct_.on("change",function(e){
|
||||
var text = $("#processsectionid").find("option:selected").text();
|
||||
$("#text").val(text);
|
||||
});
|
||||
},'json');
|
||||
}else{
|
||||
$("#hidden_bizid").attr("disabled","disabled");
|
||||
$("#input_bizid").css("display", "none");
|
||||
refreshSelect('${ScadaPic.bizid}');
|
||||
var selelct =$("#bizid").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('${ScadaPic.bizid}').trigger("change");
|
||||
selelct.on("change",function(e){
|
||||
var companyId= $(this).val();
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
|
||||
$("#processsectionid").empty();
|
||||
var selelct_ =$("#processsectionid").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){
|
||||
var text = $("#processsectionid").find("option:selected").text();
|
||||
$("#text").val(text);
|
||||
});
|
||||
},'json');
|
||||
});
|
||||
}
|
||||
},'json'); */
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getUnitForTree.do', { ng: '' }, function (data) {
|
||||
if (data.length == 1 && !data[0].hasOwnProperty("nodes")) {
|
||||
//当登陆者的pid以下没有子节点时显示单独一个span
|
||||
$("#hidden_bizid").val(data[0].id);
|
||||
$("#bizid").hide();
|
||||
$("#input_bizid").text(data[0].text);
|
||||
//companyId = data[0].id;
|
||||
$("#hidden_bizid").val(data[0].id);
|
||||
//initFun();
|
||||
refreshSelect();
|
||||
} else if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
//第一次加载时赋值
|
||||
$("#hidden_bizid").val('${ScadaPic.bizid}');
|
||||
$("#cname_input").val('${companyName}');
|
||||
//companyId = data[0].id;
|
||||
//$("#hidden_bizid").val(data[0].id);
|
||||
//initFun();
|
||||
refreshSelect();
|
||||
//$table.bootstrapTable('refresh');//异步加载重新刷新,待修改
|
||||
$('#companytree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companytree').on('nodeSelected', function (event, data) {
|
||||
$("#hidden_bizid").val(data.id);
|
||||
$("#cname_input").val(data.text);
|
||||
document.getElementById('ul_tree').style.display = "none";
|
||||
//companyId= data.id;
|
||||
//$("#hidden_bizid").val(data.id);
|
||||
//initFun();
|
||||
refreshSelect();
|
||||
});
|
||||
} else {
|
||||
//待完善
|
||||
};
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#ul_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#ul_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="subModal">
|
||||
<div class="modal-dialog modal-md">
|
||||
<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强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
<!-- 新增界面formid强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<input type="hidden" class="form-control" id ="id" name ="id" value="${ScadaPic.id}">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">*公司</label>
|
||||
<div class="col-sm-7">
|
||||
<!-- <select class="form-control select2" id="bizid" name ="bizid" style="width: 270px;">
|
||||
</select>
|
||||
<input class="form-control" id="input_bizid" style="border: none;background: transparent;">
|
||||
<input type="hidden" id="hidden_bizid" name ="bizid"> -->
|
||||
|
||||
<input id="hidden_bizid" name="bizid" type="hidden" />
|
||||
<span id="input_bizid" style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold"></span>
|
||||
<ul id="bizid" style="list-style-type:none;padding-left:0px;width:300px;">
|
||||
<li class="dropdown" style="width:300px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:300px;" onclick="document.getElementById('ul_tree').style.display = 'block';">
|
||||
|
||||
<input class="form-control " id="cname_input" name="cname_input"
|
||||
style="height:31px;width: 220px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly />
|
||||
|
||||
</a>
|
||||
<ul id="ul_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companytree" style="width: 275px;overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">*类型</label>
|
||||
<div class="col-sm-7">
|
||||
<select class="form-control select2" id="type" name ="type" style="width: 270px;">
|
||||
<option value="${Type_scadapic_detail}" >${Type_scadapic_detail_name}</option>
|
||||
<option value="${Type_scadapic_brief}" >${Type_scadapic_brief_name}</option>
|
||||
<option value="${Type_scadapic_ps}" >${Type_scadapic_ps_name}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="psdiv">
|
||||
<label class="col-sm-3 control-label">*工艺段</label>
|
||||
<div class="col-sm-7">
|
||||
<select class="form-control select2" id="processsectionid" name ="processsectionid" style="width: 270px;">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">标题</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="text" class="form-control" id="text" name ="text" placeholder="标题" value="${ScadaPic.text}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<!-- <input id="f_upload" type="file" class="file" /> -->
|
||||
<button type="button" class="btn btn-default btn-file" onclick="fileinput()" id="btn_save"><i class="fa fa-paperclip"></i>上传附件</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin:8px;">
|
||||
<input type="file" name="scadapicfile" id="scadapicfile" 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="doupdate()" id="btn_save">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user