inspect part1

This commit is contained in:
caoqianming 2020-05-28 23:31:24 +08:00
parent 73b599fa03
commit 6427ea0f63
12 changed files with 159 additions and 39 deletions

View File

@ -20,7 +20,6 @@ from django.core.serializers.json import DjangoJSONEncoder
from .forms import CompanyForm
def fenye(request):
start = request.GET.get('offset',None)
end = request.GET.get('limit',None)
@ -45,8 +44,7 @@ class MyEncoder(json.JSONEncoder):
def check_login(func): # 自定义登录验证装饰器
def warpper(request, *args, **kwargs):
is_login = request.session.get('is_login', False)
if is_login:
if request.session.get('is_login', None):
return func(request, *args, **kwargs)
else:
return redirect(reverse('groups_login'))
@ -277,6 +275,9 @@ def company_userchange_page(request, uid):
except s_models.User.DoesNotExist:
raise Http404("User does not exist")
oldcompany = user.usecomp
if request.session.get('issuper', None):
companys = s_models.Partment.objects.filter(iscompany=1,deletemark=1)
else:
companys = GroupUser.objects.get(id=request.session['user_id']).group.members.all().order_by('creattime')
return render(request, 'groups/company_userchange.html', locals())

Binary file not shown.

View File

@ -0,0 +1,57 @@
# Generated by Django 2.2.8 on 2020-05-12 22:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('safesite', '0333_auto_20200424_1000'),
]
operations = [
# migrations.RemoveField(
# model_name='companyinfo',
# name='liaison_fax',
# ),
migrations.AlterField(
model_name='checkjob',
name='checkquestion',
field=models.TextField(null=True),
),
migrations.AlterField(
model_name='checkjob',
name='content',
field=models.TextField(null=True),
),
migrations.AlterField(
model_name='checkjob',
name='pmpeople',
field=models.ManyToManyField(related_name='bcfr', to='safesite.User'),
),
migrations.AlterField(
model_name='checkjob',
name='zgjg',
field=models.TextField(null=True),
),
migrations.AlterField(
model_name='checkjob',
name='zgyq',
field=models.TextField(null=True),
),
migrations.AlterField(
model_name='checkproject',
name='checkcontent',
field=models.TextField(),
),
migrations.AlterField(
model_name='checkproject',
name='requirements',
field=models.TextField(),
),
migrations.AlterField(
model_name='checktable',
name='checkcontent',
field=models.TextField(),
),
]

View File

@ -0,0 +1,22 @@
# Generated by Django 2.2.8 on 2020-05-26 21:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('safesite', '0334_auto_20200512_2244'),
]
operations = [
# migrations.RemoveField(
# model_name='companyinfo',
# name='liaison_fax',
# ),
migrations.AddField(
model_name='equipment',
name='checknum',
field=models.IntegerField(default=2, verbose_name='每班检查次数'),
),
]

View File

@ -874,8 +874,6 @@ class RiskAct(models.Model): # 风险点表
class EquipmentCheckItem(models.Model):# 检查项目
name = models.CharField(max_length=200,verbose_name='检查项目')
content = models.CharField(max_length=400,verbose_name='检查内容')
usecomps = ArrayField(models.IntegerField(), blank=True, null=True)
nousecomps = ArrayField(models.IntegerField(), blank=True, null=True)
class EquipmentCheckForm(models.Model):# 检查表
name = models.CharField(max_length=200,verbose_name='名称')
@ -946,6 +944,11 @@ class Inspect(models.Model): # 设备巡检记录
trouble = models.ForeignKey(
Trouble, on_delete=models.CASCADE, null=True, blank=True)
class InspectItem(models.Model):
checked = models.BooleanField('是否已检查', default=True)
content = models.TextField('项目描述', null=True, blank=True)
img = models.TextField('现场图片')
checkitem = models.ForeignKey(EquipmentCheckItem, on_delete=models.CASCADE)
class Risk(models.Model): # 风险表
tasktype_choices = (
@ -1216,8 +1219,8 @@ class ReaderOperproce(models.Model):
class Checkproject(models.Model):
id =models.AutoField(primary_key=True)#主键
checktitle=models.CharField(max_length=1000)#检查项目标题
checkcontent=models.CharField(max_length=1000)#检查内容
requirements=models.CharField(max_length=500)#检查要求
checkcontent=models.TextField()#检查内容
requirements=models.TextField()#检查要求
createuser = models.ForeignKey(User,on_delete=models.CASCADE)#创建人
createdate = models.DateTimeField(default = timezone.now)#创建时间
usecomp = models.ForeignKey(Partment,related_name='checkcomp',on_delete=models.CASCADE,null=True,blank=True)#创建公司
@ -1227,7 +1230,7 @@ class Checktable(models.Model):
id =models.AutoField(primary_key=True)#主键
checktitle=models.CharField(max_length=1000)#检查表名
checkprjtype=models.ManyToManyField(Checkproject)#检查项目多选
checkcontent=models.CharField(max_length=10000)#检查内容
checkcontent=models.TextField()#检查内容
createuser = models.ForeignKey(User,on_delete=models.CASCADE)#创建人
createdate = models.DateTimeField(default = timezone.now)#创建时间
usecomp = models.ForeignKey(Partment,related_name='checktabcomp',on_delete=models.CASCADE,null=True,blank=True)#创建公司
@ -1254,7 +1257,7 @@ class Checkjob(models.Model):
id=models.AutoField(primary_key=True)#主键
checktask=models.ForeignKey(Checktask,on_delete=models.CASCADE)#关联任务表
checkname=models.ForeignKey(User,related_name='jianchas',on_delete=models.CASCADE)#检查人员
checkquestion=models.CharField(max_length=1000,null=True)#检查发现的问题
checkquestion=models.TextField(null=True)#检查发现的问题
zgtime=models.DateTimeField(null=True, blank=True)#整改时间
jctime=models.DateTimeField(null=True, blank=True)#检查时间
zguser=models.ForeignKey(User,on_delete=models.CASCADE,null=True,)#整改人
@ -1266,11 +1269,11 @@ class Checkjob(models.Model):
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=500,null=True)#整改要求
zgjg=models.CharField(max_length=500,null=True)#整改结果
zgyq=models.TextField(null=True)#整改要求
zgjg=models.TextField(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=500,null=True)#处罚内容
pmpeople=models.ManyToManyField(User,related_name='bcfr')#被处罚人员
content=models.TextField(null=True)#处罚内容
yhtp = models.CharField(max_length=1000,null=True, blank=True)
zghtp = models.CharField(max_length=1000,null=True, blank=True)

