286 lines
11 KiB
Plaintext
286 lines
11 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
<%@page import="com.sipai.entity.document.DocFileRelation"%>
|
|||
|
|
<% request.setAttribute("Type_libraryWaterTest", DocFileRelation.Type_libraryWaterTest); %>
|
|||
|
|
<style type="text/css">
|
|||
|
|
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
|
|||
|
|
function dosave() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {
|
|||
|
|
//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/process/libraryWaterTest/doupdate.do", $("#subForm").serialize(), function (data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
closeModal("subModal");
|
|||
|
|
} else if (data.res == 0) {
|
|||
|
|
showAlert('d', '保存失败');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.res);
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
code: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '化验指标编号不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '化验指标名称不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
baseHours: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '定额工时不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
baseCost: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '定额费用不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
method: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '化验方法不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
safeCareful: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '安全注意事项不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var selectMPint = function () {
|
|||
|
|
$.post(ext.contextPath + '/achievement/acceptanceModelMPoint/showlistForSelect.do', { formId: 'subForm', hiddenId: 'measurePointId', textId: 'name2', codeId: 'code' }, function (data) {
|
|||
|
|
$("#mpSubDiv").html(data);
|
|||
|
|
openModal('mpSubModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var fileRelation = function () {
|
|||
|
|
$.post(ext.contextPath + '/document/docFileRelation/show4select.do', {unitId:unitId,type:'${Type_libraryWaterTest}',masterid:$("#id").val()}, function (data) {
|
|||
|
|
$("#docFileRelationDiv").html(data);
|
|||
|
|
openModal('docFileRelationModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//下载文件
|
|||
|
|
var fileDownload = function (id) {
|
|||
|
|
window.open(ext.contextPath + "/base/downloadFile.do?key=" + id + "&tbName=tb_doc_file");
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function delRelation(id){
|
|||
|
|
stopBubbleDefaultEvent();
|
|||
|
|
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 + '/document/docFileRelation/delete.do', { id: id }, function (data) {
|
|||
|
|
if (data.code == 1) {
|
|||
|
|
$("#fileRelationTable").bootstrapTable('refresh');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', '删除失败', 'mainAlertdiv');
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$(function (){
|
|||
|
|
$("#fileRelationTable").bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/document/docFileRelation/getList.do', // 获取表格数据的url
|
|||
|
|
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
|||
|
|
striped: true, //表格显示条纹,默认为false
|
|||
|
|
pagination: true, // 在表格底部显示分页组件,默认false
|
|||
|
|
pageList: [10], // 设置页面可以显示的数据条数
|
|||
|
|
pageSize: 10, // 页面数据条数
|
|||
|
|
pageNumber: 1, // 首页页码
|
|||
|
|
sidePagination: 'server', // 设置为服务器端分页
|
|||
|
|
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
|||
|
|
return {
|
|||
|
|
rows: params.limit, // 每页要显示的数据条数
|
|||
|
|
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
|||
|
|
sort: params.sort, // 要排序的字段
|
|||
|
|
order: params.order,
|
|||
|
|
masterid: $("#id").val()
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
sortName: 'id', // 要排序的字段
|
|||
|
|
sortOrder: 'asc', // 排序规则
|
|||
|
|
// onClickRow: function (row) {//单击行事件,执行查看功能
|
|||
|
|
|
|||
|
|
// },
|
|||
|
|
columns: [
|
|||
|
|
// {
|
|||
|
|
// checkbox: true, // 显示一个勾选框
|
|||
|
|
// },
|
|||
|
|
{
|
|||
|
|
field: '', // 返回json数据中的name
|
|||
|
|
title: '资料名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
return row.commonFile.filename;
|
|||
|
|
}
|
|||
|
|
},{
|
|||
|
|
field: '', // 返回json数据中的name
|
|||
|
|
title: '上传者', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
return row.insuserName;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "操作",
|
|||
|
|
align: 'center',
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '100',
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
var buts = '';
|
|||
|
|
buts += '<button class="btn btn-default btn-sm" title="下载" onclick="fileDownload(\'' + row.docId + '\')"><i class="fa fa-download"></i><span class="hidden-md hidden-lg">下载</span></button>';
|
|||
|
|
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="delRelation(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
|
|||
|
|
buts = '<div class = "btn-group">' + buts + '</div>';
|
|||
|
|
return buts;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
onLoadSuccess: function () { //加载成功时执行
|
|||
|
|
adjustBootstrapTableView("table");
|
|||
|
|
},
|
|||
|
|
onLoadError: function () { //加载失败时执行
|
|||
|
|
console.info("加载数据失败");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
</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">
|
|||
|
|
<!-- 新增界面formid强制为subForm -->
|
|||
|
|
<form class="form-horizontal" id="subForm" autocomplete="off">
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input type="hidden" name="id" id="id" value="${libraryWaterTest.id}" />
|
|||
|
|
<input type="hidden" name="unitId" id="unitId" value="${libraryWaterTest.unitId}" />
|
|||
|
|
<input type="hidden" name="name2" id="name2" value="" />
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*化验指标编号</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="hidden" class="form-control" id="measurePointId" name="measurePointId"
|
|||
|
|
value="${libraryWaterTest.measurePointId}">
|
|||
|
|
<input type="text" class="form-control" id="code" name="code" placeholder="化验指标编号"
|
|||
|
|
value="${libraryWaterTest.mPoint.mpointcode}" onclick="selectMPint()">
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">*化验指标名称</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="name" name="name" placeholder="化验指标名称"
|
|||
|
|
value="${libraryWaterTest.name}" >
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*定额工时</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="number" class="form-control" id="baseHours" name="baseHours" placeholder="定额工时"
|
|||
|
|
value="${libraryWaterTest.baseHours}" step="0.01">
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">*定额费用</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="number" class="form-control" id="baseCost" name="baseCost" placeholder="定额费用"
|
|||
|
|
value="${libraryWaterTest.baseCost}" step="0.01">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*化验方法</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<textarea class="form-control" id="method" name="method"
|
|||
|
|
placeholder="化验方法">${libraryWaterTest.method}</textarea>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*安全注意事项</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<textarea class="form-control" id="safeCareful" name="safeCareful"
|
|||
|
|
placeholder="安全注意事项">${libraryWaterTest.safeCareful}</textarea>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<div >
|
|||
|
|
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
|||
|
|
<button type="button" class="btn btn-default" onclick="fileRelation();"><i class="fa fa-plus"></i>文件关联</button>
|
|||
|
|
<!-- <button type="button" class="btn btn-default" onclick="delDocFun();"><i class="fa fa-trash"></i> 删除</button> -->
|
|||
|
|
</div>
|
|||
|
|
<!-- <div class="input-group input-group-sm pull-right" style="width:250px" >
|
|||
|
|
<input type="text" id="search_fileName" name="search_fileName" autocomplete="off" style="height:35px" class="form-control pull-right" placeholder="资料名称...">
|
|||
|
|
<div class="input-group-btn">
|
|||
|
|
<button class="btn btn-default" style="height:35px" onclick="dosearchFile();"><i class="fa fa-search"></i></button>
|
|||
|
|
</div>
|
|||
|
|
</div> -->
|
|||
|
|
<table id="fileRelationTable"></table>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="dosave()" id="btn_save">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|