zaosheng
This commit is contained in:
parent
48cb98b203
commit
35de452e35
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.8 on 2022-08-03 14:25
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('enp', '0023_archives_note'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='prevention',
|
||||
name='preventiontype',
|
||||
field=models.IntegerField(blank=True, choices=[(1, '废水'), (2, '废气'), (3, '噪声')], default=1, null=True, verbose_name='防治类型'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.8 on 2022-08-03 14:38
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('enp', '0024_auto_20220803_1425'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='prevention',
|
||||
name='hdl',
|
||||
field=models.FloatField(blank=True, max_length=100, null=True, verbose_name='耗电率kWh'),
|
||||
),
|
||||
]
|
|
@ -156,11 +156,12 @@ class Facilities(CommonModel):
|
|||
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
|
||||
class Prevention(CommonModel):
|
||||
"""
|
||||
废气,废水防治设施
|
||||
废气,废水,噪声防治设施
|
||||
"""
|
||||
type_choices = (
|
||||
(1, '废水'),
|
||||
(2, '废气')
|
||||
(2, '废气'),
|
||||
(3, '噪声')
|
||||
)
|
||||
name = models.CharField('防治设施名称', max_length=100)
|
||||
number = models.CharField('编码', max_length=100)
|
||||
|
@ -180,7 +181,7 @@ class Prevention(CommonModel):
|
|||
pkwd = models.FloatField('排口温度℃', max_length=200, null=True, blank=True)
|
||||
yl = models.FloatField('压力kPa', max_length=100, null=True, blank=True)
|
||||
pfsj = models.FloatField('排放时间h', max_length=100, null=True, blank=True)
|
||||
hdl = models.FloatField('耗电率kWh', max_length=100)
|
||||
hdl = models.FloatField('耗电率kWh', max_length=100,null=True, blank=True)
|
||||
fcpname = models.CharField('副产品名称', max_length=100, null=True, blank=True)
|
||||
fcwcl = models.FloatField('副产物产生量t', max_length=100, null=True, blank=True)
|
||||
yjname = models.CharField('药剂名称', max_length=100, null=True, blank=True)
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
<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>
|
|
@ -14,6 +14,7 @@ urlpatterns = [
|
|||
path('fuel/', views.HtmlFuel),
|
||||
path('waterequipment/', views.HtmlWaterequipment),
|
||||
path('archives/', views.HtmlArchives),
|
||||
path('zprevention/', views.HtmlZprevention),
|
||||
|
||||
|
||||
]
|
|
@ -22,6 +22,7 @@ urlpatterns = [
|
|||
path('fuel/<str:action>/', views.ApiFuel),#燃料信息表
|
||||
path('waterequipment/<str:action>/', views.ApiWaterequipment),#废水监测仪器信息表
|
||||
path('archives/<str:action>/', views.ApiArchives),#档案管理表
|
||||
path('zprevention/<str:action>/', views.ApiZprevention),#噪声防治设施
|
||||
|
||||
|
||||
|
||||
|
|
60
enp/views.py
60
enp/views.py
|
@ -48,6 +48,8 @@ def HtmlGprevention(request):
|
|||
return render(request, 'gprevention.html')
|
||||
def HtmlArchives(request):
|
||||
return render(request, 'archives.html')
|
||||
def HtmlZprevention(request):
|
||||
return render(request, 'zprevention.html')
|
||||
# 转换为combobox所用string
|
||||
|
||||
|
||||
|
@ -559,6 +561,64 @@ def ApiWaterequipment(request, action):
|
|||
obj = Waterequipment.objects.get(id=data['id'])
|
||||
obj.delete()
|
||||
return JsonResponse({"code":1})
|
||||
#噪声防治设施
|
||||
def ApiZprevention(request, action):
|
||||
user = User.objects.get(userid=request.session['userid'])
|
||||
if action == 'list':
|
||||
objs = Prevention.objects.filter(usecomp=user.usecomp, is_deleted=False,preventiontype=3)
|
||||
total = objs.count()
|
||||
startnum, endnum = fenye(request)
|
||||
objs = objs.order_by('-create_time')[startnum:endnum].values('id', 'name', 'number', 'type', 'cs_name',
|
||||
'desig_nnumber', 'em_unit', 'start_time', 'end_time', 'state','zlxl','clfs','hdl' )
|
||||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||
elif action == 'create':
|
||||
data = json.loads(request.body.decode('utf-8'))
|
||||
obj = Prevention()
|
||||
obj.create_by = user
|
||||
obj.update_by = user
|
||||
obj.usecomp = user.usecomp
|
||||
obj.name = data['name']
|
||||
obj.number = data['number']
|
||||
obj.preventiontype=3
|
||||
obj.type = data['type']
|
||||
obj.cs_name = data['cs_name']
|
||||
obj.desig_nnumber = data['desig_nnumber']
|
||||
obj.em_unit = data['em_unit']
|
||||
obj.start_time = data['start_time']
|
||||
obj.end_time = data['end_time']
|
||||
obj.state = data['state']
|
||||
obj.zlxl = data['zlxl']
|
||||
obj.clfs = data['clfs']
|
||||
obj.hdl = data['hdl']
|
||||
|
||||
obj.save()
|
||||
return JsonResponse({"code":1})
|
||||
elif action == 'update':
|
||||
data = json.loads(request.body.decode('utf-8'))
|
||||
obj = Prevention.objects.get(id=data['id'])
|
||||
obj.create_by = user
|
||||
obj.update_by = user
|
||||
obj.usecomp = user.usecomp
|
||||
obj.name = data['name']
|
||||
obj.number = data['number']
|
||||
obj.preventiontype=3
|
||||
obj.type = data['type']
|
||||
obj.cs_name = data['cs_name']
|
||||
obj.desig_nnumber = data['desig_nnumber']
|
||||
obj.em_unit = data['em_unit']
|
||||
obj.start_time = data['start_time']
|
||||
obj.end_time = data['end_time']
|
||||
obj.state = data['state']
|
||||
obj.zlxl = data['zlxl']
|
||||
obj.clfs = data['clfs']
|
||||
obj.hdl = data['hdl']
|
||||
obj.save()
|
||||
return JsonResponse({"code":1})
|
||||
elif action == 'delete':
|
||||
data = json.loads(request.body.decode('utf-8'))
|
||||
obj = Prevention.objects.get(id=data['id'])
|
||||
obj.delete()
|
||||
return JsonResponse({"code":1})
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue