This commit is contained in:
caoqianming 2021-08-26 22:44:21 +08:00
commit fee7fb830d
7 changed files with 111 additions and 43 deletions

View File

@ -0,0 +1,29 @@
# Generated by Django 2.2.8 on 2021-08-26 20:18
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('safesite', '0385_contingencyplan_createby'),
]
operations = [
migrations.AddField(
model_name='checkjob',
name='jctim2',
field=models.DateTimeField(blank=True, null=True, verbose_name='检查结束时间'),
),
migrations.AlterField(
model_name='examtestdetail',
name='examtest',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='detail_examtest', to='safesite.ExamTest'),
),
migrations.AlterField(
model_name='trainuser',
name='isnew',
field=models.IntegerField(default=0, verbose_name='是否新参加'),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.8 on 2021-08-26 20:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('safesite', '0386_auto_20210826_2018'),
]
operations = [
migrations.RenameField(
model_name='checkjob',
old_name='jctim2',
new_name='jctime2',
),
]

View File

@ -1382,7 +1382,7 @@ class Checkjob(models.Model):
checkquestion=models.TextField(null=True)#检查发现的问题
zgtime=models.DateTimeField(null=True, blank=True)#整改时间
jctime=models.DateTimeField(null=True, blank=True)#检查开始时间
jctim2 = models.DateTimeField('检查结束时间', null=True, blank=True)
jctime2 = models.DateTimeField('检查结束时间', null=True, blank=True)
zguser=models.ForeignKey(User,on_delete=models.CASCADE,null=True,)#整改人
createuser = models.ForeignKey(User,related_name='chuangjian',on_delete=models.CASCADE,null=True)#创建人
createdate = models.DateTimeField(default = timezone.now)#创建时间

View File

@ -16,12 +16,14 @@
{% if request|has_permission:'b_checkjob_add' %}
<a id="addtask" class="easyui-linkbutton" onclick="addcheckrw()" data-options="iconCls: 'fa-plus',plain:true">执行任务</a>
{% endif %}
<a id="deljob" class="easyui-linkbutton" onclick="deljob()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% if request|has_permission:'b_checkjob_detail' %}
<a id="detailprg" class="easyui-linkbutton" onclick="detailtask()" data-options="iconCls: 'fa-info-circle',plain:true">详情</a>
<a id="detailprg" class="easyui-linkbutton" onclick="detailtask()" data-options="iconCls: 'fa-info-circle',plain:true">验收详情</a>
{% endif %}
{% if request|has_permission:'b_checkjob_del' %}
<a id="deljob" class="easyui-linkbutton" onclick="deljob()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% endif %}
@ -76,21 +78,20 @@
{ field: 'starttime', title: '任务开始时间', width: 100 },
{ field: 'endtime', title: '任务结束时间', width: 100 },
{
field: 'taskstate', title: '检查状态', width: 100, formatter: function (value, row, index) {
field: 'taskstate', title: '工作状态', width: 100, formatter: function (value, row, index) {
switch (value) {
case 1: return '正在整改中'; break;
case 2: return '已整改完成'; break;
case 3: return '任务关闭'; break;
case 4: return '执行'; break;
case 4: return '执行'; break;
}
}, styler: function (value, row, index) {
switch (value) {
case 1: return 'color:green;font-weight:bold'; break;
case 2: return 'color:red;font-weight:bold'; break;
case 3: return 'color:yellow;font-weight:bold'; break;
case 4: return 'color:blue;font-weight:bold'; break;
case 1: return 'color:red;font-weight:bold'; break;
case 2: return 'color:darkblue;font-weight:bold'; break;
case 3: return 'color:green;font-weight:bold'; break;
case 4: return 'color:orange;font-weight:bold'; break;
}}},
@ -100,9 +101,7 @@
{ field: 'yanshou', title: '验收时间', width: 100 },
//
//{ field: 'zguser__name', title: '整改人', width: 100 },
//{ field: 'zgtime', title: '整改时间', width: 100 },
//{ field: 'zgtime', title: '整改时间', width: 100 },
]]
});

View File

@ -125,7 +125,7 @@
</tr>
<tr>
<td>检查状态</td>
<td>工作状态</td>
<td>
<input type="radio" name="taskstate" value="2">已整改完成</input>
@ -174,6 +174,7 @@
$('#zgjg').textbox('setValue', data.zgjg)
$('#content').textbox('setValue', data.content)
$('#jctime').datetimebox('setValue', data.jctime)
$('#jctime2').datetimebox('setValue', data.jctime2)
$('#zgtime').datetimebox('setValue', data.zgtime)
var yhtp = data.yhtp;
@ -398,7 +399,7 @@
if (data.code == 1) {
$('#jobtab').datagrid('reload');
$("#dd").dialog("close");
} else { $.messager.alert('提示', '失败!'); }
} else { $.messager.alert('提示', data.msg); }
$('#submitb').linkbutton('enable');
},
});

