300 lines
13 KiB
Plaintext
300 lines
13 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 doupdate() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
setTimeout(function () {
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/equipment/assetClass/doupdate.do", $("#subForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
// closeModal('subModal');
|
||
// $("#table").bootstrapTable('refresh');
|
||
showAlert('s', '修改成功');
|
||
// initTreeView();
|
||
} else if (data.res == 0) {
|
||
showAlert('d', '修改失败');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
}, 100);
|
||
}
|
||
|
||
var dodel = function (id) {
|
||
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 + '/equipment/assetClass/dodelete.do', {id: id}, function (data) {
|
||
var result = data;
|
||
if (result === 1) {
|
||
$("#menuBox").html('');
|
||
initTreeView();
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||
}
|
||
}, 'json');
|
||
|
||
}
|
||
});
|
||
};
|
||
//设备所属--常排项目用
|
||
$.post(ext.contextPath + "/equipment/equipmentBelong/getEquipmentBelong4Select.do", {companyId: unitId}, function (data) {
|
||
$("#equipmentBelongId").empty();
|
||
var selelct_ = $("#equipmentBelongId").select2({
|
||
data: data,
|
||
cache: false,
|
||
placeholder: '请选择',//默认文字提示
|
||
allowClear: true,//允许清空
|
||
escapeMarkup: function (markup) {
|
||
return markup;
|
||
}, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据大于10个启用搜索框
|
||
formatResult: function formatRepo(repo) {
|
||
return repo.text;
|
||
}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) {
|
||
return repo.text;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
|
||
var select_id = '${assetClass.equipmentBelongId}';
|
||
var arr = select_id.split(",");
|
||
selelct_.val(arr).trigger("change");
|
||
}, 'json');
|
||
//设备类型树
|
||
$.post(ext.contextPath + '/equipment/equipmentClass/getEquipmentClassJsonForTree.do', {
|
||
ng: '',
|
||
unitId: unitId
|
||
}, function (data) {
|
||
//console.log("data",data[0]);
|
||
if (data.length == 1 && !data[0].hasOwnProperty("nodes")) {
|
||
//当登陆者的pid以下没有子节点时显示单独一个span
|
||
$("#classId").val(data[0].id);
|
||
$("#companyselect1").hide();
|
||
$("#companyName1").text("设备类型:" + data[0].text);
|
||
// showtable();
|
||
} else if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||
//第一次加载时赋值
|
||
// $("#classId").val(data[0].id);
|
||
// $("#cname_input1").val(data[0].text);
|
||
// showtable();
|
||
//$table.bootstrapTable('refresh');//异步加载重新刷新,待修改
|
||
$('#companytree1').treeview({
|
||
data: data,
|
||
showBorder: false,
|
||
showCheckbox: false,
|
||
levels: 1
|
||
});
|
||
$('#companytree1').on('nodeSelected', function (event, data) {
|
||
//只能点最底层
|
||
// var nodesnum=0;
|
||
// if(data.nodes!=null){
|
||
// nodesnum=data.nodes.length;
|
||
// }else{
|
||
// nodesnum=nodesnum;
|
||
// }
|
||
|
||
// if(nodesnum==0){
|
||
// $("#classId").val(data.id);
|
||
// $("#cname_input1").val(data.text);
|
||
// document.getElementById('company_select1').style.display = "none";
|
||
// $("ul#company_select1").hide();
|
||
// $("#table").bootstrapTable('refresh');
|
||
// }
|
||
|
||
$("#classId").val(data.id);
|
||
$("#cname_input1").val(data.text);
|
||
document.getElementById('company_select1').style.display = "none";
|
||
$("ul#company_select1").hide();
|
||
$("#table").bootstrapTable('refresh');
|
||
|
||
// $("ul#company_select").hide();
|
||
});
|
||
} else {
|
||
//待完善
|
||
}
|
||
;
|
||
}, 'json');
|
||
//输入框验证
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
assetclassnumber: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '资产类型编号不能为空'
|
||
},
|
||
remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值,获得一个json数据。例表示正确:{"valid",true}
|
||
url: ext.contextPath + '/equipment/assetClass/checkExist.do',//验证地址
|
||
message: '编号已存在',//提示消息
|
||
type: 'POST',//请求方式
|
||
data: function (validator) {
|
||
return {
|
||
assetclassnumber: $('#assetclassnumber').val(),
|
||
id: $("#id").val()
|
||
};
|
||
}
|
||
},
|
||
},
|
||
},
|
||
assetclassname: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '资产类型名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
|
||
$(function () {
|
||
$("#active").select2({minimumResultsForSearch: 10}).val("${assetClass.active}").trigger("change");
|
||
})
|
||
</script>
|
||
|
||
<div class="box box-primary">
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">详情</h3>
|
||
|
||
<div class="box-tools pull-right">
|
||
<a onclick="doupdate()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||
<a onclick="dodel('${assetClass.id}')" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
||
class="glyphicon glyphicon-trash"></i></a>
|
||
</div>
|
||
</div>
|
||
<!-- /.box-header -->
|
||
<div class="box-body ">
|
||
<form class="form-horizontal" id="subForm">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<input type="hidden" id="id" name="id" value="${assetClass.id}">
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*资产类型编号</label>
|
||
<div class="col-sm-6">
|
||
<input type="text" class="form-control" id="assetclassnumber" name="assetclassnumber"
|
||
placeholder="编号" value="${assetClass.assetclassnumber}">
|
||
</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="assetclassname" name="assetclassname" placeholder="名称"
|
||
value="${assetClass.assetclassname}">
|
||
</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="depreciablelife" name="depreciablelife" placeholder="年限"
|
||
value="${assetClass.depreciablelife}">
|
||
</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="netsalvageratio" name="netsalvageratio"
|
||
placeholder="净残值比例" value="${assetClass.netsalvageratio}">
|
||
</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="yeardepreciation" name="yeardepreciation"
|
||
placeholder="折旧率" value="${assetClass.yeardepreciation}">
|
||
</div>
|
||
</div>
|
||
<c:if test='${param.pid=="-1"}'>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">关联设备归属/工艺线</label>
|
||
<div class="col-sm-6">
|
||
<select class="form-control select2 " multiple="multiple" id="equipmentBelongId"
|
||
name="equipmentBelongId">
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</c:if>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">启用状态</label>
|
||
<div class="col-sm-6">
|
||
<select class="form-control select2" id="active" name="active" style="width: 100%;">
|
||
<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">
|
||
<div id="div1" class="input-group input-group-sm pull-left" style="margin-top: -0.6%;">
|
||
<input id="classId" name="classId" type="hidden"/>
|
||
<span id="companyName1" style="width:220px;border: none;background: transparent;"></span>
|
||
<ul id="companyselect1"
|
||
style="list-style-type:none;padding-left:10px;margin-top:8px;width:190px;">
|
||
<li class="dropdown messages-menu">
|
||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="width:80px;"
|
||
onclick="document.getElementById('company_select1').style.display = 'block';">
|
||
<div class="input-group" style="height: 25px">
|
||
<input class="form-control " id="cname_input1" name="cname_input1"
|
||
style="height:28px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;text-align:center;"
|
||
value="${assetClass.equipmentClass.name}"
|
||
readonly/>
|
||
</div>
|
||
</a>
|
||
<ul id="company_select1" class="dropdown-menu" data-stopPropagation="true">
|
||
<li>
|
||
<div id="companytree1" style="width: 827px;overflow:auto;max-height:500px;">
|
||
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</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="remark" name="remark"
|
||
placeholder="备注...">${assetClass.remark}</textarea>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|