Merge branch 'huanbao' of https://e.coding.net/ctcdevteam/safesite into huanbao
This commit is contained in:
commit
3a10d48c4d
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.8 on 2023-12-26 08:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('enp', '0030_gastestequipment'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='prevention',
|
||||
name='preventiontype',
|
||||
field=models.IntegerField(blank=True, choices=[(1, '废水'), (2, '废气'), (3, '噪声'), (4, '废水治理')], default=1, null=True, verbose_name='防治类型'),
|
||||
),
|
||||
]
|
|
@ -167,7 +167,8 @@ class Prevention(CommonModel):
|
|||
type_choices = (
|
||||
(1, '废水'),
|
||||
(2, '废气'),
|
||||
(3, '噪声')
|
||||
(3, '噪声'),
|
||||
(4, '废水治理'),
|
||||
)
|
||||
clfs_choices = (
|
||||
('1', '自行利用'),
|
||||
|
@ -292,3 +293,4 @@ class Archives(CommonModel):
|
|||
note = models.CharField('备注', max_length=500, null=True, blank=True)
|
||||
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, null=True, blank=True,verbose_name='所属公司')
|
||||
|
||||
|
|
@ -331,6 +331,8 @@
|
|||
function saveArchives(){
|
||||
var data = $('#arechivesForm').serializeJSON();
|
||||
data['filepath'] = document.getElementById('url').innerHTML;
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: waste_action_url,
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
<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="addwprevention()" class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain: true">新增</a>
|
||||
<a onclick="ediwprevention()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',plain: true">编辑</a>
|
||||
<a onclick="delwprevention()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',plain: true">删除</a>
|
||||
</div>
|
||||
<table id="wpreventionTable" style="height:100%"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="wpreventionDialog" 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="wpreventionForm">
|
||||
<input name="id" type="hidden">
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="name" data-options="label:'治理设备名称', labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
|
||||
<input name="number" data-options="label:'编码', labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
</div>
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="type" data-options="label:'设备型号',labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
|
||||
<input name="cs_name" data-options="label:'参数名称', labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
</div>
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="desig_nnumber" data-options="label:'设计值',labelWidth:100" class="easyui-numberbox" style="width:300px;" ></input>
|
||||
<input name="em_unit" data-options="label:'单位',labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="start_time" data-options="label:'运行开始时间', editable:false, labelWidth:100" class="easyui-datebox" style="width:300px;" ></input>
|
||||
|
||||
<input name="end_time" data-options="label:'运行结束日期', editable:false, labelWidth:100" class="easyui-datebox" style="width:300px;" ></input>
|
||||
</div>
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="state" data-options="label:'运行状态',labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
<input name="ckll" data-options="label:'出口流量', labelWidth:100" class="easyui-numberbox" style="width:300px;" ></input>
|
||||
|
||||
</div>
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="wryz" data-options="label:'污染因子',labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
|
||||
<input name="zlxl" data-options="label:'治理效率', labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
</div>
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="sjly" data-options="label:'数据来源',labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
|
||||
<input name="pqfx" data-options="label:'排放去向',labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="wncsl" data-options="label:'污泥产生量', labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
|
||||
<select class="easyui-combobox" data-options="label:'处理方式' " name="clfs" style="width:300px;">
|
||||
<option value="1">自行利用</option>
|
||||
<option value="2">委托处置</option>
|
||||
<option value="3">自行处置</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="hdl" data-options="label:'耗电量kWh', labelWidth:100" class="easyui-numberbox" style="width:300px;" ></input>
|
||||
<input name="yjname" data-options="label:'药剂名称',labelWidth:100" class="easyui-textbox" style="width:300px;" ></input>
|
||||
|
||||
|
||||
</div>
|
||||
<div style="margin-bottom:10px">
|
||||
<input name="tjtime" data-options="label:'添加时间', editable:false, labelWidth:100" class="easyui-datebox" style="width:300px;" ></input>
|
||||
<input name="tjl" data-options="label:'添加量',labelWidth:100" class="easyui-numberbox" style="width:300px;" ></input>
|
||||
|
||||
</div>
|
||||
<div style="text-align: center;">
|
||||
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="savewprevention()">保存</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var wprevention_action_url = '/api/enp/wtequipment/create/';
|
||||
|
||||
$('#wpreventionTable').datagrid({
|
||||
url: '/api/enp/wtequipment/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: 'ckll', title: '出口流量', width: 200 },
|
||||
{ field: 'wryz', title: '污染因子', width: 200 },
|
||||
{ field: 'zlxl', title: '治理效率', width: 200 },
|
||||
{ field: 'sjly', title: '数据来源', width: 200 },
|
||||
{ field: 'pqfx', title: '排放去向', width: 200 },
|
||||
{ field: 'wncsl', title: '污泥产生量', width: 200 },
|
||||
{field:'clfs',title:'处理方式', width:200,
|
||||
formatter: function(value,row,index){
|
||||
if (value=='1'){
|
||||
return '自行利用';
|
||||
}
|
||||
else if (value=='2') {
|
||||
return '委托处置';
|
||||
}
|
||||
else{
|
||||
return '自行处置';
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'hdl', title: '耗电量kWh', width: 200 },
|
||||
{ field: 'yjname', title: '药剂名称', width: 200 },
|
||||
{ field: 'tjtime', title: '添加时间', width: 200 },
|
||||
{ field: 'tjl', title: '添加量', width: 200 },
|
||||
|
||||
|
||||
]],
|
||||
onClickRow: function (index, row) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//新增
|
||||
function addwprevention() {
|
||||
$('#wpreventionDialog').dialog('open').dialog('setTitle', '新增治理设备表').window('center');
|
||||
$('#wpreventionForm').form('clear');
|
||||
wprevention_action_url = '/api/enp/wtequipment/create/'
|
||||
}
|
||||
//保存数据
|
||||
function savewprevention() {
|
||||
var data = $('#wpreventionForm').serializeJSON();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: wprevention_action_url,
|
||||
data: JSON.stringify(data),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
beforeSend: function () {
|
||||
return $('#wpreventionForm').form('validate')
|
||||
},
|
||||
success: function (data) {
|
||||
$("#wpreventionTable").datagrid('reload');
|
||||
$("#wpreventionDialog").dialog("close");
|
||||
|
||||
},
|
||||
});
|
||||
}
|
||||
//编辑数据
|
||||
function ediwprevention(){
|
||||
var row = $('#wpreventionTable').datagrid('getSelected');
|
||||
if(row){
|
||||
$('#wpreventionDialog').dialog('open').dialog('setTitle', '编辑治理设备表').window('center');
|
||||
$('#wpreventionForm').form('load', row);
|
||||
wprevention_action_url = '/api/enp/wtequipment/update/'}
|
||||
else{
|
||||
$.messager.alert('提示', '请选择一条数据!');
|
||||
}
|
||||
}
|
||||
//删除数据
|
||||
function delwprevention(){
|
||||
var row = $('#wpreventionTable').datagrid('getSelected');
|
||||
if (row) {
|
||||
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
||||
if (r) {
|
||||
var data = { id: row.id }
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/api/enp/wtequipment/delete/',
|
||||
data: JSON.stringify(data),
|
||||
datatype: "json",
|
||||
beforeSend: function () { },
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$("#wpreventionTable").datagrid('reload');
|
||||
$("#wpreventionTable").datagrid('reload');
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '操作失败!');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else { $.messager.alert('提示', '请选择一条数据!'); }
|
||||
|
||||
}
|
||||
</script>
|
|
@ -16,6 +16,8 @@ urlpatterns = [
|
|||
path('gastestequipment/', views.HtmlGasTestEquipment),
|
||||
path('archives/', views.HtmlArchives),
|
||||
path('zprevention/', views.HtmlZprevention),
|
||||
path('gastequipment/', views.Htmlgastequipment),
|
||||
|
||||
|
||||
|
||||
]
|
|
@ -17,6 +17,7 @@ urlpatterns = [
|
|||
path('facilities/<str:action>/', views.ApiFacilities),#环境设施,生产设施
|
||||
path('wprevention/<str:action>/', views.ApiWprevention),#废水防治设施
|
||||
path('gprevention/<str:action>/', views.ApiGprevention),#废水防治设施
|
||||
path('wtequipment/<str:action>/', views.ApiWpreventionequipment),#废气治理设备
|
||||
path('abnormal/<str:action>/', views.ApiAbnormal),#防治设施异常
|
||||
path('detection/<str:action>/', views.ApiDetection),#废水污染物检测
|
||||
path('fuel/<str:action>/', views.ApiFuel),#燃料信息表
|
||||
|
@ -24,4 +25,5 @@ urlpatterns = [
|
|||
path('gastestequipment/<str:action>/', views.ApiGasTestEquipment),#废气监测仪器信息表
|
||||
path('archives/<str:action>/', views.ApiArchives),#档案管理表
|
||||
path('zprevention/<str:action>/', views.ApiZprevention),#噪声防治设施
|
||||
|
||||
]
|
82
enp/views.py
82
enp/views.py
|
@ -52,6 +52,10 @@ def HtmlArchives(request):
|
|||
return render(request, 'archives.html')
|
||||
def HtmlZprevention(request):
|
||||
return render(request, 'zprevention.html')
|
||||
|
||||
def Htmlgastequipment(request):
|
||||
return render(request, 'gastequipment.html')
|
||||
|
||||
# 转换为combobox所用string
|
||||
|
||||
|
||||
|
@ -298,6 +302,9 @@ def ApiGprevention(request, action):
|
|||
obj = Prevention.objects.get(id=data['id'])
|
||||
obj.delete()
|
||||
return JsonResponse({"code":1})
|
||||
|
||||
|
||||
|
||||
#废水防治设施
|
||||
def ApiWprevention(request, action):
|
||||
user = User.objects.get(userid=request.session['userid'])
|
||||
|
@ -372,6 +379,80 @@ def ApiWprevention(request, action):
|
|||
obj = Prevention.objects.get(id=data['id'])
|
||||
obj.delete()
|
||||
return JsonResponse({"code":1})
|
||||
|
||||
def ApiWpreventionequipment(request, action):
|
||||
user = User.objects.get(userid=request.session['userid'])
|
||||
if action == 'list':
|
||||
objs = Prevention.objects.filter(usecomp=user.usecomp, is_deleted=False,preventiontype=4)
|
||||
total = objs.count()
|
||||
startnum, endnum = fenye(request)
|
||||
objs = objs.order_by('-create_time')[startnum:endnum].values('id', 'name', 'number', 'type', 'preventiontype', 'cs_name',
|
||||
'desig_nnumber', 'em_unit', 'start_time', 'end_time', 'state', 'ckll', 'wryz', 'zlxl',
|
||||
'sjly', 'pqfx', 'wncsl', 'clfs','hdl','yjname', 'tjtime', 'tjl')
|
||||
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=4
|
||||
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.ckll = data['ckll']
|
||||
obj.wryz = data['wryz']
|
||||
obj.zlxl = data['zlxl']
|
||||
obj.sjly = data['sjly']
|
||||
obj.pqfx = data['pqfx']
|
||||
obj.wncsl = data['wncsl']
|
||||
obj.clfs = data['clfs']
|
||||
obj.hdl = data['hdl']
|
||||
obj.yjname = data['yjname']
|
||||
obj.tjtime = data['tjtime']
|
||||
obj.tjl = data['tjl']
|
||||
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=4
|
||||
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.ckll = data['ckll']
|
||||
obj.wryz = data['wryz']
|
||||
obj.zlxl = data['zlxl']
|
||||
obj.sjly = data['sjly']
|
||||
obj.pqfx = data['pqfx']
|
||||
obj.wncsl = data['wncsl']
|
||||
obj.clfs = data['clfs']
|
||||
obj.hdl = data['hdl']
|
||||
obj.yjname = data['yjname']
|
||||
obj.tjtime = data['tjtime']
|
||||
obj.tjl = data['tjl']
|
||||
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})
|
||||
#防治设施异常
|
||||
def ApiAbnormal(request, action):
|
||||
user = User.objects.get(userid=request.session['userid'])
|
||||
|
@ -1015,3 +1096,4 @@ def ApiGasTestEquipment(request, action):
|
|||
obj.update_by=user
|
||||
obj.save()
|
||||
return JsonResponse({"code":1})
|
||||
|
Loading…
Reference in New Issue