safesite/enp/templates/zprevention.html

157 lines
7.1 KiB
HTML

<div class="easyui-layout" style="width:100%;height:100%;">
<div data-options="region:'center',title:'噪声防治设施表',split:true,border:false" style="height:100%;">
<div id="wpreventionTableBar">
<a onclick="addzprevention()" class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain: true">新增</a>
<a onclick="edizprevention()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',plain: true">编辑</a>
<a onclick="delzprevention()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',plain: true">删除</a>
</div>
<table id="zpreventionTable" style="height:100%"></table>
</div>
</div>
<div id="zpreventionDialog" class="easyui-dialog" style="width:800px;height:600px;padding:20px 25px;"
data-options="resizable:true,modal:true,closed:true,border:false">
<form method="post" id="zpreventionForm">
<input name="id" type="hidden">
<div style="margin-bottom:10px">
<input name="name" data-options="label:'设施名称', labelWidth:100" class="easyui-textbox" style="width:300px;" required></input>
<input name="number" data-options="label:'编码', labelWidth:100" class="easyui-textbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="type" data-options="label:'设施型号',labelWidth:100" class="easyui-textbox" style="width:300px;" required></input>
<input name="cs_name" data-options="label:'参数名称', labelWidth:100" class="easyui-textbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="desig_nnumber" data-options="label:'设计值',labelWidth:100" class="easyui-numberbox" style="width:300px;" required></input>
<input name="em_unit" data-options="label:'单位',labelWidth:100" class="easyui-textbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="start_time" data-options="label:'运行开始时间', editable:false, labelWidth:100" class="easyui-datebox" style="width:300px;" required ></input>
<input name="end_time" data-options="label:'运行结束日期', editable:false, labelWidth:100" class="easyui-datebox" style="width:300px;" required ></input>
</div>
<div style="margin-bottom:10px">
<input name="state" data-options="label:'运行状态',labelWidth:100" class="easyui-textbox" style="width:300px;" required></input>
<input name="clfs" data-options="label:'处理方式',labelWidth:100" class="easyui-textbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="hdl" data-options="label:'耗电量kWh', labelWidth:100" class="easyui-numberbox" style="width:300px;" required></input>
<input name="zlxl" data-options="label:'治理效率',labelWidth:100" class="easyui-textbox" style="width:300px;" required></input>
</div>
<div style="text-align: center;">
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="savezprevention()">保存</a>
</div>
</form>
</div>
<script>
var zprevention_action_url = '/api/enp/zprevention/create/';
$('#zpreventionTable').datagrid({
url: '/api/enp/zprevention/list/',
rownumbers: true,
singleSelect: true,
striped: true,
method: 'get',
toolbar: '#wpreventionTableBar',
border: false,
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'name', title: '防治设施名称', width: 200 },
{ field: 'number', title: '编码', width: 200 },
{ field: 'type', title: '防治设施型号', width: 200 },
{ field: 'cs_name', title: '参数名', width: 200 },
{ field: 'desig_nnumber', title: '设计值', width: 200 },
{ field: 'em_unit', title: '单位', width: 200 },
{ field: 'start_time', title: '运行开始时间', width: 200 },
{ field: 'end_time', title: '运行结束时间', width: 200 },
{ field: 'state', title: '运行状态', width: 200 },
{ field: 'zlxl', title: '治理效率', width: 200 },
{ field: 'clfs', title: '处理方式', width: 200 },
{ field: 'hdl', title: '耗电量kWh', width: 200 },
]],
onClickRow: function (index, row) {
}
});
//新增
function addzprevention() {
$('#zpreventionDialog').dialog('open').dialog('setTitle', '新增噪声防治设施').window('center');
$('#zpreventionForm').form('clear');
zprevention_action_url = '/api/enp/zprevention/create/'
}
//保存数据
function savezprevention() {
var data = $('#zpreventionForm').serializeJSON();
$.ajax({
type: "POST",
url: zprevention_action_url,
data: JSON.stringify(data),
datatype: "json",
processData: false,
contentType: "application/json;charset=utf-8",
beforeSend: function () {
return $('#zpreventionForm').form('validate')
},
success: function (data) {
$("#zpreventionTable").datagrid('reload');
$("#zpreventionDialog").dialog("close");
},
});
}
//编辑数据
function edizprevention(){
var row = $('#zpreventionTable').datagrid('getSelected');
if(row){
$('#zpreventionDialog').dialog('open').dialog('setTitle', '编辑噪声防治设施').window('center');
$('#zpreventionForm').form('load', row);
zprevention_action_url = '/api/enp/zprevention/update/'}
else{
$.messager.alert('提示', '请选择一条数据!');
}
}
//删除数据
function delzprevention(){
var row = $('#zpreventionTable').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
var data = { id: row.id }
$.ajax({
type: "POST",
url: '/api/enp/zprevention/delete/',
data: JSON.stringify(data),
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#zpreventionTable").datagrid('reload');
$("#zpreventionTable").datagrid('reload');
}
else {
$.messager.alert('提示', '操作失败!');
}
},
});
}
});
}
else { $.messager.alert('提示', '请选择一条数据!'); }
}
</script>