diff --git a/safesite/admin.py b/safesite/admin.py index 5eee4138..a97c8c56 100644 --- a/safesite/admin.py +++ b/safesite/admin.py @@ -12,6 +12,7 @@ admin.site.register(models.GridTaskSet) class Menuadmin(admin.ModelAdmin): list_display = ('menuname','menucode','type','url') list_display_links = ('menuname',) + search_fields = ('menuname', 'menucode',) def formfield_for_foreignkey(self, db_field, request, **kwargs): if db_field.name == "parentid": kwargs["queryset"] = models.Menu.objects.filter(type=1) diff --git a/safesite/migrations/0371_auto_20201227_1824.py b/safesite/migrations/0371_auto_20201227_1824.py new file mode 100644 index 00000000..725835e0 --- /dev/null +++ b/safesite/migrations/0371_auto_20201227_1824.py @@ -0,0 +1,31 @@ +# Generated by Django 2.2.8 on 2020-12-27 18:24 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0370_remove_companyinfo_liaison_fax'), + ] + + operations = [ + migrations.AddField( + model_name='trainplan', + name='createby', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='trainplan_createby', to='safesite.User'), + preserve_default=False, + ), + migrations.AddField( + model_name='trainplan', + name='updateby', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='trainplan_updateby', to='safesite.User'), + ), + migrations.AlterField( + model_name='trainplan', + name='manager', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='trainplan_manager', to='safesite.User', verbose_name='负责人'), + preserve_default=False, + ), + ] diff --git a/safesite/migrations/0372_train_trainplan.py b/safesite/migrations/0372_train_trainplan.py new file mode 100644 index 00000000..5c9a067e --- /dev/null +++ b/safesite/migrations/0372_train_trainplan.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.8 on 2020-12-27 21:48 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('safesite', '0371_auto_20201227_1824'), + ] + + operations = [ + migrations.AddField( + model_name='train', + name='trainplan', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='safesite.TrainPlan'), + ), + ] diff --git a/safesite/models.py b/safesite/models.py index 74f7baa1..f5c236fc 100644 --- a/safesite/models.py +++ b/safesite/models.py @@ -793,18 +793,21 @@ class TrainPlan(models.Model): purpose = models.TextField('培训目的') year = models.IntegerField('年份', default=2021) month = models.IntegerField('月份', default=1) - manager = models.ForeignKey(User, verbose_name="负责人", on_delete=models.SET_NULL, null=True, blank=True, related_name='trainplan_manager') + manager = models.ForeignKey(User, verbose_name="负责人", on_delete=models.CASCADE, related_name='trainplan_manager') period = models.IntegerField('预计学时', default=0) group = models.ForeignKey(Group, verbose_name='组', on_delete=models.SET_NULL, null=True, blank=True, related_name='trainplan_group') usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE) createtime = models.DateTimeField(default=timezone.now) modifytime = models.DateTimeField(auto_now=True) deletemark = models.IntegerField(default=1) + createby = models.ForeignKey(User, on_delete=models.CASCADE, related_name='trainplan_createby') + updateby = models.ForeignKey(User, on_delete=models.CASCADE, related_name='trainplan_updateby', null=True, blank=True) def __str__(self) -> str: return str(self.year)+'年'+str(self.month)+'月计划' class Train(models.Model): # 培训表 + trainplan = models.ForeignKey(TrainPlan, on_delete=models.SET_NULL, null=True, blank=True) trainid = models.AutoField(primary_key=True) trainnum = models.CharField(max_length=100, default='1') trainname = models.TextField() diff --git a/safesite/static/safesite/easyui/themes/icon.css b/safesite/static/safesite/easyui/themes/icon.css index 5441ca86..418437d7 100644 --- a/safesite/static/safesite/easyui/themes/icon.css +++ b/safesite/static/safesite/easyui/themes/icon.css @@ -181,6 +181,9 @@ .icon-scheduleset { background: url('icons/scheduleset.png') no-repeat center center; } +.icon-trainplan { + background: url('icons/trainplan.png') no-repeat center center; +} .icon-mini-add{ diff --git a/safesite/static/safesite/easyui/themes/icons/trainplan.png b/safesite/static/safesite/easyui/themes/icons/trainplan.png new file mode 100644 index 00000000..dfc7756a Binary files /dev/null and b/safesite/static/safesite/easyui/themes/icons/trainplan.png differ diff --git a/safesite/static/safesite/mystatic/js/util.js b/safesite/static/safesite/mystatic/js/util.js index 8994ce4a..df52c61e 100644 --- a/safesite/static/safesite/mystatic/js/util.js +++ b/safesite/static/safesite/mystatic/js/util.js @@ -264,13 +264,10 @@ function closeForm() { $("#dd").dialog("close"); } //关闭dialog-userdd -function closed2Form() { +function closeForm2() { $('#userdd').dialog("close"); } -//关闭dialog-userdd -function close3Form() { - $('#questiondd').dialog("close"); -} + //新建iframe function createFrame(url) { var s = ''; @@ -515,24 +512,25 @@ function opendg(title, href, w) { height: myh, closed: false, cache: false, - href: href, + href: href , modal: true, border: false, }).dialog('center'); } } -function opendg2(title, href) { +function opendg2(title, href, x) { + var x = x || ''; if (window.screen) { var myh = screen.availHeight * 0.8; var myW = screen.availWidth * 0.7; - $("#questiondd").dialog({ + $("#userdd").dialog({ title: title, width: myW, height: myh, closed: false, cache: false, - href: href, + href: href + '?a='+ x, modal: true, border: false, }).dialog('center'); diff --git a/safesite/templates/abtrain.html b/safesite/templates/abtrain.html index 7789f70c..48b55749 100644 --- a/safesite/templates/abtrain.html +++ b/safesite/templates/abtrain.html @@ -5,6 +5,12 @@
+
+ + + 选择 +
@@ -162,6 +168,10 @@ $('#lecturer').attr('value', top.$('#in').val()); $('#teacher').textbox('setValue', top.$('#in').attr('show')); } + else if (x == "trainplan") { + $('#trainplan').attr('value', top.$('#in').val()); + $('#trainplanname').textbox('setValue', top.$('#in').attr('show')); + } } function choseuser() { var myh = screen.availHeight * 0.5; @@ -252,6 +262,7 @@ $(function () { var a = GetQueryString("a"); if (a == 'accesstrain') { + $('#trainplandiv').hide() $('#chooserys').hide() $('#jsqd').hide() var b = GetQueryString("trainid"); diff --git a/safesite/templates/exampaperchose.html b/safesite/templates/exampaperchose.html new file mode 100644 index 00000000..7e9dfa42 --- /dev/null +++ b/safesite/templates/exampaperchose.html @@ -0,0 +1,48 @@ +
+ \ No newline at end of file diff --git a/safesite/templates/examtestadd.html b/safesite/templates/examtestadd.html index 8645a8cf..c5c24220 100644 --- a/safesite/templates/examtestadd.html +++ b/safesite/templates/examtestadd.html @@ -11,9 +11,14 @@ required=true />
- - + --> + + + + 选择
\ No newline at end of file diff --git a/safesite/templates/getusers.html b/safesite/templates/getusers.html index 59b8e334..32f28637 100644 --- a/safesite/templates/getusers.html +++ b/safesite/templates/getusers.html @@ -53,7 +53,7 @@
提交 - 取消 + 取消
diff --git a/safesite/templates/questionchoose.html b/safesite/templates/questionchoose.html index 74d32ecc..9641b8fa 100644 --- a/safesite/templates/questionchoose.html +++ b/safesite/templates/questionchoose.html @@ -176,7 +176,6 @@ function tmxzsubmitForm(){ var ss = []; var rows = $('#tmtable').datagrid('getSelections'); - console.log(rows) // var tmsjson = {} // tmsjson['totalnum'] = rows.length // tmsjson['dxnum']=0 @@ -209,6 +208,6 @@ } // sessionStorage.setItem('tmsjson',JSON.stringify(tmsjson)) calnum() - close3Form() + closeForm2() } \ No newline at end of file diff --git a/safesite/templates/train.html b/safesite/templates/train.html index 209e308e..cd7a595f 100644 --- a/safesite/templates/train.html +++ b/safesite/templates/train.html @@ -76,7 +76,7 @@ border: false, columns: [[ { field: 'trainid', title: '培训ID', hidden: true }, - { field: 'trainnum', title: '编号', width: 150 }, + { field: 'trainnum', title: '编号', width: 120 }, { field: 'state', title: '状态', width: 80, styler: function (value, row, index) { if (value == 0) { @@ -96,10 +96,15 @@ }, { field: 'trainplace', title: '培训地点', width: 80 }, { field: 'trainname', title: '培训名称', width: 200 }, - { field: 'starttime', title: '开始时间', width: 200 }, - { field: 'traintype__dickeyname', title: '培训类型', width: 200 }, - { field: 'teacher', title: '授课人', width: 200 }, - { field: 'submituser__name', title: '填报人', width: 200 }, + { field: 'starttime', title: '开始时间', width: 80 }, + { field: 'traintype__dickeyname', title: '培训类型', width: 80 }, + { field: 'trainplan__year', title: '所属计划', width: 200, formatter: function (value, row, index) { + if (value) { + return row.trainplan__year + '年' + row.trainplan__month + '月' + '-' + row.trainplan__purpose.substring(0,16) + '...' + } + } }, + { field: 'teacher', title: '授课人', width: 80 }, + { field: 'submituser__name', title: '填报人', width: 80 }, { field: 'submituser__userid', title: '填报人ID', hidden: true }, ]] }); diff --git a/safesite/templates/trainplan.html b/safesite/templates/trainplan.html index 6f947317..0e03624f 100644 --- a/safesite/templates/trainplan.html +++ b/safesite/templates/trainplan.html @@ -2,55 +2,51 @@
- - - - - - - - - 查询 - 重置 + + 查询 + 重置
- {% load myfilter %} - {% if request|has_permission:'b_examtest_add1' %} - 试卷库考试 - {% endif %} + + 新建 + 编辑 + 删除 +
\ No newline at end of file diff --git a/safesite/templates/trainplanadd.html b/safesite/templates/trainplanadd.html new file mode 100644 index 00000000..529fa404 --- /dev/null +++ b/safesite/templates/trainplanadd.html @@ -0,0 +1,96 @@ +
+
+ 提交 + 取消 +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + + 选择 +
+
+
+
+ \ No newline at end of file diff --git a/safesite/templates/trainplanchose.html b/safesite/templates/trainplanchose.html new file mode 100644 index 00000000..9ef3c19e --- /dev/null +++ b/safesite/templates/trainplanchose.html @@ -0,0 +1,82 @@ +
+
+
+
+ + + + 查询 + 重置 +
+
+
+ \ No newline at end of file diff --git a/safesite/templates/trainplanedit.html b/safesite/templates/trainplanedit.html new file mode 100644 index 00000000..94bf11d0 --- /dev/null +++ b/safesite/templates/trainplanedit.html @@ -0,0 +1,102 @@ +
+
+ 提交 + 取消 +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + + 选择 +
+
+
+
+ \ No newline at end of file diff --git a/safesite/urls.py b/safesite/urls.py index 31e76a54..a4b87760 100644 --- a/safesite/urls.py +++ b/safesite/urls.py @@ -1,4 +1,4 @@ -from safesite.views import inspectitem +from safesite.views import apitrainplan, inspectitem, trainplanchosehtml, trainplanhtml from django.urls import path,include from . import views,viewsdrf from . import datashowview @@ -64,6 +64,7 @@ urlpatterns = [ path('html/exampaper', views.exampaper), path('html/exampaper/edit//', views.exampaperedit), path('html/exampaper/add', views.exampaperadd), + path('html/exampaper/chose/', views.exampaperchose), path('html/questionchoose', views.questionchoose), path('html/examtest', views.examtest), path('html/examtest/add', views.examtestadd), @@ -134,6 +135,11 @@ urlpatterns = [ path('html/scheduleset/add/', views.schedulesetadd), path('html/scheduleset/edit//',views.schedulesetedit), + path('html/trainplan/', views.trainplanhtml), + path('html/trainplan/add/', views.trainplanaddhtml), + path('html/trainplan/edit//', views.trainplanedithtml), + path('html/trainplan/chose/', views.trainplanchosehtml), + path('getuser', views.getuser), path('addyh', views.addyh), path('accessyh',views.accessyh), @@ -205,6 +211,7 @@ urlpatterns = [ path('api/equipmentcheckform',viewsdrf.EquipmentCheckFormAPIView.as_view()), path('api/gridtaskset/',views.apigridtaskset), path('api/myschedule/',views.apimyschedule), + path('api/trainplan/', views.apitrainplan), path('api/examtestrate',views.apiexamtestrate), diff --git a/safesite/views.py b/safesite/views.py index 415718ca..080ad199 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -310,6 +310,8 @@ def exampaperedit(req, id): def exampaperadd(req): return render(req, 'exampaperadd.html') +def exampaperchose(req): + return render(req, 'exampaperchose.html') def exampaper(req): return render(req, 'exampaper.html') @@ -485,6 +487,17 @@ def getusersf(req): def trainhtml(req): return render(req, 'train.html') +def trainplanhtml(req): + return render(req, 'trainplan.html') + +def trainplanchosehtml(req): + return render(req, 'trainplanchose.html') + +def trainplanaddhtml(req): + return render(req, 'trainplanadd.html') + +def trainplanedithtml(req, id): + return render(req, 'trainplanedit.html', {'id': id}) def abtrain(req): return render(req, 'abtrain.html') @@ -1673,6 +1686,8 @@ def addtrain(req): x = User.objects.get(userid=req.POST.get('lecturer')) a.lecturer = x a.teacher = x.name + if req.POST.get('trainplan', None): + a.trainplan = TrainPlan.objects.get(id=req.POST.get('trainplan')) a.state = 0 a.participantnum = req.POST.get('participantnum') a.submituser = User.objects.get(userid=userid) @@ -3085,7 +3100,7 @@ def pxhandle(req): total = a.count() startnum, endnum = fenye(req) obj = a.order_by('-starttime')[startnum:endnum].values('trainnum', 'trainid', 'state', 'trainplace', 'starttime', - 'trainname', 'traintype__dickeyname', 'teacher', 'lecturer__name', 'submituser__name', 'submituser__userid', 'lecturer__userid') + 'trainname', 'traintype__dickeyname', 'teacher', 'lecturer__name', 'submituser__name', 'submituser__userid', 'lecturer__userid', 'trainplan__year', 'trainplan__month', 'trainplan__purpose') return HttpResponse(transjson(total, obj), content_type="application/json") elif req.GET.get('a') == 'detailhtml': trainid = req.GET.get('trainid') @@ -3098,7 +3113,7 @@ def pxhandle(req): total = a.count() startnum, endnum = fenye(req) a = a[startnum:endnum].values('trainnum', 'trainid', 'state', 'trainplace', 'starttime', 'trainname', - 'traintype__dickeyname', 'teacher', 'lecturer__name', 'submituser__name', 'submituser__userid', 'lecturer__userid') + 'traintype__dickeyname', 'teacher', 'lecturer__name', 'submituser__name', 'submituser__userid', 'lecturer__userid', 'trainplan__year', 'trainplan__month', 'trainplan__purpose') return HttpResponse(transjson(total, a), content_type="application/json") elif req.GET.get('a') == 'listtodo': userid = req.session['userid'] @@ -6111,16 +6126,54 @@ def apitrainplan(req): companyid = getcompany(userid) if a == 'listall': objs = TrainPlan.objects.filter(usecomp__partid=companyid,deletemark=1) + if req.GET.get('search', None): + objs = objs.filter(purpose__contains=req.GET.get('search')) + if req.GET.get('year', None): + objs = objs.filter(year=req.GET.get('year')) total = objs.count() startnum, endnum = fenye(req) - objs = objs[startnum:endnum].values('id', 'purpose', 'year', 'month', 'manager', 'group_name') - return HttpResponse(transjson(total, a), content_type="application/json") + objs = objs[startnum:endnum].values('id', 'purpose', 'year', 'month', 'manager__name', 'group__groupname', 'period') + return HttpResponse(transjson(total, objs), content_type="application/json") elif a == 'add': - pass + data = json.loads(req.body.decode('utf-8')) + vdata = {} + vdata['year'] = data['year'] + vdata['month'] = data['month'] + vdata['purpose'] = data.get('purpose', None) + vdata['group'] = Group.objects.get(groupid = data['group']) + vdata['period'] = data['period'] + vdata['manager'] = User.objects.get(userid = data['manager']) + vdata['usecomp'] = Partment.objects.get(partid=companyid) + vdata['createby'] = User.objects.get(userid=userid) + TrainPlan.objects.create(**vdata) + return JsonResponse({"code": 1}) elif a == 'edit': - pass + data = json.loads(req.body.decode('utf-8')) + id = data['id'] + obj = TrainPlan.objects.filter(id=id) + vdata = {} + vdata['year'] = data['year'] + vdata['month'] = data['month'] + vdata['purpose'] = data.get('purpose', None) + vdata['group'] = Group.objects.get(groupid = data['group']) + vdata['period'] = data['period'] + vdata['manager'] = User.objects.get(userid = data['manager']) + vdata['updateby'] = User.objects.get(userid=userid) + obj.update(**vdata) + return JsonResponse({"code": 1}) + elif a == 'detail': + id = req.GET.get('id') + obj = TrainPlan.objects.filter(id=id).values('id', 'purpose', 'year', 'month', 'manager__name', 'group__groupname', 'period', 'manager', 'group')[0] + return HttpResponse(json.dumps(obj, cls=MyEncoder), content_type="application/json") elif a == 'del': - pass + id = req.GET.get('id') + obj = TrainPlan.objects.get(id=id) + if User.objects.get(userid=userid).issuper == 1 or userid == obj.createby : + TrainPlan.objects.get(id=id).delete() + return JsonResponse({"code": 1}) + else: + return JsonResponse({"code": 0, "msg":'无权限删除'}) + def apiexamtest(req): diff --git a/static/safesite/easyui/themes/icon.css b/static/safesite/easyui/themes/icon.css index b3d93cc6..418437d7 100644 --- a/static/safesite/easyui/themes/icon.css +++ b/static/safesite/easyui/themes/icon.css @@ -169,8 +169,21 @@ .icon-bhr { background: url('icons/behv.png') no-repeat center center; } - - +.icon-caozuo { + background: url('icons/caozuo.png') no-repeat center center; +} +.icon-zeren { + background: url('icons/zeren.png') no-repeat center center; +} +.icon-inspectitem { + background: url('icons/inspectitem.png') no-repeat center center; +} +.icon-scheduleset { + background: url('icons/scheduleset.png') no-repeat center center; +} +.icon-trainplan { + background: url('icons/trainplan.png') no-repeat center center; +} .icon-mini-add{ diff --git a/static/safesite/mystatic/js/util.js b/static/safesite/mystatic/js/util.js index 982a2f67..df52c61e 100644 --- a/static/safesite/mystatic/js/util.js +++ b/static/safesite/mystatic/js/util.js @@ -4,11 +4,27 @@ $.ajaxSetup({ xhr.setRequestHeader("X-CSRFToken", csrftoken); }, complete:function(xhr, status){ - if(xhr.status==405){ - $.messager.alert('错误','超时请重新登陆!','error',function(){ - top.location = "http://" + window.location.host; - }); - } + // if(xhr.status==405){ + // $.messager.alert('错误','超时请重新登陆!','error',function(){ + // top.location = "http://" + window.location.host; + // }); + // } + try{ + var jsonData = JSON.parse(xhr.responseText); + if(jsonData.code == -1){ + //如果超时就处理 ,指定要跳转的页面(比如登陆页) + location.reload() + // $.messager.alert('错误','请重新登陆!','error',function(){ + + // }); + }else if(jsonData.code == 0){ + //其他的异常情况,给个提示。 + // $.messager.alert('错误','操作失败!','error'); + }else{ + //正常情况就不统一处理了 + } + }catch(e){ + } } }); @@ -146,7 +162,6 @@ function convertmenu(rows) { nodes.push({ id: row.menuid, text: row.menuname, - checked: row.checked, iconCls: row.icon, attributes: row.url }); @@ -164,11 +179,15 @@ function convertmenu(rows) { var row = rows[i]; if (row.parentid == node.id) { var child = { id: row.menuid, text: row.menuname, attributes: row.url, iconCls: row.icon, checked: row.checked }; + // if (row.type!=1){ + // node.state = 'closed' + // } if (node.children) { node.children.push(child); } else { node.children = [child]; } + delete node.checked toDo.push(child); } } @@ -191,12 +210,24 @@ function convert(rows, x) { for (var i = 0; i < rows.length; i++) { var row = rows[i]; if (!exists(rows, row.parentId)) { - nodes.push({ + let node = { id: row.id, text: row.name, state: x, - pic: row.pic - }); + pic: row.pic, + isopen: row.isopen + } + if(row.name=='默认分类'){ + node = { + id: row.id, + text: row.name, + state: 'closed', + pic: row.pic, + isopen: row.isopen + } + } + + nodes.push(node); } } @@ -210,7 +241,7 @@ function convert(rows, x) { for (var i = 0; i < rows.length; i++) { var row = rows[i]; if (row.parentId == node.id) { - var child = { id: row.id, text: row.name, pic: row.pic }; + var child = { id: row.id, text: row.name, pic: row.pic, isopen:row.isopen }; if (node.children) { node.children.push(child); } else { @@ -220,6 +251,12 @@ function convert(rows, x) { } } } + for (var i = 0; i < nodes.length; i++) { + var row = nodes[i]; + if(!row.children){ + row.state = 'open' + } + } return nodes; } //关闭dialog-dd @@ -227,13 +264,10 @@ function closeForm() { $("#dd").dialog("close"); } //关闭dialog-userdd -function closed2Form() { +function closeForm2() { $('#userdd').dialog("close"); } -//关闭dialog-userdd -function close3Form() { - $('#questiondd').dialog("close"); -} + //新建iframe function createFrame(url) { var s = ''; @@ -349,6 +383,22 @@ function choseusers(x) { }); $('#userdd').window('center'); } +function choseuser(x) { + var x = x || 'lecturer'; + var myh = screen.availHeight * 0.7; + $('#userdd').dialog({ + maximizable: true, + title: '选择人员', + width: 900, + height: myh, + closed: false, + cache: false, + href: 'getuserf?a=' + x, + modal: true, + border: false, + }); + $('#userdd').window('center'); +} //导出excel function JSONToCSVConvertor(JSONData, ReportTitle, ShowLabel) { //If JSONData is not an object then JSON.parse will parse the JSON string in an Object @@ -462,24 +512,25 @@ function opendg(title, href, w) { height: myh, closed: false, cache: false, - href: href, + href: href , modal: true, border: false, }).dialog('center'); } } -function opendg2(title, href) { +function opendg2(title, href, x) { + var x = x || ''; if (window.screen) { var myh = screen.availHeight * 0.8; var myW = screen.availWidth * 0.7; - $("#questiondd").dialog({ + $("#userdd").dialog({ title: title, width: myW, height: myh, closed: false, cache: false, - href: href, + href: href + '?a='+ x, modal: true, border: false, }).dialog('center'); @@ -526,7 +577,7 @@ function jsonSort(jsonObj) { } return str.substr(0, str.length - 1) } -//map定时显示,每分钟请求一次 +//map定时显示,每分钟请求一次,如果存在map function update() { if ($('#mapshowinput').length) { source.clear() @@ -558,7 +609,6 @@ function update() { } }) $.get('api/mapshow?a=operation', function (res) { - console.log(res) for (let i = 0, len = res.length; i < len; i++) { var data = res[i] data.id = data.zyqy__id @@ -566,9 +616,71 @@ function update() { data.polygon = data.zyqy__polygon data.name = data.zyqy__name data.type = 'zy' + data.list = data.zylist setPoint(data) } }) } } -var t1 = window.setInterval(update, 1000 * 60) \ No newline at end of file +function checksession(){ +$.get('api/check_session',function(res){ + if(res.code==1){ + }else{ + $.messager.alert('','长时间未操作,请重新登陆!','warning',function(){ + location.reload() + }); + } +}) +} +var t1 = window.setInterval(update, 1000 * 60) +var t2 = window.setInterval(checksession,1000*60*41) + +//扩展easyui表单的验证 +$.extend($.fn.validatebox.defaults.rules, { + //验证汉字 + CHS: { + validator: function (value) { + return /^[\u0391-\uFFE5]+$/.test(value); + }, + message: '请输入汉字' + }, + //移动手机号码验证 + Mobile: {//value值为文本框中的值 + validator: function (value) { + var reg = /^1[3|4|5|8|9]\d{9}$/; + return reg.test(value); + }, + message: '请输入正确号码' + }, + //国内邮编验证 + ZipCode: { + validator: function (value) { + var reg = /^[0-9]\d{5}$/; + return reg.test(value); + }, + message: '6位数字' + }, + //数字 + Number: { + validator: function (value) { + var reg =/^[0-9]*$/; + return reg.test(value); + }, + message: '请输入数字' + }, + //非负整数 + Integer: { + validator: function (value) { + var reg = /^[1-9]\d*|0$/; + return reg.test(value); + }, + message: '请输入非负整数' + }, + Password:{ + validator:function(value){ + var reg = /(?=.*[0-9])(?=.*[a-zA-Z]).{8,30}/; + return reg.test(value); + }, + message:'至少8位包含数字,大小写字母' + } +}) diff --git a/需求/~$培训系统建议.docx b/需求/~$培训系统建议.docx deleted file mode 100644 index 913aee83..00000000 Binary files a/需求/~$培训系统建议.docx and /dev/null differ