diff --git a/groups/migrations/0001_initial.py b/groups/migrations/0001_initial.py new file mode 100644 index 00000000..904a0432 --- /dev/null +++ b/groups/migrations/0001_initial.py @@ -0,0 +1,31 @@ +# Generated by Django 2.1.5 on 2019-09-19 14:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Groups', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=128, unique=True)), + ('password', models.CharField(max_length=256)), + ('groupname', models.CharField(max_length=128, unique=True)), + ('type', models.CharField(choices=[('real', '集团'), ('fictitious', '组合')], default='集团', max_length=32)), + ('createtime', models.DateTimeField(auto_now_add=True)), + ('members', models.ManyToManyField(to='safesite.Partment')), + ], + options={ + 'ordering': ['-createtime'], + 'verbose_name_plural': '集团', + 'verbose_name': '集团', + }, + ), + ] diff --git a/safesite/daoru.py b/safesite/daoru.py index a6f9cb2b..b0ce039e 100644 --- a/safesite/daoru.py +++ b/safesite/daoru.py @@ -17,7 +17,7 @@ def makeqr(data): filepath = os.path.join(upload_folder, data.split('=')[1]+'.png').replace('\\','/') img.save(filepath) return filepath -def makeqr2(data): +def makeqr_train(data): upload_folder = 'media/qr_train' if not os.path.exists(upload_folder): os.mkdir(upload_folder) @@ -26,7 +26,7 @@ def makeqr2(data): img.save(filepath) return filepath -def makeqr3(data): +def makeqr_riskact(data): upload_folder = 'media/qr_riskact' if not os.path.exists(upload_folder): os.mkdir(upload_folder) @@ -35,7 +35,7 @@ def makeqr3(data): img.save(filepath) return filepath -def makeqr4(data): +def makeqr_examtest(data): upload_folder = 'media/qr_examtest' if not os.path.exists(upload_folder): os.mkdir(upload_folder) @@ -44,6 +44,15 @@ def makeqr4(data): img.save(filepath) return filepath +def makeqr_area(data): + upload_folder = 'media/qr_area' + if not os.path.exists(upload_folder): + os.mkdir(upload_folder) + img = qrcode.make(data=data) + filepath = os.path.join(upload_folder, data.split('=')[1]+'.png').replace('\\','/') + img.save(filepath) + return filepath + def drequipments(companyid,path): wb = load_workbook(path) sheet = wb.worksheets[0] @@ -274,7 +283,7 @@ def drrisks(companyid,path): if users.exists(): obj.zrr = users[0] obj.save() - obj.qrcode = makeqr3('https://safeyun.ctcshe.com/miniprogram/riskact?id='+str(obj.id)) + obj.qrcode = makeqr_riskact('https://safeyun.ctcshe.com/miniprogram/riskact?id='+str(obj.id)) obj.save() a = Risk() a.riskact=obj diff --git a/safesite/edu/views.py b/safesite/edu/views.py index 7e9ad472..62d5bfd3 100644 --- a/safesite/edu/views.py +++ b/safesite/edu/views.py @@ -119,13 +119,17 @@ def api(req): elif a == 'del': id =req.GET.get('id') userid = req.session['userid'] + companyid = getcompany(userid)#公司ID a = Edulesson.objects.get(id=id) - if User.objects.get(userid = userid).issuper == 1: + if a.usecomp==Partment.objects.get(partid=companyid): a.deletemark=0 a.save() return JsonResponse({"code":1}) + else: + return JsonResponse({"code":0}) + #点击阅读 elif a=='readnumber': id =req.GET.get('id') diff --git a/safesite/forms.py b/safesite/forms.py index 2c342ee6..147d9f7c 100644 --- a/safesite/forms.py +++ b/safesite/forms.py @@ -19,6 +19,5 @@ class CompanyInfoForm(forms.Form): legalperson_phone = forms.CharField(max_length=24, label='法人电话', widget=forms.TextInput(attrs={'size': '50'})) liaison = forms.CharField(max_length=24, label='联系人', widget=forms.TextInput(attrs={'size': '50'})) liaison_phone = forms.CharField(max_length=24, label='联系人电话', widget=forms.TextInput(attrs={'size': '50'})) - liaison_fax = forms.CharField(max_length=13, label='联系人传真', widget=forms.TextInput(attrs={'size': '50'})) introduce = forms.CharField(label='公司概况', widget=forms.Textarea) diff --git a/safesite/mgt/__init__.py b/safesite/mgt/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/safesite/mgt/urls.py b/safesite/mgt/urls.py new file mode 100644 index 00000000..eff7d666 --- /dev/null +++ b/safesite/mgt/urls.py @@ -0,0 +1,11 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.index), + path('add',views.add), + path('api',views.api), + path('getdickey', views.getdickey), + path('upload', views.upload), + +] \ No newline at end of file diff --git a/safesite/mgt/views.py b/safesite/mgt/views.py new file mode 100644 index 00000000..723245fd --- /dev/null +++ b/safesite/mgt/views.py @@ -0,0 +1,95 @@ +from django.shortcuts import render,redirect,render_to_response +from django.http import HttpResponse, HttpResponseRedirect,JsonResponse +from ..models import User,Trouble,Dickey,Partment,Dicclass,Train,Drill,TroubleAccess,Group,Yjyc,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,Edulesson,EdulessonWatch,FileManage,FileReader,Regulations,Mgtsystem +from django.template import RequestContext +from django.views.decorators.csrf import csrf_exempt +from django.core import serializers +import json +from uuid import UUID +import os +import time +from datetime import datetime,date,timedelta +from django.db.models import F,Count,Sum +import requests +from ..tasks import send_wechatmsgs,send_wechatmsg,yjjs,gettime,yjjs_px,yjjs_yl,updateTzzs,updateAqzs +from ..export import exportdoc,exportxlsx,exportyjdoc,exportsimplexlsx,exportdoc2 +from ..daoru import drusers,drequipments,drrisks +from django.forms.models import model_to_dict +from ..safespider import getTzzs,getAqzs +#from duibiao import calsim +from django.db.models import Q +from django.core.serializers.json import DjangoJSONEncoder +from io import StringIO +import operator +import jwt +from ..views import getcompany,fenye,transjson +#法律法规 +def index(req): + return render(req,'mgtindex.html') +def add(req): + return render(req,'mgtadd.html') +#上传文件,返回地址和名称 +def upload(req): + username = User.objects.get(userid=req.session['userid']).username + file_name = time.strftime('%Y%m%d%H%M%S')+ '_' + req.FILES['mf'].name + user_upload_folder = os.path.join('media/mgt', username) + if not os.path.exists(user_upload_folder): + os.mkdir(user_upload_folder) + filepath = os.path.join(user_upload_folder, file_name) + filepath = filepath.replace('\\','/') + with open( filepath, 'wb') as f: + f.write(req.FILES['mf'].read()) + return JsonResponse({"code":1,"filename":file_name,"filepath":filepath}) +#转换为combobox所用string +def transstr(obj,str1,str2): + keylist = [] + for i in list(obj): + keydictstr = '{"value":"'+ str(i[str1])+'","text":"'+i[str2]+'"}' + keylist.append(keydictstr) + keystr = '['+','.join(keylist)+']' + return keystr + +def getdickey(req): + userid = req.session['userid'] + companyid = getcompany(userid) + dicclass=req.GET.get('dicclass') + a = Dickey.objects.filter(dicparent=dicclass,deletemark=1) + a = (a.filter(usecomps__contains=',1,')|a.filter(usecomps__contains=','+companyid+',')).exclude(nousecomps__contains=','+companyid+',') + a = a.values('dickeyid','dicparent__dicname','dickeyname','dicparent__dicid','detail').order_by('dickeyid') + return HttpResponse(transstr(a,'dickeyid','dickeyname'),content_type="application/json") + +def api(req): + a=req.GET.get('a') + userid = req.session['userid'] + companyid = getcompany(userid) + if a == 'add': + obj = Mgtsystem() + data = json.loads(req.body.decode('utf-8')) + obj.mgtname = data['mgtname'] + obj.mgtpath = data['filepath'] + obj.type= Dickey.objects.get(dickeyid=data['type']) + obj.publisdate=data['publisdate'] + obj.usecomp=Partment.objects.get(partid=companyid) + obj.createuser=User.objects.get(userid=userid) + + obj.save() + return JsonResponse({"code":1}) + + elif a=='listall': + startnum,endnum=fenye(req) + a = Mgtsystem.objects.filter(usecomp__partid__in= [1,Partment.objects.get(partid=companyid).partid] ,deletemark=1).order_by('id') + total = a.count() + startnum,endnum=fenye(req) + a = a[startnum:endnum].values('id','mgtname','mgtpath','type__dickeyname','publisdate','createuser__name') + return HttpResponse(transjson(total,a),content_type="application/json") + + elif a == 'del': + id =req.GET.get('id') + userid = req.session['userid'] + a = Mgtsystem.objects.get(id=id) + if a.usecomp==Partment.objects.get(partid=companyid): + a.deletemark=0 + a.save() + return JsonResponse({"code":1}) + else: + return JsonResponse({"code":0}) \ No newline at end of file diff --git a/safesite/migrations/0266_auto_20190917_2314.py b/safesite/migrations/0266_auto_20190917_2314.py new file mode 100644 index 00000000..06bf3363 --- /dev/null +++ b/safesite/migrations/0266_auto_20190917_2314.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.5 on 2019-09-17 23:14 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0265_auto_20190917_1716'), + ] + + operations = [ + migrations.AddField( + model_name='area', + name='qrcode', + field=models.CharField(blank=True, max_length=200, null=True), + ), + ] diff --git a/safesite/migrations/0268_merge_20190919_1423.py b/safesite/migrations/0268_merge_20190919_1423.py new file mode 100644 index 00000000..e03d23ed --- /dev/null +++ b/safesite/migrations/0268_merge_20190919_1423.py @@ -0,0 +1,14 @@ +# Generated by Django 2.1.5 on 2019-09-19 14:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0267_auto_20190917_1543'), + ('safesite', '0265_auto_20190917_1716'), + ] + + operations = [ + ] diff --git a/safesite/migrations/0269_auto_20190919_1423.py b/safesite/migrations/0269_auto_20190919_1423.py new file mode 100644 index 00000000..897971a2 --- /dev/null +++ b/safesite/migrations/0269_auto_20190919_1423.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-09-19 14:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0268_merge_20190919_1423'), + ] + + operations = [ + migrations.AddField( + model_name='observe', + name='lookers', + field=models.ManyToManyField(related_name='gcrs', to='safesite.User'), + ), + ] diff --git a/safesite/migrations/0270_auto_20190920_1200.py b/safesite/migrations/0270_auto_20190920_1200.py new file mode 100644 index 00000000..14f34fdb --- /dev/null +++ b/safesite/migrations/0270_auto_20190920_1200.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.5 on 2019-09-20 12:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0269_auto_20190919_1423'), + ] + + operations = [ + migrations.RemoveField( + model_name='companyinfo', + name='liaison_fax', + ), + ] diff --git a/safesite/migrations/0270_auto_20190923_1017.py b/safesite/migrations/0270_auto_20190923_1017.py new file mode 100644 index 00000000..9663ee76 --- /dev/null +++ b/safesite/migrations/0270_auto_20190923_1017.py @@ -0,0 +1,29 @@ +# Generated by Django 2.1.5 on 2019-09-23 10:17 + +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0269_auto_20190919_1423'), + ] + + operations = [ + migrations.CreateModel( + name='Mgtsystem', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('mgtname', models.CharField(max_length=50)), + ('mgtpath', models.CharField(blank=True, max_length=200, null=True)), + ('publisdate', models.DateTimeField(default=django.utils.timezone.now)), + ('deletemark', models.IntegerField(default=1)), + ('createuser', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='safesite.User')), + ('type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='safesite.Dickey')), + ('usecomp', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='safesite.Partment')), + ], + ), + + ] diff --git a/safesite/migrations/0271_auto_20190923_1018.py b/safesite/migrations/0271_auto_20190923_1018.py new file mode 100644 index 00000000..8095f19f --- /dev/null +++ b/safesite/migrations/0271_auto_20190923_1018.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-09-23 10:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0270_auto_20190923_1017'), + ] + + operations = [ + migrations.AlterField( + model_name='mgtsystem', + name='mgtname', + field=models.CharField(max_length=64), + ), + ] diff --git a/safesite/migrations/0271_auto_20190925_1113.py b/safesite/migrations/0271_auto_20190925_1113.py new file mode 100644 index 00000000..22b22b28 --- /dev/null +++ b/safesite/migrations/0271_auto_20190925_1113.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-09-25 11:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0270_auto_20190920_1200'), + ] + + operations = [ + migrations.AlterField( + model_name='trouble', + name='shresult', + field=models.IntegerField(blank=True, choices=[(1, '通过'), (2, '审核未通过'), (3, '复查未通过'), (4, '已修改'), (5, '评估未通过'), (6, '未采纳')], null=True), + ), + ] diff --git a/safesite/migrations/0272_auto_20190923_1026.py b/safesite/migrations/0272_auto_20190923_1026.py new file mode 100644 index 00000000..10d4006e --- /dev/null +++ b/safesite/migrations/0272_auto_20190923_1026.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1.5 on 2019-09-23 10:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0271_auto_20190923_1018'), + ] + + operations = [ + migrations.AlterField( + model_name='mgtsystem', + name='id', + field=models.AutoField(primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='mgtsystem', + name='mgtname', + field=models.CharField(max_length=50), + ), + ] diff --git a/safesite/migrations/0272_auto_20190925_1657.py b/safesite/migrations/0272_auto_20190925_1657.py new file mode 100644 index 00000000..070d32ac --- /dev/null +++ b/safesite/migrations/0272_auto_20190925_1657.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-09-25 16:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0271_auto_20190925_1113'), + ] + + operations = [ + migrations.AddField( + model_name='suggest', + name='accept', + field=models.IntegerField(default=1), + ), + ] diff --git a/safesite/migrations/0273_auto_20191008_1604.py b/safesite/migrations/0273_auto_20191008_1604.py new file mode 100644 index 00000000..459197f0 --- /dev/null +++ b/safesite/migrations/0273_auto_20191008_1604.py @@ -0,0 +1,29 @@ +# Generated by Django 2.1.5 on 2019-10-08 16:04 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0272_auto_20190925_1657'), + ] + + operations = [ + # migrations.AddField( + # model_name='area', + # name='qrcode', + # field=models.CharField(blank=True, max_length=200, null=True), + # ), + migrations.AddField( + model_name='operation', + name='todousers', + field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None), + ), + migrations.AddField( + model_name='operationspjd', + name='sprs', + field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None), + ), + ] diff --git a/safesite/models.py b/safesite/models.py index d66da860..1553234a 100644 --- a/safesite/models.py +++ b/safesite/models.py @@ -1,7 +1,7 @@ from django.db import models import uuid import django.utils.timezone as timezone -from django.contrib.postgres.fields import JSONField +from django.contrib.postgres.fields import JSONField,ArrayField import jwt import datetime # Create your models here. @@ -120,6 +120,7 @@ class Trouble(models.Model):#隐患排查 (3, '复查未通过'), (4, '已修改'), (5,'评估未通过'), + (6,'未采纳'), ) deletemark=models.IntegerField(default='1') troubleid = models.AutoField(primary_key=True) @@ -212,7 +213,7 @@ class Observe(models.Model):#行为观察 lookplace = models.CharField(max_length=200) looktime = models.DateTimeField(default = timezone.now) looktime2 = models.DateTimeField(null=True,blank=True) - #accompanyman = models.ManyToManyField(User,related_name='gcptr',null=True,blank=True)#陪同人员 + lookers = models.ManyToManyField(User,related_name='gcrs')#陪同人员 lookpart = models.ForeignKey(Partment,related_name='gcbm',on_delete=models.CASCADE) #观察部门 looker = models.ForeignKey(User,related_name='gcr',default='1', on_delete=models.CASCADE)#观察人 lookeder = models.CharField(max_length=100,null=True,blank=True)#被观察对象 @@ -409,6 +410,7 @@ class Suggest(models.Model):#合理化建议 yjwcsj = models.DateTimeField(null=True,blank=True) #预计完成时间 sjwcsj = models.DateTimeField(null=True,blank=True) #实际完成时间 shyj = models.CharField(max_length=1000,null=True,blank=True) #审核意见 + accept = models.IntegerField(default=1) class Suggestflow(models.Model):#建议流程 id = models.AutoField(primary_key=True) @@ -464,6 +466,7 @@ class Operation(models.Model):#作业表 zyzt = JSONField() fxcs = models.CharField(max_length=200) todouser = models.ForeignKey(User,related_name='zyclr',on_delete=models.CASCADE,null=True,blank=True) + todousers = ArrayField(models.IntegerField(), blank=True,null=True) usecomp = models.ForeignKey(Partment,on_delete=models.CASCADE,null=True,blank=True,default=1) class Fxcs(models.Model):#作业分析措施 @@ -506,12 +509,13 @@ class Operzyry(models.Model):#作业确认人 modifytime = models.DateTimeField(auto_now = True) submittime = models.DateTimeField(default = timezone.now) -class Operationspjd(models.Model):#作业审批节点 +class Operationspjd(models.Model):#作业审批节点配置 id = models.AutoField(primary_key=True) zylx = models.ForeignKey(Dickey, on_delete=models.CASCADE,null=True,blank=True) jdmc = models.CharField(max_length=100) spbm = models.ForeignKey(Partment,related_name='spbm',on_delete=models.CASCADE,null=True,blank=True)#审批部门 spr = models.ForeignKey(User,related_name='spr',on_delete=models.CASCADE,null=True,blank=True)#审批部门 + sprs = ArrayField(models.IntegerField(), blank=True,null=True) submittime = models.DateTimeField(u'创建时间',default = timezone.now) modifytime = models.DateTimeField(auto_now = True) usecomp = models.ForeignKey(Partment,on_delete=models.CASCADE,null=True,blank=True) @@ -830,7 +834,6 @@ class CompanyInfo(models.Model): legalperson_phone = models.CharField(max_length=24, null=True, blank=True, verbose_name='法人电话') liaison = models.CharField(max_length=24, verbose_name='联系人') liaison_phone = models.CharField(max_length=24, verbose_name='联系人电话') - liaison_fax = models.CharField(max_length=10, null=True, blank=True, verbose_name='联系人传真') introduce = models.TextField( null=True, blank=True, verbose_name='公司概况') createtime = models.DateTimeField(auto_now_add=True) modifytime = models.DateTimeField(auto_now=True) @@ -868,3 +871,14 @@ class FileManage(models.Model): usecomp= models.ForeignKey(Partment,on_delete=models.CASCADE,null=True,blank=True) downnum = models.IntegerField(default=0) deletemark = models.IntegerField(default=1) + +#管理制度表 +class Mgtsystem(models.Model): + id = models.AutoField(primary_key=True) + mgtname = models.CharField(max_length=50) + type = models.ForeignKey(Dickey,on_delete=models.CASCADE,null=True,blank=True) + usecomp = models.ForeignKey(Partment,on_delete=models.CASCADE,null=True,blank=True) + mgtpath = models.CharField(max_length=200,null=True,blank=True) + publisdate = models.DateTimeField(default = timezone.now) + createuser = models.ForeignKey(User,on_delete=models.CASCADE) + deletemark = models.IntegerField(default=1) diff --git a/safesite/rlt/views.py b/safesite/rlt/views.py index dedc4aeb..332f0e9e 100644 --- a/safesite/rlt/views.py +++ b/safesite/rlt/views.py @@ -75,7 +75,7 @@ def lawstype(req): list_items = (Regulations.objects.filter(usecomp__partid=companyid,deletemark=1)).annotate(parentId=F('parent__id'),name=F('typename')).values('id','parentId','name') return HttpResponse(json.dumps(list(list_items)),content_type="application/json") elif a == 'tree': - list_items = (Regulations.objects.filter(usecomp__partid=1,deletemark=1)|Regulations.objects.filter(usecomp__partid=companyid,deletemark=1)).annotate(parentId=F('parent__id')).values('id','parentId','typename') + list_items = (Regulations.objects.filter(usecomp__partid=1,deletemark=1)|Regulations.objects.filter(usecomp__partid=companyid,deletemark=1)).annotate(parentId=F('parent__id'),name=F('typename')).values('id','parentId','name') return HttpResponse(json.dumps(list(list_items)),content_type="application/json") elif a == 'add': data = json.loads(req.body.decode('utf-8')) @@ -129,7 +129,7 @@ def lawstype(req): id = req.GET.get('id') user = User.objects.get(userid=userid) a = Regulations.objects.get(id=id) - if user.issuper==1 or a.usecomp.partid == companyid: + if a.usecomp==Partment.objects.get(partid=companyid): Regulations.objects.filter(id = id).update(deletemark=0) return JsonResponse({"code":1}) else: @@ -139,7 +139,7 @@ def lawstype(req): elif a == 'canedit': id = req.GET.get('id') a = Regulations.objects.get(id=id) - if a.usecomp == companyid or int(companyid)==1: + if a.usecomp==Partment.objects.get(partid=companyid): return JsonResponse({'code':1}) else: return JsonResponse({"code":0}) @@ -169,7 +169,7 @@ def lawstype(req): id =req.GET.get('id') userid = req.session['userid'] a = FileManage.objects.get(id=id) - if User.objects.get(userid = userid).issuper == 1: + if a.usecomp==Partment.objects.get(partid=companyid): a.deletemark=0 a.save() return JsonResponse({"code":1}) diff --git a/safesite/static/safesite/easyui/themes/default/easyui.css b/safesite/static/safesite/easyui/themes/default/easyui.css index 579bac75..64ed3ae7 100644 --- a/safesite/static/safesite/easyui/themes/default/easyui.css +++ b/safesite/static/safesite/easyui/themes/default/easyui.css @@ -1,5 +1,5 @@ .panel { - overflow: hidden; + /*overflow: hidden;*/ text-align: left; margin: 0; border: 0; @@ -37,11 +37,7 @@ border-bottom-width: 0; } .panel-with-icon { -<<<<<<< HEAD - padding-left: 20px; -======= - padding-left: 10px; ->>>>>>> 0ed848ff177ad9c427f58c714cb22f8012e2c913 + padding-left: 20px; } .panel-icon, .panel-tool { @@ -3411,7 +3407,7 @@ height: 40px; line-height: 30px; color: #313030; - margin-left: 25px; + margin-left: 10px; } .sidemenu .accordion-header:hover { background: #0066cc; diff --git a/safesite/static/safesite/easyui/themes/icon.css b/safesite/static/safesite/easyui/themes/icon.css index 1cf78d04..ec677c31 100644 --- a/safesite/static/safesite/easyui/themes/icon.css +++ b/safesite/static/safesite/easyui/themes/icon.css @@ -148,6 +148,9 @@ .icon-edu{ background:url('icons/edu.png') no-repeat center center; } +.icon-gmt { + background: url('icons/gmt.png') no-repeat center center; +} .icon-regulationstype { background: url('icons/regulationstype.png') no-repeat center center; } diff --git a/safesite/static/safesite/easyui/themes/icons/gmt.png b/safesite/static/safesite/easyui/themes/icons/gmt.png new file mode 100644 index 00000000..fb4e1043 Binary files /dev/null and b/safesite/static/safesite/easyui/themes/icons/gmt.png differ diff --git a/safesite/static/safesite/mystatic/js/conversion.js b/safesite/static/safesite/mystatic/js/conversion.js new file mode 100644 index 00000000..1d598b03 --- /dev/null +++ b/safesite/static/safesite/mystatic/js/conversion.js @@ -0,0 +1 @@ +"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):window.imageConversion=t()}(function(){var t={};function e(t){return["image/png","image/jpeg","image/gif"].some(function(e){return e===t})}return t.urltoImage=function(t){return new Promise(function(e,a){var n=new Image;n.onload=function(){return e(n)},n.onerror=function(){return a(new Error("urltoImage(): Image failed to load, please check the image URL"))},n.src=t})},t.urltoBlob=function(t){return fetch(t).then(function(t){return t.blob()})},t.imagetoCanvas=async function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=document.createElement("canvas"),n=a.getContext("2d"),i=void 0,r=void 0;for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(e[o]=Number(e[o]));if(e.scale){var c=e.scale>0&&e.scale<10?e.scale:1;r=t.width*c,i=t.height*c}else r=e.width||e.height*t.width/t.height||t.width,i=e.height||e.width*t.height/t.width||t.height;switch([5,6,7,8].some(function(t){return t===e.orientation})?(a.height=r,a.width=i):(a.height=i,a.width=r),e.orientation){case 3:n.rotate(180*Math.PI/180),n.drawImage(t,-a.width,-a.height,a.width,a.height);break;case 6:n.rotate(90*Math.PI/180),n.drawImage(t,0,-a.width,a.height,a.width);break;case 8:n.rotate(270*Math.PI/180),n.drawImage(t,-a.height,0,a.height,a.width);break;case 2:n.translate(a.width,0),n.scale(-1,1),n.drawImage(t,0,0,a.width,a.height);break;case 4:n.translate(a.width,0),n.scale(-1,1),n.rotate(180*Math.PI/180),n.drawImage(t,-a.width,-a.height,a.width,a.height);break;case 5:n.translate(a.width,0),n.scale(-1,1),n.rotate(90*Math.PI/180),n.drawImage(t,0,-a.width,a.height,a.width);break;case 7:n.translate(a.width,0),n.scale(-1,1),n.rotate(270*Math.PI/180),n.drawImage(t,-a.height,0,a.height,a.width);break;default:n.drawImage(t,0,0,a.width,a.height)}return a},t.canvastoFile=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"image/jpeg";return new Promise(function(n){return t.toBlob(function(t){return n(t)},a,e)})},t.canvastoDataURL=async function(t,a,n){return e(n)||(n="image/jpeg"),t.toDataURL(n,a)},t.filetoDataURL=function(t){return new Promise(function(e){var a=new FileReader;a.onloadend=function(t){return e(t.target.result)},a.readAsDataURL(t)})},t.dataURLtoImage=function(t){return new Promise(function(e,a){var n=new Image;n.onload=function(){return e(n)},n.onerror=function(){return a(new Error("dataURLtoImage(): dataURL is illegal"))},n.src=t})},t.dataURLtoFile=async function(t,a){for(var n=t.split(","),i=n[0].match(/:(.*?);/)[1],r=atob(n[1]),o=r.length,c=new Uint8Array(o);o--;)c[o]=r.charCodeAt(o);return e(a)&&(i=a),new Blob([c],{type:i})},t.downloadFile=function(t,e){var a=document.createElement("a");a.href=window.URL.createObjectURL(t),a.download=e||Date.now().toString(36),document.body.appendChild(a);var n=document.createEvent("MouseEvents");n.initEvent("click",!1,!1),a.dispatchEvent(n),document.body.removeChild(a)},t.compress=async function(a){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(a instanceof Blob))throw new Error("compress(): First arg must be a Blob object or a File object.");if("object"!==(void 0===n?"undefined":_typeof(n))&&(n=Object.assign({quality:n})),n.quality=Number(n.quality),Number.isNaN(n.quality))return a;var i=await t.filetoDataURL(a),r=i.split(",")[0].match(/:(.*?);/)[1],o="image/jpeg";e(n.type)&&(o=n.type,r=n.type);var c=await t.dataURLtoImage(i),u=await t.imagetoCanvas(c,Object.assign({},n)),s=await t.canvastoDataURL(u,n.quality,o);return await t.dataURLtoFile(s,r)},t.compressAccurately=async function(a){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(a instanceof Blob))throw new Error("compressAccurately(): First arg must be a Blob object or a File object.");if("object"!==(void 0===n?"undefined":_typeof(n))&&(n=Object.assign({size:n})),n.size=Number(n.size),Number.isNaN(n.size))return a;if(1024*n.size>a.size)return a;n.accuracy=Number(n.accuracy),(!n.accuracy||n.accuracy<.8||n.accuracy>.99)&&(n.accuracy=.95);var i=n.size*(2-n.accuracy)*1024,r=1024*n.size,o=n.size*n.accuracy*1024,c=await t.filetoDataURL(a),u=c.split(",")[0].match(/:(.*?);/)[1],s="image/jpeg";e(n.type)&&(s=n.type,u=n.type);for(var h=await t.dataURLtoImage(c),d=await t.imagetoCanvas(h,Object.assign({},n)),l=.5,f=void 0,g=[null,null],m=1;m<=7;m++){var w=.75*(f=await t.canvastoDataURL(d,l,s)).length;if(7===m){(iw)&&(f=[f].concat(g).filter(function(t){return t}).sort(function(t,e){return Math.abs(.75*t.length-r)-Math.abs(.75*e.length-r)})[0]);break}if(iw))break;g[0]=f,l+=.5**(m+1)}}var y=await t.dataURLtoFile(f,u);return y.size>a.size?a:y},t}); \ No newline at end of file diff --git a/safesite/static/safesite/mystatic/js/util.js b/safesite/static/safesite/mystatic/js/util.js index 35f76255..982a2f67 100644 --- a/safesite/static/safesite/mystatic/js/util.js +++ b/safesite/static/safesite/mystatic/js/util.js @@ -32,6 +32,17 @@ function canvasDataURL(path, obj, callback) { scale = w / h; w = obj.width || w; h = obj.height || (w / scale); + if(w <= h ){ + if(w>640){ + w = 640 + h = w/scale + } + }else{ + if(h>640){ + h=640 + w = h*scale + } + } var quality = 0.7; // 默认图片质量为0.7 //生成canvas var canvas = document.createElement('canvas'); @@ -45,9 +56,9 @@ function canvasDataURL(path, obj, callback) { canvas.setAttributeNode(anh); ctx.drawImage(that, 0, 0, w, h); // 图像质量 - if (obj.quality && obj.quality <= 1 && obj.quality > 0) { - quality = obj.quality; - } + // if (obj.quality && obj.quality <= 1 && obj.quality > 0) { + // quality = obj.quality; + // } // quality值越小,所绘制出的图像越模糊 var base64 = canvas.toDataURL('image/jpeg', quality); // 回调函数返回base64的值 @@ -62,7 +73,6 @@ function convertBase64UrlToBlob(urlData) { } return new Blob([u8arr], { type: mime }); } - //取消上传 function cancleUploadFile() { diff --git a/safesite/templates/accesstrouble.html b/safesite/templates/accesstrouble.html index 317c97f1..90c14740 100644 --- a/safesite/templates/accesstrouble.html +++ b/safesite/templates/accesstrouble.html @@ -301,7 +301,16 @@ $("#yhms").textbox('disable'); $('#fcyjdiv,#file2,#zgxq,#shyjdiv,#csyj,#reject').hide(); $('#jxpg').show(); $("#yhpg").combobox({ url: 'getdickey?dicclass=19&a=combobox', }); - $("#zgbm").combotree({ url: 'parthandle?a=tree3', onSelect: function (node) { $('#zgr').combobox({ url: 'getuser?partid=' + node.id + '&a=combobox', }); } }); + $("#zgbm").combotree({ url: 'parthandle?a=tree3', onSelect: function (node) { + $('#zgr').combobox({ + url: 'getuser?partid=' + node.id + '&a=combobox', + editable: false, + filter: function (q, row) { + var opts = $(this).combobox('options'); + return row[opts.textField].indexOf(q) >= 0;//这里改成>=即可在任意地方匹配 + }, + }); + } }); // if (data.yhpg__dickeyname != '' & data.yhpg__dickeyname != null) { // $("#yhpg").combobox('setValue', data.yhpg__dickeyid).combobox('readonly'); // $("#yhlx").combobox({ url: 'getdicclass?dicid=15' }).combobox('setValue', data.yhlx__dicid).combobox('readonly'); diff --git a/safesite/templates/addobserve.html b/safesite/templates/addobserve.html index 724ec220..15acfea4 100644 --- a/safesite/templates/addobserve.html +++ b/safesite/templates/addobserve.html @@ -6,6 +6,12 @@
+
+ + + 选择 +
@@ -68,6 +74,12 @@
+ + + + + +
+
+
+ +
+
+ +
+ + + + + diff --git a/safesite/templates/examtestdetail.html b/safesite/templates/examtestdetail.html index 0766def4..a9c2a111 100644 --- a/safesite/templates/examtestdetail.html +++ b/safesite/templates/examtestdetail.html @@ -60,16 +60,16 @@ - + - + + {{each cjrydetail}} @@ -92,6 +95,7 @@ {{/if}} + {{/each}}
- 序号 - + 序号 + 姓名 - 部门 - + 部门 + 状态 @@ -78,6 +78,9 @@ 用时 + 答题详情 +
{{$value.score}} {{$value.took}}点击查看
@@ -183,4 +187,6 @@ } }); } + + \ No newline at end of file diff --git a/safesite/templates/lawsadd.html b/safesite/templates/lawsadd.html index 891ff5cb..3e0e8e5c 100644 --- a/safesite/templates/lawsadd.html +++ b/safesite/templates/lawsadd.html @@ -99,7 +99,7 @@ 法律法规名称: - + @@ -113,7 +113,7 @@ 法律法规分类: - @@ -158,7 +158,7 @@ 选择文件 - +

@@ -219,7 +219,7 @@ success: function (data) { if (data.code == 1) { alert("数据保存!"); - $('#edutab').datagrid('reload'); + $('#tmtable').datagrid('reload'); $("#dd").dialog("close"); } else { $.messager.alert('提示', '失败!'); } $('#submitb').linkbutton('enable'); @@ -241,37 +241,37 @@ //$("#maragename").text(fileObj.name); $("#maragename").textbox('setValue', fileObj.name) + + var fileObj = document.getElementById("file").files[0]; // js 获取文件对象 + if (fileObj == undefined || fileObj == "") { + alert("请选择文件"); + return false; + }; + var imagSize = document.getElementById("file").files[0].size; + if (imagSize > 1024 * 1024 * 10) { + alert("文件大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择10M以内的文件!"); + return false; + } + var url = "rlt/api/upload"; // 接收上传文件的后台地址 + var form = new FormData(); // FormData 对象 + form.append("mf", fileObj); // 文件对象 + xhr = new XMLHttpRequest(); // XMLHttpRequest 对象 + xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。 + xhr.onload = uploadComplete; //请求完成 + xhr.onerror = uploadFailed; //请求失败 + xhr.upload.onprogress = progressFunction; //【上传进度调用方法实现】 + xhr.upload.onloadstart = function () { //上传开始执行方法 + ot = new Date().getTime(); //设置上传开始时间 + oloaded = 0; //设置上传开始时,以上传的文件大小为0 + }; + xhr.send(form); //开始上传,发送form数据 } else { alert("请选择文件"); } } /*点击提交*/ - function sub() { - var fileObj = document.getElementById("file").files[0]; // js 获取文件对象 - if (fileObj == undefined || fileObj == "") { - alert("请选择文件"); - return false; - }; - var imagSize = document.getElementById("file").files[0].size; - if (imagSize > 1024 * 1024 * 10) { - alert("文件大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择3M以内的文件!"); - return false; - } - var url = "rlt/api/upload"; // 接收上传文件的后台地址 - var form = new FormData(); // FormData 对象 - form.append("mf",fileObj); // 文件对象 - xhr = new XMLHttpRequest(); // XMLHttpRequest 对象 - xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。 - xhr.onload = uploadComplete; //请求完成 - xhr.onerror = uploadFailed; //请求失败 - xhr.upload.onprogress = progressFunction; //【上传进度调用方法实现】 - xhr.upload.onloadstart = function () { //上传开始执行方法 - ot = new Date().getTime(); //设置上传开始时间 - oloaded = 0; //设置上传开始时,以上传的文件大小为0 - }; - xhr.send(form); //开始上传,发送form数据 - } + //上传进度实现方法,上传过程中会频繁调用该方法 function progressFunction(evt) { diff --git a/safesite/templates/main.html b/safesite/templates/main.html index 784daf6a..ae1a3390 100644 --- a/safesite/templates/main.html +++ b/safesite/templates/main.html @@ -263,7 +263,7 @@ float: left;">
-
@@ -326,6 +326,12 @@ float: left;">
+
+
+ +
+
+ diff --git a/safesite/templates/mgtindex.html b/safesite/templates/mgtindex.html new file mode 100644 index 00000000..09e87bae --- /dev/null +++ b/safesite/templates/mgtindex.html @@ -0,0 +1,78 @@ + +
+
+ 新增 + 删除 + + + +
+ +
+
+ \ No newline at end of file diff --git a/safesite/templates/observe.html b/safesite/templates/observe.html index 997550e3..12dbfe57 100644 --- a/safesite/templates/observe.html +++ b/safesite/templates/observe.html @@ -101,7 +101,7 @@ { field: 'lookplace', title: '观察地点', width: 150 }, { field: 'actname', title: '作业名称', width: 200 }, { field: 'looktime', title: '观察时间', width: 200 }, - { field: 'looker__name', title: '观察人', width: 200 }, + { field: 'looker__name', title: '观察记录人', width: 200 }, { field: 'lookeder', title: '被观察对象', width: 200 }, { field: 'otherunsafe', title: '过程和交流记录', width: 300 }, ]] diff --git a/safesite/templates/observedetail.html b/safesite/templates/observedetail.html index 68e05d24..1bbf1cf5 100644 --- a/safesite/templates/observedetail.html +++ b/safesite/templates/observedetail.html @@ -14,7 +14,10 @@ 所属部门:{{lookpart__partname}} - 观察人:{{looker__name}} + 观察人记录人:{{looker__name}} + + + 观察人员:{{lookers}} 开始时间:{{looktime| dateFormat 'yyyy-MM-dd hh:mm'}} diff --git a/safesite/templates/operationspjdadd.html b/safesite/templates/operationspjdadd.html index fde8ca25..d7f20fd9 100644 --- a/safesite/templates/operationspjdadd.html +++ b/safesite/templates/operationspjdadd.html @@ -13,7 +13,7 @@ required=true />
-
@@ -22,9 +22,13 @@