Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/process/dataVisualContentEditForText.jsp

600 lines
30 KiB
Plaintext
Raw Normal View History

2026-01-16 14:13:44 +08:00
<%@ page language="java" pageEncoding="UTF-8" %>
<%@page import="com.sipai.entity.process.DataVisualContent" %>
<%request.setAttribute("Type_Text", DataVisualContent.Type_Text); %>
<%request.setAttribute("Isfull_True", DataVisualContent.Isfull_True); %>
<%request.setAttribute("Isfull_False", DataVisualContent.Isfull_False); %>
<%@page import="com.sipai.entity.process.DataVisualText" %>
<%request.setAttribute("Click_ShowFrame", DataVisualText.Click_ShowFrame); %>
<%request.setAttribute("Click_OpenFrame", DataVisualText.Click_OpenFrame); %>
<%request.setAttribute("Click_TabFrame", DataVisualText.Click_TabFrame); %>
<%request.setAttribute("Click_OpenLine", DataVisualText.Click_OpenLine); %>
<%request.setAttribute("Click_RoundTime", DataVisualText.Click_RoundTime); %>
<%@page import="com.sipai.entity.process.DataVisualFrame" %>
<%request.setAttribute("MenuType_ProVisual", DataVisualFrame.MenuType_ProVisual); %>
<%@page import="com.sipai.entity.process.DataVisualFrame" %>
<%request.setAttribute("Type_frame", DataVisualFrame.Type_frame); %>
<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>
<style type="text/css">
</style>
<script type="text/javascript">
$(function () {
$('#colorContainer1').colorpicker({format: null});
$('#colorContainer2').colorpicker({format: null});
$("#clickname").select2({minimumResultsForSearch: -1}).val("${dataVisualText.clickname}").trigger("change");
if ("${dataVisualText.clickname}" == "${Click_ShowFrame}" || "${dataVisualText.clickname}" == "${Click_OpenFrame}" || "${dataVisualText.clickname}" == "${Click_TabFrame}") {
$("#showFrameDiv").css('display', 'block');
<%--if ("${dataVisualText.clickname}" == "${Click_OpenFrame}" || "${dataVisualText.clickname}" == "${Click_TabFrame}") {--%>
$("#urlstringShow").css('display', 'block');
// }
} else if ("${dataVisualText.clickname}" == "${Click_OpenLine}") {
$("#showChartMpids").css('display', 'block');
} else if ("${dataVisualText.clickname}" == "${Click_RoundTime}") {
$("#showRoundTime").css('display', 'block');
}
$.post(ext.contextPath + "/process/dataVisualFrame/getFrame.do", {id: '${dataVisualText.clickparameter}'}, function (data) {
if (data != null) {
$("#showFrameSelectName").val(data.name);
}
}, 'json');
$.post(ext.contextPath + "/process/dataVisualFrame/getFrameTree.do", {
unitId: unitId
// menuType: '${MenuType_ProVisual}'
}, function (data) {
$('#showFrameSelectTree').treeview({
data: data,
showBorder: false,
showCheckbox: false,
levels: 2
});
$('#showFrameSelectTree').on('nodeSelected', function (event, data) {
if (data.type == '${Type_frame}') {
$("#clickparameter").val(data.id);
$("#showFrameSelectName").val(data.text);
$("#showFrameSelect").hide();
}
});
}, 'json');
$("#clickname").change(function () {
var clickname = $("#clickname").val();
if (clickname == "${Click_ShowFrame}" || clickname == "${Click_OpenFrame}" || clickname == "${Click_TabFrame}") {
$("#showFrameDiv").css('display', 'block');
$("#showChartMpids").css('display', 'none');
$("#showRoundTime").css('display', 'none');
<%--if (clickname == "${Click_OpenFrame}" || clickname == "${Click_TabFrame}") {--%>
$("#urlstringShow").css('display', 'block');
// } else {
// $("#urlstringShow").css('display', 'none');
// }
} else if (clickname == "${Click_OpenLine}") {
$("#showChartMpids").css('display', 'block');
$("#showFrameDiv").css('display', 'none');
$("#showRoundTime").css('display', 'none');
$("#urlstringShow").css('display', 'none');
} else if (clickname == "${Click_RoundTime}") {
$("#showRoundTime").css('display', 'block');
$("#showChartMpids").css('display', 'none');
$("#showFrameDiv").css('display', 'none');
$("#urlstringShow").css('display', 'none');
} else {
$("#showChartMpids").css('display', 'none');
$("#showFrameDiv").css('display', 'none');
$("#showRoundTime").css('display', 'none');
$("#urlstringShow").css('display', 'none');
}
});
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});//选中元素上下居中
var dataTextalign = JSON.parse("[{\"id\":\"center\",\"text\":\"居中\"},{\"id\":\"left\",\"text\":\"靠左\"},{\"id\":\"right\",\"text\":\"靠右\"}]");
var selectTextalign = $("#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;
} // 函数用于呈现当前的选择
});
selectTextalign.val('${dataVisualText.textalign}').trigger("change");//设置选中
var datavaluemethod = JSON.parse("[{\"id\":\"nowTime\",\"text\":\"nowTime\"},{\"id\":\"sum\",\"text\":\"sum\"},{\"id\":\"diff\",\"text\":\"diff\"},{\"id\":\"avg\",\"text\":\"avg\"},{\"id\":\"max\",\"text\":\"max\"},{\"id\":\"min\",\"text\":\"min\"},{\"id\":\"first\",\"text\":\"first\"},{\"id\":\"last\",\"text\":\"last\"}]");
var selectvaluemethod = $("#valuemethod").select2({
data: datavaluemethod,
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;
} // 函数用于呈现当前的选择
});
selectvaluemethod.val('${dataVisualText.valuemethod}').trigger("change");//设置选中
$('#switchBtnIsFull').bootstrapSwitch({
onText: '是',
offText: '否',
size: "small",
});
if ('${dataVisualContent.isfull}' == '${Isfull_False}') {
$('#switchBtnIsFull').bootstrapSwitch('state', false, true);
} else if ('${dataVisualContent.isfull}' == '${Isfull_True}') {
$('#switchBtnIsFull').bootstrapSwitch('state', true, true);
} else {
$('#switchBtnIsFull').bootstrapSwitch('state', false, true);
}
$('#switchBtnIsFixed').bootstrapSwitch({
onText: '是',
offText: '否',
size: "small",
});
if ('${dataVisualContent.isfixed}' == 'false') {
$('#switchBtnIsFixed').bootstrapSwitch('state', false, true);
} else if ('${dataVisualContent.isfixed}' == 'true') {
$('#switchBtnIsFixed').bootstrapSwitch('state', true, true);
} else {
$('#switchBtnIsFixed').bootstrapSwitch('state', false, true);
}
$('#switchBtnUnitSt').bootstrapSwitch({
onText: '是',
offText: '否',
size: "small",
});
if ('${dataVisualText.unitst}' == 'false') {
$('#switchBtnUnitSt').bootstrapSwitch('state', false, true);
} else if ('${dataVisualText.unitst}' == 'true') {
$('#switchBtnUnitSt').bootstrapSwitch('state', true, true);
} else {
$('#switchBtnUnitSt').bootstrapSwitch('state', false, true);
}
});
function doTextsave() {
$("#subForm3").bootstrapValidator('validate');//提交验证
if ($("#subForm3").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
let form = $("#subForm3").serialize();
const isFullStatus = $('#switchBtnIsFull').bootstrapSwitch('state');
if (isFullStatus) {
form = form + "&isfull=${Isfull_True}";
} else {
form = form + "&isfull=${Isfull_False}";
}
const isFixedStatus = $('#switchBtnIsFixed').bootstrapSwitch('state');
if (isFixedStatus) {
form = form + "&isfixed=true";
} else {
form = form + "&isfixed=false";
}
$.post(ext.contextPath + "/process/dataVisualContent/doupdate.do", form, function (data) {
if (data.code == 1) {
$("#subForm4").bootstrapValidator('validate');//提交验证
let form = $("#subForm4").serialize();
const unitStStatus = $('#switchBtnUnitSt').bootstrapSwitch('state');
if (unitStStatus) {
form = form + "&unitst=true";
} else {
form = form + "&unitst=false";
}
if ($("#subForm4").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/process/dataVisualText/doupdate.do", form, function (data) {
if (data.code == 1) {
closeModal('subModal');
if ('${dataVisualContent.istab}' == 'true') {
showOneContent('${dataVisualContent.id}', 'tab');
} else {
showOneContent('${dataVisualContent.id}');
}
// showFrame(frameId);
} else if (data.code == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.res);
}
}, 'json');
}
} else if (data.code == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.res);
}
}, 'json');
}
}
function doContentDel() {
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/process/dataVisualContent/dodelete.do', {
id: '${dataVisualContent.id}',
did: '${dataVisualText.id}',
type: '${Type_Text}'
}, function (data) {
var datajson = JSON.parse(data);
if (datajson.code == 1) {
closeModal('subModal');
$('#${dataVisualContent.id}').remove();
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
});
}
});
}
function doTextCopy() {
$.post(ext.contextPath + '/process/dataVisualText/doTextCopy.do', {
contentId: '${dataVisualContent.id}',
id: '${dataVisualText.id}'
}, function (data) {
var datajson = JSON.parse(data);
closeModal('subModal');
if ('${dataVisualContent.istab}' == 'true') {
showOneContent(datajson.id, 'tab');
} else {
showOneContent(datajson.id);
}
});
}
function selectmpid() {
$.post(ext.contextPath + '/work/mpoint/mpointListSingle4LayerES.do', {
// mpids: mpids,
mpids: '',
fucname: 'ckmpidDone'
}, function (data) {
$("#mpSelectDiv").html(data);
openModal('subModalMpoint');
});
}
function ckmpidDone(data) {
data = JSON.parse(data);
$('#subForm4 #mpid').val(data[0].mpid);
closeModal('subModalMpoint');
}
function selectmpids() {
$.post(ext.contextPath + '/work/mpoint/mpointList4LayerES.do', {
// mpids: mpids,
mpids: '',
fucname: 'ckmpidsDone'
}, function (data) {
$("#mpSelectDiv").html(data);
openModal('subModalMpoint');
});
}
function ckmpidsDone(data) {
$('#subForm4 #chartmpids').val(data);
closeModal('subModalMpoint');
}
</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 id="alertDiv"></div>
<div class="modal-body">
<!-- 新增界面formid强制为subForm -->
<form class="form-horizontal" id="subForm3" autocomplete="off">
<!-- 界面提醒div强制id为alertDiv -->
<input type="hidden" name="id" id="id" value="${dataVisualContent.id}"/>
<div class="form-group">
<label class="col-sm-2 control-label">左侧距离</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="postx" name="postx" placeholder="左侧距离"
value="${dataVisualContent.postx}">
</div>
<label class="col-sm-2 control-label">上侧距离</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="posty" name="posty" placeholder="上侧距离"
value="${dataVisualContent.posty}">
</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="${dataVisualContent.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="${dataVisualContent.height}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">自适应</label>
<div class="col-sm-4">
<div class="switch" data-on="primary" data-off="info">
<input id="switchBtnIsFull" type="checkbox"/>
</div>
</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="switchBtnIsFixed" type="checkbox"/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">刷新时间</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="refreshtime" name="refreshtime"
placeholder="刷新时间"
value="${dataVisualContent.refreshtime}">
</div>
<div class="col-sm-1">
<div style="line-height: 34px;text-align: center;">min</div>
</div>
<label class="col-sm-2 control-label">图层</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="zIndex" name="zIndex" placeholder="图层"
value="${dataVisualContent.zIndex}">
</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="style" name="style" placeholder="样式"
value="${dataVisualContent.style}">
</div>
</div>
</form>
<form class="form-horizontal" id="subForm4" autocomplete="off">
<!-- 界面提醒div强制id为alertDiv -->
<input type="hidden" name="id" id="id" value="${dataVisualText.id}"/>
<div class="form-group">
<label class="col-sm-2 control-label">测量点</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="mpid" name="mpid" placeholder="测量点"
value="${dataVisualText.mpid}" 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="switchBtnUnitSt" type="checkbox"/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">计算方式</label>
<div class="col-sm-4">
<select class="form-control select2 " id="valuemethod" name="valuemethod"
style="width: 170px;"></select>
</div>
<label class="col-sm-2 control-label">系数</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="rate" name="rate" placeholder="系数"
value="${dataVisualText.rate}">
</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="urldata" name="urldata"
placeholder="接口数据"
value="${dataVisualText.urldata}">
</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="numtail" name="numtail"
placeholder="小数位"
value="${dataVisualText.numtail}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">文本内容</label>
<div class="col-sm-10">
<textarea id="textcontent" name="textcontent" style="width:100%;height:66px;"
wrap="soft">${dataVisualText.textcontent}</textarea>
</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="${dataVisualText.fontsize}">
</div>
<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"
placeholder="文字颜色"
value="${dataVisualText.fontcolor}">
<div class="input-group-addon">
<i></i>
</div>
</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="fontweight" name="fontweight"
placeholder="文字粗细"
value="${dataVisualText.fontweight}">
</div>
<label class="col-sm-2 control-label">背景色</label>
<div class="col-sm-4">
<div class="input-group" id="colorContainer2">
<input name="background" id="background" type="text" class="form-control"
placeholder="背景色"
value="${dataVisualText.background}">
<div class="input-group-addon">
<i></i>
</div>
</div>
</div>
</div>
<div class="form-group">
<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>
<label class="col-sm-2 control-label">文字高度</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="textheight" name="textheight"
placeholder="文字高度"
value="${dataVisualText.textheight}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">点击事件</label>
<div class="col-sm-4">
<select class="form-control select2" id="clickname" name="clickname"
style="width: 170px;">
<option value="-" selected="selected">无</option>
<option value="${Click_ShowFrame}" selected="selected">画面跳转</option>
<option value="${Click_OpenFrame}" selected="selected">弹出画面</option>
<option value="${Click_TabFrame}" selected="selected">tab画面</option>
<option value="${Click_OpenLine}" selected="selected">弹出曲线</option>
<option value="${Click_RoundTime}" selected="selected">轮巡展示</option>
</select>
</div>
<div id="showFrameDiv" style="display: none;">
<label class="col-sm-2 control-label">画面选择</label>
<div class="col-sm-4">
<ul style="list-style-type:none;padding-left:0px;margin-top:0px;width:170px;">
<li class="dropdown messages-menu">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
style="width:170px;"
onclick="document.getElementById('showFrameSelect').style.display = 'block';">
<div class="input-group" style="height: 25px">
<input type="hidden" name="clickparameter" id="clickparameter"
value="${dataVisualText.clickparameter}"/>
<input class="form-control " id="showFrameSelectName"
name="showFrameSelectName"
style="height:28px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;text-align:center;"
readonly/>
</div>
</a>
<ul id="showFrameSelect" class="dropdown-menu"
data-stopPropagation="true">
<li>
<div id="showFrameSelectTree"
style="width: 170px;height:250px;overflow:auto;"></div>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="form-group" id="urlstringShow" style="display: none;">
<label class="col-sm-2 control-label">画面地址</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="urlstring" name="urlstring"
placeholder="画面地址" value="${dataVisualText.urlstring}">
</div>
</div>
<div id="showChartMpids" class="form-group" style="display: none;">
<label class="col-sm-2 control-label">曲线测点</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="chartmpids" name="chartmpids"
placeholder="曲线测点" onclick="selectmpids();"
value="${dataVisualText.chartmpids}">
</div>
</div>
<div id="showRoundTime" class="form-group" style="display: none;">
<label class="col-sm-2 control-label">组件id</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="roundtimeid" name="roundtimeid"
placeholder="组件id"
value="${dataVisualText.roundtimeid}">
</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" onclick="doContentDel();">删除</button>
<button type="button" class="btn btn-primary" onclick="doTextCopy()">拷贝</button>
<button type="button" class="btn btn-primary" onclick="doTextsave()" id="btn_save">保存</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>