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

312 lines
14 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" %>
<%@ 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.GroupContentForm" %>
<% request.setAttribute("Showtextst_TRUE", GroupContentForm.Showtextst_TRUE);%>
<% request.setAttribute("Showtextst_FALSE", GroupContentForm.Showtextst_FALSE);%>
<% request.setAttribute("Mpst_1", GroupContentForm.Mpst_1);%>
<% request.setAttribute("Mpst_2", GroupContentForm.Mpst_2);%>
<link rel="stylesheet"
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"/>
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
charset="utf-8"></script>
<script type="text/javascript">
$(function () {
$("#valuerange").select2({minimumResultsForSearch: -1}).val("${groupContentForm.valuerange}").trigger("change");
$('#switchBtn').bootstrapSwitch({
onText: '是',
offText: '否',
size: "small",
});
if ('${groupContentForm.showtextst}' == '${Showtextst_FALSE}') {
$('#switchBtn').bootstrapSwitch('state', false, true);
} else if ('${groupContentForm.showtextst}' == '${Showtextst_TRUE}') {
$('#switchBtn').bootstrapSwitch('state', true, true);
} else {
$('#switchBtn').bootstrapSwitch('state', false, true);
}
$('#switchBtn_Mpst').bootstrapSwitch({
onText: '输入',
offText: '输出',
size: "small",
});
if ('${groupContentForm.mpst}' == '${Mpst_2}') {
$('#switchBtn_Mpst').bootstrapSwitch('state', false, true);
} else if ('${groupContentForm.mpst}' == '${Mpst_1}') {
$('#switchBtn_Mpst').bootstrapSwitch('state', true, true);
} else {
$('#switchBtn_Mpst').bootstrapSwitch('state', false, true);
}
$('#colorContainer1').colorpicker({format: null});
$('#colorContainer2').colorpicker({format: null});
var dataTextalign = JSON.parse("[{\"id\":\"center\",\"text\":\"居中\"},{\"id\":\"left\",\"text\":\"靠左\"},{\"id\":\"right\",\"text\":\"靠右\"}]");
var select = $("#textalign").select2({
data: dataTextalign,
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;
} // 函数用于呈现当前的选择
});
// select.on("change", function (e) {
//
// });
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});//选中元素上下居中
select.val('${groupContentForm.textalign}').trigger("change");//设置选中
})
function doContentFormSave() {
$("#contentFormSubForm").bootstrapValidator('validate');//提交验证
if ($("#contentFormSubForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var form = $("#contentFormSubForm").serialize();
var status = $('#switchBtn').bootstrapSwitch('state');
if (status) {
form = form + "&showtextst=${Showtextst_TRUE}";
} else {
form = form + "&showtextst=${Showtextst_FALSE}";
}
var statusMpst = $('#switchBtn_Mpst').bootstrapSwitch('state');
if (statusMpst) {
form = form + "&mpst=${Mpst_1}";
} else {
form = form + "&mpst=${Mpst_2}";
}
$.post(ext.contextPath + "/work/groupContentForm/doupdateForColumn.do", form, function (data) {
if (data.code == 1) {
closeModal('contentFormSubModal');
$("#contentFormTable").bootstrapTable('refresh');
setTimeout(doExpend, 500);
} else if (data.code == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.msg);
}
}, 'json');
}
}
$("#contentFormSubForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
insertcolumn: {
validators: {
notEmpty: {
message: '列数不能为空'
},
regexp: {
regexp: /^[0-9]*$/,
message: '列数必须为数字'
}
}
},
insertcolumn: {
validators: {
notEmpty: {
message: '所占行不能为空'
},
regexp: {
regexp: /^[0-9]*$/,
message: '所占行必须为数字'
}
}
},
insertcolumn: {
validators: {
notEmpty: {
message: '所占列不能为空'
},
regexp: {
regexp: /^[0-9]*$/,
message: '所占列必须为数字'
}
}
}
}
});
function doContentFormClose() {
closeModal('contentFormSubModal');
}
var selectMPint = function () {
$.post(ext.contextPath + '/work/mpoint/showlistForSelect.do', {
formId: 'contentFormSubForm',
hiddenId: 'mpid',
textId: 'mpcode',
mpid: $("#mpid").val()
}, function (data) {
$("#mpSubDiv").html(data);
openModal('mpSubModal');
});
};
function selectmpid() {
$.post(ext.contextPath + '/work/mpoint/mpointListSingle4LayerES.do', {
// mpids: mpids,
mpids: '',
fucname: 'ckmpidDone'
}, function (data) {
$("#mpSubDiv").html(data);
openModal('subModalMpoint');
});
}
function ckmpidDone(data) {
data = JSON.parse(data);
$('#contentFormSubForm #datampid').val(data[0].mpid);
closeModal('subModalMpoint');
}
</script>
<div class="modal fade" id="contentFormSubModal">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" onclick="doContentFormClose()">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">编辑列</h4>
</div>
<!-- 界面提醒div强制id为alertDiv -->
<div class="modal-body">
<!-- 新增界面formid强制为contentFormSubForm -->
<form class="form-horizontal" id="contentFormSubForm">
<input id="id" name="id" type="hidden" value="${groupContentForm.id}"/>
<div class="form-group">
<label class="col-sm-2 control-label">列数</label>
<div class="col-sm-4">
<input type="number" class="form-control" id="insertcolumn" name="insertcolumn"
placeholder="第...列" value="${groupContentForm.insertcolumn}">
</div>
<%-- <label class="col-sm-2 control-label">测量点</label>--%>
<%-- <div class="col-sm-4">--%>
<%-- <input type="text" class="form-control" id="mpid" name ="mpid" placeholder="测量点" onclick="selectMPint()" value="${groupContentForm.mpid}">--%>
<%-- <input type="hidden" class="form-control" id="mpcode" name ="mpcode" >--%>
<%-- </div>--%>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">所占行</label>
<div class="col-sm-4">
<input type="number" class="form-control" id="rows" name="rows" placeholder="所占行"
value="${groupContentForm.rows}">
</div>
<label class="col-sm-2 control-label">所占列</label>
<div class="col-sm-4">
<input type="number" class="form-control" id="columns" name="columns" placeholder="所占列"
value="${groupContentForm.columns}">
</div>
</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="width" name="width" placeholder="宽度"
value="${groupContentForm.width}">
</div>
<label class="col-sm-2 control-label">高度</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="height" name="height" placeholder="高度"
value="${groupContentForm.height}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">单元内容</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="showtext" name="showtext" placeholder="显示内容"
value="${groupContentForm.showtext}">
</div>
<label class="col-sm-2 control-label">输入单元</label>
<div class="col-sm-2">
<div class="switch" data-on="primary" data-off="info">
<input id="switchBtn" type="checkbox"/>
</div>
</div>
</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="datampid" name="datampid" placeholder="数据测量点"
value="${groupContentForm.datampid}" onclick="selectmpid();">
</div>
<label class="col-sm-2 control-label">测量点类型</label>
<div class="col-sm-4">
<div class="switch" data-on="primary" data-off="info">
<input id="switchBtn_Mpst" type="checkbox"/>
</div>
</div>
</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="fontsize" name="fontsize" placeholder="文字大小"
value="${groupContentForm.fontsize}">
</div>
<label class="col-sm-2 control-label">文字粗细</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="fontweight" name="fontweight" placeholder="文字粗细"
value="${groupContentForm.fontweight}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">文字颜色</label>
<div class="col-sm-4">
<div class="input-group " id="colorContainer1">
<input name="fontcolor" id="fontcolor" type="text" class="form-control"
value="${groupContentForm.fontcolor}">
<div class="input-group-addon">
<i></i>
</div>
</div>
</div>
<label class="col-sm-2 control-label">文字位置</label>
<div class="col-sm-4">
<select class="form-control select2 " id="textalign" name="textalign"
style="width: 170px;"></select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">背景色</label>
<div class="col-sm-4">
<div class="input-group " id="colorContainer2">
<input name="backgroundcolor" id="backgroundcolor" type="text" class="form-control"
value="${groupContentForm.backgroundcolor}">
<div class="input-group-addon">
<i></i>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" onclick="doContentFormClose()">关闭</button>
<button type="button" class="btn btn-primary" onclick="doContentFormSave()" id="btn_save">保存</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>