safesite/enp/templates/detection.html

151 lines
6.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="easyui-layout" style="width:100%;height:100%;">
<div data-options="region:'center',title:'废水污染物检测表',split:true,border:false" style="height:100%;">
<div id="detectionTableBar">
<a onclick="adddetection()" class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain: true">新增</a>
<a onclick="edidetection()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',plain: true">编辑</a>
<a onclick="deldetection()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',plain: true">删除</a>
</div>
<table id="detectionTable" style="height:100%"></table>
</div>
</div>
<div id="detectionDialog" class="easyui-dialog" style="width:700px;height:600px;padding:20px 25px;"
data-options="resizable:true,modal:true,closed:true,border:false">
<form method="post" id="detectionForm">
<input name="id" type="hidden">
<div style="margin-bottom:10px">
<input name="number" data-options="label:'排放口编码', labelWidth:100" class="easyui-textbox" style="width:600px;" ></input>
</div>
<div style="margin-bottom:10px">
<input name="jcDate" data-options="label:'监测日期', editable:false, labelWidth:100" class="easyui-datebox" style="width:300px;" ></input>
<input name="jctime" data-options="label:'监测时间', editable:false, labelWidth:100" class="easyui-datetimespinner" style="width:300px;" ></input>
</div>
<div style="margin-bottom:10px">
<input name="ckhxxyl" data-options="label:'出口化学需氧量mg/L',labelWidth:180" class="easyui-numberbox" style="width:300px;" ></input>
<input name="ckshxll" data-options="label:'出口生化需氧量mg/L', labelWidth:180" class="easyui-numberbox" style="width:300px;" ></input>
</div>
<div style="margin-bottom:10px">
<input name="ckad" data-options="label:'出口氨氮mg/L',labelWidth:180" class="easyui-numberbox" style="width:300px;" ></input>
<input name="ckxfw" data-options="label:'出口悬浮物mg/L', labelWidth:180" class="easyui-numberbox" style="width:300px;" ></input>
</div>
<div style="margin-bottom:10px">
<input name="jkhxxyl" data-options="label:'进口化学需氧量mg/L',labelWidth:180" class="easyui-numberbox" style="width:300px;" reqired></input>
<input name="jkshxll" data-options="label:'进口生化需氧量mg/L', labelWidth:180" class="easyui-numberbox" style="width:300px;" ></input>
</div>
<div style="margin-bottom:10px">
<input name="jkad" data-options="label:'进口氨氮mg/L',labelWidth:180" class="easyui-numberbox" style="width:300px;" ></input>
<input name="jkxfw" data-options="label:'进口悬浮物mg/L', labelWidth:180" class="easyui-numberbox" style="width:300px;" ></input>
</div>
<div style="text-align: center;">
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="savedetection()">保存</a>
</div>
</form>
</div>
<script>
var detection_action_url = '/api/enp/detection/create/';
$('#detectionTable').datagrid({
url: '/api/enp/detection/list/',
rownumbers: true,
singleSelect: true,
striped: true,
method: 'get',
toolbar: '#detectionTableBar',
border: false,
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'number', title: '排放口编号', width: 200 },
{ field: 'jcDate', title: '监测日期', width: 200 },
{ field: 'jctime', title: '监测时间', width: 200 },
{ field: 'ckhxxyl', title: '出口化学需氧量mg/L', width: 200 },
{ field: 'ckshxll', title: '出口生化需氧量mg/L', width: 200 },
{ field: 'ckad', title: '出口氨氮mg/L', width: 200 },
{ field: 'ckxfw', title: '出口悬浮物mg/L', width: 200 },
{ field: 'jkhxxyl', title: '进口化学需氧量mg/L', width: 200 },
{ field: 'jkshxll', title: '进口生化需氧量mg/L', width: 200 },
{ field: 'jkad', title: '进口氨氮mg/L', width: 200 },
{ field: 'jkxfw', title: '进口悬浮物mg/L', width: 200 },
]],
onClickRow: function (index, row) {
}
});
//新增
function adddetection() {
$('#detectionDialog').dialog('open').dialog('setTitle', '新增废水污染物检测').window('center');
$('#detectionForm').form('clear');
detection_action_url = '/api/enp/detection/create/'
}
//保存数据
function savedetection() {
var data = $('#detectionForm').serializeJSON();
$.ajax({
type: "POST",
url: detection_action_url,
data: JSON.stringify(data),
datatype: "json",
processData: false,
contentType: "application/json;charset=utf-8",
beforeSend: function () {
return $('#detectionForm').form('validate')
},
success: function (data) {
$("#detectionTable").datagrid('reload');
$("#detectionDialog").dialog("close");
},
});
}
//编辑数据
function edidetection(){
var row = $('#detectionTable').datagrid('getSelected');
if(row){
$('#detectionDialog').dialog('open').dialog('setTitle', '编辑废水污染物检测结').window('center');
$('#detectionForm').form('load', row);
detection_action_url = '/api/enp/detection/update/'}
else{
$.messager.alert('提示', '请选择一条数据!');
}
}
//删除数据
function deldetection(){
var row = $('#detectionTable').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
var data = { id: row.id }
$.ajax({
type: "POST",
url: '/api/enp/detection/delete/',
data: JSON.stringify(data),
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#detectionTable").datagrid('reload');
$("#detectionTable").datagrid('reload');
}
else {
$.messager.alert('提示', '操作失败!');
}
},
});
}
});
}
else { $.messager.alert('提示', '请选择一条数据!'); }
}
</script>