142 lines
5.6 KiB
Plaintext
142 lines
5.6 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||
<style type="text/css">
|
||
</style>
|
||
<script type="text/javascript">
|
||
function doRecordSave(){
|
||
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) {
|
||
$('#saveB').attr('onclick','');
|
||
$('#saveB').text('加载中...');
|
||
$.post(ext.contextPath + '/achievement/acceptanceModelCreate/doOverwriteData.do', {pid:'${param.pid}'} , function(data) {
|
||
closeModal('dataSubModal');
|
||
},'json');
|
||
}
|
||
});
|
||
}
|
||
|
||
function valueChange(value,id){
|
||
$.post(ext.contextPath + '/achievement/acceptanceModelCreate/doChangeData.do', {value:value,id:id} , function(data) {
|
||
if(data.code==1){
|
||
// showAlert('d','修改成功');
|
||
}else{
|
||
showAlert('d','删除失败','alertDiv');
|
||
}
|
||
},'json');
|
||
}
|
||
|
||
function queryParams(params) {
|
||
var temp={
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
pid:'${param.pid}'
|
||
};
|
||
return temp;
|
||
}
|
||
|
||
function showHis(mpcode){
|
||
$.post(ext.contextPath + '/data/showOnlyLine.do', {mpcode:mpcode} , function(data) {
|
||
$("#curveDiv").html(data);
|
||
openModal('curveModal');
|
||
});
|
||
}
|
||
|
||
$(function() {
|
||
$("#dataTable").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/achievement/acceptanceModelCreate/getRptDataRecordlist.do', // 获取表格数据的url
|
||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
// clickToSelect:true,
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||
pageSize: 20, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: queryParams,
|
||
queryParamsType: "limit",
|
||
sortName: 'mpid', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
/* showColumns: true,
|
||
showRefresh: true, */
|
||
columns: [
|
||
{
|
||
field: 'mpid', // 返回json数据中的name
|
||
title: '测量点名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function(value,row,index){
|
||
return row.mPoint.parmname;
|
||
}
|
||
},{
|
||
field: 'value', // 返回json数据中的name
|
||
title: '值', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function(value,row,index){
|
||
return "<input type=\"text\" style=\"height:34px;text-align: center;\" value=\""+value+"\" onchange=\"valueChange(this.value,'"+row.id+"');\">";
|
||
}
|
||
},{
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: 80, // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
return '<div class="btn-group">'+
|
||
'<button title="历史数据" class="btn btn-default btn-sm" onclick="showHis(\'' + row.mPoint.mpointcode + '\')"><i class="fa fa-line-chart"></i></button>'+
|
||
'</div>';
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function(){ //加载成功时执行
|
||
adjustBootstrapTableView("dataTable");
|
||
},
|
||
onLoadError: function(){ //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
|
||
})
|
||
});
|
||
</script>
|
||
<div class="modal fade" id="dataSubModal">
|
||
<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">
|
||
<table id="dataTable" ></table>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||
<button id="saveB" type="button" class="btn btn-primary" onclick="doRecordSave()" id="btn_save">覆盖数据</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|