enp drain 表修改

This commit is contained in:
曹前明 2022-05-17 17:19:01 +08:00
parent bcb6fa08e4
commit 9380406a69
6 changed files with 224 additions and 90 deletions

View File

@ -0,0 +1,40 @@
# Generated by Django 2.2.8 on 2022-05-17 16:54
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('enp', '0017_auto_20220516_0858'),
]
operations = [
migrations.RemoveField(
model_name='detection',
name='number',
),
migrations.AddField(
model_name='detection',
name='drain',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='enp.Drain', verbose_name='关联排放口'),
preserve_default=False,
),
migrations.AddField(
model_name='drain',
name='polygon',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True, verbose_name='点位坐标'),
),
migrations.AddField(
model_name='drain',
name='type',
field=models.PositiveSmallIntegerField(choices=[(10, '排水'), (20, '排气')], default=10, verbose_name='排污口类型'),
),
migrations.AlterField(
model_name='waterequipment',
name='count',
field=models.IntegerField(blank=True, null=True, verbose_name='监测次数'),
),
]

View File

@ -0,0 +1,29 @@
# Generated by Django 2.2.8 on 2022-05-17 17:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('enp', '0018_auto_20220517_1654'),
]
operations = [
migrations.RenameField(
model_name='drain',
old_name='polygon',
new_name='location',
),
migrations.RemoveField(
model_name='waterequipment',
name='number',
),
migrations.AddField(
model_name='waterequipment',
name='drain',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='enp.Drain', verbose_name='关联排放口'),
preserve_default=False,
),
]

View File