View File

@ -10,8 +10,7 @@ class UserSerializers(serializers.ModelSerializer):
class EquipmentCheckItemSerializers(serializers.ModelSerializer):
class Meta:
model = EquipmentCheckItem
fields = ('id','name','content')
read_only_fields = ('id',)
fields = '__all__'
class EquipmentCheckFormSerializers(serializers.Serializer):
id = serializers.IntegerField(read_only=True)

View File

@ -34,7 +34,7 @@
<td>检查时间:</td>
<td>
<input id="jctime" editable="false" name="jctime" class="easyui-datetimebox" style="width:480px"
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" />
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" required=true/>
</td>
</tr>
@ -70,7 +70,7 @@
<td>整改期限:</td>
<td>
<input id="zgtime" editable="false" name="zgtime" class="easyui-datetimebox" style="width:480px"
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" />
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" required=true/>
</td>
</tr>
@ -97,7 +97,7 @@
<tr>
<td>需要整改:</td>
<td>
<input id="zgjg" class="easyui-textbox" name="zgjg" style="width:480px;height:60px" data-options="multiline:true">
<input id="zgjg" class="easyui-textbox" name="zgjg" style="width:480px;height:60px" data-options="multiline:true" required=true>
</td>
</tr>
<tr>

View File

@ -23,6 +23,8 @@
{% endif %}
<a id="bindjcb" onclick="javascript:$('#bindjcbdg').dialog('open')" class="easyui-linkbutton"
data-options="iconCls:'fa-plug',plain:true">批量绑定检查表</a>
<a id="setChecknum" onclick="javascript:$('#setChecknumdg').dialog('open')" class="easyui-linkbutton"
data-options="iconCls:'fa-plug',plain:true">批量设定每班检查次数</a>
<!-- <a id="bindfxd" onclick="bindfxd()" class="easyui-linkbutton"
data-options="iconCls:'fa-plug',plain:true">批量绑定风险点</a> -->
</div>
@ -126,10 +128,19 @@
<input id="checkform" class="easyui-combobox" data-options="label:'检查表'" required=true style="width:100%"
editable=false></input>
</div>
<div id="setChecknumdg" class="easyui-dialog" title="设定每班检查次数" style="width:400px;height:200px;padding: 10px;"
data-options="resizable:true,modal:true,closed:true,border:false,buttons:'#dlg-buttons2'">
<input id="checknum" class="easyui-numberbox" value="2" data-options="min:1,precision:0,label:'检查次数'" required=true style="width:100%"
></input>
</div>
<div id="dlg-buttons">
<a class="easyui-linkbutton" onclick="savejcb()">保存</a>
<a class="easyui-linkbutton" onclick="javascript:$('#bindjcbdg').dialog('close')">取消</a>
</div>
<div id="dlg-buttons2">
<a class="easyui-linkbutton" onclick="setChecknum()">保存</a>
<a class="easyui-linkbutton" onclick="javascript:$('#setChecknumdg').dialog('close')">取消</a>
</div>
</div>
<script>
$.get('api/equipmentcheckform', function (res) {
@ -227,7 +238,7 @@
}
},
{ field: 'checkform__name', title: '检查表', width: 80 },
{ field: 'checknum', title: '每班检查次数', width: 40 },
]],
onSelect: function (index, data) {
if ($('#b_equipment_change').length) {
@ -421,4 +432,32 @@
}
}
function setChecknum() {
var row = $('#sbtable').datagrid('getSelections');
let ids = []
for (i = 0; i < row.length; i++) {
ids.push(row[i].id)
}
if (ids.length) {
let checknum= $('#checknum').numberbox('getValue')
let data = { 'ids': ids, 'checknum': checknum }
$.ajax({
type: "POST",
url: 'api/equipment?a=setchecknum',
data: JSON.stringify(data),
datatype: "json",
processData: false,
contentType: "application/json;charset=utf-8",
beforeSend: function () {
},
success: function (data) {
$("#sbtable").datagrid('reload');
$('#setChecknumdg').dialog('close')
},
});
} else {
$.messager.alert('提示', '未选择数据');
}
}
</script>

