Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
|
3a10d48c4d | |
|
9a36033ac3 | |
|
940c85a06d | |
|
81684ffcef | |
|
81910ee3f4 | |
|
a888509aab | |
|
e1ba5ff491 | |
|
bf004376de | |
|
2a0a069d38 | |
|
d6c9ee2580 |
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.2.8 on 2022-10-31 16:13
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('enp', '0027_auto_20220902_1005'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='drain',
|
||||||
|
name='need_predict',
|
||||||
|
field=models.BooleanField(default=True, verbose_name='是否需要预测'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.2.8 on 2022-10-31 17:07
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('enp', '0028_drain_need_predict'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='drain',
|
||||||
|
name='need_predict',
|
||||||
|
field=models.IntegerField(default=1, verbose_name='是否需要预测'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,36 @@
|
||||||
|
# Generated by Django 2.2.8 on 2022-11-01 12:51
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('safesite', '0396_auto_20220304_1648'),
|
||||||
|
('enp', '0029_auto_20221031_1707'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='GasTestEquipment',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
|
||||||
|
('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
|
||||||
|
('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
|
||||||
|
('contaminant', models.CharField(max_length=100, verbose_name='污染物')),
|
||||||
|
('model', models.CharField(max_length=100, verbose_name='仪器型号')),
|
||||||
|
('state', models.CharField(default='正常', max_length=100, verbose_name='设备状态')),
|
||||||
|
('remark', models.CharField(max_length=200, verbose_name='备注')),
|
||||||
|
('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='gastestequipment_create_by', to='safesite.User', verbose_name='创建人')),
|
||||||
|
('drain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='enp.Drain', verbose_name='关联排放口')),
|
||||||
|
('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='gastestequipment_update_by', to='safesite.User', verbose_name='最后编辑人')),
|
||||||
|
('usecomp', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='safesite.Partment', verbose_name='所属公司')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -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='防治类型'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -106,6 +106,7 @@ class Drain(CommonModel):
|
||||||
number = models.CharField('编号', max_length=100,null=True, blank=True)
|
number = models.CharField('编号', max_length=100,null=True, blank=True)
|
||||||
name = models.CharField('名称', max_length=100,null=True, blank=True)
|
name = models.CharField('名称', max_length=100,null=True, blank=True)
|
||||||
location = JSONField('点位坐标', null=True, blank=True)
|
location = JSONField('点位坐标', null=True, blank=True)
|
||||||
|
need_predict = models.IntegerField('是否需要预测', default=1)
|
||||||
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
|
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
|
||||||
|
|
||||||
class GasEmit(CommonModel):
|
class GasEmit(CommonModel):
|
||||||
|
@ -166,7 +167,8 @@ class Prevention(CommonModel):
|
||||||
type_choices = (
|
type_choices = (
|
||||||
(1, '废水'),
|
(1, '废水'),
|
||||||
(2, '废气'),
|
(2, '废气'),
|
||||||
(3, '噪声')
|
(3, '噪声'),
|
||||||
|
(4, '废水治理'),
|
||||||
)
|
)
|
||||||
clfs_choices = (
|
clfs_choices = (
|
||||||
('1', '自行利用'),
|
('1', '自行利用'),
|
||||||
|
@ -265,6 +267,18 @@ class Waterequipment(CommonModel):
|
||||||
jcyqmodel = models.CharField('监测仪器型号', max_length=100, null=True, blank=True)
|
jcyqmodel = models.CharField('监测仪器型号', max_length=100, null=True, blank=True)
|
||||||
note = models.CharField('备注', max_length=500, null=True, blank=True)
|
note = models.CharField('备注', max_length=500, null=True, blank=True)
|
||||||
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
|
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
|
||||||
|
|
||||||
|
class GasTestEquipment(CommonModel):
|
||||||
|
"""
|
||||||
|
废气检测仪器
|
||||||
|
"""
|
||||||
|
drain = models.ForeignKey(Drain, verbose_name='关联排放口', on_delete=models.CASCADE)
|
||||||
|
contaminant = models.CharField('污染物', max_length=100)
|
||||||
|
model = models.CharField('仪器型号', max_length=100)
|
||||||
|
state = models.CharField('设备状态', default='正常', max_length=100)
|
||||||
|
remark = models.CharField('备注', max_length=200)
|
||||||
|
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, verbose_name='所属公司')
|
||||||
|
|
||||||
class Archives(CommonModel):
|
class Archives(CommonModel):
|
||||||
"""
|
"""
|
||||||
档案管理
|
档案管理
|
||||||
|
@ -279,3 +293,4 @@ class Archives(CommonModel):
|
||||||
note = models.CharField('备注', max_length=500, null=True, blank=True)
|
note = models.CharField('备注', max_length=500, null=True, blank=True)
|
||||||
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, null=True, blank=True,verbose_name='所属公司')
|
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, null=True, blank=True,verbose_name='所属公司')
|
||||||
|
|
||||||
|
|
|
@ -331,6 +331,8 @@
|
||||||
function saveArchives(){
|
function saveArchives(){
|
||||||
var data = $('#arechivesForm').serializeJSON();
|
var data = $('#arechivesForm').serializeJSON();
|
||||||
data['filepath'] = document.getElementById('url').innerHTML;
|
data['filepath'] = document.getElementById('url').innerHTML;
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: waste_action_url,
|
url: waste_action_url,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div style="padding: 10px;" id="fulldiv">
|
<div style="padding: 10px;" id="fulldiv">
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$.get('/api/enp/drain/combobox/', function (res) {
|
$.get('/api/enp/drain/combobox/?need_predict=1', function (res) {
|
||||||
for (var i = 0; i < res.length; i++) {
|
for (var i = 0; i < res.length; i++) {
|
||||||
var drain = res[i]
|
var drain = res[i]
|
||||||
var panelId = 'panel' + res[i]['id']
|
var panelId = 'panel' + res[i]['id']
|
||||||
|
@ -11,17 +11,17 @@
|
||||||
height: 360,
|
height: 360,
|
||||||
title: panelTitle,
|
title: panelTitle,
|
||||||
});
|
});
|
||||||
var div1 = panelId + 'out_smoke';
|
// var div1 = panelId + 'out_smoke';
|
||||||
var div2 = panelId + 'out_so2';
|
var div2 = panelId + 'out_so2';
|
||||||
var div3 = panelId + 'out_particle';
|
var div3 = panelId + 'out_particle';
|
||||||
var div4 = panelId + 'out_nox';
|
var div4 = panelId + 'out_nox';
|
||||||
$('#' + panelId).append(
|
$('#' + panelId).append(
|
||||||
'<div style="float:left;width:25%;height:100%" id="' + div1 + '"></div>' +
|
// '<div style="float:left;width:25%;height:100%" id="' + div1 + '"></div>' +
|
||||||
'<div style="float:left;width:25%;height:100%" id="' + div2 + '"></div>' +
|
'<div style="float:left;width:33%;height:100%" id="' + div2 + '"></div>' +
|
||||||
'<div style="float:left;width:25%;height:100%" id="' + div3 + '"></div>' +
|
'<div style="float:left;width:33%;height:100%" id="' + div3 + '"></div>' +
|
||||||
'<div style="float:left;width:25%;height:100%" id="' + div4 + '"></div>'
|
'<div style="float:left;width:33%;height:100%" id="' + div4 + '"></div>'
|
||||||
)
|
)
|
||||||
initMap(div1, 'out_smoke', res[i]['id'], '标态干烟气量', 'Nm3/h');
|
// initMap(div1, 'out_smoke', res[i]['id'], '标态干烟气量', 'Nm3/h');
|
||||||
initMap(div2, 'out_so2', res[i]['id'], '二氧化硫', 'mg/m3');
|
initMap(div2, 'out_so2', res[i]['id'], '二氧化硫', 'mg/m3');
|
||||||
initMap(div3, 'out_particle', res[i]['id'], '颗粒物', 'mg/m3');
|
initMap(div3, 'out_particle', res[i]['id'], '颗粒物', 'mg/m3');
|
||||||
initMap(div4, 'out_nox', res[i]['id'], '氮氧化物', 'mg/m3');
|
initMap(div4, 'out_nox', res[i]['id'], '氮氧化物', 'mg/m3');
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
option.series[0].data = ydata
|
option.series[0].data = ydata
|
||||||
option.series[0].markArea.data = [ [{
|
option.series[0].markArea.data = [ [{
|
||||||
name: '预测区',
|
name: '预测区',
|
||||||
xAxis: leng-3
|
xAxis: leng-2
|
||||||
}, {
|
}, {
|
||||||
xAxis: leng-1
|
xAxis: leng-1
|
||||||
}] ]
|
}] ]
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
}, {
|
}, {
|
||||||
gt: leng-3,
|
gt: leng-3,
|
||||||
lte: leng-2,
|
lte: leng-2,
|
||||||
color: 'red'
|
color: 'green'
|
||||||
}, {
|
}, {
|
||||||
gt: leng-2,
|
gt: leng-2,
|
||||||
color: 'red'
|
color: 'red'
|
||||||
|
|
|
@ -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>
|
|
@ -0,0 +1,138 @@
|
||||||
|
<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>
|
|
@ -29,63 +29,73 @@
|
||||||
<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>
|
required></input>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="margin-bottom:10px">
|
||||||
|
<select class="easyui-combobox" name="need_predict" label="是否预测" style="width:300px;">
|
||||||
|
<option value=1>是</option>
|
||||||
|
<option value=0>否</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="saveDrain()">保存</a>
|
<a class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="saveDrain()">保存</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="gasEmitDialog" class="easyui-dialog" style="width:400px;height:800px;padding:5px 15px;"
|
<div id="gasEmitDialog" class="easyui-dialog" style="width:700px;height:500px;padding:5px 15px;"
|
||||||
data-options="resizable:true,modal:true,closed:true,border:false">
|
data-options="resizable:true,modal:true,closed:true,border:false">
|
||||||
<form method="post" id="gasEmitForm">
|
<form method="post" id="gasEmitForm">
|
||||||
<input name="id" type="hidden">
|
<input name="id" type="hidden">
|
||||||
<input name="drain" type="hidden" id="gasEmitForm_drain">
|
<input name="drain" type="hidden" id="gasEmitForm_drain">
|
||||||
<div style="margin-bottom:10px">
|
<div style="margin-bottom:10px">
|
||||||
<input name="watch_time" data-options="label:'监测时间', editable:false, labelWidth:120" class="easyui-datetimebox" style="width:300px;" ></input>
|
<input name="watch_time" data-options="label:'监测时间', editable:false, labelWidth:120" class="easyui-datetimebox" style="width:300px;float:left" ></input>
|
||||||
|
|
||||||
|
<input name="out_smoke" data-options="label:'出:标态干烟气量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:right" ></input>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:10px">
|
<div style="margin-bottom:10px">
|
||||||
<input name="out_smoke" data-options="label:'出:标态干烟气量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" ></input>
|
<input name="out_o2" data-options="label:'出:氧含量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:left" ></input>
|
||||||
|
|
||||||
|
<input name="out_so2" data-options="label:'出:二氧化硫', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:right" ></input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-bottom:10px">
|
<div style="margin-bottom:10px">
|
||||||
<input name="out_o2" data-options="label:'出:氧含量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" ></input>
|
<input name="out_so2_s" data-options="label:'出:二氧化硫:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:left" ></input>
|
||||||
|
|
||||||
|
<input name="out_particle" data-options="label:'出:颗粒物', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:right" ></input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div style="margin-bottom:10px">
|
<div style="margin-bottom:10px">
|
||||||
<input name="out_so2" data-options="label:'出:二氧化硫', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" ></input>
|
<input name="out_particle_s" data-options="label:'出:颗粒物:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:left" ></input>
|
||||||
|
|
||||||
|
<input name="out_nox" data-options="label:'出:氮氧化物', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:right" ></input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div style="margin-bottom:10px">
|
<div style="margin-bottom:10px">
|
||||||
<input name="out_so2_s" data-options="label:'出:二氧化硫:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" ></input>
|
<input name="out_nox_s" data-options="label:'出:氮氧化物:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:left" ></input>
|
||||||
|
|
||||||
|
<input name="in_smoke" data-options="label:'入:标态干烟气量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:right" ></input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div style="margin-bottom:10px">
|
<div style="margin-bottom:10px">
|
||||||
<input name="out_particle" data-options="label:'出:颗粒物', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" ></input>
|
<input name="in_o2" data-options="label:'入:氧含量', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:left" ></input>
|
||||||
|
|
||||||
|
<input name="in_so2" data-options="label:'入:二氧化硫', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:right" ></input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div style="margin-bottom:10px">
|
<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;" ></input>
|
<input name="in_so2_s" data-options="label:'入:二氧化硫:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:left" ></input>
|
||||||
|
|
||||||
|
<input name="in_particle" data-options="label:'入:颗粒物', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:right" ></input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div style="margin-bottom:10px">
|
<div style="margin-bottom:10px">
|
||||||
<input name="out_nox" data-options="label:'出:氮氧化物', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" ></input>
|
<input name="in_particle_s" data-options="label:'入:颗粒物:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;float:left" ></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;float:right" ></input>
|
||||||
<input name="out_nox_s" data-options="label:'出:氮氧化物:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" ></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;" ></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;" ></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;" ></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;" ></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;" ></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;" ></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;" ></input>
|
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:10px">
|
<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;" ></input>
|
<input name="in_nox_s" data-options="label:'入:氮氧化物:折标', labelWidth:120, min:0,precision:2" class="easyui-numberbox" style="width:300px;" ></input>
|
||||||
|
@ -117,6 +127,7 @@
|
||||||
{ field: 'id', title: 'ID', hidden: true },
|
{ field: 'id', title: 'ID', hidden: true },
|
||||||
{ field: 'number', title: '排放口编号', width: 100 },
|
{ field: 'number', title: '排放口编号', width: 100 },
|
||||||
{ field: 'name', title: '排放口名称', width: 100 },
|
{ field: 'name', title: '排放口名称', width: 100 },
|
||||||
|
{ field: 'need_predict', title: '是否预测', width: 80 },
|
||||||
]],
|
]],
|
||||||
onClickRow: function (index, row) {
|
onClickRow: function (index, row) {
|
||||||
$('#gasEmitTable').datagrid({
|
$('#gasEmitTable').datagrid({
|
||||||
|
@ -170,7 +181,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
function editDrain(){
|
function editDrain(){
|
||||||
var row = $('#draineTable').datagrid('getSelected');
|
var row = $('#drainTable').datagrid('getSelected');
|
||||||
if(row){
|
if(row){
|
||||||
$('#drainDialog').dialog('open').dialog('setTitle', '编辑排放口').window('center');
|
$('#drainDialog').dialog('open').dialog('setTitle', '编辑排放口').window('center');
|
||||||
$('#drainForm').form('load', row);
|
$('#drainForm').form('load', row);
|
||||||
|
|
|
@ -13,8 +13,11 @@ urlpatterns = [
|
||||||
path('detection/', views.HtmlDetection),
|
path('detection/', views.HtmlDetection),
|
||||||
path('fuel/', views.HtmlFuel),
|
path('fuel/', views.HtmlFuel),
|
||||||
path('waterequipment/', views.HtmlWaterequipment),
|
path('waterequipment/', views.HtmlWaterequipment),
|
||||||
|
path('gastestequipment/', views.HtmlGasTestEquipment),
|
||||||
path('archives/', views.HtmlArchives),
|
path('archives/', views.HtmlArchives),
|
||||||
path('zprevention/', views.HtmlZprevention),
|
path('zprevention/', views.HtmlZprevention),
|
||||||
|
path('gastequipment/', views.Htmlgastequipment),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
|
@ -17,15 +17,13 @@ urlpatterns = [
|
||||||
path('facilities/<str:action>/', views.ApiFacilities),#环境设施,生产设施
|
path('facilities/<str:action>/', views.ApiFacilities),#环境设施,生产设施
|
||||||
path('wprevention/<str:action>/', views.ApiWprevention),#废水防治设施
|
path('wprevention/<str:action>/', views.ApiWprevention),#废水防治设施
|
||||||
path('gprevention/<str:action>/', views.ApiGprevention),#废水防治设施
|
path('gprevention/<str:action>/', views.ApiGprevention),#废水防治设施
|
||||||
|
path('wtequipment/<str:action>/', views.ApiWpreventionequipment),#废气治理设备
|
||||||
path('abnormal/<str:action>/', views.ApiAbnormal),#防治设施异常
|
path('abnormal/<str:action>/', views.ApiAbnormal),#防治设施异常
|
||||||
path('detection/<str:action>/', views.ApiDetection),#废水污染物检测
|
path('detection/<str:action>/', views.ApiDetection),#废水污染物检测
|
||||||
path('fuel/<str:action>/', views.ApiFuel),#燃料信息表
|
path('fuel/<str:action>/', views.ApiFuel),#燃料信息表
|
||||||
path('waterequipment/<str:action>/', views.ApiWaterequipment),#废水监测仪器信息表
|
path('waterequipment/<str:action>/', views.ApiWaterequipment),#废水监测仪器信息表
|
||||||
|
path('gastestequipment/<str:action>/', views.ApiGasTestEquipment),#废气监测仪器信息表
|
||||||
path('archives/<str:action>/', views.ApiArchives),#档案管理表
|
path('archives/<str:action>/', views.ApiArchives),#档案管理表
|
||||||
path('zprevention/<str:action>/', views.ApiZprevention),#噪声防治设施
|
path('zprevention/<str:action>/', views.ApiZprevention),#噪声防治设施
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
136
enp/views.py
136
enp/views.py
|
@ -5,7 +5,7 @@ from rest_framework.views import APIView
|
||||||
from rest_framework.authentication import BaseAuthentication
|
from rest_framework.authentication import BaseAuthentication
|
||||||
from safesite.models import User,Dickey,Partment
|
from safesite.models import User,Dickey,Partment
|
||||||
from rest_framework.exceptions import AuthenticationFailed
|
from rest_framework.exceptions import AuthenticationFailed
|
||||||
from .models import DWasteHandleRecord, DWasteKeepRecord, DWasteMakeList, DWasteMakeRecord, Drain, GasEmit, NormalWasteRecord, Waste, Facilities,Prevention,abnormal,Detection,Fuel,Waterequipment,Archives
|
from .models import DWasteHandleRecord, DWasteKeepRecord, DWasteMakeList, DWasteMakeRecord, Drain, GasEmit, GasTestEquipment, NormalWasteRecord, Waste, Facilities,Prevention,abnormal,Detection,Fuel,Waterequipment,Archives
|
||||||
from safesite.views import transjson, fenye, MyEncoder
|
from safesite.views import transjson, fenye, MyEncoder
|
||||||
from django.http import HttpResponse, JsonResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
import json
|
import json
|
||||||
|
@ -44,12 +44,18 @@ def HtmlFuel(request):
|
||||||
return render(request, 'fuel.html')
|
return render(request, 'fuel.html')
|
||||||
def HtmlWaterequipment(request):
|
def HtmlWaterequipment(request):
|
||||||
return render(request, 'waterequipment.html')
|
return render(request, 'waterequipment.html')
|
||||||
|
def HtmlGasTestEquipment(request):
|
||||||
|
return render(request, 'gastestequipment.html')
|
||||||
def HtmlGprevention(request):
|
def HtmlGprevention(request):
|
||||||
return render(request, 'gprevention.html')
|
return render(request, 'gprevention.html')
|
||||||
def HtmlArchives(request):
|
def HtmlArchives(request):
|
||||||
return render(request, 'archives.html')
|
return render(request, 'archives.html')
|
||||||
def HtmlZprevention(request):
|
def HtmlZprevention(request):
|
||||||
return render(request, 'zprevention.html')
|
return render(request, 'zprevention.html')
|
||||||
|
|
||||||
|
def Htmlgastequipment(request):
|
||||||
|
return render(request, 'gastequipment.html')
|
||||||
|
|
||||||
# 转换为combobox所用string
|
# 转换为combobox所用string
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,6 +302,9 @@ def ApiGprevention(request, action):
|
||||||
obj = Prevention.objects.get(id=data['id'])
|
obj = Prevention.objects.get(id=data['id'])
|
||||||
obj.delete()
|
obj.delete()
|
||||||
return JsonResponse({"code":1})
|
return JsonResponse({"code":1})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#废水防治设施
|
#废水防治设施
|
||||||
def ApiWprevention(request, action):
|
def ApiWprevention(request, action):
|
||||||
user = User.objects.get(userid=request.session['userid'])
|
user = User.objects.get(userid=request.session['userid'])
|
||||||
|
@ -370,6 +379,80 @@ def ApiWprevention(request, action):
|
||||||
obj = Prevention.objects.get(id=data['id'])
|
obj = Prevention.objects.get(id=data['id'])
|
||||||
obj.delete()
|
obj.delete()
|
||||||
return JsonResponse({"code":1})
|
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):
|
def ApiAbnormal(request, action):
|
||||||
user = User.objects.get(userid=request.session['userid'])
|
user = User.objects.get(userid=request.session['userid'])
|
||||||
|
@ -757,11 +840,14 @@ def ApiDrainq(request, action):
|
||||||
objs = Drain.objects.filter(usecomp=user.usecomp, is_deleted=False,type=20)
|
objs = Drain.objects.filter(usecomp=user.usecomp, is_deleted=False,type=20)
|
||||||
total = objs.count()
|
total = objs.count()
|
||||||
startnum, endnum = fenye(request)
|
startnum, endnum = fenye(request)
|
||||||
objs = objs.order_by('id')[startnum:endnum].values('id', 'number', 'name')
|
objs = objs.order_by('id')[startnum:endnum].values('id', 'number', 'name', 'need_predict')
|
||||||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||||
elif action == 'combobox':
|
elif action == 'combobox':
|
||||||
objs = Drain.objects.filter(usecomp=user.usecomp, is_deleted=False).order_by('id')
|
objs = Drain.objects.filter(usecomp=user.usecomp, is_deleted=False, type=20).order_by('id')
|
||||||
data = objs.values('id', 'number', 'name')
|
need_predict = request.GET.get('need_predict', False)
|
||||||
|
if need_predict:
|
||||||
|
objs = objs.filter(need_predict=need_predict)
|
||||||
|
data = objs.values('id', 'number', 'name', 'need_predict')
|
||||||
return JsonResponse(list(data), safe=False)
|
return JsonResponse(list(data), safe=False)
|
||||||
elif action == 'create':
|
elif action == 'create':
|
||||||
data = json.loads(request.body.decode('utf-8'))
|
data = json.loads(request.body.decode('utf-8'))
|
||||||
|
@ -769,6 +855,7 @@ def ApiDrainq(request, action):
|
||||||
obj.number = data['number']
|
obj.number = data['number']
|
||||||
obj.type = 20
|
obj.type = 20
|
||||||
obj.name = data['name']
|
obj.name = data['name']
|
||||||
|
obj.need_predict = data['need_predict']
|
||||||
obj.create_by = user
|
obj.create_by = user
|
||||||
obj.update_by = user
|
obj.update_by = user
|
||||||
obj.usecomp = user.usecomp
|
obj.usecomp = user.usecomp
|
||||||
|
@ -785,6 +872,7 @@ def ApiDrainq(request, action):
|
||||||
obj.number = data['number']
|
obj.number = data['number']
|
||||||
obj.type = 20
|
obj.type = 20
|
||||||
obj.name = data['name']
|
obj.name = data['name']
|
||||||
|
obj.need_predict = data['need_predict']
|
||||||
obj.update_by=user
|
obj.update_by=user
|
||||||
obj.save()
|
obj.save()
|
||||||
return JsonResponse({"code":1})
|
return JsonResponse({"code":1})
|
||||||
|
@ -964,10 +1052,48 @@ def ApiGasPredict(request, element, drainId):
|
||||||
.order_by('-create_time')[0:5].values_list(element, flat=True))
|
.order_by('-create_time')[0:5].values_list(element, flat=True))
|
||||||
element_list.reverse()
|
element_list.reverse()
|
||||||
if len(element_list)>=3:
|
if len(element_list)>=3:
|
||||||
result = GM11(np.array(element_list), 3)
|
result = GM11(np.array(element_list), 1)
|
||||||
element_list.extend(result['predict']['value'])
|
element_list.extend(result['predict']['value'])
|
||||||
ret = {"code":1, "data":[round(i,2) for i in element_list]}
|
ret = {"code":1, "data":[round(i,2) for i in element_list]}
|
||||||
return JsonResponse(ret)
|
return JsonResponse(ret)
|
||||||
else:
|
else:
|
||||||
return JsonResponse({"code":0, "msg":'至少需要三条记录'})
|
return JsonResponse({"code":0, "msg":'至少需要三条记录'})
|
||||||
|
|
||||||
|
|
||||||
|
def ApiGasTestEquipment(request, action):
|
||||||
|
user = User.objects.get(userid=request.session['userid'])
|
||||||
|
if action == 'list':
|
||||||
|
objs = GasTestEquipment.objects.filter(usecomp=user.usecomp, is_deleted=False)
|
||||||
|
total = objs.count()
|
||||||
|
startnum, endnum = fenye(request)
|
||||||
|
objs = objs.order_by('id')[startnum:endnum].values('id', 'drain', 'drain__name', 'contaminant', 'model', 'state', 'remark')
|
||||||
|
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||||
|
elif action == 'create':
|
||||||
|
data = json.loads(request.body.decode('utf-8'))
|
||||||
|
obj= GasTestEquipment()
|
||||||
|
obj.drain = Drain.objects.get(id=data['drain'])
|
||||||
|
obj.contaminant = data['contaminant']
|
||||||
|
obj.model = data['model']
|
||||||
|
obj.state = data['state']
|
||||||
|
obj.remark = data['remark']
|
||||||
|
obj.create_by = user
|
||||||
|
obj.update_by = user
|
||||||
|
obj.usecomp = user.usecomp
|
||||||
|
obj.save()
|
||||||
|
return JsonResponse({"code":1})
|
||||||
|
elif action == 'delete':
|
||||||
|
data = json.loads(request.body.decode('utf-8'))
|
||||||
|
obj = GasTestEquipment.objects.get(id=data['id'])
|
||||||
|
obj.delete()
|
||||||
|
return JsonResponse({"code":1})
|
||||||
|
elif action == 'update':
|
||||||
|
data = json.loads(request.body.decode('utf-8'))
|
||||||
|
obj = GasTestEquipment.objects.get(id=data['id'])
|
||||||
|
obj.contaminant = data['contaminant']
|
||||||
|
obj.model = data['model']
|
||||||
|
obj.state = data['state']
|
||||||
|
obj.remark = data['remark']
|
||||||
|
obj.update_by=user
|
||||||
|
obj.save()
|
||||||
|
return JsonResponse({"code":1})
|
||||||
|
|
|
@ -233,7 +233,7 @@ desired effect
|
||||||
<footer class="main-footer">
|
<footer class="main-footer">
|
||||||
<!-- To the right -->
|
<!-- To the right -->
|
||||||
<div class="pull-right hidden-xs">
|
<div class="pull-right hidden-xs">
|
||||||
企业安全生产管理系统集团后台
|
企业环保管理系统集团后台
|
||||||
</div>
|
</div>
|
||||||
<!-- Default to the left -->
|
<!-- Default to the left -->
|
||||||
<strong>Copyright © 2019 <a href="https://ctc.ac.cn">国检集团</a>.</strong> 版权所有.
|
<strong>Copyright © 2019 <a href="https://ctc.ac.cn">国检集团</a>.</strong> 版权所有.
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- /.login-logo -->
|
<!-- /.login-logo -->
|
||||||
<div class="login-box-body">
|
<div class="login-box-body">
|
||||||
<p class="login-box-msg">企业安全生产管理系统</p>
|
<p class="login-box-msg">企业环保管理系统</p>
|
||||||
|
|
||||||
<form action="{% url 'groups_login' %}" method="post">
|
<form action="{% url 'groups_login' %}" method="post">
|
||||||
{% if groups_form.captcha.errors %}
|
{% if groups_form.captcha.errors %}
|
||||||
|
|
Binary file not shown.
|
@ -37,7 +37,7 @@ ul { margin: 0; padding: 0;}
|
||||||
*zoom: 1;
|
*zoom: 1;
|
||||||
}
|
}
|
||||||
header{width:100%; height: 90px; background: url(../../images/bigdata/bg_top.png) center no-repeat ; text-align: center; font-size: 36px; color: #00f6ff; line-height: 90px; margin: 0 auto;}
|
header{width:100%; height: 90px; background: url(../../images/bigdata/bg_top.png) center no-repeat ; text-align: center; font-size: 36px; color: #00f6ff; line-height: 90px; margin: 0 auto;}
|
||||||
#content{width: 1860px; height: 100%; margin: 20px auto 0 auto;}
|
#content{width: 1460px; height: 100%; margin: 20px auto 0 auto;}
|
||||||
#content .content_left{width: 385px; height: 100%; float: left;}
|
#content .content_left{width: 385px; height: 100%; float: left;}
|
||||||
.content_left .dtuplc{width: 355px; height: 180px; padding: 15px 15px 0 15px; background: url(../../images/bigdata/zuoyi.png) top no-repeat;}
|
.content_left .dtuplc{width: 355px; height: 180px; padding: 15px 15px 0 15px; background: url(../../images/bigdata/zuoyi.png) top no-repeat;}
|
||||||
.dtu{width: 177px; height: 180px; float: left;}
|
.dtu{width: 177px; height: 180px; float: left;}
|
||||||
|
|
|
@ -1466,7 +1466,7 @@ function bindmap9(x) {
|
||||||
myChart9 = echarts.init(document.getElementById(x));
|
myChart9 = echarts.init(document.getElementById(x));
|
||||||
myChart9.setOption(option = {
|
myChart9.setOption(option = {
|
||||||
legend: {
|
legend: {
|
||||||
data: ['隐患', '培训', '演练', '观察', '事件']
|
data: ['隐患', '培训', '演练']
|
||||||
},
|
},
|
||||||
toolbox: {
|
toolbox: {
|
||||||
show: true,
|
show: true,
|
||||||
|
@ -1516,17 +1516,7 @@ function bindmap9(x) {
|
||||||
name: '演练',
|
name: '演练',
|
||||||
type:'bar',
|
type:'bar',
|
||||||
data: data.演练
|
data: data.演练
|
||||||
},
|
}
|
||||||
{
|
|
||||||
name: '观察',
|
|
||||||
type:'bar',
|
|
||||||
data: data.观察
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '事件',
|
|
||||||
type:'bar',
|
|
||||||
data: data.事件
|
|
||||||
},
|
|
||||||
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -596,49 +596,49 @@ function jsonSort(jsonObj) {
|
||||||
function mapupdate() {
|
function mapupdate() {
|
||||||
if ($('#mapshowinput').length) {
|
if ($('#mapshowinput').length) {
|
||||||
source.clear()
|
source.clear()
|
||||||
$.get('/api/mapshow?a=risk', function (res) {
|
// $.get('/api/mapshow?a=risk', function (res) {
|
||||||
for (let i = 0, len = res.length; i < len; i++) {
|
// for (let i = 0, len = res.length; i < len; i++) {
|
||||||
setPolygon(res[i])
|
// setPolygon(res[i])
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
$.get('/api/mapshow?a=trouble', function (res) {
|
// $.get('/api/mapshow?a=trouble', function (res) {
|
||||||
|
|
||||||
for (let i = 0, len = res.length; i < len; i++) {
|
// for (let i = 0, len = res.length; i < len; i++) {
|
||||||
var data = res[i]
|
// var data = res[i]
|
||||||
data.id = data.yhqy__id
|
// data.id = data.yhqy__id
|
||||||
data.num = data.num
|
// data.num = data.num
|
||||||
data.polygon = data.yhqy__polygon
|
// data.polygon = data.yhqy__polygon
|
||||||
data.name = data.yhqy__name
|
// data.name = data.yhqy__name
|
||||||
data.type = 'yh'
|
// data.type = 'yh'
|
||||||
setPoint(data)
|
// setPoint(data)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
$.get('/api/mapshow?a=miss', function (res) {
|
// $.get('/api/mapshow?a=miss', function (res) {
|
||||||
for (let i = 0, len = res.length; i < len; i++) {
|
// for (let i = 0, len = res.length; i < len; i++) {
|
||||||
var data = res[i]
|
// var data = res[i]
|
||||||
data.id = data.missqy__id
|
// data.id = data.missqy__id
|
||||||
data.num = data.num
|
// data.num = data.num
|
||||||
data.polygon = data.missqy__polygon
|
// data.polygon = data.missqy__polygon
|
||||||
data.name = data.missqy__name
|
// data.name = data.missqy__name
|
||||||
data.type = 'ws'
|
// data.type = 'ws'
|
||||||
setPoint(data)
|
// setPoint(data)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
$.get('/api/mapshow?a=operation', function (res) {
|
// $.get('/api/mapshow?a=operation', function (res) {
|
||||||
for (let i = 0, len = res.length; i < len; i++) {
|
// for (let i = 0, len = res.length; i < len; i++) {
|
||||||
var data = res[i]
|
// var data = res[i]
|
||||||
data.id = data.zyqy__id
|
// data.id = data.zyqy__id
|
||||||
data.num = data.num
|
// data.num = data.num
|
||||||
data.polygon = data.zyqy__polygon
|
// data.polygon = data.zyqy__polygon
|
||||||
data.name = data.zyqy__name
|
// data.name = data.zyqy__name
|
||||||
data.type = 'zy'
|
// data.type = 'zy'
|
||||||
data.list = data.zylist
|
// data.list = data.zylist
|
||||||
setPoint(data)
|
// setPoint(data)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
//监测地图,排口获取
|
//监测地图,排口获取
|
||||||
$.get('/api/enp/draindt/allmap', function (res) {
|
$.get('/api/enp/draindt/allmap', function (res) {
|
||||||
console.log(res);
|
console.log(res)
|
||||||
for (let i = 0; i < res.length; i++) {
|
for (let i = 0; i < res.length; i++) {
|
||||||
|
|
||||||
var data = res[i]
|
var data = res[i]
|
||||||
|
@ -646,8 +646,8 @@ function mapupdate() {
|
||||||
data.number = data.number
|
data.number = data.number
|
||||||
data.location = data.location
|
data.location = data.location
|
||||||
data.name = data.name
|
data.name = data.name
|
||||||
data.type = 'pk'
|
data.type2 = 'pk'
|
||||||
setPoint(data)
|
setPointOnly(data)
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,44 +13,77 @@ from django.db.models import Sum
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from .safespider import getTzzs, getAqzs
|
from .safespider import getTzzs, getAqzs
|
||||||
import time
|
import time
|
||||||
dirname = settings.BASE_DIR +'/safesite/'
|
|
||||||
|
dirname = settings.BASE_DIR + "/safesite/"
|
||||||
|
|
||||||
|
|
||||||
def getcs(companyid): # 获取公司相关参数设置
|
def getcs(companyid): # 获取公司相关参数设置
|
||||||
return Yjsetup.objects.filter(usecomp__partid=companyid).values()[0]
|
return Yjsetup.objects.filter(usecomp__partid=companyid).values()[0]
|
||||||
|
|
||||||
|
|
||||||
def gettime(x=datetime.datetime.now()):
|
def gettime(x=datetime.datetime.now()):
|
||||||
|
if x:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
x = datetime.datetime.now()
|
||||||
days_num = calendar.monthrange(x.year, x.month)[1]
|
days_num = calendar.monthrange(x.year, x.month)[1]
|
||||||
first_day = datetime.date(x.year, x.month, 1)
|
first_day = datetime.date(x.year, x.month, 1)
|
||||||
first_day_of_next_month = first_day + datetime.timedelta(days=days_num)
|
first_day_of_next_month = first_day + datetime.timedelta(days=days_num)
|
||||||
return first_day, first_day_of_next_month
|
return first_day, first_day_of_next_month
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def send_wechatmsgs(postdict, tolist):
|
def send_wechatmsgs(postdict, tolist):
|
||||||
with open(dirname + 'token.txt','r',encoding= 'utf-8') as f:
|
with open(dirname + "token.txt", "r", encoding="utf-8") as f:
|
||||||
token = f.read()
|
token = f.read()
|
||||||
try:
|
try:
|
||||||
for i in tolist:
|
for i in tolist:
|
||||||
postdict['touser']=i
|
postdict["touser"] = i
|
||||||
requests.post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token='+token,data=json.dumps(postdict))
|
requests.post(
|
||||||
|
"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="
|
||||||
|
+ token,
|
||||||
|
data=json.dumps(postdict),
|
||||||
|
)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def recal_yjjs(year, month):
|
||||||
|
cal_time = datetime.datetime(year, month, 1)
|
||||||
|
companys = Partment.objects.filter(iscompany=1).order_by("-creattime")
|
||||||
|
for i in companys:
|
||||||
|
yjjs(i.partid, cal_time)
|
||||||
|
yjjs_gc(i.partid, cal_time)
|
||||||
|
yjjs_px(i.partid, cal_time)
|
||||||
|
yjjs_ws(i.partid, cal_time)
|
||||||
|
yjjs_yl(i.partid, cal_time)
|
||||||
|
ycjs(year, month)
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def send_wechatmsg(postdict):
|
def send_wechatmsg(postdict):
|
||||||
with open(dirname + 'token.txt','r',encoding= 'utf-8') as f:
|
with open(dirname + "token.txt", "r", encoding="utf-8") as f:
|
||||||
token = f.read()
|
token = f.read()
|
||||||
try:
|
try:
|
||||||
v = requests.post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token='+token,data=json.dumps(postdict))
|
v = requests.post(
|
||||||
|
"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="
|
||||||
|
+ token,
|
||||||
|
data=json.dumps(postdict),
|
||||||
|
)
|
||||||
print(v.text())
|
print(v.text())
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def yjjs(companyid):
|
def yjjs(companyid, cal_time=None):
|
||||||
first_day,first_day_of_next_month = gettime()
|
first_day, first_day_of_next_month = gettime(cal_time)
|
||||||
# 隐患算分
|
# 隐患算分
|
||||||
a = Trouble.objects.filter(fxsj__range=(first_day, first_day_of_next_month),usecomp__partid=companyid,deletemark=1)
|
a = Trouble.objects.filter(
|
||||||
|
fxsj__range=(first_day, first_day_of_next_month),
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
deletemark=1,
|
||||||
|
)
|
||||||
# 隐患按时上报率
|
# 隐患按时上报率
|
||||||
if a.count() == 0:
|
if a.count() == 0:
|
||||||
sbjs = 1
|
sbjs = 1
|
||||||
|
@ -77,26 +110,58 @@ def yjjs(companyid):
|
||||||
yhqs = a.filter(yhpg__dickeyid=51).count()
|
yhqs = a.filter(yhpg__dickeyid=51).count()
|
||||||
yhqws = a.filter(yhpg__dickeyid=50).count()
|
yhqws = a.filter(yhpg__dickeyid=50).count()
|
||||||
yhwsh = a.filter(yhpg__dickeyid=49).count()
|
yhwsh = a.filter(yhpg__dickeyid=49).count()
|
||||||
score = (((yhsw*1 + yhzs*0.6 + yhqs*0.3+ yhqws*0.2 + yhwsh*0.1)/cs['monthyhavg'] )* cs['yhpgqz']+ #隐患评估
|
score = (
|
||||||
(a.filter(yhdj__dickeyid=55).count()*0.3+a.filter(yhdj__dickeyid=56).count()*1)* cs['yhdjqz']+ #隐患等级
|
(
|
||||||
sbjs*cs['yhsblqz']+ #隐患上报率
|
(yhsw * 1 + yhzs * 0.6 + yhqs * 0.3 + yhqws * 0.2 + yhwsh * 0.1)
|
||||||
zgjs*cs['yhzglqz']) #隐患整改率
|
/ cs["monthyhavg"]
|
||||||
|
)
|
||||||
|
* cs["yhpgqz"] # 隐患评估
|
||||||
|
+ (
|
||||||
|
a.filter(yhdj__dickeyid=55).count() * 0.3
|
||||||
|
+ a.filter(yhdj__dickeyid=56).count() * 1
|
||||||
|
)
|
||||||
|
* cs["yhdjqz"] # 隐患等级
|
||||||
|
+ sbjs * cs["yhsblqz"] # 隐患上报率
|
||||||
|
+ zgjs * cs["yhzglqz"]
|
||||||
|
) # 隐患整改率
|
||||||
# print(score)
|
# print(score)
|
||||||
year = first_day.year
|
year = first_day.year
|
||||||
month = first_day.month
|
month = first_day.month
|
||||||
obj,created = Yjyc.objects.get_or_create(usecomp__partid=companyid,year=year,month=month,defaults={'usecomp':Partment.objects.get(partid=companyid) ,'year':year,'month':month})
|
obj, created = Yjyc.objects.get_or_create(
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
year=year,
|
||||||
|
month=month,
|
||||||
|
defaults={
|
||||||
|
"usecomp": Partment.objects.get(partid=companyid),
|
||||||
|
"year": year,
|
||||||
|
"month": month,
|
||||||
|
},
|
||||||
|
)
|
||||||
obj.troublevalue = score
|
obj.troublevalue = score
|
||||||
obj.yjz = round(obj.troublevalue + obj.trainvalue + obj.drillvalue + obj.missvalue + obj.observevalue,2)
|
obj.yjz = round(
|
||||||
|
obj.troublevalue
|
||||||
|
+ obj.trainvalue
|
||||||
|
+ obj.drillvalue
|
||||||
|
+ obj.missvalue
|
||||||
|
+ obj.observevalue,
|
||||||
|
2,
|
||||||
|
)
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def yjjs_px(companyid):
|
def yjjs_px(companyid, cal_time=None):
|
||||||
first_day,first_day_of_next_month = gettime()
|
first_day, first_day_of_next_month = gettime(cal_time)
|
||||||
# 培训算分
|
# 培训算分
|
||||||
a = Train.objects.filter(starttime__range=(first_day, first_day_of_next_month),usecomp__partid=companyid,state=1,deletemark=1) #有效培训
|
a = Train.objects.filter(
|
||||||
|
starttime__range=(first_day, first_day_of_next_month),
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
state=1,
|
||||||
|
deletemark=1,
|
||||||
|
) # 有效培训
|
||||||
# 计算培训效果
|
# 计算培训效果
|
||||||
participantnum = Trainuser.objects.filter(train__in=a).count()
|
participantnum = Trainuser.objects.filter(train__in=a).count()
|
||||||
knownum = a.aggregate(knownum = Sum('knownum'))['knownum']
|
knownum = a.aggregate(knownum=Sum("knownum"))["knownum"]
|
||||||
if participantnum != 0:
|
if participantnum != 0:
|
||||||
x = knownum / participantnum
|
x = knownum / participantnum
|
||||||
else:
|
else:
|
||||||
|
@ -111,20 +176,45 @@ def yjjs_px(companyid):
|
||||||
pxxg = 0.1
|
pxxg = 0.1
|
||||||
# 培训等级
|
# 培训等级
|
||||||
cs = getcs(companyid)
|
cs = getcs(companyid)
|
||||||
score = ((a.filter(trainlevel__dicid=5).count()*0.5 + a.filter(trainlevel__dicid=6).count()*0.8 + a.filter(trainlevel__dicid=7).count()*0.5+ a.filter(trainlevel__dicid=42).count()*0.5)*cs['pxdjqz'] +
|
score = (
|
||||||
pxxg*cs['pxxgqz'] ) #培训效果
|
a.filter(trainlevel__dicid=5).count() * 0.5
|
||||||
|
+ a.filter(trainlevel__dicid=6).count() * 0.8
|
||||||
|
+ a.filter(trainlevel__dicid=7).count() * 0.5
|
||||||
|
+ a.filter(trainlevel__dicid=42).count() * 0.5
|
||||||
|
) * cs["pxdjqz"] + pxxg * cs["pxxgqz"] # 培训效果
|
||||||
year = first_day.year
|
year = first_day.year
|
||||||
month = first_day.month
|
month = first_day.month
|
||||||
obj,created = Yjyc.objects.get_or_create(usecomp__partid=companyid,year=year,month=month,defaults={'usecomp':Partment.objects.get(partid=companyid) ,'year':year,'month':month})
|
obj, created = Yjyc.objects.get_or_create(
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
year=year,
|
||||||
|
month=month,
|
||||||
|
defaults={
|
||||||
|
"usecomp": Partment.objects.get(partid=companyid),
|
||||||
|
"year": year,
|
||||||
|
"month": month,
|
||||||
|
},
|
||||||
|
)
|
||||||
obj.trainvalue = -score
|
obj.trainvalue = -score
|
||||||
obj.yjz = round(obj.troublevalue + obj.trainvalue + obj.drillvalue + obj.missvalue + obj.observevalue,2)
|
obj.yjz = round(
|
||||||
|
obj.troublevalue
|
||||||
|
+ obj.trainvalue
|
||||||
|
+ obj.drillvalue
|
||||||
|
+ obj.missvalue
|
||||||
|
+ obj.observevalue,
|
||||||
|
2,
|
||||||
|
)
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def yjjs_gc(companyid):
|
def yjjs_gc(companyid, cal_time=None):
|
||||||
first_day,first_day_of_next_month = gettime()
|
first_day, first_day_of_next_month = gettime(cal_time)
|
||||||
# 观察算分
|
# 观察算分
|
||||||
a = Observe.objects.filter(looktime__range=(first_day, first_day_of_next_month),usecomp__partid=companyid,deletemark=1)
|
a = Observe.objects.filter(
|
||||||
|
looktime__range=(first_day, first_day_of_next_month),
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
deletemark=1,
|
||||||
|
)
|
||||||
num = a.count()
|
num = a.count()
|
||||||
if num > 40:
|
if num > 40:
|
||||||
score = (num - 40) * 0.04 + 40 * 0.4
|
score = (num - 40) * 0.04 + 40 * 0.4
|
||||||
|
@ -132,31 +222,74 @@ def yjjs_gc(companyid):
|
||||||
score = num * 0.4
|
score = num * 0.4
|
||||||
year = first_day.year
|
year = first_day.year
|
||||||
month = first_day.month
|
month = first_day.month
|
||||||
obj,created = Yjyc.objects.get_or_create(usecomp__partid=companyid,year=year,month=month,defaults={'usecomp':Partment.objects.get(partid=companyid) ,'year':year,'month':month})
|
obj, created = Yjyc.objects.get_or_create(
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
year=year,
|
||||||
|
month=month,
|
||||||
|
defaults={
|
||||||
|
"usecomp": Partment.objects.get(partid=companyid),
|
||||||
|
"year": year,
|
||||||
|
"month": month,
|
||||||
|
},
|
||||||
|
)
|
||||||
obj.observevalue = -score
|
obj.observevalue = -score
|
||||||
obj.yjz = round(obj.troublevalue + obj.trainvalue + obj.drillvalue + obj.missvalue + obj.observevalue,2)
|
obj.yjz = round(
|
||||||
|
obj.troublevalue
|
||||||
|
+ obj.trainvalue
|
||||||
|
+ obj.drillvalue
|
||||||
|
+ obj.missvalue
|
||||||
|
+ obj.observevalue,
|
||||||
|
2,
|
||||||
|
)
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def yjjs_ws(companyid):
|
def yjjs_ws(companyid, cal_time=None):
|
||||||
# 未遂算分
|
# 未遂算分
|
||||||
first_day,first_day_of_next_month = gettime()
|
first_day, first_day_of_next_month = gettime(cal_time)
|
||||||
a = Miss.objects.filter(misstime__range=(first_day, first_day_of_next_month),usecomp__partid=companyid,deletemark=1) #
|
a = Miss.objects.filter(
|
||||||
|
misstime__range=(first_day, first_day_of_next_month),
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
deletemark=1,
|
||||||
|
) #
|
||||||
score = (a.count()) * 0.6
|
score = (a.count()) * 0.6
|
||||||
year = first_day.year
|
year = first_day.year
|
||||||
month = first_day.month
|
month = first_day.month
|
||||||
obj,created = Yjyc.objects.get_or_create(usecomp__partid=companyid,year=year,month=month,defaults={'usecomp':Partment.objects.get(partid=companyid) ,'year':year,'month':month})
|
obj, created = Yjyc.objects.get_or_create(
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
year=year,
|
||||||
|
month=month,
|
||||||
|
defaults={
|
||||||
|
"usecomp": Partment.objects.get(partid=companyid),
|
||||||
|
"year": year,
|
||||||
|
"month": month,
|
||||||
|
},
|
||||||
|
)
|
||||||
obj.missvalue = score
|
obj.missvalue = score
|
||||||
obj.yjz = round(obj.troublevalue + obj.trainvalue + obj.drillvalue + obj.missvalue + obj.observevalue,2)
|
obj.yjz = round(
|
||||||
|
obj.troublevalue
|
||||||
|
+ obj.trainvalue
|
||||||
|
+ obj.drillvalue
|
||||||
|
+ obj.missvalue
|
||||||
|
+ obj.observevalue,
|
||||||
|
2,
|
||||||
|
)
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def yjjs_yl(companyid):
|
def yjjs_yl(companyid, cal_time=None):
|
||||||
first_day,first_day_of_next_month = gettime()
|
first_day, first_day_of_next_month = gettime(cal_time)
|
||||||
a = Drill.objects.filter(starttime__range=(first_day, first_day_of_next_month),usecomp__partid=companyid,state=1,deletemark=1) #有效演练
|
a = Drill.objects.filter(
|
||||||
|
starttime__range=(first_day, first_day_of_next_month),
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
state=1,
|
||||||
|
deletemark=1,
|
||||||
|
) # 有效演练
|
||||||
# 计算演练效果
|
# 计算演练效果
|
||||||
participantnum = Drill.objects.filter(drillid__in=a).count()
|
participantnum = Drill.objects.filter(drillid__in=a).count()
|
||||||
knownum = a.aggregate(knownum = Sum('knownum'))['knownum']
|
knownum = a.aggregate(knownum=Sum("knownum"))["knownum"]
|
||||||
if participantnum != 0:
|
if participantnum != 0:
|
||||||
x = knownum / participantnum
|
x = knownum / participantnum
|
||||||
else:
|
else:
|
||||||
|
@ -171,50 +304,71 @@ def yjjs_yl(companyid):
|
||||||
ylxg = 0.1
|
ylxg = 0.1
|
||||||
# 演练等级
|
# 演练等级
|
||||||
cs = getcs(companyid)
|
cs = getcs(companyid)
|
||||||
score = ((a.filter(drilllevel__dicid=20).count()*1 + a.filter(drilllevel__dicid=21).count()*0.5 + a.filter(drilllevel__dicid=22).count()*1 + a.filter(drilllevel__dicid=43).count()*0.5)*cs['yldjqz'] +
|
score = (
|
||||||
ylxg*cs['ylxgqz'] ) #演练效果
|
a.filter(drilllevel__dicid=20).count() * 1
|
||||||
|
+ a.filter(drilllevel__dicid=21).count() * 0.5
|
||||||
|
+ a.filter(drilllevel__dicid=22).count() * 1
|
||||||
|
+ a.filter(drilllevel__dicid=43).count() * 0.5
|
||||||
|
) * cs["yldjqz"] + ylxg * cs["ylxgqz"] # 演练效果
|
||||||
year = first_day.year
|
year = first_day.year
|
||||||
month = first_day.month
|
month = first_day.month
|
||||||
obj,created = Yjyc.objects.get_or_create(usecomp__partid=companyid,year=year,month=month,defaults={'usecomp':Partment.objects.get(partid=companyid) ,'year':year,'month':month})
|
obj, created = Yjyc.objects.get_or_create(
|
||||||
|
usecomp__partid=companyid,
|
||||||
|
year=year,
|
||||||
|
month=month,
|
||||||
|
defaults={
|
||||||
|
"usecomp": Partment.objects.get(partid=companyid),
|
||||||
|
"year": year,
|
||||||
|
"month": month,
|
||||||
|
},
|
||||||
|
)
|
||||||
obj.drillvalue = -score
|
obj.drillvalue = -score
|
||||||
obj.yjz = round(obj.troublevalue + obj.trainvalue + obj.drillvalue, 2)
|
obj.yjz = round(obj.troublevalue + obj.trainvalue + obj.drillvalue, 2)
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def ycjs():
|
def ycjs(nowyear=datetime.datetime.now().year, nowmonth=datetime.datetime.now().month):
|
||||||
# print('正在执行预测计算。。。')
|
# print('正在执行预测计算。。。')
|
||||||
companys = Partment.objects.filter(iscompany=1)
|
companys = Partment.objects.filter(iscompany=1)
|
||||||
nowyear = datetime.datetime.now().year
|
|
||||||
nowmonth = datetime.datetime.now().month
|
|
||||||
objs = Yjyc.objects.exclude(yjz=0, year=nowyear, month=nowmonth)
|
objs = Yjyc.objects.exclude(yjz=0, year=nowyear, month=nowmonth)
|
||||||
for x in companys:
|
for x in companys:
|
||||||
obj = objs.filter(usecomp=x).order_by('-yjycid')
|
obj = objs.filter(usecomp=x).order_by("-yjycid")
|
||||||
objv = obj.values('yjycid','yjz')
|
objv = obj.values("yjycid", "yjz")
|
||||||
# print(objv)
|
# print(objv)
|
||||||
if len(obj) > 1:
|
if len(obj) > 1:
|
||||||
vl = list(objv)
|
vl = list(objv)
|
||||||
for i in range(len(vl)):
|
for i in range(len(vl)):
|
||||||
vl[i]['num'] = i+1
|
vl[i]["num"] = i + 1
|
||||||
if i == 0:
|
if i == 0:
|
||||||
vl[i]['yjzs'] = vl[i]['yjz']
|
vl[i]["yjzs"] = vl[i]["yjz"]
|
||||||
if i > 0:
|
if i > 0:
|
||||||
vl[i]['yjzs'] = vl[i-1]['yjzs'] + vl[i]['yjz']
|
vl[i]["yjzs"] = vl[i - 1]["yjzs"] + vl[i]["yjz"]
|
||||||
df = pd.DataFrame(vl)
|
df = pd.DataFrame(vl)
|
||||||
# 建立线性回归模型
|
# 建立线性回归模型
|
||||||
regr = linear_model.LinearRegression()
|
regr = linear_model.LinearRegression()
|
||||||
# 拟合
|
# 拟合
|
||||||
regr.fit(df['num'].values.reshape(-1, 1), df['yjzs']) # 注意此处.reshape(-1, 1),因为X是一维的
|
regr.fit(
|
||||||
|
df["num"].values.reshape(-1, 1), df["yjzs"]
|
||||||
|
) # 注意此处.reshape(-1, 1),因为X是一维的
|
||||||
# 得到直线的斜率、截距
|
# 得到直线的斜率、截距
|
||||||
a, b = regr.coef_, regr.intercept_
|
a, b = regr.coef_, regr.intercept_
|
||||||
# 更新本月的预测值
|
# 更新本月的预测值
|
||||||
# first_day,first_day_of_next_month = gettime()
|
# first_day,first_day_of_next_month = gettime()
|
||||||
# year = first_day_of_next_month.year
|
# year = first_day_of_next_month.year
|
||||||
# month = first_day_of_next_month.month
|
# month = first_day_of_next_month.month
|
||||||
objnew,created = Yjyc.objects.get_or_create(usecomp=x,year=nowyear,month=nowmonth,defaults={'usecomp':x,'year':nowyear,'month':nowmonth})
|
objnew, created = Yjyc.objects.get_or_create(
|
||||||
objnew.ycz = ("%.2f" % a)
|
usecomp=x,
|
||||||
objnew.b = ("%.2f" % b)
|
year=nowyear,
|
||||||
|
month=nowmonth,
|
||||||
|
defaults={"usecomp": x, "year": nowyear, "month": nowmonth},
|
||||||
|
)
|
||||||
|
objnew.ycz = "%.2f" % a
|
||||||
|
objnew.b = "%.2f" % b
|
||||||
objnew.save()
|
objnew.save()
|
||||||
# print('执行完毕!')
|
# print('执行完毕!')
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def risktask():
|
def risktask():
|
||||||
nowtime = datetime.datetime.now()
|
nowtime = datetime.datetime.now()
|
||||||
|
@ -224,7 +378,9 @@ def risktask():
|
||||||
if (nowtime - i.tasktime).seconds >= 28800:
|
if (nowtime - i.tasktime).seconds >= 28800:
|
||||||
taskexpire = nowtime + datetime.timedelta(seconds=28800)
|
taskexpire = nowtime + datetime.timedelta(seconds=28800)
|
||||||
Risktask.objects.filter(risk=i).update(usable=0)
|
Risktask.objects.filter(risk=i).update(usable=0)
|
||||||
Risktask.objects.create(risk=i,group=i.group,taskexpire = taskexpire,taskadd=nowtime)
|
Risktask.objects.create(
|
||||||
|
risk=i, group=i.group, taskexpire=taskexpire, taskadd=nowtime
|
||||||
|
)
|
||||||
i.tasktime = nowtime
|
i.tasktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
elif i.tasktype == 2:
|
elif i.tasktype == 2:
|
||||||
|
@ -232,7 +388,9 @@ def risktask():
|
||||||
if (nowtime - i.tasktime).days >= 1:
|
if (nowtime - i.tasktime).days >= 1:
|
||||||
taskexpire = nowtime + datetime.timedelta(days=1)
|
taskexpire = nowtime + datetime.timedelta(days=1)
|
||||||
Risktask.objects.filter(risk=i).update(usable=0)
|
Risktask.objects.filter(risk=i).update(usable=0)
|
||||||
Risktask.objects.create(risk=i,group=i.group,taskexpire = taskexpire,taskadd=nowtime)
|
Risktask.objects.create(
|
||||||
|
risk=i, group=i.group, taskexpire=taskexpire, taskadd=nowtime
|
||||||
|
)
|
||||||
i.tasktime = nowtime
|
i.tasktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
elif i.tasktype == 3:
|
elif i.tasktype == 3:
|
||||||
|
@ -240,7 +398,9 @@ def risktask():
|
||||||
if (nowtime - i.tasktime).days >= 7:
|
if (nowtime - i.tasktime).days >= 7:
|
||||||
taskexpire = nowtime + datetime.timedelta(days=7)
|
taskexpire = nowtime + datetime.timedelta(days=7)
|
||||||
Risktask.objects.filter(risk=i).update(usable=0)
|
Risktask.objects.filter(risk=i).update(usable=0)
|
||||||
Risktask.objects.create(risk=i,group=i.group,taskexpire = taskexpire,taskadd=nowtime)
|
Risktask.objects.create(
|
||||||
|
risk=i, group=i.group, taskexpire=taskexpire, taskadd=nowtime
|
||||||
|
)
|
||||||
i.tasktime = nowtime
|
i.tasktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
# elif i.tasktype == 4:
|
# elif i.tasktype == 4:
|
||||||
|
@ -251,6 +411,8 @@ def risktask():
|
||||||
# Risktask.objects.create(risk=i,group=i.group,taskexpire = taskexpire)
|
# Risktask.objects.create(risk=i,group=i.group,taskexpire = taskexpire)
|
||||||
# i.tasktime = taskexpire
|
# i.tasktime = taskexpire
|
||||||
# i.save()
|
# i.save()
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def riskacttask():
|
def riskacttask():
|
||||||
nowtime = datetime.datetime.now()
|
nowtime = datetime.datetime.now()
|
||||||
|
@ -260,7 +422,9 @@ def riskacttask():
|
||||||
if (nowtime - i.tasktime).seconds >= 28800:
|
if (nowtime - i.tasktime).seconds >= 28800:
|
||||||
taskexpire = nowtime + datetime.timedelta(seconds=28800)
|
taskexpire = nowtime + datetime.timedelta(seconds=28800)
|
||||||
RiskActTask.objects.filter(riskact=i, istask=1).update(usable=0)
|
RiskActTask.objects.filter(riskact=i, istask=1).update(usable=0)
|
||||||
RiskActTask.objects.create(riskact=i,taskexpire = taskexpire,taskadd=nowtime,istask=1)
|
RiskActTask.objects.create(
|
||||||
|
riskact=i, taskexpire=taskexpire, taskadd=nowtime, istask=1
|
||||||
|
)
|
||||||
i.tasktime = nowtime
|
i.tasktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
elif i.tasktype == 2:
|
elif i.tasktype == 2:
|
||||||
|
@ -268,7 +432,9 @@ def riskacttask():
|
||||||
if (nowtime - i.tasktime).days >= 1:
|
if (nowtime - i.tasktime).days >= 1:
|
||||||
taskexpire = nowtime + datetime.timedelta(days=1)
|
taskexpire = nowtime + datetime.timedelta(days=1)
|
||||||
RiskActTask.objects.filter(riskact=i, istask=1).update(usable=0)
|
RiskActTask.objects.filter(riskact=i, istask=1).update(usable=0)
|
||||||
RiskActTask.objects.create(riskact=i,taskexpire = taskexpire,taskadd=nowtime,istask=1)
|
RiskActTask.objects.create(
|
||||||
|
riskact=i, taskexpire=taskexpire, taskadd=nowtime, istask=1
|
||||||
|
)
|
||||||
i.tasktime = nowtime
|
i.tasktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
elif i.tasktype == 3:
|
elif i.tasktype == 3:
|
||||||
|
@ -276,10 +442,13 @@ def riskacttask():
|
||||||
if (nowtime - i.tasktime).days >= 7:
|
if (nowtime - i.tasktime).days >= 7:
|
||||||
taskexpire = nowtime + datetime.timedelta(days=7)
|
taskexpire = nowtime + datetime.timedelta(days=7)
|
||||||
RiskActTask.objects.filter(riskact=i, istask=1).update(usable=0)
|
RiskActTask.objects.filter(riskact=i, istask=1).update(usable=0)
|
||||||
RiskActTask.objects.create(riskact=i,taskexpire = taskexpire,taskadd=nowtime,istask=1)
|
RiskActTask.objects.create(
|
||||||
|
riskact=i, taskexpire=taskexpire, taskadd=nowtime, istask=1
|
||||||
|
)
|
||||||
i.tasktime = nowtime
|
i.tasktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def gridtasksend():
|
def gridtasksend():
|
||||||
nowtime = datetime.datetime.now()
|
nowtime = datetime.datetime.now()
|
||||||
|
@ -289,28 +458,39 @@ def gridtasksend():
|
||||||
for i in GridTaskSet.objects.filter(is_paused=False, start_task____lte=time2):
|
for i in GridTaskSet.objects.filter(is_paused=False, start_task____lte=time2):
|
||||||
sendGridtask(i)
|
sendGridtask(i)
|
||||||
|
|
||||||
|
|
||||||
from dateutil.relativedelta import *
|
from dateutil.relativedelta import *
|
||||||
|
|
||||||
|
|
||||||
def sendGridtask(obj):
|
def sendGridtask(obj):
|
||||||
nowtime = datetime.datetime.now()
|
nowtime = datetime.datetime.now()
|
||||||
schedule = obj.schedule
|
schedule = obj.schedule
|
||||||
if 'interval' in schedule and schedule['interval']:
|
if "interval" in schedule and schedule["interval"]:
|
||||||
number, type_ = schedule['interval'].split(',')
|
number, type_ = schedule["interval"].split(",")
|
||||||
start_task = obj.start_task
|
start_task = obj.start_task
|
||||||
m = start_task + relativedelta({type_: int(number)})
|
m = start_task + relativedelta({type_: int(number)})
|
||||||
if nowtime >= m:
|
if nowtime >= m:
|
||||||
newm = nowtime + relativedelta({type_: int(number)})
|
newm = nowtime + relativedelta({type_: int(number)})
|
||||||
RiskActTask.objects.filter(taskset=obj, usable=1).update(usable=0)
|
RiskActTask.objects.filter(taskset=obj, usable=1).update(usable=0)
|
||||||
RiskActTask.objects.create(riskact=obj.riskact,taskexpire = newm,taskadd=nowtime,istask=1,taskset=obj,tasknote=obj.note,user=obj.user)
|
RiskActTask.objects.create(
|
||||||
|
riskact=obj.riskact,
|
||||||
|
taskexpire=newm,
|
||||||
|
taskadd=nowtime,
|
||||||
|
istask=1,
|
||||||
|
taskset=obj,
|
||||||
|
tasknote=obj.note,
|
||||||
|
user=obj.user,
|
||||||
|
)
|
||||||
obj.start_task = nowtime
|
obj.start_task = nowtime
|
||||||
obj.count = obj.count + 1
|
obj.count = obj.count + 1
|
||||||
obj.save()
|
obj.save()
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def sendGridtask2(**kwargs):
|
def sendGridtask2(**kwargs):
|
||||||
obj = GridTaskSet.objects.get(id=kwargs['gridtaskset'])
|
obj = GridTaskSet.objects.get(id=kwargs["gridtaskset"])
|
||||||
if obj.trouble:
|
if obj.trouble:
|
||||||
if obj.trouble.yhzt == 6:
|
if obj.trouble.yhzt == 6:
|
||||||
# 如果隐患关闭了就直接停止计划任务
|
# 如果隐患关闭了就直接停止计划任务
|
||||||
|
@ -321,9 +501,24 @@ def sendGridtask2(**kwargs):
|
||||||
nowtime = datetime.datetime.now()
|
nowtime = datetime.datetime.now()
|
||||||
if obj.expire:
|
if obj.expire:
|
||||||
newm = nowtime + datetime.timedelta(hours=int(obj.expire))
|
newm = nowtime + datetime.timedelta(hours=int(obj.expire))
|
||||||
TroubleFollowTask.objects.create(trouble=obj.trouble,taskexpire = newm,taskadd=nowtime,taskset=obj,tasknote=obj.note,user=obj.user,gridlevel=obj.gridlevel)
|
TroubleFollowTask.objects.create(
|
||||||
|
trouble=obj.trouble,
|
||||||
|
taskexpire=newm,
|
||||||
|
taskadd=nowtime,
|
||||||
|
taskset=obj,
|
||||||
|
tasknote=obj.note,
|
||||||
|
user=obj.user,
|
||||||
|
gridlevel=obj.gridlevel,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
TroubleFollowTask.objects.create(trouble=obj.trouble,taskadd=nowtime,taskset=obj,tasknote=obj.note,user=obj.user,gridlevel=obj.gridlevel)
|
TroubleFollowTask.objects.create(
|
||||||
|
trouble=obj.trouble,
|
||||||
|
taskadd=nowtime,
|
||||||
|
taskset=obj,
|
||||||
|
tasknote=obj.note,
|
||||||
|
user=obj.user,
|
||||||
|
gridlevel=obj.gridlevel,
|
||||||
|
)
|
||||||
obj.last_run_at = nowtime
|
obj.last_run_at = nowtime
|
||||||
obj.count = obj.count + 1
|
obj.count = obj.count + 1
|
||||||
obj.save()
|
obj.save()
|
||||||
|
@ -333,26 +528,50 @@ def sendGridtask2(**kwargs):
|
||||||
nowtime = datetime.datetime.now()
|
nowtime = datetime.datetime.now()
|
||||||
if obj.expire:
|
if obj.expire:
|
||||||
newm = nowtime + datetime.timedelta(hours=int(obj.expire))
|
newm = nowtime + datetime.timedelta(hours=int(obj.expire))
|
||||||
RiskActTask.objects.create(riskact=obj.riskact,taskexpire = newm,taskadd=nowtime,istask=1,taskset=obj,tasknote=obj.note,user=obj.user)
|
RiskActTask.objects.create(
|
||||||
|
riskact=obj.riskact,
|
||||||
|
taskexpire=newm,
|
||||||
|
taskadd=nowtime,
|
||||||
|
istask=1,
|
||||||
|
taskset=obj,
|
||||||
|
tasknote=obj.note,
|
||||||
|
user=obj.user,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
RiskActTask.objects.create(riskact=obj.riskact,taskadd=nowtime,istask=1,taskset=obj,tasknote=obj.note,user=obj.user)
|
RiskActTask.objects.create(
|
||||||
|
riskact=obj.riskact,
|
||||||
|
taskadd=nowtime,
|
||||||
|
istask=1,
|
||||||
|
taskset=obj,
|
||||||
|
tasknote=obj.note,
|
||||||
|
user=obj.user,
|
||||||
|
)
|
||||||
obj.last_run_at = nowtime
|
obj.last_run_at = nowtime
|
||||||
obj.count = obj.count + 1
|
obj.count = obj.count + 1
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def expireRiskacttask():
|
def expireRiskacttask():
|
||||||
RiskActTask.objects.filter(taskexpire__lte = datetime.datetime.now(), usable=1).update(usable=0)
|
RiskActTask.objects.filter(
|
||||||
|
taskexpire__lte=datetime.datetime.now(), usable=1
|
||||||
|
).update(usable=0)
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def expireTroublefollowtask():
|
def expireTroublefollowtask():
|
||||||
TroubleFollowTask.objects.filter(taskexpire__lte = datetime.datetime.now(), usable=1).update(usable=0)
|
TroubleFollowTask.objects.filter(
|
||||||
|
taskexpire__lte=datetime.datetime.now(), usable=1
|
||||||
|
).update(usable=0)
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def closeExamtest():
|
def closeExamtest():
|
||||||
# 自动关闭到期的考试
|
# 自动关闭到期的考试
|
||||||
ExamTest.objects.filter(state=1, endtime__lt = datetime.datetime.now()).update(state=0)
|
ExamTest.objects.filter(state=1, endtime__lt=datetime.datetime.now()).update(
|
||||||
|
state=0
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def checktask():
|
def checktask():
|
||||||
|
@ -360,79 +579,127 @@ def checktask():
|
||||||
for i in Checktask.objects.filter(deletemark=1, taskstate=1):
|
for i in Checktask.objects.filter(deletemark=1, taskstate=1):
|
||||||
if i.tasktype == 1:
|
if i.tasktype == 1:
|
||||||
if i.checktime:
|
if i.checktime:
|
||||||
|
|
||||||
if (nowtime - i.checktime).days >= 1:
|
if (nowtime - i.checktime).days >= 1:
|
||||||
endtimes = nowtime + datetime.timedelta(days=1)
|
endtimes = nowtime + datetime.timedelta(days=1)
|
||||||
for j in i.checkname.all():
|
for j in i.checkname.all():
|
||||||
x = User.objects.get(userid=j.userid)
|
x = User.objects.get(userid=j.userid)
|
||||||
|
|
||||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
Checkjob.objects.filter(checktask=i, checkname=x).update(
|
||||||
Checkjob.objects.create(checktask=i,checkname=x,taskstate=4,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
jobstate=2
|
||||||
|
)
|
||||||
|
Checkjob.objects.create(
|
||||||
|
checktask=i,
|
||||||
|
checkname=x,
|
||||||
|
taskstate=4,
|
||||||
|
starttime=nowtime,
|
||||||
|
endtime=endtimes,
|
||||||
|
usecomp=i.usecomp,
|
||||||
|
)
|
||||||
|
|
||||||
i.checktime = nowtime
|
i.checktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
elif i.tasktype == 2:
|
elif i.tasktype == 2:
|
||||||
if i.checktime:
|
if i.checktime:
|
||||||
|
|
||||||
if (nowtime - i.checktime).days >= 7:
|
if (nowtime - i.checktime).days >= 7:
|
||||||
endtimes = nowtime + datetime.timedelta(days=7)
|
endtimes = nowtime + datetime.timedelta(days=7)
|
||||||
for j in i.checkname.all():
|
for j in i.checkname.all():
|
||||||
x = User.objects.get(userid=j.userid)
|
x = User.objects.get(userid=j.userid)
|
||||||
|
|
||||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
Checkjob.objects.filter(checktask=i, checkname=x).update(
|
||||||
Checkjob.objects.create(checktask=i,checkname=x,taskstate=4,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
jobstate=2
|
||||||
|
)
|
||||||
|
Checkjob.objects.create(
|
||||||
|
checktask=i,
|
||||||
|
checkname=x,
|
||||||
|
taskstate=4,
|
||||||
|
starttime=nowtime,
|
||||||
|
endtime=endtimes,
|
||||||
|
usecomp=i.usecomp,
|
||||||
|
)
|
||||||
|
|
||||||
i.checktime = nowtime
|
i.checktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
elif i.tasktype == 3:
|
elif i.tasktype == 3:
|
||||||
if i.checktime:
|
if i.checktime:
|
||||||
|
|
||||||
if (nowtime - i.checktime).days >= 30:
|
if (nowtime - i.checktime).days >= 30:
|
||||||
endtimes = nowtime + datetime.timedelta(days=30)
|
endtimes = nowtime + datetime.timedelta(days=30)
|
||||||
for j in i.checkname.all():
|
for j in i.checkname.all():
|
||||||
x = User.objects.get(userid=j.userid)
|
x = User.objects.get(userid=j.userid)
|
||||||
|
|
||||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
Checkjob.objects.filter(checktask=i, checkname=x).update(
|
||||||
Checkjob.objects.create(checktask=i,checkname=x,taskstate=4,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
jobstate=2
|
||||||
|
)
|
||||||
|
Checkjob.objects.create(
|
||||||
|
checktask=i,
|
||||||
|
checkname=x,
|
||||||
|
taskstate=4,
|
||||||
|
starttime=nowtime,
|
||||||
|
endtime=endtimes,
|
||||||
|
usecomp=i.usecomp,
|
||||||
|
)
|
||||||
|
|
||||||
i.checktime = nowtime
|
i.checktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
elif i.tasktype == 4:
|
elif i.tasktype == 4:
|
||||||
if i.checktime:
|
if i.checktime:
|
||||||
|
|
||||||
if (nowtime - i.checktime).days >= 120:
|
if (nowtime - i.checktime).days >= 120:
|
||||||
endtimes = nowtime + datetime.timedelta(days=120)
|
endtimes = nowtime + datetime.timedelta(days=120)
|
||||||
for j in i.checkname.all():
|
for j in i.checkname.all():
|
||||||
x = User.objects.get(userid=j.userid)
|
x = User.objects.get(userid=j.userid)
|
||||||
|
|
||||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
Checkjob.objects.filter(checktask=i, checkname=x).update(
|
||||||
Checkjob.objects.create(checktask=i,checkname=x,taskstate=4,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
jobstate=2
|
||||||
|
)
|
||||||
|
Checkjob.objects.create(
|
||||||
|
checktask=i,
|
||||||
|
checkname=x,
|
||||||
|
taskstate=4,
|
||||||
|
starttime=nowtime,
|
||||||
|
endtime=endtimes,
|
||||||
|
usecomp=i.usecomp,
|
||||||
|
)
|
||||||
|
|
||||||
i.checktime = nowtime
|
i.checktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
elif i.tasktype == 5:
|
elif i.tasktype == 5:
|
||||||
if i.checktime:
|
if i.checktime:
|
||||||
|
|
||||||
if (nowtime - i.checktime).days >= 182:
|
if (nowtime - i.checktime).days >= 182:
|
||||||
endtimes = nowtime + datetime.timedelta(days=182)
|
endtimes = nowtime + datetime.timedelta(days=182)
|
||||||
for j in i.checkname.all():
|
for j in i.checkname.all():
|
||||||
x = User.objects.get(userid=j.userid)
|
x = User.objects.get(userid=j.userid)
|
||||||
|
|
||||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
Checkjob.objects.filter(checktask=i, checkname=x).update(
|
||||||
Checkjob.objects.create(checktask=i,checkname=x,taskstate=4,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
jobstate=2
|
||||||
|
)
|
||||||
|
Checkjob.objects.create(
|
||||||
|
checktask=i,
|
||||||
|
checkname=x,
|
||||||
|
taskstate=4,
|
||||||
|
starttime=nowtime,
|
||||||
|
endtime=endtimes,
|
||||||
|
usecomp=i.usecomp,
|
||||||
|
)
|
||||||
|
|
||||||
i.checktime = nowtime
|
i.checktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
elif i.tasktype == 6:
|
elif i.tasktype == 6:
|
||||||
if i.checktime:
|
if i.checktime:
|
||||||
|
|
||||||
if (nowtime - i.checktime).days >= 365:
|
if (nowtime - i.checktime).days >= 365:
|
||||||
endtimes = nowtime + datetime.timedelta(days=365)
|
endtimes = nowtime + datetime.timedelta(days=365)
|
||||||
for j in i.checkname.all():
|
for j in i.checkname.all():
|
||||||
x = User.objects.get(userid=j.userid)
|
x = User.objects.get(userid=j.userid)
|
||||||
|
|
||||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
Checkjob.objects.filter(checktask=i, checkname=x).update(
|
||||||
Checkjob.objects.create(checktask=i,checkname=x,taskstate=4,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
jobstate=2
|
||||||
|
)
|
||||||
|
Checkjob.objects.create(
|
||||||
|
checktask=i,
|
||||||
|
checkname=x,
|
||||||
|
taskstate=4,
|
||||||
|
starttime=nowtime,
|
||||||
|
endtime=endtimes,
|
||||||
|
usecomp=i.usecomp,
|
||||||
|
)
|
||||||
|
|
||||||
i.checktime = nowtime
|
i.checktime = nowtime
|
||||||
i.save()
|
i.save()
|
||||||
|
@ -440,7 +707,9 @@ def checktask():
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def expireTzzs():
|
def expireTzzs():
|
||||||
queryset = Socertificate.objects.filter(yfsrq__lte = datetime.datetime.now()+datetime.timedelta(days=185))
|
queryset = Socertificate.objects.filter(
|
||||||
|
yfsrq__lte=datetime.datetime.now() + datetime.timedelta(days=185)
|
||||||
|
)
|
||||||
for x in queryset:
|
for x in queryset:
|
||||||
try:
|
try:
|
||||||
x.zszt = guoqi(x.yfsrq)
|
x.zszt = guoqi(x.yfsrq)
|
||||||
|
@ -448,9 +717,12 @@ def expireTzzs():
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def expireAqzs():
|
def expireAqzs():
|
||||||
queryset = Safecert.objects.filter(yfsrq__lte = datetime.datetime.now()+datetime.timedelta(days=185))
|
queryset = Safecert.objects.filter(
|
||||||
|
yfsrq__lte=datetime.datetime.now() + datetime.timedelta(days=185)
|
||||||
|
)
|
||||||
for x in queryset:
|
for x in queryset:
|
||||||
try:
|
try:
|
||||||
x.zszt = guoqi(x.yfsrq)
|
x.zszt = guoqi(x.yfsrq)
|
||||||
|
@ -458,43 +730,52 @@ def expireAqzs():
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def updateTzzs():
|
def updateTzzs():
|
||||||
queryset = Socertificate.objects.filter(yfsrq__lte = datetime.datetime.now()+datetime.timedelta(days=200))
|
queryset = Socertificate.objects.filter(
|
||||||
|
yfsrq__lte=datetime.datetime.now() + datetime.timedelta(days=200)
|
||||||
|
)
|
||||||
for x in queryset:
|
for x in queryset:
|
||||||
data = getTzzs(x.cardnum, x.realname)
|
data = getTzzs(x.cardnum, x.realname)
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
if data:
|
if data:
|
||||||
for i in data:
|
for i in data:
|
||||||
updated_values = {
|
updated_values = {
|
||||||
'realname':i['姓名'],
|
"realname": i["姓名"],
|
||||||
'gender':i['性别'],
|
"gender": i["性别"],
|
||||||
'zylb':i['作业类别'],
|
"zylb": i["作业类别"],
|
||||||
'czxm':i['操作项目'],
|
"czxm": i["操作项目"],
|
||||||
'fzjg':i['发证机关'],
|
"fzjg": i["发证机关"],
|
||||||
'ccfzrq':i['初次发证日期'] if i['初次发证日期'] else None,
|
"ccfzrq": i["初次发证日期"] if i["初次发证日期"] else None,
|
||||||
'yfsrq':i['应复审日期'] if i['应复审日期'] else None,
|
"yfsrq": i["应复审日期"] if i["应复审日期"] else None,
|
||||||
'yxqkssj':i['有效期开始时间'] if i['有效期开始时间'] else None,
|
"yxqkssj": i["有效期开始时间"] if i["有效期开始时间"] else None,
|
||||||
'yxqjssj':i['有效期结束时间'] if i['有效期结束时间'] else None,
|
"yxqjssj": i["有效期结束时间"] if i["有效期结束时间"] else None,
|
||||||
'sjfssj':i['实际复审时间'] if i['实际复审时间'] else None,
|
"sjfssj": i["实际复审时间"] if i["实际复审时间"] else None,
|
||||||
'user':x.user,
|
"user": x.user,
|
||||||
'usecomp':x.usecomp
|
"usecomp": x.usecomp,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
updated_values['zszt'] = guoqi(i['应复审日期'])
|
updated_values["zszt"] = guoqi(i["应复审日期"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
# obj, created = Socertificate.objects.update_or_create(
|
# obj, created = Socertificate.objects.update_or_create(
|
||||||
# cardnum=x.cardnum, czxm=i['操作项目'], defaults=updated_values)
|
# cardnum=x.cardnum, czxm=i['操作项目'], defaults=updated_values)
|
||||||
try:
|
try:
|
||||||
obj = Socertificate.objects.get(cardnum=x.cardnum, czxm=i['操作项目'])
|
obj = Socertificate.objects.get(
|
||||||
if obj.yxqjssj.strftime('%Y-%m-%d')<i['有效期结束时间']:
|
cardnum=x.cardnum, czxm=i["操作项目"]
|
||||||
obj.yfsrq = i['应复审日期'] if i['应复审日期'] else None
|
)
|
||||||
obj.yxqkssj = i['有效期结束时间'] if i['有效期结束时间'] else None
|
if obj.yxqjssj.strftime("%Y-%m-%d") < i["有效期结束时间"]:
|
||||||
obj.yxqjssj = i['有效期结束时间'] if i['有效期结束时间'] else None
|
obj.yfsrq = i["应复审日期"] if i["应复审日期"] else None
|
||||||
obj.sjfssj = i['实际复审时间'] if i['实际复审时间'] else None
|
obj.yxqkssj = (
|
||||||
|
i["有效期结束时间"] if i["有效期结束时间"] else None
|
||||||
|
)
|
||||||
|
obj.yxqjssj = (
|
||||||
|
i["有效期结束时间"] if i["有效期结束时间"] else None
|
||||||
|
)
|
||||||
|
obj.sjfssj = i["实际复审时间"] if i["实际复审时间"] else None
|
||||||
try:
|
try:
|
||||||
zsst = guoqi(i['应复审日期'])
|
zsst = guoqi(i["应复审日期"])
|
||||||
obj.zszt = zsst
|
obj.zszt = zsst
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -503,50 +784,60 @@ def updateTzzs():
|
||||||
obj = Socertificate(**updated_values)
|
obj = Socertificate(**updated_values)
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
def guoqi(x):
|
def guoqi(x):
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
now1 = datetime.datetime.now() + datetime.timedelta(days=180)
|
now1 = datetime.datetime.now() + datetime.timedelta(days=180)
|
||||||
if datetime.datetime.strptime(x,'%Y-%m-%d')>now1:
|
if datetime.datetime.strptime(x, "%Y-%m-%d") > now1:
|
||||||
return 1
|
return 1
|
||||||
elif now1 > datetime.datetime.strptime(x,'%Y-%m-%d')>now:
|
elif now1 > datetime.datetime.strptime(x, "%Y-%m-%d") > now:
|
||||||
return 2
|
return 2
|
||||||
else:
|
else:
|
||||||
return 3
|
return 3
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def updateAqzs():
|
def updateAqzs():
|
||||||
queryset = Safecert.objects.filter(yfsrq__lte = datetime.datetime.now()+datetime.timedelta(days=200))
|
queryset = Safecert.objects.filter(
|
||||||
|
yfsrq__lte=datetime.datetime.now() + datetime.timedelta(days=200)
|
||||||
|
)
|
||||||
for x in queryset:
|
for x in queryset:
|
||||||
data = getAqzs(x.cardnum, x.realname)
|
data = getAqzs(x.cardnum, x.realname)
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
if data:
|
if data:
|
||||||
for i in data:
|
for i in data:
|
||||||
updated_values = {
|
updated_values = {
|
||||||
'realname':i['姓名'],
|
"realname": i["姓名"],
|
||||||
'gender':i['性别'],
|
"gender": i["性别"],
|
||||||
'zglx':i['资格类型'],
|
"zglx": i["资格类型"],
|
||||||
'dwlx':i['单位类型'],
|
"dwlx": i["单位类型"],
|
||||||
'fzjg':i['发证机关'],
|
"fzjg": i["发证机关"],
|
||||||
'yfsrq':i['应复审日期'] if i['应复审日期'] else None,
|
"yfsrq": i["应复审日期"] if i["应复审日期"] else None,
|
||||||
'yxqkssj':i['有效期开始时间'] if i['有效期开始时间'] else None,
|
"yxqkssj": i["有效期开始时间"] if i["有效期开始时间"] else None,
|
||||||
'yxqjssj':i['有效期结束时间'] if i['有效期结束时间'] else None,
|
"yxqjssj": i["有效期结束时间"] if i["有效期结束时间"] else None,
|
||||||
'user':x.user,
|
"user": x.user,
|
||||||
'usecomp':x.usecomp
|
"usecomp": x.usecomp,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
updated_values['zszt'] = guoqi(i['有效期结束时间'])
|
updated_values["zszt"] = guoqi(i["有效期结束时间"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
# obj, created = Safecert.objects.update_or_create(
|
# obj, created = Safecert.objects.update_or_create(
|
||||||
# cardnum=x.cardnum, zglx=i['资格类型'], dwlx=i['单位类型'], defaults=updated_values)
|
# cardnum=x.cardnum, zglx=i['资格类型'], dwlx=i['单位类型'], defaults=updated_values)
|
||||||
try:
|
try:
|
||||||
obj = Safecert.objects.get(cardnum=x.cardnum, zglx=i['资格类型'], dwlx=i['单位类型'])
|
obj = Safecert.objects.get(
|
||||||
if obj.yxqjssj.strftime('%Y-%m-%d')<i['有效期结束时间']:
|
cardnum=x.cardnum, zglx=i["资格类型"], dwlx=i["单位类型"]
|
||||||
obj.yfsrq = i['应复审日期'] if i['应复审日期'] else None
|
)
|
||||||
obj.yxqkssj = i['有效期结束时间'] if i['有效期结束时间'] else None
|
if obj.yxqjssj.strftime("%Y-%m-%d") < i["有效期结束时间"]:
|
||||||
obj.yxqjssj = i['有效期结束时间'] if i['有效期结束时间'] else None
|
obj.yfsrq = i["应复审日期"] if i["应复审日期"] else None
|
||||||
|
obj.yxqkssj = (
|
||||||
|
i["有效期结束时间"] if i["有效期结束时间"] else None
|
||||||
|
)
|
||||||
|
obj.yxqjssj = (
|
||||||
|
i["有效期结束时间"] if i["有效期结束时间"] else None
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
zsst = guoqi(i['有效期结束时间'])
|
zsst = guoqi(i["有效期结束时间"])
|
||||||
obj.zszt = zsst
|
obj.zszt = zsst
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -555,6 +846,7 @@ def updateAqzs():
|
||||||
obj = Safecert(**updated_values)
|
obj = Safecert(**updated_values)
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def call_trainplan_manager():
|
def call_trainplan_manager():
|
||||||
first_day, first_day_of_next_month = gettime()
|
first_day, first_day_of_next_month = gettime()
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
企业安全管理数据统计
|
企业环保管理数据统计
|
||||||
<span id=localtime style=" font-size:14px; position: absolute; right: 30px; top:-20px; "></span>
|
<span id=localtime style=" font-size:14px; position: absolute; right: 30px; top:-20px; "></span>
|
||||||
</header>
|
</header>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
@ -99,27 +99,7 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content_right">
|
|
||||||
<div class="report">
|
|
||||||
<div class="report1">
|
|
||||||
<p>线下培训</p>
|
|
||||||
<small>{{px}}条</small>
|
|
||||||
</div>
|
|
||||||
<div class="report2">
|
|
||||||
<p>行为观察</p>
|
|
||||||
<small>{{xw}} 条</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="news_report">
|
|
||||||
<div class="title"><img src="/static/safesite/mystatic/images/bigdata/icon05.png" /> 本月安全状态</div>
|
|
||||||
<div id="map1div" style="width: 100%; height:100%;float:left;"></div>
|
|
||||||
</div>
|
|
||||||
<div class="data_box">
|
|
||||||
<div class="title"><img src="/static/safesite/mystatic/images/bigdata/icon06.png" /> 预警预测趋势图</div>
|
|
||||||
<div id="map2div" style="width:100%; height:80%;float:left;"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--遮罩层-->
|
<!--遮罩层-->
|
||||||
<div class="bgPop"></div>
|
<div class="bgPop"></div>
|
||||||
<!--弹出框-->
|
<!--弹出框-->
|
||||||
|
@ -485,6 +465,7 @@
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
src = '/static/safesite/mystatic/images/icon1.png'
|
src = '/static/safesite/mystatic/images/icon1.png'
|
||||||
|
anchor = [0.9, 50]
|
||||||
}
|
}
|
||||||
return new ol.style.Style({
|
return new ol.style.Style({
|
||||||
/**{olx.style.IconOptions}类型*/
|
/**{olx.style.IconOptions}类型*/
|
||||||
|
@ -527,6 +508,17 @@
|
||||||
pointFeature.setStyle(createPointStyle(pointFeature));
|
pointFeature.setStyle(createPointStyle(pointFeature));
|
||||||
source.addFeature(pointFeature)
|
source.addFeature(pointFeature)
|
||||||
}
|
}
|
||||||
|
function setPointOnly(i) {
|
||||||
|
var pointFeature = new ol.Feature({
|
||||||
|
geometry: new ol.geom.Point(i.location),
|
||||||
|
id: i.id,
|
||||||
|
name: i.name,
|
||||||
|
type: i.type2,
|
||||||
|
num: i.number
|
||||||
|
});
|
||||||
|
pointFeature.setStyle(createPointStyle(pointFeature));
|
||||||
|
source.addFeature(pointFeature)
|
||||||
|
}
|
||||||
function setPolygon(i) {
|
function setPolygon(i) {
|
||||||
var polygonFeature = new ol.Feature({
|
var polygonFeature = new ol.Feature({
|
||||||
geometry: new ol.geom.Polygon(i.polygon),
|
geometry: new ol.geom.Polygon(i.polygon),
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
企业安全数据显示大屏
|
企业环保数据显示大屏
|
||||||
</header>
|
</header>
|
||||||
<div class="center_top">
|
<div class="center_top">
|
||||||
<div id="map" class="map" style="width:100%;height:100%;outline: #4A74A8 solid 0.15em;">
|
<div id="map" class="map" style="width:100%;height:100%;outline: #4A74A8 solid 0.15em;">
|
||||||
|
@ -386,46 +386,46 @@
|
||||||
function updatepo() {
|
function updatepo() {
|
||||||
if ($('#mapshowinput').length) {
|
if ($('#mapshowinput').length) {
|
||||||
source.clear()
|
source.clear()
|
||||||
$.get('/api/mapshow?a=risk', function (res) {
|
// $.get('/api/mapshow?a=risk', function (res) {
|
||||||
for (let i = 0, len = res.length; i < len; i++) {
|
// for (let i = 0, len = res.length; i < len; i++) {
|
||||||
setPolygon(res[i])
|
// setPolygon(res[i])
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
$.get('/api/mapshow?a=trouble', function (res) {
|
// $.get('/api/mapshow?a=trouble', function (res) {
|
||||||
for (let i = 0, len = res.length; i < len; i++) {
|
// for (let i = 0, len = res.length; i < len; i++) {
|
||||||
var data = res[i]
|
// var data = res[i]
|
||||||
data.id = data.yhqy__id
|
// data.id = data.yhqy__id
|
||||||
data.num = data.num
|
// data.num = data.num
|
||||||
data.polygon = data.yhqy__polygon
|
// data.polygon = data.yhqy__polygon
|
||||||
data.name = data.yhqy__name
|
// data.name = data.yhqy__name
|
||||||
data.type = 'yh'
|
// data.type = 'yh'
|
||||||
setPoint(data)
|
// setPoint(data)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
$.get('/api/mapshow?a=miss', function (res) {
|
// $.get('/api/mapshow?a=miss', function (res) {
|
||||||
for (let i = 0, len = res.length; i < len; i++) {
|
// for (let i = 0, len = res.length; i < len; i++) {
|
||||||
var data = res[i]
|
// var data = res[i]
|
||||||
data.id = data.missqy__id
|
// data.id = data.missqy__id
|
||||||
data.num = data.num
|
// data.num = data.num
|
||||||
data.polygon = data.missqy__polygon
|
// data.polygon = data.missqy__polygon
|
||||||
data.name = data.missqy__name
|
// data.name = data.missqy__name
|
||||||
data.type = 'ws'
|
// data.type = 'ws'
|
||||||
setPoint(data)
|
// setPoint(data)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
$.get('/api/mapshow?a=operation', function (res) {
|
// $.get('/api/mapshow?a=operation', function (res) {
|
||||||
for (let i = 0, len = res.length; i < len; i++) {
|
// for (let i = 0, len = res.length; i < len; i++) {
|
||||||
var data = res[i]
|
// var data = res[i]
|
||||||
data.id = data.zyqy__id
|
// data.id = data.zyqy__id
|
||||||
data.num = data.num
|
// data.num = data.num
|
||||||
data.polygon = data.zyqy__polygon
|
// data.polygon = data.zyqy__polygon
|
||||||
data.name = data.zyqy__name
|
// data.name = data.zyqy__name
|
||||||
data.type = 'zy'
|
// data.type = 'zy'
|
||||||
data.list = data.zylist
|
// data.list = data.zylist
|
||||||
popuplist.push(data)
|
// popuplist.push(data)
|
||||||
setPoint(data)
|
// setPoint(data)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Updatepoint = setInterval(updatepo, 1000 * 60 * 5)
|
Updatepoint = setInterval(updatepo, 1000 * 60 * 5)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
required=true />
|
required=true />
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:5px">
|
<div style="margin-bottom:5px">
|
||||||
<input id="aqcs" class="easyui-textbox" name="aqcs" style="width:480px;height:100px" data-options="label:'安全措施',multiline:true"
|
<input id="aqcs" class="easyui-textbox" name="aqcs" style="width:480px;height:100px" data-options="label:'环保措施',multiline:true"
|
||||||
required=true />
|
required=true />
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:5px">
|
<div style="margin-bottom:5px">
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
required=true />
|
required=true />
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:5px">
|
<div style="margin-bottom:5px">
|
||||||
<input id="aqcs" class="easyui-textbox" name="aqcs" style="width:480px;height:100px" data-options="label:'安全措施',multiline:true"
|
<input id="aqcs" class="easyui-textbox" name="aqcs" style="width:480px;height:100px" data-options="label:'环保措施',multiline:true"
|
||||||
required=true />
|
required=true />
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:5px">
|
<div style="margin-bottom:5px">
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
<title>ctc安全生产管理系统</title>
|
<title>ctc环保管理系统</title>
|
||||||
<link rel="icon" href="/media/favicon.ico" type="image/x-icon" />
|
<link rel="icon" href="/media/favicon.ico" type="image/x-icon" />
|
||||||
<link rel="stylesheet" type="text/css" href="/static/safesite/mystatic/css/loading.css">
|
<link rel="stylesheet" type="text/css" href="/static/safesite/mystatic/css/loading.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/static/safesite/easyui/themes/default/easyui.css">
|
<link rel="stylesheet" type="text/css" href="/static/safesite/easyui/themes/default/easyui.css">
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
<title>ctc安全生产管理系统</title>
|
<title>ctc环保管理系统</title>
|
||||||
<link rel="icon" href="/static/safesite/favicon.ico" type="image/x-icon" />
|
<link rel="icon" href="/static/safesite/favicon.ico" type="image/x-icon" />
|
||||||
<link rel="stylesheet" type="text/css" href="/static/safesite/mystatic/css/loading.css">
|
<link rel="stylesheet" type="text/css" href="/static/safesite/mystatic/css/loading.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/static/safesite/easyui/themes/default/easyui.css">
|
<link rel="stylesheet" type="text/css" href="/static/safesite/easyui/themes/default/easyui.css">
|
||||||
|
@ -116,12 +116,12 @@
|
||||||
<button style="margin: 15px;background-color: transparent;border: 0;color: white;cursor: pointer;"
|
<button style="margin: 15px;background-color: transparent;border: 0;color: white;cursor: pointer;"
|
||||||
onclick="javascript:$('#tt').tabs('select',0)"><span
|
onclick="javascript:$('#tt').tabs('select',0)"><span
|
||||||
style="font-size:24px">{{companyname}}</span><br /><span
|
style="font-size:24px">{{companyname}}</span><br /><span
|
||||||
style="font-size:20px">安全生产管理系统</span></button>
|
style="font-size:20px">环保管理系统</span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="menuTreediv" data-options="region:'west'" style="width: 150px; background-color: #ffffff;">
|
<div id="menuTreediv" data-options="region:'west'" style="width: 180px; background-color: #ffffff;">
|
||||||
<!-- <div class="divMune">
|
<!-- <div class="divMune">
|
||||||
<img src="/static/safesite/mystatic/images/fanhuiBut.png"
|
<img src="/static/safesite/mystatic/images/fanhuiBut.png"
|
||||||
style="float: right;width:20px;height:20px;text-align: center;margin-top: 10px;margin-right: 10px;"
|
style="float: right;width:20px;height:20px;text-align: center;margin-top: 10px;margin-right: 10px;"
|
||||||
|
@ -249,7 +249,9 @@
|
||||||
var headimgurl = $('#userindex').attr('headimgurl');
|
var headimgurl = $('#userindex').attr('headimgurl');
|
||||||
var issuper = {{ issuper }};
|
var issuper = {{ issuper }};
|
||||||
if (issuper == 1) { $('#setupb').show(); $('#bindwx').hide() }
|
if (issuper == 1) { $('#setupb').show(); $('#bindwx').hide() }
|
||||||
if ((openid == 0 || openid == 'None') && issuper != 1) { $('#wxdg').dialog(); } else { $('#bindwx').text('解绑微信'); };
|
if ((openid == 0 || openid == 'None') && issuper != 1) {
|
||||||
|
//$('#wxdg').dialog();
|
||||||
|
} else { $('#bindwx').text('解绑微信'); };
|
||||||
if (headimgurl != 0 && headimgurl != 'None' && issuper != 1) { $('#headimg').attr('src', headimgurl); }
|
if (headimgurl != 0 && headimgurl != 'None' && issuper != 1) { $('#headimg').attr('src', headimgurl); }
|
||||||
function logout() {
|
function logout() {
|
||||||
$.messager.confirm('系统提示', '您确定要退出本次登录吗?', function (r) {
|
$.messager.confirm('系统提示', '您确定要退出本次登录吗?', function (r) {
|
||||||
|
@ -334,7 +336,7 @@
|
||||||
}
|
}
|
||||||
$.get('menutree', function (data) {
|
$.get('menutree', function (data) {
|
||||||
var data = convertmenu(data)
|
var data = convertmenu(data)
|
||||||
data[0]['state'] = 'open'
|
// data[0]['state'] = 'open'
|
||||||
$('#menuTree').sidemenu({
|
$('#menuTree').sidemenu({
|
||||||
data: data,
|
data: data,
|
||||||
border: false,
|
border: false,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>安全生产管理系统</title>
|
<title>环保管理系统</title>
|
||||||
<link rel="icon" href="/static/safesite/favicon.ico" type="image/x-icon" />
|
<link rel="icon" href="/static/safesite/favicon.ico" type="image/x-icon" />
|
||||||
<meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
|
<meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
|
||||||
<meta name="author" content="Vincent Garreau" />
|
<meta name="author" content="Vincent Garreau" />
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
|
|
||||||
<div class="login" style="right:10%">
|
<div class="login" style="right:10%">
|
||||||
<div class="login-top">
|
<div class="login-top">
|
||||||
企业安全生产管理系统
|
企业环保管理系统
|
||||||
</div>
|
</div>
|
||||||
<form id="dlform" action="{% url 'login' %}" method="post">
|
<form id="dlform" action="{% url 'login' %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<div style="margin-left: 10px;margin-right:10px;overflow: hidden;">
|
<div style="margin-left: 10px;margin-right:10px;overflow: hidden;">
|
||||||
<div style="width:100%;height:300px;padding: 20px;">
|
<!-- <div style="width:100%;height:300px;padding: 20px;">
|
||||||
<div id="map1div" style="width: 33%; height:100%;float:left;"></div>
|
<div id="map1div" style="width: 33%; height:100%;float:left;"></div>
|
||||||
<div id="map2div" style="width: 66%; height:100%;float:left;"></div>
|
<div id="map2div" style="width: 66%; height:100%;float:left;"></div>
|
||||||
</div>
|
</div> -->
|
||||||
<div style="width:100%">
|
<div style="width:100%">
|
||||||
|
|
||||||
<div style="width:100%;height:160px;">
|
<div style="width:100%;height:140px;">
|
||||||
<div style="width: 19.5%;
|
<div style="width: 30%;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: 0.5%;
|
margin-left: 0.5%;
|
||||||
float: left;">
|
float: left;">
|
||||||
|
@ -56,7 +56,7 @@ float: left;">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 19.5%;
|
<div style="width: 30%;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: 0.5%;
|
margin-left: 0.5%;
|
||||||
float: left;">
|
float: left;">
|
||||||
|
@ -105,7 +105,7 @@ float: left;">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 19.5%;
|
<div style="width: 30%;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: 0.5%;
|
margin-left: 0.5%;
|
||||||
float: left;">
|
float: left;">
|
||||||
|
@ -155,113 +155,12 @@ float: left;">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 19.5%;
|
|
||||||
position: relative;
|
|
||||||
margin-left: 0.5%;
|
|
||||||
float: left;">
|
|
||||||
<div style="border-radius: 5px; display: block; margin: 10px; overflow:hidden;color: #FFFFFF; background-color: #ffb848;">
|
|
||||||
<div style="width: 80px;
|
|
||||||
height: 50px;
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-left: 5px;
|
|
||||||
margin-bottom: 18px;
|
|
||||||
font-size: 35px;
|
|
||||||
line-height: 35px;">
|
|
||||||
<img src="/static/safesite/mystatic/images/xwgc.png" style="width:80%;text-align: center;height:90%"
|
|
||||||
id="headimg" />
|
|
||||||
</div>
|
|
||||||
<div style=" position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
padding-right: 15px;">
|
|
||||||
<div style="padding-top: 10px;
|
|
||||||
text-align: right;
|
|
||||||
font-size: 32px;
|
|
||||||
line-height: 36px;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
font-weight: 300;" id="xwData">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div style="text-align: right;
|
|
||||||
font-size: 15px;
|
|
||||||
padding-top: 5px;">
|
|
||||||
本月行为观察
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<a url="observehtml" value="listall" style="background-color: #cb871b; clear: both;
|
|
||||||
display: block;
|
|
||||||
padding: 5px 10px 5px 10px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: 300;
|
|
||||||
font-size: 11px;
|
|
||||||
color: #fff;
|
|
||||||
opacity: 0.7;height: 20px;cursor: pointer;" title="行为观察" onclick="changehref(this)">
|
|
||||||
点击查看全部
|
|
||||||
<i style="background-position: -27px -10px;width: 14px;
|
|
||||||
height: 14px; vertical-align: top;background-repeat: no-repeat;margin-top: 4px;
|
|
||||||
float: right;background-image: url(/static/safesite/mystatic/images/syncfusion-icons-white.png);"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id = 'panelxdiv' style="width:98%;margin-left:1%;height:800px;" hidden=true>
|
||||||
<div style="width: 19.5%;
|
<div id="panelx" class="easyui-panel" data-options="iconCls:'fa-bar-chart'" >
|
||||||
position: relative;
|
|
||||||
margin-left: 0.5%;
|
|
||||||
float: left;">
|
|
||||||
<div style="border-radius: 5px; display: block; margin: 10px; overflow:hidden;color: #FFFFFF; background-color: #ec2a3b;">
|
|
||||||
<div style="width: 80px;
|
|
||||||
height: 50px;
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-left: 10px;
|
|
||||||
margin-bottom: 18px;
|
|
||||||
font-size: 35px;
|
|
||||||
line-height: 35px;">
|
|
||||||
<img src="/static/safesite/mystatic/images/wssj.png" style="width:80%;text-align: center;height:90%"
|
|
||||||
id="headimg" />
|
|
||||||
</div>
|
</div>
|
||||||
<div style=" position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
padding-right: 15px;">
|
|
||||||
<div style="padding-top: 10px;
|
|
||||||
text-align: right;
|
|
||||||
font-size: 32px;
|
|
||||||
line-height: 36px;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
font-weight: 300;" id="wsData">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div style="text-align: right;
|
|
||||||
font-size: 15px;
|
|
||||||
padding-top: 5px;">
|
|
||||||
本月未遂事件
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<a url="misshtml" value="listall" style="background-color: #cb1b1b; clear: both;
|
|
||||||
display: block;
|
|
||||||
padding: 5px 10px 5px 10px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: 300;
|
|
||||||
font-size: 11px;
|
|
||||||
color: #fff;
|
|
||||||
opacity: 0.7;height: 20px;" title="未遂事件" onclick="changehref(this)">
|
|
||||||
点击查看全部
|
|
||||||
<i style="background-position: -27px -10px;width: 14px;
|
|
||||||
height: 14px; vertical-align: top;background-repeat: no-repeat;margin-top: 4px;
|
|
||||||
float: right;background-image: url(/static/safesite/mystatic/images/syncfusion-icons-white.png);"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div style="width:100%;height:600px">
|
<div style="width:100%;height:600px">
|
||||||
|
|
||||||
|
@ -330,11 +229,8 @@ float: left;">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id = 'panelxdiv' style="width:98%;margin-left:1%;height:800px;" hidden=true>
|
|
||||||
<div id="panelx" class="easyui-panel" data-options="iconCls:'fa-bar-chart'" >
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -350,8 +246,8 @@ float: left;">
|
||||||
document.getElementById("yhData").innerHTML = data.yhnum;
|
document.getElementById("yhData").innerHTML = data.yhnum;
|
||||||
document.getElementById("pxData").innerHTML = data.monthpx;
|
document.getElementById("pxData").innerHTML = data.monthpx;
|
||||||
document.getElementById("ylData").innerHTML = data.ylnum;
|
document.getElementById("ylData").innerHTML = data.ylnum;
|
||||||
document.getElementById("xwData").innerHTML = data.xwnum;
|
// document.getElementById("xwData").innerHTML = data.xwnum;
|
||||||
document.getElementById("wsData").innerHTML = data.wsnum;
|
// document.getElementById("wsData").innerHTML = data.wsnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -363,22 +259,22 @@ float: left;">
|
||||||
});
|
});
|
||||||
|
|
||||||
//获取相关参数并绘图
|
//获取相关参数并绘图
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
type: "GET",
|
// type: "GET",
|
||||||
url: 'setup?a=setup',
|
// url: 'setup?a=setup',
|
||||||
datatype: 'json',
|
// datatype: 'json',
|
||||||
processData: false,
|
// processData: false,
|
||||||
contentType: false,
|
// contentType: false,
|
||||||
beforeSend: function () { },
|
// beforeSend: function () { },
|
||||||
success: function (data) {
|
// success: function (data) {
|
||||||
$.get('api/tool?a=servertime',function(res){
|
// $.get('api/tool?a=servertime',function(res){
|
||||||
if(res.code==1){
|
// if(res.code==1){
|
||||||
bindmap1('map1div', data,res.year,res.month);
|
// bindmap1('map1div', data,res.year,res.month);
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
bindmap2('map2div', data);
|
// bindmap2('map2div', data);
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% load myfilter %}
|
{% load myfilter %}
|
||||||
|
|
|
@ -130,6 +130,9 @@
|
||||||
else if (data.type == 'zy') {
|
else if (data.type == 'zy') {
|
||||||
html = html + "<p>危险作业数量:" + data.num.toString() + "</p>" + "<p><a href='#' onclick='opendetail(" + data.id.toString() + ")'>查看详情</a></p>"
|
html = html + "<p>危险作业数量:" + data.num.toString() + "</p>" + "<p><a href='#' onclick='opendetail(" + data.id.toString() + ")'>查看详情</a></p>"
|
||||||
}
|
}
|
||||||
|
else if (data.type == 'pk') {
|
||||||
|
html = html + "<p>排口编号:" + data.number+ "</p>" + "<p><a href='#' onclick='opendetail(" + data.id.toString() + ")'>查看详情</a></p>"
|
||||||
|
}
|
||||||
content.innerHTML = html;
|
content.innerHTML = html;
|
||||||
//设置overlay的显示位置
|
//设置overlay的显示位置
|
||||||
overlay.setPosition(e.coordinate);
|
overlay.setPosition(e.coordinate);
|
||||||
|
@ -208,6 +211,7 @@
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
src = '/static/safesite/mystatic/images/icon1.png'
|
src = '/static/safesite/mystatic/images/icon1.png'
|
||||||
|
anchor = [0.9, 50]
|
||||||
}
|
}
|
||||||
return new ol.style.Style({
|
return new ol.style.Style({
|
||||||
/**{olx.style.IconOptions}类型*/
|
/**{olx.style.IconOptions}类型*/
|
||||||
|
@ -249,6 +253,17 @@
|
||||||
pointFeature.setStyle(createPointStyle(pointFeature));
|
pointFeature.setStyle(createPointStyle(pointFeature));
|
||||||
source.addFeature(pointFeature)
|
source.addFeature(pointFeature)
|
||||||
}
|
}
|
||||||
|
function setPointOnly(i) {
|
||||||
|
var pointFeature = new ol.Feature({
|
||||||
|
geometry: new ol.geom.Point(i.location),
|
||||||
|
id: i.id,
|
||||||
|
name: i.name,
|
||||||
|
type: i.type2,
|
||||||
|
number: i.number
|
||||||
|
});
|
||||||
|
pointFeature.setStyle(createPointStyle(pointFeature));
|
||||||
|
source.addFeature(pointFeature)
|
||||||
|
}
|
||||||
function setPolygon(i) {
|
function setPolygon(i) {
|
||||||
var polygonFeature = new ol.Feature({
|
var polygonFeature = new ol.Feature({
|
||||||
geometry: new ol.geom.Polygon(i.polygon),
|
geometry: new ol.geom.Polygon(i.polygon),
|
||||||
|
@ -261,9 +276,9 @@
|
||||||
source.addFeature(polygonFeature)
|
source.addFeature(polygonFeature)
|
||||||
}
|
}
|
||||||
function opendetail(id) {
|
function opendetail(id) {
|
||||||
closepopup()
|
//closepopup()
|
||||||
var myw = screen.availWidth * 0.5;
|
//var myw = screen.availWidth * 0.5;
|
||||||
opendg('区域详情', 'html/areadetail?id=' + id, myw)
|
//opendg('区域详情', 'html/areadetail?id=' + id, myw)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,12 +112,12 @@
|
||||||
<ul id="addImage" class="imgul"></ul>
|
<ul id="addImage" class="imgul"></ul>
|
||||||
<HR width="480px" color='blue' SIZE=1 align='left'>
|
<HR width="480px" color='blue' SIZE=1 align='left'>
|
||||||
</div>
|
</div>
|
||||||
<div class='labeldiv'>请确认以下风险分析和安全措施是否就绪</div>
|
<div class='labeldiv'>请确认以下风险分析和环保措施是否就绪</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" name="fxcs" value={{x.id}}><input>
|
<input type="checkbox" name="fxcs" value={{x.id}}><input>
|
||||||
<div>
|
<div>
|
||||||
<p>风险分析:{{x.fxfx}}</p>
|
<p>风险分析:{{x.fxfx}}</p>
|
||||||
<p>安全措施:{{x.aqcs}}</p>
|
<p>环保措施:{{x.aqcs}}</p>
|
||||||
<p>措施类型:{{x.cslx}}</p>
|
<p>措施类型:{{x.cslx}}</p>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</table>
|
</table>
|
||||||
<div class="labeldiv">风险分析和安全措施</div>
|
<div class="labeldiv">风险分析和环保措施</div>
|
||||||
<table class='detailtable'>
|
<table class='detailtable'>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<table name="" id="partaqytable" class='easyui-datagrid' title="安全员" data-options="
|
<table name="" id="partaqytable" class='easyui-datagrid' title="环保员" data-options="
|
||||||
rownumbers:true,
|
rownumbers:true,
|
||||||
singleSelect:true,
|
singleSelect:true,
|
||||||
method:'get',
|
method:'get',
|
||||||
|
|
|
@ -281,7 +281,7 @@
|
||||||
//bindmap3('map3', _year, _month);
|
//bindmap3('map3', _year, _month);
|
||||||
bindmap3_o('map3', { 'year': _year, 'month': _month, 'part': part })
|
bindmap3_o('map3', { 'year': _year, 'month': _month, 'part': part })
|
||||||
//bindmap4('map4', _year, _month);
|
//bindmap4('map4', _year, _month);
|
||||||
bindmap4_o('map4', { 'year': _year, 'month': _month, 'part': part })
|
// bindmap4_o('map4', { 'year': _year, 'month': _month, 'part': part })
|
||||||
bindmap5('map5', { 'year': _year, 'month': _month, 'part': part });
|
bindmap5('map5', { 'year': _year, 'month': _month, 'part': part });
|
||||||
bindmap6('map6', { 'year': _year, 'month': _month, 'part': part });
|
bindmap6('map6', { 'year': _year, 'month': _month, 'part': part });
|
||||||
bindmapgclx('map7', { 'year': _year, 'month': _month, 'part': part });
|
bindmapgclx('map7', { 'year': _year, 'month': _month, 'part': part });
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox" style="width:110px;height:22px" />
|
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox" style="width:110px;height:22px" />
|
||||||
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox" style="width:110px;height:22px" />
|
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox" style="width:110px;height:22px" />
|
||||||
<label>发现部门</label><input id="sfxbm" name="fxbm" style="width:200px;height:22px" />
|
<label>发现部门</label><input id="sfxbm" name="fxbm" style="width:200px;height:22px" />
|
||||||
<a onclick="yhbztsearch()" class='easyui-linkbutton' iconCls='fa-search' plain=true>查询</a></form>
|
<a onclick="yhbztsearch()" class='easyui-linkbutton' iconCls='fa-search' plain=true>查询</a>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="width:100%;height:500px;padding: 20px">
|
<div style="width:100%;height:500px;padding: 20px">
|
||||||
|
@ -48,9 +49,12 @@
|
||||||
<a onclick="fxrpmexport()" class='easyui-linkbutton' iconCls='fa-upload' plain=true>导出</a>
|
<a onclick="fxrpmexport()" class='easyui-linkbutton' iconCls='fa-upload' plain=true>导出</a>
|
||||||
<div>
|
<div>
|
||||||
<label>发现部门</label><input id="sfxbm2" name="fxbm" style="width:180px;height:22px" />
|
<label>发现部门</label><input id="sfxbm2" name="fxbm" style="width:180px;height:22px" />
|
||||||
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox" style="width:80px;height:22px" />
|
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox"
|
||||||
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox" style="width:80px;height:22px" />
|
style="width:80px;height:22px" />
|
||||||
<label>检查类型</label><input id="sjclx" name="jclx" class="easyui-combobox" style="width:100px;height:22px" data-options="
|
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox"
|
||||||
|
style="width:80px;height:22px" />
|
||||||
|
<label>检查类型</label><input id="sjclx" name="jclx" class="easyui-combobox" style="width:100px;height:22px"
|
||||||
|
data-options="
|
||||||
method: 'get',
|
method: 'get',
|
||||||
valueField:'value',
|
valueField:'value',
|
||||||
textField:'text',
|
textField:'text',
|
||||||
|
@ -84,8 +88,10 @@
|
||||||
<a onclick="zgrpmexport()" class='easyui-linkbutton' iconCls='fa-upload' plain=true>导出</a>
|
<a onclick="zgrpmexport()" class='easyui-linkbutton' iconCls='fa-upload' plain=true>导出</a>
|
||||||
<div>
|
<div>
|
||||||
<label>整改人</label><input class="easyui-textbox" name="zgr" style="width:80px;height:22px" />
|
<label>整改人</label><input class="easyui-textbox" name="zgr" style="width:80px;height:22px" />
|
||||||
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox" style="width:80px;height:22px" />
|
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox"
|
||||||
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox" style="width:80px;height:22px" />
|
style="width:80px;height:22px" />
|
||||||
|
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox"
|
||||||
|
style="width:80px;height:22px" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -125,7 +131,7 @@
|
||||||
function yhbztsearch() {
|
function yhbztsearch() {
|
||||||
var querydata = $('#yhbztf').serializeJSON();
|
var querydata = $('#yhbztf').serializeJSON();
|
||||||
bindmap3_o('yhlbt', querydata)
|
bindmap3_o('yhlbt', querydata)
|
||||||
bindmap4_o('yhpgt', querydata)
|
// bindmap4_o('yhpgt', querydata)
|
||||||
bindmap8('yhztt', querydata)
|
bindmap8('yhztt', querydata)
|
||||||
bindmap7('yhqst', querydata);
|
bindmap7('yhqst', querydata);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +139,7 @@
|
||||||
var year = now.getFullYear();
|
var year = now.getFullYear();
|
||||||
var month = now.getMonth() + 1;
|
var month = now.getMonth() + 1;
|
||||||
bindmap3_o('yhlbt', { 'year': year, 'month': month });
|
bindmap3_o('yhlbt', { 'year': year, 'month': month });
|
||||||
bindmap4_o('yhpgt', { 'year': year, 'month': month });
|
// bindmap4_o('yhpgt', { 'year': year, 'month': month });
|
||||||
bindmap7('yhqst');
|
bindmap7('yhqst');
|
||||||
bindmap8('yhztt');
|
bindmap8('yhztt');
|
||||||
function fxrpmexport() {
|
function fxrpmexport() {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div data-options="region:'center',border:false" style="height:100%;">
|
<div data-options="region:'center',border:false" style="height:100%;">
|
||||||
<div style="height:50%">
|
<div style="height:50%">
|
||||||
<table id="fxcstable" style="width:auto;height:100%;" title='风险分析和安全措施'></table>
|
<table id="fxcstable" style="width:auto;height:100%;" title='风险分析和环保措施'></table>
|
||||||
<div id="fxcsbar" style="padding:6px;height:auto">
|
<div id="fxcsbar" style="padding:6px;height:auto">
|
||||||
|
|
||||||
{% load myfilter %}
|
{% load myfilter %}
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
columns: [[
|
columns: [[
|
||||||
{ field: 'id', title: 'ID', hidden: true },
|
{ field: 'id', title: 'ID', hidden: true },
|
||||||
{ field: 'fxfx', title: '风险分析', width: 40 },
|
{ field: 'fxfx', title: '风险分析', width: 40 },
|
||||||
{ field: 'aqcs', title: '安全措施', width: 120 },
|
{ field: 'aqcs', title: '环保措施', width: 120 },
|
||||||
{ field: 'cslx', title: '措施类型', width: 80 },
|
{ field: 'cslx', title: '措施类型', width: 80 },
|
||||||
]]
|
]]
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue