266 lines
12 KiB
Plaintext
266 lines
12 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
|||
|
|
<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 dosave() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
setTimeout(function () {
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/equipment/assetClass/dosave.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);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//设备所属--常排项目用
|
|||
|
|
$.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'})
|
|||
|
|
|
|||
|
|
selelct_.val('').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()
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
assetclassname: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '资产类型名称不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
//工艺线
|
|||
|
|
var selectEquipmentBelong = function () {
|
|||
|
|
$.post(ext.contextPath + '/equipment/equipmentBelong/showEquipmentBelongForSelect.do', {equipmentBelongId: $('#equipmentBelongId').val}, function (data) {
|
|||
|
|
$("#equipmentBelongSubDiv").html(data);
|
|||
|
|
openModal('equipmentBelongSubModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
</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="dosave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
|||
|
|
class="glyphicon glyphicon-floppy-disk"></i></a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.box-header -->
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<form class="form-horizontal" id="subForm">
|
|||
|
|
<input id="pid" name="pid" type="hidden" value="${param.pid}"/>
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<div id="equipmentBelongSubDiv"></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="assetclassnumber" name="assetclassnumber"
|
|||
|
|
placeholder="编号">
|
|||
|
|
</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="名称">
|
|||
|
|
</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="年限">
|
|||
|
|
</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="净残值比例">
|
|||
|
|
</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="折旧率">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<c:if test='${param.pid==""}'>
|
|||
|
|
<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: 270px;">
|
|||
|
|
<option value="1" selected="selected">启用</option>
|
|||
|
|
<option value="0">禁用</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<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">
|
|||
|
|
<!-- Menu toggle button -->
|
|||
|
|
<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">
|
|||
|
|
<span class="input-group-addon"
|
|||
|
|
style="height:25px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">设备类型:</span>
|
|||
|
|
<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;"
|
|||
|
|
readonly/>
|
|||
|
|
</div>
|
|||
|
|
</a>
|
|||
|
|
<ul id="company_select1" class="dropdown-menu" data-stopPropagation="true">
|
|||
|
|
<li>
|
|||
|
|
<!-- <a href="javascript:company_selectchange();"> -->
|
|||
|
|
<!-- -->
|
|||
|
|
<div id="companytree1" style="width: 275px;overflow:auto;max-height:500px;">
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<!-- <button type="button" class="btn btn-default btn-sm" onclick="selectnode();"><i class="fa fa-cloud-upload"></i>确定</button> -->
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
</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="备注..."></textarea>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
</div>
|