View File

@ -53,7 +53,7 @@
{ field: 'name', title: '考试名', width: 160 },
{ field: 'exampaper__name', title: '试卷名', width: 160 },
{ field: 'duration', title: '答卷时长', width: 60 },
{ field: 'createtime', title: '发布时间', width: 80 },
{ field: 'starttime', title: '开启时间', width: 80 },
{ field: 'createuser__name', title: '发布人', width: 80 },
{ field: 'state', title: '状态', width: 40,styler: function (value, row, index) {
switch (value) {

View File

@ -32,6 +32,10 @@
<td style="width:50%">发布人:{{createuser__name}}</td>
<td style="width:50%">发布时间:{{createtime| dateFormat 'yyyy-MM-dd hh:mm'}}</td>
</tr>
<tr>
<td style="width:50%">开启时间:{{starttime| dateFormat 'yyyy-MM-dd hh:mm'}}</td>
<td style="width:50%">关闭时间:{{endtime| dateFormat 'yyyy-MM-dd hh:mm'}}</td>
</tr>
<tr>
<td>所用试卷:{{exampaper__name}}</td>
<td>限制用时:{{duration}} 分钟</td>

View File

@ -1,7 +1,7 @@
from captcha.helpers import captcha_image_url
from captcha.models import CaptchaStore
from django.shortcuts import render, redirect, render_to_response
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from .models import User, Trouble, Dickey, Partment, Dicclass, Train, Drill, TroubleAccess, Group, Yjyc,Checktable, Trainuser, Drilluser, Yjsetup, Menu, Observe, Observeto, Unsafes, Miss, Socertificate, Userprofile, Suggest, Notice, Noticeto, Operation, Operzyry, Fxcs, Operationspjd, Operspxq, Question, ExamPaper, ExamTest, ExamPaperDetail, ExamTestDetail, Questioncat, Safecert, Map, Area, Missto, Suggestflow, Equipment, Inspect, Risk, RiskAct, Risktask, Riskcheck, Report, RiskActTask, Riskcheck2,Resbility,Operproce,Readerblility,ReaderOperproce,Role,EquipmentCheckForm,EquipmentCheckItem,Checkproject,Checktask,Checkjob
from django.template import RequestContext
@ -7545,16 +7545,16 @@ def getresbilitydata(req):
obj = Resbility()
data = json.loads(req.body.decode('utf-8'))
obj.title = data['title']
if data['group']:
if 'group' in data and data['group']:
obj.jobs =Group.objects.get(groupid= data['group'])
if data['type']:
if 'type' in data and data['type']:
obj.homeworktype= Dickey.objects.get(dickeyid=data['type'])
if data['filepath']:
obj.resbilitypath=data['filepath']
obj.createuser=User.objects.get(userid=userid)
if data['publisdate']:
if 'publisdate' in data and data['publisdate']:
obj.createdate=data['publisdate']
obj.usecomp=Partment.objects.get(partid=companyid)
if data['filepath']:
@ -7641,16 +7641,16 @@ def getprodata(req):
obj = Operproce()
data = json.loads(req.body.decode('utf-8'))
obj.title = data['title']
if data['group']:
if 'group' in data and data['group']:
obj.jobs =Group.objects.get(groupid= data['group'])
if data['type']:
if 'type' in data and data['type']:
obj.homeworktype= Dickey.objects.get(dickeyid=data['type'])
if 'jobpart' in data and data['jobpart']:
obj.department=Partment.objects.get(partid=data['jobpart'])
if data['filepath']:
obj.operprocepath=data['filepath']
obj.createuser=User.objects.get(userid=userid)
if data['publisdate']:
if 'publisdate' in data and data['publisdate']:
obj.createdate=data['publisdate']
obj.usecomp=Partment.objects.get(partid=companyid)
if data['filepath']:
@ -7876,16 +7876,11 @@ def checkprojects(req):
}
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()
obj_checktask = obj.checktask
if obj_checktask.zxstate==2:
for i in obj_checktask.checkname.all():
if i.userid != userid:
Checkjob.objects.filter(checkname=i,checktask=obj_checktask).update(taskstate=3)
return JsonResponse({'code': 1})
elif a == 'yanshou':

View File

@ -48,7 +48,7 @@ class EquipmentCheckFormAPIView(APIView):
if 'id' in i and i['id']:
ins = EquipmentCheckItem.objects.filter(id=i['id']).first()
if serializerx.is_valid():
erializerx.update(ins,i)
serializerx.update(ins,i)
else:
if serializerx.is_valid():