tmdaoru
This commit is contained in:
parent
0ccd5a69dc
commit
277fc87699
|
@ -2,7 +2,7 @@ from docxtpl import DocxTemplate, InlineImage
|
|||
from docx.shared import Mm, Inches, Pt
|
||||
from openpyxl import Workbook, load_workbook
|
||||
from openpyxl.drawing.image import Image
|
||||
from .models import User,Trouble,Dickey,Partment,Dicclass,Train,Drill,TroubleAccess,Group,Yjyc,Equipment,Area,RiskAct,Risk
|
||||
from .models import User,Trouble,Dickey,Partment,Dicclass,Train,Drill,TroubleAccess,Group,Yjyc,Equipment,Area,RiskAct,Risk,Question,Questioncat
|
||||
from datetime import datetime,date
|
||||
import base64
|
||||
from django.conf import settings
|
||||
|
@ -53,6 +53,48 @@ def makeqr_area(data):
|
|||
img.save(filepath)
|
||||
return filepath
|
||||
|
||||
def drquestions(companyid,path):
|
||||
wb = load_workbook(path)
|
||||
sheet = wb.worksheets[0]
|
||||
i = 4
|
||||
while sheet['c'+str(i)].value!=None:
|
||||
type = sheet['a'+str(i)].value.replace(' ', '')
|
||||
cate = sheet['b'+str(i)].value.replace(' ', '')
|
||||
title = sheet['c'+str(i)].value
|
||||
answerA = sheet['d'+str(i)].value
|
||||
answerB = sheet['e'+str(i)].value
|
||||
answerC = sheet['f'+str(i)].value
|
||||
answerD = sheet['g'+str(i)].value
|
||||
answerE = sheet['h'+str(i)].value
|
||||
answerF = sheet['i'+str(i)].value
|
||||
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)
|
||||
if objs.exists():
|
||||
cateobj = objs[0]
|
||||
else:
|
||||
objs = Questioncat.objects.filter(usecomp__partid=companyid,name=cate)
|
||||
if objs.exists():
|
||||
cateobj = objs[0]
|
||||
else:
|
||||
cateobj = Questioncat.objects.create(usecomp__partid=companyid,name=cate)
|
||||
if type == '单选':
|
||||
obj = Question()
|
||||
obj.type = 1
|
||||
obj.cate = cateobj
|
||||
obj.title = title
|
||||
obj.answerA = answerA
|
||||
obj.answerB = answerB
|
||||
obj.answerC = answerC
|
||||
obj.answerD = answerD
|
||||
obj.answerE = answerE
|
||||
obj.answerF = answerF
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
def drequipments(companyid,path):
|
||||
wb = load_workbook(path)
|
||||
sheet = wb.worksheets[0]
|
||||
|
|
|
@ -598,7 +598,7 @@ class ExamTestDetail(models.Model):#考试详情表
|
|||
endtime = models.DateTimeField(null=True,blank=True)
|
||||
took = models.IntegerField(default=0) #耗时
|
||||
rights = models.IntegerField(default=1) #正确数
|
||||
ison = models.IntegerField(default=0) #未参加/已参加/不计算
|
||||
ison = models.IntegerField(default=0) #未参加0/已参加1/
|
||||
passcode = models.IntegerField(default=0) #是否通过
|
||||
testdetail = JSONField(null=True,blank=True)
|
||||
score = models.FloatField(default=0)#得分
|
||||
|
|
Binary file not shown.
|
@ -29,7 +29,7 @@
|
|||
<table id="tmtable" style="height:100%;"></table>
|
||||
|
||||
</div>
|
||||
<div id="drtmdg" class="easyui-dialog" title="导入用户" style="width:400px;height:200px;" data-options="iconCls:'fa-upload',resizable:true,modal:true,closed:true,border:false">
|
||||
<div id="drtmdg" class="easyui-dialog" title="导入" style="width:400px;height:200px;" data-options="iconCls:'fa-upload',resizable:true,modal:true,closed:true,border:false">
|
||||
<p style="color:red;margin-left: 10px">请按模板录入后导入</p>
|
||||
<p style="margin-left: 10px"><a href="/static/safesite/muban/tm.xlsx" target="_blank">点击下载模板</a></p>
|
||||
<p style="margin-left: 10px">录入完成后点击下方按钮上传文件</p>
|
||||
|
|
|
@ -345,6 +345,7 @@
|
|||
//data['map7v'] = myChart7.getDataURL({ pixelRatio: 2, });
|
||||
data['nowyjz'] = nowyjz;
|
||||
//console.log(JSON.stringify(data));5
|
||||
console.log(data)
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
async: false, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
|
|
Loading…
Reference in New Issue