203 lines
10 KiB
Plaintext
203 lines
10 KiB
Plaintext
|
|
<%@ 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">
|
|||
|
|
function doParameterUpdate() {
|
|||
|
|
$("#editEquipmentCardLinksParameterForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#editEquipmentCardLinksParameterForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/equipment/equipmentCardLinksParameter/doupdate.do", $("#editEquipmentCardLinksParameterForm").serialize(), function(data) {
|
|||
|
|
if (data.res == 1){
|
|||
|
|
closeModal('subParameterModal');
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','保存失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//输入框验证
|
|||
|
|
$("#editEquipmentCardLinksParameterForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
parameter: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '参数不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
parameterType: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '类型不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
active: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '状态不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$(function(){
|
|||
|
|
var dynamic = [{ id: 'aaaa', text: '设备台账', disabled: true },{ id: 'equipmentname', text: '设备名称:equipmentname' },{ id: 'equipmentmodel', text: '设备型号:equipmentmodel' }
|
|||
|
|
,{ id: 'assetnumber', text: '资产编号:assetnumber' },{ id: 'equipmentManufacturer', text: '生产商:equipmentManufacturer' },{ id: 'leaveFactoryNumber', text: '出厂编号:leaveFactoryNumber' }];
|
|||
|
|
$("#parameterType_edit").empty();
|
|||
|
|
var parameterType = [{ id: 'fixed', text: '固定' },{ id: 'dynamic', text: '动态' }];
|
|||
|
|
var selelct_parameterType =$("#parameterType_edit").select2({
|
|||
|
|
width: '270px',
|
|||
|
|
data: parameterType,
|
|||
|
|
placeholder:'请选择',//默认文字提示
|
|||
|
|
allowClear: true,//允许清空
|
|||
|
|
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_parameterType.on('change', function (e) {
|
|||
|
|
if(e.target.value==parameterType[1].id){
|
|||
|
|
//动态
|
|||
|
|
$("#parameterValue_edit").attr("readonly","readonly");
|
|||
|
|
//$("#dynamic").removeAttr("readonly");
|
|||
|
|
$("#dynamic_edit").empty();
|
|||
|
|
var selelct_dynamic =$("#dynamic_edit").select2({
|
|||
|
|
width: '270px',
|
|||
|
|
data: dynamic,
|
|||
|
|
placeholder:'请选择',//默认文字提示
|
|||
|
|
allowClear: true,//允许清空
|
|||
|
|
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;}, // 函数用于呈现当前的选择
|
|||
|
|
disabled:false
|
|||
|
|
});
|
|||
|
|
selelct_dynamic.val("${equipmentCardLinksParameter.dynamic}").trigger("change");
|
|||
|
|
}else{
|
|||
|
|
$("#parameterValue_edit").removeAttr("readonly");
|
|||
|
|
//$("#dynamic").attr("readonly","readonly");
|
|||
|
|
$("#dynamic_edit").empty();
|
|||
|
|
var selelct_dynamic =$("#dynamic_edit").select2({
|
|||
|
|
width: '270px',
|
|||
|
|
data: dynamic,
|
|||
|
|
placeholder:'请选择',//默认文字提示
|
|||
|
|
allowClear: true,//允许清空
|
|||
|
|
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;}, // 函数用于呈现当前的选择
|
|||
|
|
disabled:true
|
|||
|
|
});
|
|||
|
|
selelct_dynamic.val("${equipmentCardLinksParameter.dynamic}").trigger("change");
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
selelct_parameterType.val("${equipmentCardLinksParameter.parameterType}").trigger("change");
|
|||
|
|
$("#parameter_active_edit").empty();
|
|||
|
|
var parameter_active = [{ id: '1', text: '启用' },{ id: '0', text: '禁用' }];
|
|||
|
|
var selelct_parameter_active =$("#parameter_active_edit").select2({
|
|||
|
|
width: '270px',
|
|||
|
|
data: parameter_active,
|
|||
|
|
placeholder:'请选择',//默认文字提示
|
|||
|
|
allowClear: true,//允许清空
|
|||
|
|
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_parameter_active.val("${equipmentCardLinksParameter.active}").trigger("change");
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
</script>
|
|||
|
|
<div class="modal fade" id="subParameterModal">
|
|||
|
|
<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强制为editEquipmentCardLinksParameterForm -->
|
|||
|
|
<form class="form-horizontal" id="editEquipmentCardLinksParameterForm">
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input type="hidden" name="id" value= "${equipmentCardLinksParameter.id}">
|
|||
|
|
<input type="hidden" name="linkId" value= "${equipmentCardLinksParameter.linkId}">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*链接参数</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input type="text" class="form-control" id="parameter_edit" name ="parameter" placeholder="参数" value="${equipmentCardLinksParameter.parameter}" >
|
|||
|
|
</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="parameterValue_edit" name ="parameterValue" placeholder="固定值" value="${equipmentCardLinksParameter.parameterValue}" >
|
|||
|
|
</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="parameterType_edit" name ="parameterType" placeholder="类型" value="${equipmentCardLinksParameter.parameterType}" >
|
|||
|
|
</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="dynamic_edit" name ="dynamic" placeholder="动态参数" value="${equipmentCardLinksParameter.dynamic}" >
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*启用状态</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<select class="form-control select2" id="parameter_active_edit" name ="active" style="width: 270px;">
|
|||
|
|
<option value= "1" selected = "selected">启用</option>
|
|||
|
|
<option value= "0">禁用</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">顺序</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input type="number" class="form-control" id="morder_edit" name ="morder" placeholder="顺序" value="${equipmentCardLinks.morder}" >
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">备注</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<textarea class="form-control" rows="2" id ="remarks_edit" name ="remarks" placeholder="备注...">${equipmentCardLinksParameter.remarks}</textarea>
|
|||
|
|
</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="doParameterUpdate()" id="btn_update">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|