任务做完
This commit is contained in:
commit
d50c6c8a21
|
|
@ -1,4 +1,4 @@
|
|||
'__version__', (512, 15)
|
||||
'tz', (1536, 23)
|
||||
'utc_enabled', (1024, 4)
|
||||
'entries', (2048, 568)
|
||||
'entries', (2048, 728)
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,4 +1,4 @@
|
|||
'__version__', (512, 15)
|
||||
'tz', (1536, 23)
|
||||
'utc_enabled', (1024, 4)
|
||||
'entries', (2048, 568)
|
||||
'entries', (2048, 728)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
14104
|
||||
15644
|
||||
|
|
|
|||
77774
log/all-2019-11-16.log.1
77774
log/all-2019-11-16.log.1
File diff suppressed because it is too large
Load Diff
77734
log/all-2019-11-16.log.5
77734
log/all-2019-11-16.log.5
File diff suppressed because it is too large
Load Diff
77543
log/all-2019-11-17.log.1
77543
log/all-2019-11-17.log.1
File diff suppressed because it is too large
Load Diff
77696
log/all-2019-11-17.log.5
77696
log/all-2019-11-17.log.5
File diff suppressed because it is too large
Load Diff
|
|
@ -38,5 +38,10 @@ app.conf.update(
|
|||
'schedule': timedelta(minutes=1),
|
||||
#'args': (5, 6)
|
||||
},
|
||||
'check-task': {
|
||||
'task': 'safesite.tasks.checktask',
|
||||
'schedule': timedelta(minutes=1),
|
||||
#'args': (5, 6)
|
||||
},
|
||||
}
|
||||
)
|
||||
|
|
@ -84,11 +84,11 @@ def drquestions(companyid,path,userid):
|
|||
right = sheet['j'+str(i)].value.replace(' ', '')
|
||||
resolution = sheet['k'+str(i)].value
|
||||
level = sheet['l'+str(i)].value
|
||||
objs = Questioncat.objects.filter(usecomp__partid=1,name=cate)
|
||||
objs = Questioncat.objects.filter(usecomp__partid=1,name=cate,deletemark=1)
|
||||
if objs.exists():
|
||||
cateobj = objs[0]
|
||||
else:
|
||||
objs = Questioncat.objects.filter(usecomp__partid=companyid,name=cate)
|
||||
objs = Questioncat.objects.filter(usecomp__partid=companyid,name=cate,deletemark=1)
|
||||
if objs.exists():
|
||||
cateobj = objs[0]
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -645,9 +645,11 @@ def exportxlsx(a,objs):
|
|||
num = str(i+3)
|
||||
sheet['a'+num] = x.num
|
||||
sheet['b'+num] = x.name
|
||||
sheet['c'+num] = x.cate.dickeyname
|
||||
if x.cate:
|
||||
sheet['c'+num] = x.cate.dickeyname
|
||||
sheet['d'+num] = x.type
|
||||
sheet['e'+num] = x.area.name
|
||||
if x.area:
|
||||
sheet['e'+num] = x.area.name
|
||||
sheet['f'+num] = '正常' if x.state==1 else '异常'
|
||||
sheet['g'+num] = 'https://safeyun.ctcshe.com/miniprogram/equipment?id='+str(x.id)
|
||||
nowtime = datetime.now().strftime('%Y%m%d%H%M%S')
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-11 17:10
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
#('safesite', '0316_auto_20200306_1444'),
|
||||
#('safesite', '0320_auto_20200302_1402'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
]
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-02 14:03
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0320_auto_20200302_1402'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
]
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-05 14:11
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0321_remove_companyinfo_liaison_fax'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AlterField(
|
||||
model_name='examtestdetail',
|
||||
name='tms',
|
||||
field=models.TextField(default=','),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='examtestdetail',
|
||||
name='wrongs',
|
||||
field=models.TextField(default=','),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-12 09:38
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0316_auto_20200306_1444'),
|
||||
('safesite', '0322_auto_20200305_1411'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
]
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-12 09:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0323_merge_20200312_0938'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='checktask',
|
||||
name='tasktype',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-12 15:01
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0324_auto_20200312_0939'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='checkjob',
|
||||
name='endtime',
|
||||
field=models.DateTimeField(blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='checkjob',
|
||||
name='jobstate',
|
||||
field=models.IntegerField(default=1),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='checkjob',
|
||||
name='starttime',
|
||||
field=models.DateTimeField(blank=True, null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-13 13:48
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0325_auto_20200312_1501'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='checktask',
|
||||
name='userlist',
|
||||
field=models.CharField(max_length=200, null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-18 15:16
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0326_auto_20200313_1348'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='checktable',
|
||||
name='zxstate',
|
||||
field=models.IntegerField(default=1),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-18 16:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0327_auto_20200318_1516'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='checktable',
|
||||
name='zxstate',
|
||||
),
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='checktask',
|
||||
name='zxstate',
|
||||
field=models.IntegerField(default=1),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 2.2.8 on 2020-03-23 09:57
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0328_auto_20200318_1652'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='checkjob',
|
||||
name='content',
|
||||
field=models.CharField(max_length=400, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='checkjob',
|
||||
name='pmpeople',
|
||||
field=models.ManyToManyField(null=True, related_name='bcfr', to='safesite.User'),
|
||||
),
|
||||
]
|
||||
|
|
@ -774,8 +774,8 @@ class ExamTestDetail(models.Model): # 考试详情表
|
|||
passcode = models.IntegerField(default=0) # 是否通过
|
||||
testdetail = JSONField(null=True, blank=True)
|
||||
score = models.FloatField(default=0) # 得分
|
||||
tms = models.CharField(max_length=10000, default=',')
|
||||
wrongs = models.CharField(max_length=10000, default=',')
|
||||
tms = models.TextField(default=',')
|
||||
wrongs = models.TextField(default=',')
|
||||
|
||||
|
||||
class Train(models.Model): # 培训表
|
||||
|
|
@ -1233,6 +1233,7 @@ class Checktable(models.Model):
|
|||
usecomp = models.ForeignKey(Partment,related_name='checktabcomp',on_delete=models.CASCADE,null=True,blank=True)#创建公司
|
||||
deletemark = models.IntegerField(default=1)#是否删除
|
||||
|
||||
|
||||
#检查任务
|
||||
class Checktask(models.Model):
|
||||
id=models.AutoField(primary_key=True)#主键
|
||||
|
|
@ -1245,8 +1246,9 @@ class Checktask(models.Model):
|
|||
createdate = models.DateTimeField(default = timezone.now)#创建时间
|
||||
usecomp = models.ForeignKey(Partment,related_name='taskscomp',on_delete=models.CASCADE,null=True,blank=True)#创建公司
|
||||
deletemark = models.IntegerField(default=1)#是否删除
|
||||
tasktype = models.IntegerField(default=0)#任务执行频率(1每天,2每周,3每年,0)
|
||||
|
||||
tasktype = models.IntegerField(default=0)#任务执行频率(1每天,2每周,3每月,4每季度,5每半年,6每年)
|
||||
userlist = models.CharField(max_length=200,null=True,)#检查人列表
|
||||
zxstate = models.IntegerField(default=1)#1同时执行,2一个执行就执行
|
||||
class Checkjob(models.Model):
|
||||
id=models.AutoField(primary_key=True)#主键
|
||||
checktask=models.ForeignKey(Checktask,on_delete=models.CASCADE)#关联任务表
|
||||
|
|
@ -1258,8 +1260,13 @@ class Checkjob(models.Model):
|
|||
createdate = models.DateTimeField(default = timezone.now)#创建时间
|
||||
usecomp = models.ForeignKey(Partment,related_name='taskcomps',on_delete=models.CASCADE,null=True,blank=True)#创建公司
|
||||
deletemark = models.IntegerField(default=1)#是否删除
|
||||
taskstate = models.IntegerField(default=1)#检查任务状态,1正在检查,2检查完毕
|
||||
taskstate = models.IntegerField(default=1)#执行状态,1正在检查,2检查完毕,3,已关闭
|
||||
starttime=models.DateTimeField(null=True, blank=True)#任务开始时间
|
||||
endtime=models.DateTimeField(null=True, blank=True)#任务结束时间
|
||||
jobstate = 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(null=True, blank=True)#验收时间
|
||||
yanshouren=models.ForeignKey(User,related_name='yanshouren',on_delete=models.CASCADE,null=True)#验收人员
|
||||
pmpeople=models.ManyToManyField(User,related_name='bcfr',null=True)#被处罚人员
|
||||
content=models.CharField(max_length=400,null=True)#处罚内容
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from celery import shared_task
|
|||
import json
|
||||
import logging
|
||||
import requests
|
||||
from .models import User,Trouble,Dickey,Partment,Dicclass,Train,Drill,TroubleAccess,Group,Yjyc,Yjsetup,Socertificate,Trainuser,Risk,Risktask,RiskActTask,Miss,Observe,RiskAct
|
||||
from .models import User,Checkjob,Checktask,Trouble,Dickey,Partment,Dicclass,Train,Drill,TroubleAccess,Group,Yjyc,Yjsetup,Socertificate,Trainuser,Risk,Risktask,RiskActTask,Miss,Observe,RiskAct
|
||||
import datetime
|
||||
import calendar
|
||||
import pandas as pd
|
||||
|
|
@ -279,6 +279,88 @@ def riskacttask():
|
|||
RiskActTask.objects.create(riskact=i,taskexpire = taskexpire,taskadd=nowtime,istask=1)
|
||||
i.tasktime = nowtime
|
||||
i.save()
|
||||
@shared_task
|
||||
def checktask():
|
||||
nowtime = datetime.datetime.now()
|
||||
for i in Checktask.objects.exclude(tasktype=0):
|
||||
if i.tasktype==1:
|
||||
if i.checktime:
|
||||
|
||||
if (nowtime - i.checktime).days>=1:
|
||||
endtimes = nowtime + datetime.timedelta(days=1)
|
||||
for j in i.checkname.all():
|
||||
x=User.objects.get(userid=j.userid)
|
||||
|
||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
||||
Checkjob.objects.create(checktask=i,checkname=x,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
||||
|
||||
i.checktime = nowtime
|
||||
i.save()
|
||||
elif i.tasktype==2:
|
||||
if i.checktime:
|
||||
|
||||
if (nowtime - i.checktime).days>=7:
|
||||
endtimes = nowtime + datetime.timedelta(days=7)
|
||||
for j in i.checkname.all():
|
||||
x=User.objects.get(userid=j.userid)
|
||||
|
||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
||||
Checkjob.objects.create(checktask=i,checkname=x,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
||||
|
||||
i.checktime = nowtime
|
||||
i.save()
|
||||
elif i.tasktype==3:
|
||||
if i.checktime:
|
||||
|
||||
if (nowtime - i.checktime).days>=30:
|
||||
endtimes = nowtime + datetime.timedelta(days=30)
|
||||
for j in i.checkname.all():
|
||||
x=User.objects.get(userid=j.userid)
|
||||
|
||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
||||
Checkjob.objects.create(checktask=i,checkname=x,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
||||
|
||||
i.checktime = nowtime
|
||||
i.save()
|
||||
elif i.tasktype==4:
|
||||
if i.checktime:
|
||||
|
||||
if (nowtime - i.checktime).days>=120:
|
||||
endtimes = nowtime + datetime.timedelta(days=120)
|
||||
for j in i.checkname.all():
|
||||
x=User.objects.get(userid=j.userid)
|
||||
|
||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
||||
Checkjob.objects.create(checktask=i,checkname=x,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
||||
|
||||
i.checktime = nowtime
|
||||
i.save()
|
||||
elif i.tasktype==5:
|
||||
if i.checktime:
|
||||
|
||||
if (nowtime - i.checktime).days>=182:
|
||||
endtimes = nowtime + datetime.timedelta(days=182)
|
||||
for j in i.checkname.all():
|
||||
x=User.objects.get(userid=j.userid)
|
||||
|
||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
||||
Checkjob.objects.create(checktask=i,checkname=x,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
||||
|
||||
i.checktime = nowtime
|
||||
i.save()
|
||||
elif i.tasktype==6:
|
||||
if i.checktime:
|
||||
|
||||
if (nowtime - i.checktime).days>=365:
|
||||
endtimes = nowtime + datetime.timedelta(days=365)
|
||||
for j in i.checkname.all():
|
||||
x=User.objects.get(userid=j.userid)
|
||||
|
||||
Checkjob.objects.filter(checktask=i,checkname=x).update(jobstate=2)
|
||||
Checkjob.objects.create(checktask=i,checkname=x,starttime=nowtime,endtime = endtimes,usecomp=i.usecomp)
|
||||
|
||||
i.checktime = nowtime
|
||||
i.save()
|
||||
|
||||
def updateTzzs():
|
||||
for x in Socertificate.objects.all():
|
||||
|
|
|
|||
|
|
@ -53,23 +53,49 @@
|
|||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ 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: 'starttime', title: '任务开始时间', width: 100 },
|
||||
{ field: 'endtime', title: '任务结束时间', width: 100 },
|
||||
{
|
||||
field: 'taskstate', title: '执行状态', width: 100, formatter: function (value, row, index) {
|
||||
if (value == 1) {
|
||||
return '正在检查';
|
||||
}
|
||||
else if (value == 2) {
|
||||
return '检查完毕'
|
||||
}
|
||||
field: 'taskstate', title: '检查状态', width: 100, formatter: function (value, row, index) {
|
||||
|
||||
switch (value) {
|
||||
case 1: return '正在检查'; break;
|
||||
case 2: return '检查完毕'; break;
|
||||
case 3: 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;
|
||||
|
||||
}}},
|
||||
|
||||
|
||||
{
|
||||
field: 'jobstate', title: '任务状态', width: 100, styler: function (value, row, index) {
|
||||
if (value == 1) {
|
||||
return 'background-color:yellow;';
|
||||
}
|
||||
else {
|
||||
return 'background-color:green;';
|
||||
}
|
||||
}, formatter: function (value, row, index) {
|
||||
if (value == 1) {
|
||||
return '可执行';
|
||||
}
|
||||
else {
|
||||
return '已过期'
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'createdate', title: '创建时间', width: 100 },
|
||||
{ field: 'yanshou', title: '验收时间', width: 100 },
|
||||
//
|
||||
//{ field: 'zguser__name', title: '整改人', width: 100 },
|
||||
|
|
@ -81,7 +107,20 @@
|
|||
function addcheckrw() {
|
||||
var row = $('#jobtab').datagrid('getSelected');
|
||||
if (row) {
|
||||
opendg('查看检查任务','html/addcheckjob/'+row.id.toString())
|
||||
|
||||
$.get('api/checkproject?a=jobdetail&id=' + row.id, function (res) {
|
||||
var data = res.data
|
||||
console.log(data)
|
||||
if (data.jobstate == 2) {
|
||||
$.messager.alert('提示', '该任务已过期不能执行!');
|
||||
}
|
||||
else if (data.taskstate ==3) {
|
||||
$.messager.alert('提示', '该任务已关闭不能执行!');
|
||||
}
|
||||
else
|
||||
opendg('查看检查任务','html/addcheckjob/'+row.id.toString())
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '请先选择一条数据!');
|
||||
|
|
|
|||
|
|
@ -46,51 +46,71 @@
|
|||
</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>-->
|
||||
<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>-->
|
||||
|
||||
<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>
|
||||
<td>检查状态:</td>
|
||||
<td>
|
||||
|
||||
<input type="radio" name="taskstate" value="1" >正在检查</input>
|
||||
<input type="radio" name="taskstate" value="2">检查完成</input>
|
||||
<input type="radio" name="taskstate" value="1">正在检查</input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</table>
|
||||
<div id="chufa" style="margin-top:10px;margin-bottom:5px;">
|
||||
<input class="easyui-textbox" id="participantname" style="width:480px;height:60px" editable="false"
|
||||
data-options="label:'被处罚人员:',multiline:true,prompt:'没有被处罚人员可以不选'" >
|
||||
<input type="hidden" id="participant" name="participant" />
|
||||
<a id="chooserys" class='easyui-linkbutton' onclick="choseusers()" style="width:auto">选择</a>
|
||||
</div>
|
||||
<div>
|
||||
<input class="easyui-textbox" id="content" name="content" style="width:480px;height:60px"
|
||||
data-options="label:'处罚内容:',multiline:true">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var jobid = {{ id }}
|
||||
function aaa(x) {
|
||||
if (x == "participant") {
|
||||
$('#participant').attr('value', top.$('#in').val());
|
||||
$('#participantname').textbox('setValue', top.$('#in').attr('show'));
|
||||
$('#participantnum').textbox('setValue', top.$('#in').attr('total'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(function () {
|
||||
|
||||
|
||||
|
||||
$.get('api/checkproject?a=jobdetail&id=' + jobid, function (res) {
|
||||
var data = res.data
|
||||
console.log(data)
|
||||
|
|
@ -100,6 +120,7 @@
|
|||
$('#checkcontent').textbox('setValue', data.checktask__checktype__checkcontent)
|
||||
$('#checkplace').textbox('setValue', data.checktask__checkplace)
|
||||
$('#checkquestion').textbox('setValue', data.checkquestion)
|
||||
$('#zgjg').textbox('setValue', data.zgjg)
|
||||
if (data.taskstate == 1) {
|
||||
$("input[name='taskstate'][value=1]").attr("checked",true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,16 @@
|
|||
|
||||
</tr>
|
||||
<tr style="height:80px">
|
||||
<td style="font-weight: bold;">检查内容:</td>
|
||||
<td colspan="3">{{checktask__checktype__checkcontent}}</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 colspan="3">{{checkquestion}}</td>
|
||||
<td style="font-weight: bold;">检查发现的问题:</td>
|
||||
<td colspan="3">{{checkquestion}}</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>
|
||||
|
|
@ -34,31 +38,38 @@
|
|||
|
||||
</tr>
|
||||
<!--<tr style="height:80px">
|
||||
<td style="font-weight: bold;">整改要求:</td>
|
||||
<td colspan="3">{{zgyq}}</td>
|
||||
<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 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 colspan="3">{{content}}</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>-->
|
||||
|
||||
<td style="font-weight: bold;">被处罚人员:</td>
|
||||
<td colspan="3">{{bcfr==[]?'kkl':bcfr}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-weight: bold;">填报人:</td>
|
||||
<td>{{createuser__username}}</td>
|
||||
<td style="font-weight: bold;">验收人:</td>
|
||||
<td>{{yanshouren__username}}</td>
|
||||
|
||||
<td style="font-weight: bold;">填报时间:</td>
|
||||
<td>{{zgtime| dateFormat 'yyyy-MM-dd hh:mm:ss'}}</td>
|
||||
<td style="font-weight: bold;">验收时间:</td>
|
||||
<td>{{yanshou}}</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
|
|
|||
|
|
@ -35,13 +35,34 @@
|
|||
toolbar:'#taskbar',
|
||||
columns: [[
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'checktaskname', title: '任务名称', width: 100 },
|
||||
{ field: 'checktaskname', title: '任务名称', width: 150 },
|
||||
{ field: 'checktype__checktitle', title: '检查表', width: 100 },
|
||||
{ field: 'checktime', title: '检查时间', width: 300 },
|
||||
{ field: 'createuser__name', title: '创建人', width: 300 },
|
||||
{ field: 'createdate', title: '创建时间', width: 300 },
|
||||
{ field: 'checkplace', title: '检查地点', width: 300 },
|
||||
|
||||
{ field: 'tasktype', title: '排查频次', width: 100, formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 0: return '未制定'; break;
|
||||
case 1: return '每天一次'; break;
|
||||
case 2: return '每周一次'; break;
|
||||
case 3: return '每月一次'; break;
|
||||
case 4: return '每季度一次'; break;
|
||||
case 5: return '每半年一次'; break;
|
||||
case 6: return '每年一次'; break;
|
||||
}
|
||||
}, styler: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 0: return 'color:green;font-weight:bold'; break;
|
||||
case 1: return 'color:green;font-weight:bold'; break;
|
||||
case 2: return 'color:green;font-weight:bold'; break;
|
||||
case 3: return 'color:green;font-weight:bold'; break;
|
||||
case 4: return 'color:green;font-weight:bold'; break;
|
||||
case 5: return 'color:green;font-weight:bold'; break;
|
||||
case 6: return 'color:green;font-weight:bold'; break;
|
||||
}}},
|
||||
|
||||
|
||||
]]
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,17 +16,38 @@
|
|||
<input type="hidden" id="participant" name="participant" />
|
||||
<a id="chooserys" class='easyui-linkbutton' onclick="choseusers()" style="width:auto">选择</a>
|
||||
</div>
|
||||
<div style="margin-top:6px;margin-left:200px">
|
||||
<input type="radio" name="zxstate" value="1" checked="true">同时执行</input>
|
||||
<input type="radio" name="zxstate" value="2">单人执行</input>
|
||||
</div>
|
||||
<div style="margin-top:6px;">
|
||||
<select id="tasktype" class="easyui-combobox" name="tasktype" style="width:480px;height:40px" data-options="label:'检查频率'"
|
||||
required=true editable=false>
|
||||
<option value="1">每天一次</option>
|
||||
<option value="2">每周一次</option>
|
||||
<option value="3">每月一次</option>
|
||||
<option value="4">每季度一次</option>
|
||||
<option value="5">每半年一次</option>
|
||||
<option value="6">每年一次</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-top:10px;margin-bottom:5px">
|
||||
<input id="starttime" editable="false" name="starttime" class="easyui-datetimebox" style="width:480px;height:40px"
|
||||
data-options="label:'检查时间',currentText:'今天',closeText:'关闭',showSeconds:false" required=true />
|
||||
data-options="label:'初次检查',currentText:'今天',closeText:'关闭',showSeconds:false" required=true />
|
||||
</div>
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="checktabtitle" class="easyui-textbox" name="checktabtitle" style="width:480px;height:40px" data-options="label:'检查项目'" required=true />
|
||||
<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:'检查地点'"
|
||||
<input id="checkplace" class="easyui-textbox" name="checkplace" style=" width: 480px;
|
||||
height: 40px
|
||||
" data-options="label:'检查地点'"
|
||||
required=true />
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<a id="updtask" class="easyui-linkbutton" onclick="updtask()" data-options="iconCls: 'fa-plus',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' %}
|
||||
<!--{% if request|has_permission:'b_checktable_del' %}
|
||||
<a id="delprg" class="easyui-linkbutton" onclick="deltask()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
||||
{% endif %}
|
||||
{% endif %}-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -46,8 +46,13 @@
|
|||
]]
|
||||
});
|
||||
function addtask(){
|
||||
opendg('新增检查任务','html/addchecktask?a=addcheck')
|
||||
opendg('新增检查内容','html/addchecktask?a=addcheck')
|
||||
}
|
||||
function updtask(){
|
||||
var row = $('#tasktab').datagrid('getSelected');
|
||||
if (row) {
|
||||
opendg('修改检查内容','html/updchecktable/'+row.id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||
<div id='southdiv' data-options="region:'south'" style="height:50px;text-align:center;padding:5px">
|
||||
<a href="javascript:void(0)" iconCls="fa-check" class="easyui-linkbutton" onclick="wssubmitForm()" id="submitb">提交</a>
|
||||
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
|
||||
</div>
|
||||
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
|
||||
<form id="wsff" method="post" name="wsff" enctype="multipart/form-data">
|
||||
|
||||
<div style="margin-top:10px;margin-bottom:5px">
|
||||
<input id="checktaskname" class="easyui-textbox" name="checktaskname" style="width:480px;height:40px" data-options="label:'任务名称'"
|
||||
required=true />
|
||||
</div>
|
||||
<!--<div style="margin-bottom:5px">
|
||||
<input id="checktype" class="easyui-textbox" name="checktype" style="width:480px;height:40px" data-options="label:'检查项目',multiline:true" required=true />
|
||||
</div>-->
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="checkcontent" class="easyui-textbox" name="checkcontent" style="width:480px;height:500px" data-options="label:'检查内容',multiline:true" required=true />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var id = {{ id }}
|
||||
|
||||
|
||||
$(function () {
|
||||
|
||||
|
||||
$.get('api/checkproject?a=updchechtab&id=' + id, function (res) {
|
||||
var data = res.data
|
||||
console.log(data)
|
||||
$('#checktaskname').textbox('setValue', data.checktitle)
|
||||
$('#checkcontent').textbox('setValue', data.checkcontent)
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
function wssubmitForm() {
|
||||
|
||||
var wsdata = $('#wsff').serializeJSON();
|
||||
//var checkvalue = $("#checktype").combobox('getValues');
|
||||
|
||||
//wsdata['checkprjtype'] =checkvalue;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'api/checkproject?a=updchecktaba&id='+id,
|
||||
data: JSON.stringify(wsdata),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
beforeSend: function () {
|
||||
var bo = $('#wsff').form('validate')
|
||||
if (bo == false) {
|
||||
return bo
|
||||
} else {
|
||||
$('#submitb').linkbutton('disable');
|
||||
}
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$('#tasktab').datagrid('reload');
|
||||
$("#dd").dialog("close");
|
||||
} else { $.messager.alert('提示', '失败!'); }
|
||||
$('#submitb').linkbutton('enable');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
<div style="margin-bottom:5px;">
|
||||
<label>是否公开</label>
|
||||
<input id="ispublicbutton" class="easyui-switchbutton" data-options="onText:'公开',offText:'不公开'" style="width: 80px;">
|
||||
<input id="ispublic" name="ispublic" val="yes" type="hidden"></input>
|
||||
<input id="ispublic" name="ispublic" value="yes" type="hidden"></input>
|
||||
</div>
|
||||
<div style="margin-bottom:5px" id="choosediv">
|
||||
<input class="easyui-textbox" id="participantname" style="width:500px;height:120px" editable="false"
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<div style="margin-bottom:5px;">
|
||||
<label>是否公开</label>
|
||||
<input id="ispublicbutton" class="easyui-switchbutton" data-options="onText:'公开',offText:'不公开'" style="width: 80px;">
|
||||
<input id="ispublic" name="ispublic" val="yes" type="hidden"></input>
|
||||
<input id="ispublic" name="ispublic" value="yes" type="hidden"></input>
|
||||
</div>
|
||||
<div style="margin-bottom:5px" id="choosediv">
|
||||
<input class="easyui-textbox" id="participantname" style="width:500px;height:120px" editable="false"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@
|
|||
{% if request|has_permission:'b_personaltrain_exportexl' %}
|
||||
<a class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true" onclick="exportgrpxexcel()">导出Excel</a>
|
||||
{% endif %}
|
||||
|
||||
{% if request|has_permission:'b_personaltrain_litall' %}
|
||||
<a class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain:true" onclick="listall()">显示全部</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
|
@ -102,7 +104,13 @@
|
|||
}
|
||||
|
||||
}
|
||||
function listall(){
|
||||
var sry = $('#sry').combobox('getValue')
|
||||
var url = 'api/train?a=listall'
|
||||
|
||||
$('#grpxtable').datagrid({url:url});
|
||||
|
||||
}
|
||||
function exportgrpxexcel() {
|
||||
var datalist = $('#grpxtable').datagrid('getData').rows;
|
||||
for(var j = 0,len = datalist.length; j < len; j++){
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ function tmsubmitForm(){
|
|||
tmdata['type'] = 3
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'api/question?a=add',
|
||||
url: 'api/question?a=edit',
|
||||
data: JSON.stringify(tmdata),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ urlpatterns = [
|
|||
path('html/checkjob',views.checkjob),#检查任务
|
||||
path('html/addcheckjob/<int:id>/',views.addcheckjob),#检查任务
|
||||
path('html/detailjob/<int:id>/',views.detailjob),#任务详情
|
||||
path('html/updchecktable/<int:id>/',views.updchecktable),#修改检查表
|
||||
#html页面
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -517,6 +517,8 @@ def addcheckrw(req):
|
|||
return render(req,'checklistadd.html')
|
||||
def detailjob(req,id):
|
||||
return render(req,'checkjobdetail.html',{'id':id})
|
||||
def updchecktable(req,id):
|
||||
return render(req,'checktabupd.html',{'id':id})
|
||||
def mainhtml(req):
|
||||
# 计算一些数据
|
||||
userid = req.session['userid']
|
||||
|
|
@ -6387,7 +6389,16 @@ def apitrain(req):
|
|||
objs = objs[startnum:endnum].values('train__trainnum', 'train__trainid', 'train__state', 'train__trainplace', 'train__starttime', 'train__trainname',
|
||||
'train__teacher', 'train__lecturer__name', 'participant__name', 'participant__name', 'checked', 'train__duration', 'examtestdetail')
|
||||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||
elif req.GET.get('a') == 'listall':
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)
|
||||
objs = Trainuser.objects.filter(train__deletemark=1,participant__usecomp__partid=companyid)
|
||||
|
||||
total = objs.count()
|
||||
startnum, endnum = fenye(req)
|
||||
objs = objs[startnum:endnum].values('train__trainnum', 'train__trainid', 'train__state', 'train__trainplace', 'train__starttime', 'train__trainname',
|
||||
'train__teacher', 'train__lecturer__name', 'participant__name', 'participant__name', 'checked', 'train__duration', 'examtestdetail')
|
||||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||
|
||||
def apiquestioncat(req):
|
||||
a = req.GET.get('a')
|
||||
|
|
@ -7716,7 +7727,7 @@ def checkprojects(req):
|
|||
total = a.count()
|
||||
startnum, endnum = fenye(req)
|
||||
|
||||
a = a[startnum:endnum].values('id','checktaskname','checktype__checktitle','checkplace', 'checktime','createuser__name','createdate')
|
||||
a = a[startnum:endnum].values('id','checktaskname','tasktype','checktype__checktitle','checkplace', 'checktime','createuser__name','createdate')
|
||||
|
||||
return HttpResponse(transjson(total, a), content_type="application/json")
|
||||
elif a == 'listall4':
|
||||
|
|
@ -7725,7 +7736,7 @@ def checkprojects(req):
|
|||
total = a.count()
|
||||
startnum, endnum = fenye(req)
|
||||
|
||||
a = a[startnum:endnum].values('id','checktask__checktaskname','yanshou','checkquestion','zguser__username','zgtime','checktask__checktype__checktitle','checkname__username', 'taskstate','checktask__checktime','createuser__username','createdate')
|
||||
a = a[startnum:endnum].values('id','checktask__checktaskname','jobstate','starttime','endtime','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")
|
||||
|
||||
|
|
@ -7734,7 +7745,7 @@ def checkprojects(req):
|
|||
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')
|
||||
a = a[startnum:endnum].values('id','checktask__checktaskname','jobstate','starttime','endtime','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 == 'listself':
|
||||
|
|
@ -7742,7 +7753,7 @@ def checkprojects(req):
|
|||
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')
|
||||
a = a[startnum:endnum].values('id','checktask__checktaskname','jobstate','starttime','endtime','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 == 'listallx':
|
||||
|
|
@ -7750,23 +7761,64 @@ def checkprojects(req):
|
|||
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')
|
||||
a = a[startnum:endnum].values('id','checktask__checktaskname','jobstate','starttime','endtime','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 == 'jobdetail':
|
||||
obj = Checkjob.objects.filter(id=req.GET.get('id'))
|
||||
obj = obj.values('checktask__checktaskname','zguser','taskstate','checkquestion','checktask__checkplace','checktask__checktype__checkcontent','checkname__username','checktask__checktime')[0]
|
||||
obj = obj.values('checktask__checktaskname','zguser','zgjg','jobstate','taskstate','checkquestion','checktask__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.zgjg = data['zgjg']
|
||||
obj.taskstate = data['taskstate']
|
||||
obj.createuser = User.objects.get(userid=userid)
|
||||
obj.content=data['content']
|
||||
s=[]
|
||||
if data['participant']!="":
|
||||
list = data['participant'].split(',')
|
||||
for i in list:
|
||||
x = User.objects.get(userid=i)
|
||||
obj.pmpeople.add(x)
|
||||
s.append(x.openid)
|
||||
postdict = {
|
||||
'touser': '',
|
||||
'template_id': 'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
||||
"miniprogram": {"appid": "wx5c39b569f01c27db"},
|
||||
'data': {
|
||||
'first': {
|
||||
'value': '处罚通知:'
|
||||
},
|
||||
'keyword1': {
|
||||
'value':'处罚内容:'+ obj.content
|
||||
},
|
||||
'keyword2': {
|
||||
'value': '通知时间:'+str(obj.createdate)
|
||||
},
|
||||
'keyword3': {
|
||||
'value': '处罚人:'+obj.createuser.name
|
||||
},
|
||||
'remark': {
|
||||
'value': '请及时查看阅读'
|
||||
}
|
||||
}
|
||||
}
|
||||
send_wechatmsgs.delay(postdict, s)
|
||||
obj.save()
|
||||
objs = Checktask.objects.get(id=obj.checktask.id)
|
||||
if objs.zxstate==2:
|
||||
for i in objs.checkname.all():
|
||||
user = User.objects.get(userid=i.userid)
|
||||
if user!=User.objects.get(userid=userid):
|
||||
jobss = Checkjob.objects.get(checkname=user,checktask=objs)
|
||||
jobss.taskstate=3
|
||||
jobss.save()
|
||||
|
||||
|
||||
return JsonResponse({'code': 1})
|
||||
elif a == 'yanshou':
|
||||
obj = Checkjob.objects.get(id=req.GET.get('id'))
|
||||
|
|
@ -7779,25 +7831,70 @@ def checkprojects(req):
|
|||
return HttpResponse(transstr(projectlist,'id','checktitle'),content_type="application/json")
|
||||
elif a=='addchecklist':
|
||||
data = json.loads(req.body.decode('utf-8'))
|
||||
|
||||
tasktype=int(data['tasktype'])
|
||||
starttime =datetime.strptime(str(data['starttime']), '%Y-%m-%d %H:%M')
|
||||
obj = Checktask()
|
||||
obj.checktaskname = data['checktaskname']
|
||||
obj.checktime=data['starttime']
|
||||
obj.checktime=starttime
|
||||
obj.checkplace=data['checkplace']
|
||||
obj.zxstate=data['zxstate']
|
||||
obj.tasktype=tasktype
|
||||
obj.checktype =Checktable.objects.get(id=data['checktabtitle'])
|
||||
obj.createuser = User.objects.get(userid=userid)
|
||||
obj.usecomp=Partment.objects.get(partid=companyid)
|
||||
obj.userlist=data['participant'].split(',')
|
||||
obj.save()
|
||||
|
||||
list = data['participant'].split(',')
|
||||
s=[]
|
||||
for i in list:
|
||||
x = User.objects.get(userid=i)
|
||||
obj.checkname.add(x)
|
||||
objs = Checkjob()
|
||||
objs.checktask=obj
|
||||
objs.checkname=x
|
||||
objs.usecomp=Partment.objects.get(partid=companyid)
|
||||
objs.save()
|
||||
objs.starttime=starttime
|
||||
if tasktype==1:
|
||||
objs.endtime =starttime+ timedelta(days=1)
|
||||
elif tasktype==2:
|
||||
objs.endtime=starttime + timedelta(days=7)
|
||||
elif tasktype==3:
|
||||
objs.endtime=starttime+ timedelta(days=30)
|
||||
elif tasktype==4:
|
||||
objs.endtime=starttime + timedelta(days=120)
|
||||
elif tasktype==5:
|
||||
objs.endtime=starttime + timedelta(days=182)
|
||||
elif tasktype==6:
|
||||
objs.endtime=starttime + timedelta(days=365)
|
||||
|
||||
objs.usecomp=Partment.objects.get(partid=companyid)
|
||||
|
||||
objs.save()
|
||||
s.append(x.openid)
|
||||
postdict = {
|
||||
'touser': '',
|
||||
'template_id': 'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
||||
"miniprogram": {"appid": "wx5c39b569f01c27db"},
|
||||
'data': {
|
||||
'first': {
|
||||
'value': '检查任务通知:'
|
||||
},
|
||||
'keyword1': {
|
||||
'value':'任务名:'+ obj.checktaskname
|
||||
},
|
||||
'keyword2': {
|
||||
'value': '执行时间:'+str(data['starttime'])
|
||||
},
|
||||
'keyword3': {
|
||||
'value': '发布人:'+obj.createuser.name
|
||||
},
|
||||
'remark': {
|
||||
'value': '请及时查看阅读'
|
||||
}
|
||||
}
|
||||
}
|
||||
send_wechatmsgs.delay(postdict, s)
|
||||
return JsonResponse({"code": 1})
|
||||
#删除
|
||||
elif a == 'del':
|
||||
|
|
@ -7811,10 +7908,29 @@ def checkprojects(req):
|
|||
else:
|
||||
|
||||
return JsonResponse({"code":0})
|
||||
elif a == 'updchechtab':
|
||||
obj = Checktable.objects.filter(id=req.GET.get('id'))
|
||||
obj = obj.values('checktitle','checkcontent')[0]
|
||||
|
||||
return JsonResponse({'code': 1, 'data': obj})
|
||||
elif a == 'updchecktaba':
|
||||
data = json.loads(req.body.decode('utf-8'))
|
||||
a = Checktable.objects.get(id=req.GET.get('id'))
|
||||
a.checktitle = data['checktaskname']
|
||||
a.checkcontent = data['checkcontent']
|
||||
a.save()
|
||||
return JsonResponse({"code": 1})
|
||||
|
||||
|
||||
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]
|
||||
list1=Checkjob.objects.get(id=id).pmpeople.all()
|
||||
uselist=[]
|
||||
for item in list1:
|
||||
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', 'checkquestion', 'zgtime', 'zguser__username', 'createuser__username',
|
||||
'createdate', 'taskstate','content','pmpeople', 'zgyq','zgjg', 'yanshou', 'yanshouren__username')[0]
|
||||
x['bcfr'] = uselist
|
||||
return HttpResponse(json.dumps(x, cls=MyEncoder), content_type="application/json")
|
||||
Loading…
Reference in New Issue