View File

@ -2,16 +2,18 @@
<script type="text/html" id="text">
{% verbatim %}
<div id='southdiv' data-options="region:'south'" style="height:50px;text-align:center;padding:5px">
{{if taskstate==2}}
<a id="yanshou" onclick="yanshou()" class="easyui-linkbutton" data-options="iconCls: 'fa-download'">验收</a>
{{/if}}
<a iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">关闭</a>
</div>
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
<div style="text-align:center;font-size: 24px;font-weight: bold;margin-bottom: 20px;">{{checktask__checktaskname}}</div>
<table class='detailtable' style="text-align:center;">
<tr>
<td style="font-weight: bold;">检查人员</td>
<td style="font-weight: bold;">检查人员</td>
<td>{{checkname__username}}/{{checkname__name}}</td>
<td style="font-weight: bold;">检查频率</td>
<td style="font-weight: bold;">检查频率</td>
{{if checktask__tasktype==1}}
<td>每天一次</td>
{{else if checktask__tasktype==2}}
@ -29,23 +31,29 @@
</tr>
<tr>
<td style="font-weight: bold;">检查时间段:</td>
<td style="font-weight: bold;">任务时间段</td>
<td colspan="3">{{starttime| dateFormat 'yyyy-MM-dd hh:mm:ss'}}到{{endtime| dateFormat 'yyyy-MM-dd hh:mm:ss'}}</td>
</tr>
<tr>
<td style="font-weight: bold;">提交时间:</td>
<td style="font-weight: bold;">检查时间段</td>
<td colspan="3">{{jctime| dateFormat 'yyyy-MM-dd hh:mm:ss'}}到{{jctime2| dateFormat 'yyyy-MM-dd hh:mm:ss'}}</td>
</tr>
<tr>
<td style="font-weight: bold;">提交时间</td>
<td>{{jctime}}</td>
<td style="font-weight: bold;">整改时间:</td>
<td style="font-weight: bold;">整改时间</td>
<td>{{zgtime}}</td>
</tr>
<tr style="height:80px">
<td style="font-weight: bold;">检查内容</td>
<td style="font-weight: bold;">检查内容</td>
<td colspan="3">{{checktask__checktype__checkcontent}}</td>
</tr>
<tr style="height:80px">
<td style="font-weight: bold;">检查问题:</td>
<td style="font-weight: bold;">检查记录</td>
<td colspan="3">{{checkquestion}}</td>
</tr>
<tr>
@ -62,7 +70,7 @@
</tr>
<tr style="height:80px">
<td style="font-weight: bold;">整改情况</td>
<td style="font-weight: bold;">整改情况</td>
<td colspan="3">{{zgjg}}</td>
</tr>
<tr>
@ -79,53 +87,61 @@
</tr>
<tr>
<td style="font-weight: bold;">检查状态:</td>
<td>{{taskstate==1?'正在检查':'检查完毕'}}</td>
<td style="font-weight: bold;">工作状态</td>
{{if taskstate==1}}
<td style="color:red;">整改中</td>
{{else if taskstate==2}}
<td style="color:darkblue;">整改完成</td>
{{else if taskstate==3}}
<td style="color:green;">任务关闭</td>
{{else if taskstate==4}}
<td style="color:orange;">待执行</td>
{{/if}}
<td style="font-weight: bold;">检查地点:</td>
<td style="font-weight: bold;">检查地点</td>
<td>{{checktask__checkplace}}</td>
</tr>
<!--<tr style="height:80px">
<td style="font-weight: bold;">整改要求:</td>
<td style="font-weight: bold;">整改要求</td>
<td colspan="3">{{zgyq}}</td>
</tr>
<tr style="height:80px">
<td style="font-weight: bold;">整改结果</td>
<td style="font-weight: bold;">整改结果</td>
<td colspan="3">{{zgjg}}</td>
</tr>
<tr>
<td style="font-weight: bold;">整改人</td>
<td style="font-weight: bold;">整改人</td>
<td>{{zguser__username}}</td>
<td style="font-weight: bold;">整改时间</td>
<td style="font-weight: bold;">整改时间</td>
<td>{{zgtime| dateFormat 'yyyy-MM-dd hh:mm:ss'}}</td>
</tr>-->
<tr>
<td style="font-weight: bold;">经验总结</td>
<td style="font-weight: bold;">经验总结</td>
<td colspan="3">{{content}}</td>
</tr>
<tr>
<td style="font-weight: bold;">涉及人员</td>
<td style="font-weight: bold;">涉及人员</td>
<td colspan="3">{{bcfr==[]?'kkl':bcfr}}</td>
</tr>
<tr>
<td style="font-weight: bold;">验收人</td>
<td style="font-weight: bold;">验收人</td>
<td>{{yanshouren__name}}</td>
<td style="font-weight: bold;">验收时间</td>
<td style="font-weight: bold;">验收时间</td>
<td>{{yanshou}}</td>
</tr>
</table>
<div style="font-size:25px;background-color:aquamarine;margin-top:30px;">
{{yanshou==null?'本任务还没有验收,需要发布人验收':'该任务已经验收完毕,验收人是:'}}{{yanshouren__username}}
{{yanshou==null?'本任务还没有验收,需要发布人验收':'该任务已经验收完毕,验收人是:'}}{{yanshouren__name}}
</div>
</div>
{% endverbatim %}
@ -136,6 +152,7 @@
var state;
var id = {{ id }};
template.defaults.imports.dateFormat = function (date, format) {
if(date==null) return "";
date = new Date(date);
var map = {
"M": date.getMonth() + 1, //月份
@ -188,7 +205,7 @@
if (data.code == 1) {
$('#jobtab').datagrid('reload');
$("#dd").dialog("close");
} else { $.messager.alert('提示', '失败!'); }
} else { $.messager.alert('提示', data.msg); }
$('#submitb').linkbutton('enable');
}

View File

@ -8683,7 +8683,7 @@ def checkprojects(req):
total = a.count()
startnum, endnum = fenye(req)
a = a.order_by('-starttime')[startnum:endnum].values('id','checkname__name','checktask__checktaskname','jobstate','starttime','endtime','yanshou','checkquestion','zguser__username','zgtime','checktask__checktype__checktitle','checkname__username', 'taskstate','checktask__checktime','createuser__username','createdate')
a = a.order_by('-starttime')[startnum:endnum].values('id','checkname__name','checktask__checktaskname','jobstate','starttime','endtime','yanshou', 'yanshouren__name', 'checkquestion','zguser__username','zgtime','checktask__checktype__checktitle','checkname__username', 'taskstate','checktask__checktime','createuser__username','createdate')
return HttpResponse(transjson(total, a), content_type="application/json")
elif a == 'wxlistall':
@ -8713,7 +8713,7 @@ def checkprojects(req):
elif a == 'jobdetail':
obj = Checkjob.objects.filter(id=req.GET.get('id'))
obj = obj.values('checktask__checktaskname','zguser','yhtp','content','jctime','zgtime','checkname__name','zgjg','jobstate','taskstate','checkquestion','checktask__checkplace','checktask__checktype__checkcontent','checkname__username','checktask__checktime')[0]
obj = obj.values('checktask__checktaskname','zguser','yhtp','content','jctime','zgtime','checkname__name','zgjg','jobstate','taskstate','checkquestion','checktask__checkplace','checktask__checktype__checkcontent','checkname__username','checktask__checktime', 'jctime2')[0]
if obj['yhtp']:
obj['yhtp'] = obj['yhtp'].split('?')
@ -8731,8 +8731,8 @@ def checkprojects(req):
obj.taskstate =int(data['taskstate'])
obj.createuser = User.objects.get(userid=userid)
obj.content=data['content']
obj.jctime = data['jctime']
obj.jctim2 = data['jctime2']
obj.jctime = data['jctime'] if data.get('jctime', None) else obj.starttime
obj.jctime2 = data['jctime2'] if data.get('jctime2', None) else obj.endtime
obj.zgtime = data['zgtime']
if yhtp:
obj.yhtp=yhtp
@ -8777,6 +8777,10 @@ def checkprojects(req):
elif a == 'yanshou':
obj = Checkjob.objects.get(id=req.GET.get('id'))
if obj.yanshou:
return JsonResponse({'code': 0, 'msg':'任务已验收'})
if obj.taskstate !=2:
return JsonResponse({'code': 0, 'msg':'任务状态有误'})
obj.yanshou = datetime.now()
obj.yanshouren = User.objects.get(userid=userid)
obj.save()
@ -8976,7 +8980,7 @@ def checkprojects(req):
uselist.append(item.name)
x = a.values('checktask__checktaskname','starttime','zgjg','checktask__tasktype','endtime','jobstate','zguser__username','checktask__checktype__checkcontent','checktask__checkplace','checktask__checktime' ,'checkname__username','checkname__name', 'checkquestion', 'zgtime', 'zguser__username', 'createuser__username',
'createdate', 'taskstate','zghtp','jctime','content','yhtp','pmpeople', 'zgyq','zgjg', 'yanshou', 'yanshouren__name')[0]
'createdate', 'taskstate','zghtp','content','yhtp','pmpeople', 'zgyq','zgjg', 'yanshou', 'yanshouren__name', 'jctime', 'jctime2')[0]
x['bcfr'] = uselist
if x['yhtp']:
x['yhtp'] = x['yhtp'].split('?')