138 lines
5.7 KiB
HTML
138 lines
5.7 KiB
HTML
<div class="easyui-layout" style="width:100%;height:100%;">
|
|
|
|
|
|
<div data-options="region:'center',split:true,border:false" style="height:100%;">
|
|
<div id="gastestequipTableBar">
|
|
<a onclick="addwaterequipment()" class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain: true">新增</a>
|
|
<a onclick="ediwaterequipment()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',plain: true">编辑</a>
|
|
<a onclick="delwaterequipment()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',plain: true">删除</a>
|
|
</div>
|
|
<table id="gastestequipTable" style="height:100%"></table>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="gastestequipDialog" 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="gastestequipForm">
|
|
<input name="id" type="hidden">
|
|
<div style="margin-bottom:10px">
|
|
<input name="drain" data-options="label:'排放口', labelWidth:100" class="easyui-textbox" style="width:600px;" ></input>
|
|
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input name="contaminant" data-options="label:'污染物',labelWidth:100" class="easyui-textbox" style="width:600px;" ></input>
|
|
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input name="model" data-options="label:'仪器型号',labelWidth:100" class="easyui-textbox" style="width:600px;" ></input>
|
|
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<select name='state' data-options="label:'设备状态',labelWidth:100" class="easyui-combobox" style="width:600px;"
|
|
editable=false>
|
|
<option value="">请选择</option>
|
|
<option value="1">正常</option>
|
|
<option value="0">异常</option>
|
|
</select>
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input name="remark" data-options="label:'备注',labelWidth:100" class="easyui-textbox" style="width:600px;" ></input>
|
|
|
|
</div>
|
|
<div style="text-align: center;">
|
|
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="savegastestequip()">保存</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<script>
|
|
|
|
var gastestequip_action_url = '/api/enp/gastestequipment/create/';
|
|
|
|
$('#gastestequipTable').datagrid({
|
|
url: '/api/enp/gastestequipment/list/',
|
|
rownumbers: true,
|
|
singleSelect: true,
|
|
striped: true,
|
|
method: 'get',
|
|
toolbar: '#gastestequipTableBar',
|
|
border: false,
|
|
columns: [[
|
|
{ field: 'id', title: 'ID', hidden: true },
|
|
{ field: 'drain__name', title: '排放口', width: 200 },
|
|
{ field: 'contaminant', title: '污染物', width: 200 },
|
|
{ field: 'model', title: '仪器型号', width: 200 },
|
|
{ field: 'state', title: '设备状态', width: 200 },
|
|
{ field: 'remark', title: '备注', width: 200 },
|
|
]],
|
|
onClickRow: function (index, row) {
|
|
|
|
}
|
|
});
|
|
|
|
//新增
|
|
function addwaterequipment() {
|
|
$('#gastestequipDialog').dialog('open').dialog('setTitle', '新增').window('center');
|
|
$('#gastestequipForm').form('clear');
|
|
gastestequip_action_url = '/api/enp/gastestequipment/create/'
|
|
}
|
|
//保存数据
|
|
function savegastestequip() {
|
|
var data = $('#gastestequipForm').serializeJSON();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: gastestequip_action_url,
|
|
data: JSON.stringify(data),
|
|
datatype: "json",
|
|
processData: false,
|
|
contentType: "application/json;charset=utf-8",
|
|
beforeSend: function () {
|
|
return $('#gastestequipForm').form('validate')
|
|
},
|
|
success: function (data) {
|
|
$("#gastestequipTable").datagrid('reload');
|
|
$("#gastestequipDialog").dialog("close");
|
|
|
|
},
|
|
});
|
|
}
|
|
//编辑数据
|
|
function ediwaterequipment(){
|
|
var row = $('#gastestequipTable').datagrid('getSelected');
|
|
if(row){
|
|
$('#gastestequipDialog').dialog('open').dialog('setTitle', '编辑').window('center');
|
|
$('#gastestequipForm').form('load', row);
|
|
gastestequip_action_url = '/api/enp/gastestequipment/update/'}
|
|
else{
|
|
$.messager.alert('提示', '请选择一条数据!');
|
|
}
|
|
}
|
|
//删除数据
|
|
function delwaterequipment(){
|
|
var row = $('#gastestequipTable').datagrid('getSelected');
|
|
if (row) {
|
|
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
|
if (r) {
|
|
var data = { id: row.id }
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/api/enp/gastestequipment/delete/',
|
|
data: JSON.stringify(data),
|
|
datatype: "json",
|
|
beforeSend: function () { },
|
|
success: function (data) {
|
|
if (data.code == 1) {
|
|
$("#gastestequipTable").datagrid('reload');
|
|
$("#gastestequipTable").datagrid('reload');
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '操作失败!');
|
|
}
|
|
},
|
|
});
|
|
}
|
|
});
|
|
}
|
|
else { $.messager.alert('提示', '请选择一条数据!'); }
|
|
|
|
}
|
|
</script> |