1 line
8.2 KiB
Plaintext
1 line
8.2 KiB
Plaintext
|
|
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<style type="text/css">
.select2-container .select2-selection--single {
height: 34px;
line-height: 34px;
}
.select2-selection__arrow {
margin-top: 3px;
}
.foot {
display: flex;
padding-left: 50px;
}
/*.layout{*/
/* display: flex;*/
/* padding-left: 15px;*/
/*}*/
.form-horizontal {
padding-top: 20px;
}
.right {
margin-left: 50px;
}
</style>
<script type="text/javascript">
$(function () {
initDropDownStatus();
$("#startDate").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
$("#startDate").datepicker('setDate',new Date());
});
//保存
function addSaveFun() {
//console.log($("#addForm").serialize());
$("#addForm").bootstrapValidator('validate');//提交验证
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var formData = new FormData($("#addForm")[0]);
$.ajax({
url: ext.contextPath + '/whp/baseinfo/WhpTestMethod/save.do',
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
console.log(data)
if (data.code == 1) {
$("#table").bootstrapTable('refresh');
closeModal('subModal');
} else {
showAlert('d', '保存失败!' + data.msg);
}
},
error: function (data) {
}
});
}
}
function initDropDownStatus() {
var select_Data = jQuery.parseJSON('${enableDropDown}');
var select_3 = $("#status").select2({
data: select_Data,
cache: false,
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;
} // 函数用于呈现当前的选择
});
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
select_3.val('1').trigger('change');
}
function showUnit4SelectFun() {
$.post(ext.contextPath + '/whp/baseinfo/WhpTestMethod/whpTestItemPop.do', {
formId: "addForm",
hiddenId: "testItem_id",
textId: "testItem_name",
}, function (data) {
$("#whpTestItemPop").html(data);
openModal("whpTestItemPops");
});
}
$("#addForm").bootstrapValidator({
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
fields: {
testItem_name: {validators: {notEmpty: {message: '检测项目不能为空'}}},
methodBasis: {validators: {notEmpty: {message: '方法依据不能为空'}}},
startDate: {validators: {notEmpty: {message: '启用时间不能为空'}}},
status: {valid
|