@ -1,6 +1,7 @@
from django.db import models
from safesite.models import User, Partment
from utils.models import CommonModel
from django.contrib.postgres.fields import JSONField
# Create your models here.
class Waste(CommonModel):
@ -90,8 +91,14 @@ class Drain(CommonModel):
"""
排放口
"""
DRAIN_TYPE_CHOICES = (
(10, '排水'),
(20, '排气')
)
type = models.PositiveSmallIntegerField('排污口类型', default=10, choices=DRAIN_TYPE_CHOICES)
number = models.CharField('编号', max_length=100)
name = models.CharField('名称', max_length=100)
location = JSONField('点位坐标', null=True, blank=True)
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
class GasEmit(CommonModel):
@ -197,11 +204,12 @@ class abnormal(CommonModel):
sfbg = models.CharField('是否报告', max_length=200, null=True, blank=True)
ydcs = models.CharField('应对措施', max_length=200, null=True, blank=True)
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
class Detection(CommonModel):
"""
废水污染物检测结果表
"""
number = models.CharField('排放口编号', max_length=100)
drain = models.ForeignKey(Drain, verbose_name='关联排放口', on_delete=models.CASCADE)
jcDate = models.DateTimeField('监测日期', null=True, blank=True)
jctime = models.DateTimeField('监测时间', null=True, blank=True)
ckhxxyl = models.FloatField('出口化学需氧量mg/L', max_length=200, null=True, blank=True)
@ -213,6 +221,7 @@ class Detection(CommonModel):
jkad = models.FloatField('进口氨氮mg/L', max_length=200, null=True, blank=True)
jkxfw = models.FloatField('进口悬浮物mg/L', max_length=200, null=True, blank=True)
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
class Fuel(CommonModel):
"""
燃料信息表
@ -230,14 +239,15 @@ class Fuel(CommonModel):
rqqt = models.CharField('燃气其他', max_length=100, null=True, blank=True)
qtrlxgwzhl = models.CharField('其他燃料相关物质含量', max_length=400, null=True, blank=True)
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
class Waterequipment(CommonModel):
"""
废水监测仪器信息表
"""
number = models.CharField('排放口编号', max_length=100)
drain = models.ForeignKey(Drain, verbose_name='关联排放口', on_delete=models.CASCADE)
type = models.CharField('污染物种类', max_length=100, null=True, blank=True)
methods = models.CharField('监测采样方法及个数', max_length=300, null=True, blank=True)
count = models.IntegerField('监测次数', max_length=100, null=True, blank=True)
count = models.IntegerField('监测次数', null=True, blank=True)
identification = models.CharField('鉴定方法', max_length=200, null=True, blank=True)
jcyqmodel = models.CharField('监测仪器型号', max_length=100, null=True, blank=True)
note = models.CharField('备注', max_length=500, null=True, blank=True)

View File

View File

@ -1,68 +1,97 @@
<div class="easyui-layout" style="width:100%;height:100%;">
<div data-options="region:'west', title:'一般固废名称', split:true, border:false" style="width: 300px;height:100%;">
<div id="wasteTableBar">
<a onclick="addWaste()" class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain: true">新增</a>
<a onclick="editWaste()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',plain: true">编辑</a>
<a onclick="delWaste()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',plain: true">删除</a>
<div data-options="region:'west', title:'排放口', split:true, border:false" style="width: 300px;height:100%;">
<div id="drainTableBar">
<a onclick="addDrain()" class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain: true">新增</a>
<a onclick="editDrain()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',plain: true">编辑</a>
<a onclick="delDrain()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',plain: true">删除</a>
</div>
<table id="wasteTable" style="height:100%"></table>
<table id="drainTable" style="height:100%"></table>
</div>
<div data-options="region:'center',title:'一般固废台账',split:true,border:false" style="height:100%;">
<div id="normalWasteRecordTableBar">
<a onclick="addNormalWasteRecord()" class="easyui-linkbutton"
<div data-options="region:'center',title:'监测记录',split:true,border:false" style="height:100%;">
<div id="gasEmitTableBar">
<a onclick="addGasEmitRecord()" class="easyui-linkbutton"
data-options="iconCls: 'fa-plus',plain: true">新增</a>
<a onclick="delNormalWasteRecord()" class="easyui-linkbutton"
<a onclick="delGasEmitRecord()" class="easyui-linkbutton"
data-options="iconCls: 'fa-trash',plain: true">删除</a>
</div>
<table id="normalWasteRecordTable" style="height:100%"></table>
<table id="gasEmitTable" style="height:100%"></table>
</div>
</div>
<div id="wasteDialog" class="easyui-dialog" style="width:400px;height:200px;padding:5px 15px;"
<div id="drainDialog" class="easyui-dialog" style="width:400px;height:200px;padding:5px 15px;"
data-options="resizable:true,modal:true,closed:true,border:false">
<form method="post" id="wasteForm">
<form method="post" id="drainForm">
<input name="id" type="hidden">
<input name="type" type="hidden" id="typeFormItem">
<div style="margin-bottom:10px">
<input name="number" data-options="label:'废物编号'" class="easyui-textbox" style="width:300px;" required></input>
<input name="number" data-options="label:'排放口编号'" class="easyui-textbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="name" data-options="label:'废物名称'" class="easyui-textbox" style="width:300px;"
<input name="name" data-options="label:'排放口名称'" class="easyui-textbox" style="width:300px;"
required></input>
</div>
<div style="text-align: center;">
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="saveWaste()">保存</a>
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="saveDrain()">保存</a>
</div>
</form>
</div>
<div id="normalWasteRecordDialog" class="easyui-dialog" style="width:400px;height:600px;padding:5px 15px;"
<div id="gasEmitDialog" class="easyui-dialog" style="width:400px;height:800px;padding:5px 15px;"
data-options="resizable:true,modal:true,closed:true,border:false">
<form method="post" id="normalWasteRecordForm">
<form method="post" id="gasEmitForm">
<input name="id" type="hidden">
<input name="waste" type="hidden" id="wasteFormItem">
<input name="operator" type="hidden" id="operatorFormItem">
<input name="drain" type="hidden" id="gasEmitForm_drain">
<div style="margin-bottom:10px">
<input name="gen_date" data-options="label:'产生日期', editable:false, labelWidth:100" class="easyui-datebox" style="width:300px;" required ></input>
<input name="watch_time" data-options="label:'监测时间', editable:false, labelWidth:120" class="easyui-datetimebox" style="width:300px;" required ></input>
</div>
<div style="margin-bottom:10px">
<input name="gen_count" data-options="label:'产生数量(吨)', labelWidth:100" class="easyui-numberbox" style="width:300px;" required></input>
<input name="out_smoke" data-options="label:'出:标态干烟气量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="dis_date" data-options="label:'处置日期', editable:false, labelWidth:100" class="easyui-datebox" style="width:300px;" required ></input>
<input name="out_o2" data-options="label:'出:氧含量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="dis_count" data-options="label:'委托处置量(吨)', labelWidth:100" class="easyui-numberbox" style="width:300px;" required></input>
<input name="out_so2" data-options="label:'出:二氧化硫', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="inv_count" data-options="label:'库存(吨)', labelWidth:100" class="easyui-numberbox" style="width:300px;" required></input>
<input name="out_so2_s" data-options="label:'出:二氧化硫:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="operator__name" data-options="label:'经办人', labelWidth:100" class="easyui-textbox" style="width:300px;" id="operator__nameFormItem"
required readonly></input>
<a class='easyui-linkbutton' onclick="choseuser('operator')" style="width:auto">选择</a>
<input name="out_particle" data-options="label:'出:颗粒物', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="out_particle_s" data-options="label:'出:颗粒物:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="out_nox" data-options="label:'出:氮氧化物', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="out_nox_s" data-options="label:'出:氮氧化物:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="in_smoke" data-options="label:'入:标态干烟气量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="in_o2" data-options="label:'入:氧含量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="in_so2" data-options="label:'入:二氧化硫', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="in_so2_s" data-options="label:'入:二氧化硫:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="in_particle" data-options="label:'入:颗粒物', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="in_particle_s" data-options="label:'入:颗粒物:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="in_nox" data-options="label:'入:氮氧化物', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="margin-bottom:10px">
<input name="in_nox_s" data-options="label:'入:氮氧化物:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" required></input>
</div>
<div style="text-align: center;">
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="saveNormalWasteRecord()">保存</a>
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="saveGasEmitRecord()">保存</a>
</div>
</form>
</div>
@ -73,102 +102,103 @@
$('#operator__nameFormItem').textbox('setValue', top.$('#in').attr('show'));
}
}
var waste_action_url = '/api/enp/waste/create/';
var record_action_url = '/api/enp/normalwasterecord/create/';
$('#wasteTable').datagrid({
url: '/api/enp/waste/list/?type=1',
var drain_action_url = '/api/enp/drain/create/';
var record_action_url = '/api/enp/gasemit/create/';
$('#drainTable').datagrid({
url: '/api/enp/drain/list/',
rownumbers: true,
singleSelect: true,
striped: true,
method: 'get',
toolbar: '#wasteTableBar',
toolbar: '#drainTableBar',
border: false,
fitColumns: true,
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'number', title: '废物编号', width: 100 },
{ field: 'name', title: '废物名称', width: 100 },
{ field: 'number', title: '排放口编号', width: 100 },
{ field: 'name', title: '排放口名称', width: 100 },
]],
onClickRow: function (index, row) {
$('#normalWasteRecordTable').datagrid({
url: '/api/enp/normalwasterecord/list/?waste=' + row.id
$('#gasEmitTable').datagrid({
url: '/api/enp/gasemit/list/?drain=' + row.id
})
}
});
$('#normalWasteRecordTable').datagrid({
url: '/api/enp/normalwasterecord/list/',
$('#gasEmitTable').datagrid({
url: '/api/enp/gasemit/list/',
rownumbers: true,
singleSelect: true,
striped: true,
method: 'get',
toolbar: '#normalWasteRecordTableBar',
toolbar: '#gasEmitTableBar',
border: false,
fitColumns: true,
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'operator', title: 'operator', hidden: true },
{ field: 'waste', title: 'waste', hidden: true },
{ field: 'waste__name', title: '废物名称', width: 100 },
{ field: 'gen_date', title: '产生日期', width: 100 },
{ field: 'gen_count', title: '产生数量(吨)', width: 100 },
{ field: 'dis_date', title: '处置日期', width: 100 },
{ field: 'dis_count', title: '委托处置量(吨)', width: 100 },
{ field: 'inv_count', title: '库存量(吨)', width: 100 },
{ field: 'operator__name', title: '经办人', width: 100 },
{ field: 'drain', title: 'drain', hidden: true },
{ field: 'drain__name', title: '排放口 ', width: 100 },
{ field: 'watch_time', title: '监测时间', width: 100 },
{ field: 'out_smoke', title: '出:干烟含量', width: 100 },
{ field: 'out_o2', title: '出:氧含量', width: 100 },
{ field: 'out_so2', title: '出:二氧化硫', width: 100 },
{ field: 'out_so2_s', title: '出:二氧化硫折标', width: 100 },
{ field: 'out_particle', title: '出:颗粒物', width: 100 },
{ field: 'out_particle_s', title: '出:颗粒物折标', width: 100 },
{ field: 'out_nox', title: '出:氮氧化物', width: 100 },
{ field: 'out_nox_s', title: '出:氮氧化物折标', width: 100 },
]],
onClickRow: function (index, row) {
}
});
function addWaste() {
$('#wasteDialog').dialog('open').dialog('setTitle', '新增一般固废名').window('center');
$('#wasteForm').form('clear');
$('#typeFormItem').attr('value',1);
waste_action_url = '/api/enp/waste/create/'
function addDrain() {
$('#drainDialog').dialog('open').dialog('setTitle', '新增排放口').window('center');
$('#drainForm').form('clear');
drain_action_url = '/api/enp/drain/create/'
}
function addNormalWasteRecord() {
function addGasEmitRecord() {
var row = $('#wasteTable').datagrid('getSelected');
var row = $('#drainTable').datagrid('getSelected');
if(row){
$('#normalWasteRecordDialog').dialog('open').dialog('setTitle', '新增记录').window('center');
$('#normalWasteRecordForm').form('clear');
$('#wasteFormItem').attr('value', row.id);
record_action_url = '/api/enp/normalwasterecord/create/';
$('#gasEmitDialog').dialog('open').dialog('setTitle', '新增记录').window('center');
$('#gasEmitForm').form('clear');
$('#gasEmitForm_drain').attr('value', row.id);
record_action_url = '/api/enp/gasemit/create/';
}else{
$.messager.alert('提示', '请先选择左侧废物!');
$.messager.alert('提示', '请先选择左侧排放口!');
}
}
function editWaste(){
var row = $('#wasteTable').datagrid('getSelected');
function editDrain(){
var row = $('#draineTable').datagrid('getSelected');
if(row){
$('#wasteDialog').dialog('open').dialog('setTitle', '编辑一般固废名').window('center');
$('#wasteForm').form('load', row);
waste_action_url = '/api/enp/waste/update/'}
$('#drainDialog').dialog('open').dialog('setTitle', '编辑排放口').window('center');
$('#drainForm').form('load', row);
drain_action_url = '/api/enp/drain/update/'}
else{
$.messager.alert('提示', '请选择一条数据!');
}
}
function saveWaste() {
var data = $('#wasteForm').serializeJSON();
function saveDrain() {
var data = $('#drainForm').serializeJSON();
$.ajax({
type: "POST",
url: waste_action_url,
url: drain_action_url,
data: JSON.stringify(data),
datatype: "json",
processData: false,
contentType: "application/json;charset=utf-8",
beforeSend: function () {
return $('#wasteForm').form('validate')
return $('#drainForm').form('validate')
},
success: function (data) {
$("#wasteTable").datagrid('reload');
$("#wasteDialog").dialog("close");
$("#drainTable").datagrid('reload');
$("#drainDialog").dialog("close");
},
});
}
function saveNormalWasteRecord() {
var data = $('#normalWasteRecordForm').serializeJSON();
function saveGasEmitRecord() {
var data = $('#gasEmitForm').serializeJSON();
$.ajax({
type: "POST",
url: record_action_url,
@ -177,30 +207,57 @@
processData: false,
contentType: "application/json;charset=utf-8",
beforeSend: function () {
return $('#normalWasteRecordForm').form('validate')
return $('#gasEmitForm').form('validate')
},
success: function (data) {
$("#normalWasteRecordTable").datagrid('reload');
$("#normalWasteRecordDialog").dialog("close");
$("#gasEmitTable").datagrid('reload');
$("#gasEmitDialog").dialog("close");
},
});
}
function delWaste() {
var row = $('#wasteTable').datagrid('getSelected');
function delDrain() {
var row = $('#drainTable').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
var data = { id: row.id }
$.ajax({
type: "POST",
url: '/api/enp/waste/delete/',
url: '/api/enp/drain/delete/',
data: JSON.stringify(data),
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#wasteTable").datagrid('reload');
$("#normalWasteRecordTable").datagrid('reload');
$("#drainTable").datagrid('reload');
// $("#gasEmitTable").datagrid('reload');
}
else {
$.messager.alert('提示', '操作失败!');
}
},
});
}
});
}
else { $.messager.alert('提示', '请选择一条数据!'); }
}
function delGasEmitRecord() {
var row = $('#gasEmitTable').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
var data = { id: row.id }
$.ajax({
type: "POST",
url: '/api/enp/gasemit/delete/',
data: JSON.stringify(data),
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#gasEmitTable").datagrid('reload');
// $("#gasEmitTable").datagrid('reload');
}
else {
$.messager.alert('提示', '操作失败!');

View File

@ -12,7 +12,5 @@ urlpatterns = [
path('abnormal/', views.HtmlAbnormal),
path('detection/', views.HtmlDetection),
path('fuel/', views.HtmlFuel),
path('waterequipment/', views.HtmlWaterequipment),
path('waterequipment/', views.HtmlWaterequipment),
]