178 lines
7.3 KiB
Plaintext
178 lines
7.3 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">
|
||
var showApplyPurchasePlan4SelectFun = function() {
|
||
$.post(ext.contextPath + '/sparepart/applyPurchasePlan/showList4Select.do', {formId:"subForm",hiddenId:"pid",textId:"pname"} , function(data) {
|
||
$("#fault4SelectDiv").html(data);
|
||
openModal('fault4SelectModal');
|
||
});
|
||
};
|
||
function doupdate() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {
|
||
$.post(ext.contextPath + "/sparepart/applyPurchasePlan/update.do", $("#subForm").serialize(), function(result) {
|
||
if (result == 1) {
|
||
showAlert('s','保存成功');
|
||
dosearch();
|
||
closeModal('subModal');
|
||
}else{
|
||
showAlert('d','保存失败');
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
|
||
function dodel() {
|
||
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 + '/sparepart/applyPurchasePlan/delete.do', $("#subForm").serialize(), function(data) {
|
||
if(data>0){
|
||
initTreeView();
|
||
}else{
|
||
showAlert('d','删除失败');
|
||
}
|
||
},'json');
|
||
|
||
}
|
||
});
|
||
}
|
||
$(function() {
|
||
$("#bizId").val(companyId);
|
||
/* BOOTSTRAP SLIDER */
|
||
var intSlider = $("input.slider").bootstrapSlider({
|
||
tooltip: 'always'
|
||
}).on('change',function() {
|
||
var intArr = intSlider.bootstrapSlider('getValue');
|
||
$('#planApplyPurchaseStartdate').val(intArr[0]);
|
||
$('#planApplyPurchaseEnddate').val(intArr[1]);
|
||
});
|
||
$.post(ext.contextPath + "/user/getUnitsByUnitId4Select.do", {id:companyId}, function(data) {
|
||
var selelct = $("#departmentId").select2({
|
||
data: data,
|
||
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;} // 函数用于呈现当前的选择
|
||
});
|
||
selelct.val('${applyPurchasePlan.departmentId}').trigger("change");
|
||
},'json');
|
||
$("#status").select2({minimumResultsForSearch: 10}).val("${applyPurchasePlan.status}").trigger("change");
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
applicant: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '负责人不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
});
|
||
|
||
//关闭模态框时刷新表格数据
|
||
function closeModel(){
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
}
|
||
</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">×</span></button>
|
||
<h4 class="modal-title">编辑记录</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="form-horizontal " id="subForm">
|
||
<input id="id" name="id" type="hidden" value="${applyPurchasePlan.id}"/>
|
||
<input id="bizId" name="bizId" type="hidden"/>
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<div id="fault4SelectDiv"></div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*部门</label>
|
||
<div class="col-sm-9">
|
||
<select class="form-control" id="departmentId" name ="departmentId" style="width: 100%;" >
|
||
</select>
|
||
</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="applicantName" name ="applicantName" placeholder="负责人" value="${applyPurchasePlan.applicantName}" readonly>
|
||
<input name="applicant" type="hidden" value="${applyPurchasePlan.applicant}"/>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*状态</label>
|
||
<div class="col-sm-4">
|
||
<select id ="status" name="status" class="form-control select2">
|
||
<option value="启用">启用</option>
|
||
<option value="禁用" >禁用</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-4 control-label">*每月开始时间~结束时间</label>
|
||
<div class="col-sm-8">
|
||
<input type="text" value="" class="slider form-control" data-slider-min="1" data-slider-max="31"
|
||
data-slider-step="1" data-slider-value="[${applyPurchasePlan.planApplyPurchaseStartdate},${applyPurchasePlan.planApplyPurchaseEnddate}]"
|
||
data-slider-orientation="horizontal"
|
||
data-slider-selection="before" data-slider-tooltip="show" data-slider-id="green" id="slider" >
|
||
<input id="planApplyPurchaseStartdate" name="planApplyPurchaseStartdate" type="hidden" value="${applyPurchasePlan.planApplyPurchaseStartdate}"/>
|
||
<input id="planApplyPurchaseEnddate" name="planApplyPurchaseEnddate" type="hidden" value="${applyPurchasePlan.planApplyPurchaseEnddate}"/>
|
||
</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="备注...">${applyPurchasePlan.remark}</textarea>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default" onclick="closeModel()">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="doupdate()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|