xiugai
This commit is contained in:
parent
6e0108f2ea
commit
e7a142bcd3
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Generated by Django 2.2.8 on 2020-08-12 20:46
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('safesite', '0341_auto_20200811_2113'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
# migrations.RemoveField(
|
||||||
|
# model_name='companyinfo',
|
||||||
|
# name='liaison_fax',
|
||||||
|
# ),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='map',
|
||||||
|
name='type',
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Generated by Django 2.2.8 on 2020-08-12 21:04
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('safesite', '0342_auto_20200812_2046'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
# migrations.RemoveField(
|
||||||
|
# model_name='companyinfo',
|
||||||
|
# name='liaison_fax',
|
||||||
|
# ),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='riskact',
|
||||||
|
name='kind',
|
||||||
|
field=models.IntegerField(choices=[(1, '工厂'), (2, '矿山')], default=1, verbose_name='类型'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -58,10 +58,10 @@ class Partment(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class Map(models.Model):
|
class Map(models.Model):
|
||||||
type_choices = (
|
# type_choices = (
|
||||||
(1, '工厂'),
|
# (1, '工厂'),
|
||||||
(2, '矿山'),
|
# (2, '矿山'),
|
||||||
)
|
# )
|
||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
name = models.CharField(max_length=50)
|
name = models.CharField(max_length=50)
|
||||||
pic = models.CharField(max_length=1000, blank=True)
|
pic = models.CharField(max_length=1000, blank=True)
|
||||||
|
|
@ -69,7 +69,7 @@ class Map(models.Model):
|
||||||
'self', blank=True, null=True, on_delete=models.CASCADE)
|
'self', blank=True, null=True, on_delete=models.CASCADE)
|
||||||
link = models.CharField(max_length=200, blank=True)
|
link = models.CharField(max_length=200, blank=True)
|
||||||
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE)
|
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE)
|
||||||
type = models.IntegerField('地图类型', default=1, choices=type_choices)
|
# type = models.IntegerField('地图类型', default=1, choices=type_choices)
|
||||||
default = models.IntegerField(default=0)
|
default = models.IntegerField(default=0)
|
||||||
deletemark = models.IntegerField(default='1')
|
deletemark = models.IntegerField(default='1')
|
||||||
|
|
||||||
|
|
@ -852,9 +852,14 @@ class Relation(models.Model): # 各模块关系表,没用到
|
||||||
|
|
||||||
|
|
||||||
class RiskAct(models.Model): # 风险点表
|
class RiskAct(models.Model): # 风险点表
|
||||||
|
kind_choices = (
|
||||||
|
(1, '工厂'),
|
||||||
|
(2, '矿山'),
|
||||||
|
)
|
||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
area = models.ForeignKey(Area, on_delete=models.CASCADE,
|
area = models.ForeignKey(Area, on_delete=models.CASCADE,
|
||||||
null=True, blank=True, related_name='riskactarea')
|
null=True, blank=True, related_name='riskactarea')
|
||||||
|
kind = models.IntegerField('类型', default=1, choices=kind_choices)
|
||||||
place = models.CharField(max_length=50, null=True, blank=True)
|
place = models.CharField(max_length=50, null=True, blank=True)
|
||||||
type = models.ForeignKey(
|
type = models.ForeignKey(
|
||||||
Dickey, on_delete=models.CASCADE, null=True, blank=True)
|
Dickey, on_delete=models.CASCADE, null=True, blank=True)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
data-options="iconCls:'fa-upload',plain:true">导入风险</a>
|
data-options="iconCls:'fa-upload',plain:true">导入风险</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request|has_permission:'b_riskact_add' %}
|
{% if request|has_permission:'b_riskact_add' %}
|
||||||
<a onclick="opendg('新增风险','html/riskact/add')" class="easyui-linkbutton"
|
<a onclick="opendg('新增风险','html/riskact/add/{{kind}}/')" class="easyui-linkbutton"
|
||||||
data-options="iconCls:'fa-plus',plain:true">新增</a>
|
data-options="iconCls:'fa-plus',plain:true">新增</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request|has_permission:'b_riskact_change' %}
|
{% if request|has_permission:'b_riskact_change' %}
|
||||||
|
|
@ -68,6 +68,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
var kind = {{kind}}
|
||||||
$('#zrbm').combotree({
|
$('#zrbm').combotree({
|
||||||
url: 'parthandle?a=tree', loadFilter: function (rows) { return convert(rows); }, onSelect: function (node) {
|
url: 'parthandle?a=tree', loadFilter: function (rows) { return convert(rows); }, onSelect: function (node) {
|
||||||
$('#zrr').combobox({ url: 'getuser?partid=' + node.id + '&a=combobox', })
|
$('#zrr').combobox({ url: 'getuser?partid=' + node.id + '&a=combobox', })
|
||||||
|
|
@ -78,7 +79,7 @@
|
||||||
$('#riskacttable').datagrid('load',querydata);
|
$('#riskacttable').datagrid('load',querydata);
|
||||||
}
|
}
|
||||||
$('#riskacttable').datagrid({
|
$('#riskacttable').datagrid({
|
||||||
url: 'api/riskact?a=listall',
|
url: 'api/riskact?a=listall&kind='+kind,
|
||||||
singleSelect:true,
|
singleSelect:true,
|
||||||
rownumbers: true,
|
rownumbers: true,
|
||||||
fitColumns: true,
|
fitColumns: true,
|
||||||
|
|
@ -112,7 +113,7 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#risktable').datagrid({
|
$('#risktable').datagrid({
|
||||||
url: 'api/risk?a=listall',
|
url: 'api/risk?a=listall&kind='+kind,
|
||||||
rownumbers: true,
|
rownumbers: true,
|
||||||
singleSelect: true,
|
singleSelect: true,
|
||||||
striped: true,
|
striped: true,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
},"
|
},"
|
||||||
required=true>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:5px">
|
<div style="margin-bottom:5px">
|
||||||
<input id="fxdlx" class="easyui-combobox" name="type" style="width:480px" data-options="
|
<input id="fxdlx" class="easyui-combobox" name="type" style="width:480px" data-options="
|
||||||
|
|
@ -74,9 +74,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
var kind = {{kind}}
|
||||||
$("#zrbm").combotree({ url: 'parthandle?a=tree', onSelect: function (node) { $('#zrr').combobox({ url: 'getuser?partid=' + node.id + '&a=combobox', }); } });
|
$("#zrbm").combotree({ url: 'parthandle?a=tree', onSelect: function (node) { $('#zrr').combobox({ url: 'getuser?partid=' + node.id + '&a=combobox', }); } });
|
||||||
function fxdsubmitForm() {
|
function fxdsubmitForm() {
|
||||||
var data = $('#fxdff').serializeJSON();
|
var data = $('#fxdff').serializeJSON();
|
||||||
|
data['kind'] = kind
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: 'api/riskact?a=add',
|
url: 'api/riskact?a=add',
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
},"
|
},"
|
||||||
required=true>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:5px">
|
<div style="margin-bottom:5px">
|
||||||
<input id="fxdlx" class="easyui-combobox" name="type" style="width:480px" data-options="
|
<input id="fxdlx" class="easyui-combobox" name="type" style="width:480px" data-options="
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
<option value="3">每周一次</option>
|
<option value="3">每周一次</option>
|
||||||
<option value="2">每天一次(24h)</option>
|
<option value="2">每天一次(24h)</option>
|
||||||
<option value="1">每班一次(8h)</option>
|
<option value="1">每班一次(8h)</option>
|
||||||
|
<option value="0">暂停</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top:6px">
|
<div style="margin-top:6px">
|
||||||
|
|
@ -53,7 +54,7 @@
|
||||||
{ field: 'ck', checkbox: true },
|
{ field: 'ck', checkbox: true },
|
||||||
{ field: 'tasktype', title: '排查频次', width: 100, formatter: function (value, row, index) {
|
{ field: 'tasktype', title: '排查频次', width: 100, formatter: function (value, row, index) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 0: return '未制定'; break;
|
case 0: return '未制定/暂停'; break;
|
||||||
case 1: return '每班一次(8h)'; break;
|
case 1: return '每班一次(8h)'; break;
|
||||||
case 2: return '每天一次(24h)'; break;
|
case 2: return '每天一次(24h)'; break;
|
||||||
case 3: return '每周一次'; break;
|
case 3: return '每周一次'; break;
|
||||||
|
|
@ -70,6 +71,7 @@
|
||||||
{ field: 'name', title: '风险点名称', width: 80 },
|
{ field: 'name', title: '风险点名称', width: 80 },
|
||||||
{ field: 'area__name', title: '区域', width: 100 },
|
{ field: 'area__name', title: '区域', width: 100 },
|
||||||
{ field: 'type__dickeyname', title: '风险点类型', width: 100 },
|
{ field: 'type__dickeyname', title: '风险点类型', width: 100 },
|
||||||
|
{ field: 'tasktype', title: '任务状态', width: 100 },
|
||||||
// { field: 'num', title: '风险数量', width: 100 },
|
// { field: 'num', title: '风险数量', width: 100 },
|
||||||
|
|
||||||
]],
|
]],
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,8 @@ urlpatterns = [
|
||||||
path('html/equipment',views.equipment),
|
path('html/equipment',views.equipment),
|
||||||
path('html/inspectitem',views.inspectitem),
|
path('html/inspectitem',views.inspectitem),
|
||||||
path('html/inspect',views.inspect),
|
path('html/inspect',views.inspect),
|
||||||
path('html/risk/<int:id>/',views.risk),
|
path('html/risk/<int:kind>/',views.risk),
|
||||||
path('html/riskact/add',views.riskactadd),
|
path('html/riskact/add/<int:kind>/',views.riskactadd),
|
||||||
path('html/riskact/edit/<int:id>/',views.riskactedit),
|
path('html/riskact/edit/<int:id>/',views.riskactedit),
|
||||||
path('html/risk/add/<int:id>/',views.riskadd),
|
path('html/risk/add/<int:id>/',views.riskadd),
|
||||||
path('html/task',views.task),
|
path('html/task',views.task),
|
||||||
|
|
|
||||||
|
|
@ -196,16 +196,16 @@ def riskactedit(req, id):
|
||||||
return render(req, 'riskactedit.html', {'id': id})
|
return render(req, 'riskactedit.html', {'id': id})
|
||||||
|
|
||||||
|
|
||||||
def riskactadd(req):
|
def riskactadd(req, kind):
|
||||||
return render(req, 'riskactadd.html')
|
return render(req, 'riskactadd.html', {'kind':kind})
|
||||||
|
|
||||||
|
|
||||||
def riskadd(req, id):
|
def riskadd(req, id):
|
||||||
return render(req, 'riskadd.html', {'id': id})
|
return render(req, 'riskadd.html', {'id': id})
|
||||||
|
|
||||||
|
|
||||||
def risk(req, id):
|
def risk(req, kind):
|
||||||
return render(req, 'risk.html', {'id': id})
|
return render(req, 'risk.html', {'kind': kind})
|
||||||
|
|
||||||
|
|
||||||
def inspect(req):
|
def inspect(req):
|
||||||
|
|
@ -6923,10 +6923,12 @@ def apiriskact(req):
|
||||||
companyid = getcompany(userid)
|
companyid = getcompany(userid)
|
||||||
if a == 'listall':
|
if a == 'listall':
|
||||||
a = RiskAct.objects.filter(usecomp__partid=companyid)
|
a = RiskAct.objects.filter(usecomp__partid=companyid)
|
||||||
if req.GET.get('area'):
|
if req.GET.get('area', None):
|
||||||
a = a.filter(area__id=req.GET.get('area'))
|
a = a.filter(area__id=req.GET.get('area'))
|
||||||
if req.GET.get('type'):
|
if req.GET.get('type', None):
|
||||||
a = a.filter(type__dickeyid=req.GET.get('type'))
|
a = a.filter(type__dickeyid=req.GET.get('type'))
|
||||||
|
if req.GET.get('kind', None):
|
||||||
|
a = a.filter(kind=req.GET.get('kind'))
|
||||||
total = a.count()
|
total = a.count()
|
||||||
startnum, endnum = fenye(req)
|
startnum, endnum = fenye(req)
|
||||||
a = a.order_by('area')[startnum:endnum].values('id', 'area__name', 'type__dickeyname',
|
a = a.order_by('area')[startnum:endnum].values('id', 'area__name', 'type__dickeyname',
|
||||||
|
|
@ -6955,7 +6957,8 @@ def apiriskact(req):
|
||||||
elif a == 'add':
|
elif a == 'add':
|
||||||
data = json.loads(req.body.decode('utf-8'))
|
data = json.loads(req.body.decode('utf-8'))
|
||||||
obj = RiskAct()
|
obj = RiskAct()
|
||||||
obj.area = Area.objects.get(id=data['area'])
|
if 'area' in data and data['area']:
|
||||||
|
obj.area = Area.objects.get(id=data['area'])
|
||||||
obj.type = Dickey.objects.get(dickeyid=data['type'])
|
obj.type = Dickey.objects.get(dickeyid=data['type'])
|
||||||
obj.name = data['name']
|
obj.name = data['name']
|
||||||
obj.place = data['place'] if data['place'] else None
|
obj.place = data['place'] if data['place'] else None
|
||||||
|
|
@ -6964,6 +6967,8 @@ def apiriskact(req):
|
||||||
obj.zrbm = Partment.objects.get(partid=data['zrbm'])
|
obj.zrbm = Partment.objects.get(partid=data['zrbm'])
|
||||||
obj.zrr = User.objects.get(userid=data['zrr'])
|
obj.zrr = User.objects.get(userid=data['zrr'])
|
||||||
obj.group = Group.objects.get(groupid=data['group'])
|
obj.group = Group.objects.get(groupid=data['group'])
|
||||||
|
if 'kind' in data and data['kind']:
|
||||||
|
obj.kind = data['kind']
|
||||||
obj.save()
|
obj.save()
|
||||||
obj.qrcode = makeqr_riskact(
|
obj.qrcode = makeqr_riskact(
|
||||||
'https://safeyun.ctcshe.com/miniprogram/riskact?id='+str(obj.id))
|
'https://safeyun.ctcshe.com/miniprogram/riskact?id='+str(obj.id))
|
||||||
|
|
@ -7049,6 +7054,8 @@ def apirisk(req):
|
||||||
a = a.filter(riskact__id=req.GET.get('riskact'))
|
a = a.filter(riskact__id=req.GET.get('riskact'))
|
||||||
total = a.count()
|
total = a.count()
|
||||||
else:
|
else:
|
||||||
|
if req.GET.get('kind', None):
|
||||||
|
a = a.filter(riskact__kind=req.GET.get('kind'))
|
||||||
startnum, endnum = fenye(req)
|
startnum, endnum = fenye(req)
|
||||||
total = a.count()
|
total = a.count()
|
||||||
a = a[startnum:endnum]
|
a = a[startnum:endnum]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue