pull新内容

This commit is contained in:
shilixia 2020-03-06 15:54:24 +08:00
parent a5f282a9b5
commit 6b43625224
10 changed files with 315 additions and 53 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 2.2.8 on 2020-03-06 14:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('safesite', '0315_auto_20200115_1421'),
]
operations = [
migrations.AlterField(
model_name='checkjob',
name='yanshou',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='checktask',
name='checktime',
field=models.DateTimeField(blank=True, null=True),
),
]

View File

@ -1196,7 +1196,7 @@ class Checktask(models.Model):
checktaskname=models.CharField(max_length=300)#任务名
checktype=models.ForeignKey(Checktable,on_delete=models.CASCADE)#关联检查表
checkname=models.ManyToManyField(User,related_name='jiancha')#检查人员
checktime= models.DateTimeField(default = timezone.now)#检查时间
checktime= models.DateTimeField(null=True, blank=True)#检查时间
checkplace=models.CharField(max_length=200)#检查地点
createuser = models.ForeignKey(User,related_name='chuangjians',on_delete=models.CASCADE)#创建人
createdate = models.DateTimeField(default = timezone.now)#创建时间
@ -1216,5 +1216,5 @@ class Checkjob(models.Model):
taskstate = models.IntegerField(default=1)#检查任务状态1正在检查2检查完毕
zgyq=models.CharField(max_length=200,null=True)#整改要求
zgjg=models.CharField(max_length=200,null=True)#整改结果
yanshou=models.DateTimeField(default = timezone.now)#验收时间
yanshou=models.DateTimeField(null=True, blank=True)#验收时间
yanshouren=models.ForeignKey(User,related_name='yanshouren',on_delete=models.CASCADE,null=True)#验收人员

View File

@ -1,13 +1,25 @@
<div id="taskbar" style="padding: 4px;">
<div >
</div>
<div>
<a id="addtask" class="easyui-linkbutton" onclick="addcheckrw()" data-options="iconCls: 'fa-plus',plain:true">查看任务</a>
<a id="delprg" class="easyui-linkbutton" onclick="deltask()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
<label>快捷查询</label>
<select id='kjcxyh' style='width:150px;'>
<option value="">请选择</option>
<option value="listself">我的任务</option>
<option value="listchuli">验收任务</option>
<option value="listallx">全部任务</option>
</select>
</div>
<div>
{% load myfilter %}
{% if request|has_permission:'b_checkjob_add' %}
<a id="addtask" class="easyui-linkbutton" onclick="addcheckrw()" data-options="iconCls: 'fa-plus',plain:true">执行任务</a>
{% endif %}
{% if request|has_permission:'b_checkjob_detail' %}
<a id="detailprg" class="easyui-linkbutton" onclick="detailtask()" data-options="iconCls: 'fa-info-circle',plain:true">详情</a>
{% endif %}
</div>
@ -17,7 +29,15 @@
$(function () {
})
$('#kjcxyh').combobox({
editable: false,
onSelect: function (node) {
if (node.value != '') {
$('#jobtab').datagrid({ url: 'api/checkproject', queryParams: { a: node.value } });
}
}
})
$('#jobtab').datagrid({
url: 'api/checkproject?a=listall4',
rownumbers: true,
@ -34,7 +54,11 @@
{ field: 'checktask__checktaskname', title: '任务名称', width: 100 },
{ field: 'checktask__checktype__checktitle', title: '检查表', width: 100 },
{ field: 'checktask__checktime', title: '检查时间', width: 100 },
{ field: 'checkname__username', title: '检查人员', width: 100 },
{ field: 'createdate', title: '创建时间', width: 100 },
//{ field: 'zguser__username', title: '整改人', width: 100 },
//{ field: 'zgtime', title: '整改时间', width: 100 },
{
field: 'taskstate', title: '执行状态', width: 100, formatter: function (value, row, index) {
if (value == 1) {
@ -46,7 +70,8 @@
}
},
//{ field: 'checkname__name', title: '检查人员', width: 100 },
{ field: 'yanshou', title: '验收时间', width: 100 },
//
//{ field: 'zguser__name', title: '整改人', width: 100 },
//{ field: 'zgtime', title: '整改时间', width: 100 },
@ -63,6 +88,14 @@
}
}
function detailtask() {
var row = $('#jobtab').datagrid('getSelected');
if (row) {
opendg('任务详情','html/detailjob/'+row.id.toString())
}
else {
$.messager.alert('提示', '请先选择一条数据!');
}
}
</script>

View File

@ -27,6 +27,12 @@
<input id="checktabtitle" class="easyui-textbox" name="checktabtitle" style="width:480px" />
</td>
</tr>
<tr>
<td>检查地点:</td>
<td>
<input id="checkplace" class="easyui-textbox" name="checkplace" style="width:480px" />
</td>
</tr>
<tr>
<td>检查内容:</td>
<td>
@ -39,37 +45,37 @@
<input id="checkquestion" class="easyui-textbox" name="checkquestion" style="width:480px;height:100px" data-options="multiline:true" required=true>
</td>
</tr>
<tr>
<td>整改时间:</td>
<td>
<input id="zgtime" editable="false" name="zgtime" class="easyui-datetimebox" style="width:480px"
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" required=true />
</td>
</tr>
<tr>
<td>整改人:</td>
<td>
<input id="zguser" class="easyui-textbox" name="zguser" style="width:480px" required=true />
</td>
</tr>
<tr>
<td>整改要求:</td>
<td>
<input id="zgyq" class="easyui-textbox" name="zgyq" style="width:480px;height:60px" data-options="multiline:true" required=true>
</td>
</tr>
<tr>
<td>整改结果:</td>
<td>
<input id="zgjg" class="easyui-textbox" name="zgjg" style="width:480px;height:60px" data-options="multiline:true" required=true>
</td>
</tr>
<!--<tr>
<td>整改时间:</td>
<td>
<input id="zgtime" editable="false" name="zgtime" class="easyui-datetimebox" style="width:480px"
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" required=true />
</td>
</tr>
<tr>
<td>整改人:</td>
<td>
<input id="zguser" class="easyui-textbox" name="zguser" style="width:480px" required=true />
</td>
</tr>
<tr>
<td>整改要求:</td>
<td>
<input id="zgyq" class="easyui-textbox" name="zgyq" style="width:480px;height:60px" data-options="multiline:true" required=true>
</td>
</tr>
<tr>
<td>整改结果:</td>
<td>
<input id="zgjg" class="easyui-textbox" name="zgjg" style="width:480px;height:60px" data-options="multiline:true" required=true>
</td>
</tr>-->
<tr>
<td>检查状态:</td>
<td>
<input type="radio" name="taskstate" value="1">正在检查</input>
<input type="radio" name="taskstate" value="2" checked="true">检查完成</input>
<input type="radio" name="taskstate" value="1" checked="true">正在检查</input>
<input type="radio" name="taskstate" value="2">检查完成</input>
</td>
</tr>
</table>
@ -89,9 +95,11 @@
var data = res.data
console.log(data)
$('#checktaskname').textbox('setValue', data.checktask__checktaskname)
$('#checktabtitle').textbox('setValue', data.checkname__name)
$('#checktabtitle').textbox('setValue', data.checkname__username)
$('#starttime').datetimebox('setValue', data.checktask__checktime)
$('#checkcontent').textbox('setValue', data.checktask__checktype__checkcontent)
$('#checkplace').textbox('setValue', data.checktask__checkplace)
});
})
@ -102,7 +110,7 @@
var wsdata = $('#wsff').serializeJSON();
$.ajax({
type: "POST",
url: 'api/checkproject?a=addchecklist',
url: 'api/checkproject?a=addjob&jobid='+jobid,
data: JSON.stringify(wsdata),
datatype: "json",
processData: false,
@ -117,7 +125,7 @@
},
success: function (data) {
if (data.code == 1) {
$('#tasktab').datagrid('reload');
$('#jobtab').datagrid('reload');
$("#dd").dialog("close");
} else { $.messager.alert('提示', '失败!'); }
$('#submitb').linkbutton('enable');

View File

@ -0,0 +1,136 @@
<div class="easyui-layout" id="result" style="width:100%;height:100%"></div>
<script type="text/html" id="text">
{% verbatim %}
<div id='southdiv' data-options="region:'south'" style="height:50px;text-align:center;padding:5px">
<a id="yanshou" onclick="yanshou()" class="easyui-linkbutton" data-options="iconCls: 'fa-download'">验收</a>
<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>{{checkname__username}}</td>
<td style="font-weight: bold;">检查时间:</td>
<td>{{checktask__checktime| dateFormat 'yyyy-MM-dd hh:mm:ss'}}</td>
</tr>
<tr style="height:80px">
<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 colspan="3">{{checkquestion}}</td>
</tr>
<tr>
<td style="font-weight: bold;">检查状态:</td>
<td>{{taskstate==1?'正在检查':'检查完毕'}}</td>
<td style="font-weight: bold;">检查地点:</td>
<td>{{checktask__checkplace}}</td>
</tr>
<!--<tr style="height:80px">
<td style="font-weight: bold;">整改要求:</td>
<td colspan="3">{{zgyq}}</td>
</tr>
<tr style="height:80px">
<td style="font-weight: bold;">整改结果:</td>
<td colspan="3">{{zgjg}}</td>
</tr>
<tr>
<td style="font-weight: bold;">整改人:</td>
<td>{{zguser__username}}</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>{{createuser__username}}</td>
<td style="font-weight: bold;">填报时间:</td>
<td>{{zgtime| dateFormat 'yyyy-MM-dd hh:mm:ss'}}</td>
</tr>
</table>
<div style="font-size:25px;background-color:aquamarine;margin-top:30px;">
{{yanshou==null?'本任务还没有验收,需要发布人验收':'该任务已经验收完毕,验收人是:'}}{{yanshouren__username}}
</div>
</div>
{% endverbatim %}
</script>
<script type="text/javascript" src="/static/safesite/mystatic/js/template-web.js"></script>
<script>
var html;
var state;
var id = {{ id }};
template.defaults.imports.dateFormat = function (date, format) {
date = new Date(date);
var map = {
"M": date.getMonth() + 1, //月份
"d": date.getDate(), //日
"h": date.getHours(), //小时
"m": date.getMinutes(), //分
"s": date.getSeconds(), //秒
"q": Math.floor((date.getMonth() + 3) / 3), //季度
"S": date.getMilliseconds() //毫秒
};
format = format.replace(/([yMdhmsqS])+/g, function (all, t) {
var v = map[t];
if (v !== undefined) {
if (all.length > 1) {
v = '0' + v;
v = v.substr(v.length - 2);
}
return v;
}
else if (t === 'y') {
return (date.getFullYear() + '').substr(4 - all.length);
}
return all;
});
return format;
};
template.defaults.imports.gfilename = function(value){
x = value.split('/').pop();
return x;
}
$.ajax({
type: "get",
url: "api/checkproject?a=checkjobdetail",
data: { id: id },
async: false, // ajax同步使用false
success: function (data) {
html = template('text', data);
}
});
$('#result').html(html);
function yanshou() {
$.ajax({
type: "get",
url: "api/checkproject?a=yanshou",
data: { id: id },
async: false, // ajax同步使用false
success: function (data) {
if (data.code == 1) {
$('#jobtab').datagrid('reload');
$("#dd").dialog("close");
} else { $.messager.alert('提示', '失败!'); }
$('#submitb').linkbutton('enable');
}
});
}
</script>

View File

@ -6,8 +6,12 @@
</div>
<div>
{% load myfilter %}
{% if request|has_permission:'b_checklist_add' %}
<a id="addtask" class="easyui-linkbutton" onclick="addcheckrw()" data-options="iconCls: 'fa-plus',plain:true">发布任务</a>
<a id="delprg" class="easyui-linkbutton" onclick="deltask()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% endif %}
<!-- <a id="delprg" class="easyui-linkbutton" onclick="deltask()" data-options="iconCls: 'fa-trash',plain:true">删除</a>-->
</div>
@ -36,8 +40,8 @@
{ field: 'checktime', title: '检查时间', width: 300 },
{ field: 'createuser__name', title: '创建人', width: 300 },
{ field: 'createdate', title: '创建时间', width: 300 },
{ field: 'checkplace', title: '检查地点', width: 300 },
]]
});

View File

@ -23,7 +23,10 @@
<div style="margin-bottom:5px">
<input id="checktabtitle" class="easyui-textbox" name="checktabtitle" style="width:480px;height:40px" data-options="label:'检查项目'" required=true />
</div>
<div style="margin-top:10px;margin-bottom:5px">
<input id="checkplace" class="easyui-textbox" name="checkplace" style="width:480px;height:40px" data-options="label:'检查地点'"
required=true />
</div>
</form>
</div>
</div>

View File

@ -6,9 +6,14 @@
</div>
<div>
<a id="addtask" class="easyui-linkbutton" onclick="addtask()" data-options="iconCls: 'fa-plus',plain:true">新增</a>
<a id="delprg" class="easyui-linkbutton" onclick="deltask()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% load myfilter %}
{% if request|has_permission:'b_checktable_add' %}
<a id="addtask" class="easyui-linkbutton" onclick="addtask()" data-options="iconCls: 'fa-plus',plain:true">新增</a>
{% endif %}
{% if request|has_permission:'b_checktable_del' %}
<a id="delprg" class="easyui-linkbutton" onclick="deltask()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% endif %}
</div>
</div>

View File

@ -109,6 +109,7 @@ urlpatterns = [
path('html/addcheckrw',views.addcheckrw),#检查任务
path('html/checkjob',views.checkjob),#检查任务
path('html/addcheckjob/<int:id>/',views.addcheckjob),#检查任务
path('html/detailjob/<int:id>/',views.detailjob),#任务详情
#html页面

View File

@ -508,7 +508,8 @@ def checklist(req):
return render(req,'checklist.html')
def addcheckrw(req):
return render(req,'checklistadd.html')
def detailjob(req,id):
return render(req,'checkjobdetail.html',{'id':id})
def mainhtml(req):
# 计算一些数据
userid = req.session['userid']
@ -7393,7 +7394,7 @@ def checkprojects(req):
total = a.count()
startnum, endnum = fenye(req)
a = a[startnum:endnum].values('id','checktaskname','checktype__checktitle', 'checktime','createuser__name','createdate')
a = a[startnum:endnum].values('id','checktaskname','checktype__checktitle','checkplace', 'checktime','createuser__name','createdate')
return HttpResponse(transjson(total, a), content_type="application/json")
elif a == 'listall4':
@ -7402,14 +7403,55 @@ def checkprojects(req):
total = a.count()
startnum, endnum = fenye(req)
a = a[startnum:endnum].values('id','checktask__checktaskname','zguser__name','zgtime','checktask__checktype__checktitle','checkname__name', 'taskstate','checktask__checktime','createuser__name','createdate')
a = a[startnum:endnum].values('id','checktask__checktaskname','yanshou','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 == 'listchuli':
a = Checkjob.objects.filter(usecomp=Partment.objects.get(partid=companyid),taskstate=2,checktask__createuser__userid=userid).exclude(deletemark=0)
total = a.count()
startnum, endnum = fenye(req)
a = a[startnum:endnum].values('id','checktask__checktaskname','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 == 'listself':
a = Checkjob.objects.filter(usecomp=Partment.objects.get(partid=companyid),checkname__userid=userid,deletemark=1)
total = a.count()
startnum, endnum = fenye(req)
a = a[startnum:endnum].values('id','checktask__checktaskname','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 == 'listallx':
a = Checkjob.objects.filter(usecomp=Partment.objects.get(
partid=companyid),deletemark=1)
total = a.count()
startnum, endnum = fenye(req)
a = a[startnum:endnum].values('id','checktask__checktaskname','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 == 'jobdetail':
obj = Checkjob.objects.filter(id=req.GET.get('id'))
obj = obj.values('checktask__checktaskname','checktask__checktype__checkcontent','checkname__name','checktask__checktime')[0]
obj = obj.values('checktask__checktaskname','zguser','checkplace','checktask__checktype__checkcontent','checkname__username','checktask__checktime')[0]
return JsonResponse({'code': 1, 'data': obj})
elif a == 'addjob':
data = json.loads(req.body.decode('utf-8'))
obj = Checkjob.objects.get(id=req.GET.get('jobid'))
obj.checkquestion = data['checkquestion']
obj.taskstate = data['taskstate']
obj.createuser = User.objects.get(userid=userid)
obj.save()
return JsonResponse({'code': 1})
elif a == 'yanshou':
obj = Checkjob.objects.get(id=req.GET.get('id'))
obj.yanshou = datetime.now()
obj.yanshouren = User.objects.get(userid=userid)
obj.save()
return JsonResponse({'code': 1})
elif a=='checktablist':
projectlist = Checktable.objects.filter(usecomp__partid=companyid).values('id', 'checktitle')
return HttpResponse(transstr(projectlist,'id','checktitle'),content_type="application/json")
@ -7418,10 +7460,10 @@ def checkprojects(req):
obj = Checktask()
obj.checktaskname = data['checktaskname']
obj.checktime=data['starttime']
obj.checkplace=data['checkplace']
obj.checktype =Checktable.objects.get(id=data['checktabtitle'])
obj.createuser = User.objects.get(userid=userid)
obj.usecomp=Partment.objects.get(partid=companyid)
obj.yanshouren=User.objects.get(userid=userid)
obj.save()
list = data['participant'].split(',')
@ -7446,4 +7488,11 @@ def checkprojects(req):
else:
return JsonResponse({"code":0})
return JsonResponse({"code":0})
elif a == 'checkjobdetail':
id = req.GET.get('id')
a = Checkjob.objects.filter(id=id)
x = a.values('checktask__checktaskname','zguser__username','checktask__checktype__checkcontent','checktask__checkplace','checktask__checktime' ,'checkname__username', 'checkquestion', 'zgtime', 'zguser__username', 'createuser__username',
'createdate', 'taskstate', 'zgyq','zgjg', 'yanshou', 'yanshouren__username')[0]
return HttpResponse(json.dumps(x, cls=MyEncoder), content_type="application/json")