新建trainplan表
This commit is contained in:
parent
88fda3d631
commit
7f1cc7c19f
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
]
|
|
@ -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'),
|
||||
),
|
||||
]
|
|
@ -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()
|
||||
|
|
|
@ -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{
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 486 B |
|
@ -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 = '<iframe id="ifr" scrolling="auto" frameborder="0" src="' + url + '" style="width:100%;height:100%;"></iframe>';
|
||||
|
@ -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');
|
||||
|
|
|
@ -5,6 +5,12 @@
|
|||
</div>
|
||||
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
|
||||
<form id="pxff" method="post" name="pxff" enctype="multipart/form-data">
|
||||
<div style="margin-bottom:5px" id="trainplandiv">
|
||||
<input id="trainplanname" class="easyui-textbox" style="width:480px" data-options="label:'所属计划'" editable=false
|
||||
>
|
||||
<input type="hidden" name="trainplan" id="trainplan"/>
|
||||
<a id="choosetrainplan" class='easyui-linkbutton' onclick="javascript:opendg2('选择计划','html/trainplan/chose/', 'trainplan')" style="width:auto">选择</a>
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="starttime" editable="false" name="starttime" class="easyui-datetimebox" style="width:480px"
|
||||
data-options="label:'培训时间',currentText:'今天',closeText:'关闭',showSeconds:false" required=true />
|
||||
|
@ -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");
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<table id="sjtable" style="width:auto;height:100%;"></table>
|
||||
<script>
|
||||
$(function(){
|
||||
$('#sjtable').datagrid({url:'api/exampaper',queryParams:{a:'listall'}});
|
||||
//$("#searchsjff").form('clear');
|
||||
})
|
||||
$('#sjtable').datagrid({
|
||||
url: '',
|
||||
rownumbers: true,
|
||||
singleSelect: true,
|
||||
striped: true,
|
||||
fitColumns: true,
|
||||
method: 'get',
|
||||
pagination: 'true',
|
||||
pageSize: 20,
|
||||
toolbar: '#sjtablebar',
|
||||
border:false,
|
||||
columns: [[
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'num', title: '编号', width: 80 },
|
||||
{ field: 'name', title: '试卷名', width: 200 },
|
||||
{ field: 'state', title: '状态', width: 80,styler: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 0: return 'background-color:red;'; break;
|
||||
case 1: return 'background-color:green;'; break;
|
||||
}
|
||||
},formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 0: return '已禁用'; break;
|
||||
case 1: return '使用中'; break;
|
||||
}
|
||||
} },
|
||||
{ field: 'total', title: '题量', width: 400 ,formatter: function (value, row, index) {
|
||||
return '总题数:'+ value.total.num + ';总分:'+value.total.score + ';单选题数:'+value.dx.num + ';多选题数:'+value.duox.num + ';判断题数:'+value.pd.num;
|
||||
}},
|
||||
]],
|
||||
onClickRow: function (index, item) {
|
||||
var id = item.id;
|
||||
var name = item.name
|
||||
var a = GetQueryString2("a");
|
||||
top.$('#in').attr('value', id);
|
||||
top.$('#in').attr('show', name);
|
||||
top.$('#in').attr('target', a);
|
||||
aaa(a);
|
||||
closeForm2()
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -11,9 +11,14 @@
|
|||
required=true />
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="exampaper" editable="false" name="exampaper" class="easyui-combobox" style="width:90%"
|
||||
<!-- <input id="exampaper" editable="false" name="exampaper" class="easyui-combobox" style="width:90%"
|
||||
data-options="label:'选择试卷'" required=true />
|
||||
<a id="editpaper" class='easyui-linkbutton' onclick="editpaper()" style="width:auto;display:none" >编辑</a>
|
||||
<a id="editpaper" class='easyui-linkbutton' onclick="editpaper()" style="width:auto;display:none" >编辑</a> -->
|
||||
|
||||
<input id="exampapername" class="easyui-textbox" style="width:90%" data-options="label:'选择试卷'"
|
||||
editable=false>
|
||||
<input type="hidden" name="exampaper" id="exampaper"/>
|
||||
<a id="choseexampaper" class='easyui-linkbutton' onclick="javascript:opendg2('选择试卷','html/exampaper/chose/', 'exampaper')" style="width:auto">选择</a>
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="totalscore" name="totalscore" class="easyui-numberbox" style="width:90%"
|
||||
|
@ -55,19 +60,6 @@
|
|||
</div>
|
||||
<script>
|
||||
$('#choosediv').hide()
|
||||
$.get('api/exampaper?a=listok', function (res) {
|
||||
$('#exampaper').combobox({
|
||||
valueField: 'id',
|
||||
textField: 'name',
|
||||
data: res.rows,
|
||||
onSelect: function (node) {
|
||||
$.get('api/exampaper?a=detail&id=' + node.id,function(res){
|
||||
$('#totalscore').textbox('setValue',res.total.score);
|
||||
})
|
||||
$('#editpaper').show()
|
||||
}
|
||||
})
|
||||
})
|
||||
$('#ispublicbutton').switchbutton({
|
||||
checked: true,
|
||||
onChange: function(checked){
|
||||
|
@ -123,5 +115,9 @@
|
|||
$('#participantname').textbox('setValue', top.$('#in').attr('show'));
|
||||
$('#participantnum').textbox('setValue', top.$('#in').attr('total'));
|
||||
}
|
||||
else if (x == "exampaper") {
|
||||
$('#exampaper').attr('value', top.$('#in').val());
|
||||
$('#exampapername').textbox('setValue', top.$('#in').attr('show'));
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -53,7 +53,7 @@
|
|||
<div data-options="region:'south'" style="height:8%">
|
||||
<a href="javascript:void(0)" iconCls="fa-check" class="easyui-linkbutton" onclick="GetUsersChecked()"
|
||||
style="width:auto;height:100%" id="submitform">提交</a>
|
||||
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closed2Form()" style="width:auto;height:100%">取消</a>
|
||||
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm2()" style="width:auto;height:100%">取消</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
</script>
|
|
@ -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 },
|
||||
]]
|
||||
});
|
||||
|
|
|
@ -2,55 +2,51 @@
|
|||
<div id="pxjhtablebar" style="padding:4px;height:auto">
|
||||
<div>
|
||||
<form id='searchpxjhff'>
|
||||
<label>考试状态</label>
|
||||
<select name='state' style='width:150px' class="easyui-combobox" editable=false>
|
||||
<option value="">请选择</option>
|
||||
<option value="open">进行中</option>
|
||||
<option value="close">已关闭</option>
|
||||
<label>年份</label>
|
||||
<select id="year" name='year' style='width:150px' editable=false>
|
||||
</select>
|
||||
<label>开始时间</label>
|
||||
<a class="easyui-datebox" name="starttime1" editable=false></a>
|
||||
<label>-</label>
|
||||
<a class="easyui-datebox" name="starttime2" editable=false></a>
|
||||
<a class="easyui-textbox" name="search" data-options="prompt:'考试名或试卷名'"></a>
|
||||
|
||||
<a onclick="kssearch()" class="easyui-linkbutton">查询</a>
|
||||
<a onclick="ksreset()" class="easyui-linkbutton">重置</a>
|
||||
<a class="easyui-textbox" name="search" data-options="prompt:'培训目的/概述'"></a>
|
||||
<a onclick="plansearch()" class="easyui-linkbutton">查询</a>
|
||||
<a onclick="planresset()" class="easyui-linkbutton">重置</a>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
{% load myfilter %}
|
||||
{% if request|has_permission:'b_examtest_add1' %}
|
||||
<a class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain:true" onclick="addks()">试卷库考试</a>
|
||||
{% endif %}
|
||||
<!-- {% load myfilter %}
|
||||
{% if request|has_permission:'b_examtest_add1' %} -->
|
||||
<a class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain:true" onclick="addplan()">新建</a>
|
||||
<a id="updateplan" onclick="updateplan()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',plain:true">编辑</a>
|
||||
<a id="delplan" class="easyui-linkbutton" onclick="delplan()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
||||
<!-- {% endif %}
|
||||
{% if request|has_permission:'b_examtest_add2' %}
|
||||
<a class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain:true" onclick="addks2()">自动抽题考试</a>
|
||||
<a class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain:true" onclick="addplan2()">自动抽题考试</a>
|
||||
{% endif %}
|
||||
{% if request|has_permission:'b_examtest_close' %}
|
||||
<a class="easyui-linkbutton" data-options="iconCls: 'fa-times',plain:true" onclick="closeks()">关闭考试</a>
|
||||
{% endif %}
|
||||
{% if request|has_permission:'b_examtest_del' %}
|
||||
<a id="delks" class="easyui-linkbutton" onclick="delks()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
||||
<a id="delplan" class="easyui-linkbutton" onclick="delplan()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
||||
{% endif %}
|
||||
{% if request|has_permission:'b_examtest_detail' %}
|
||||
<a id="ksdetail" onclick="ksdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a>
|
||||
{% endif %}
|
||||
{% endif %} -->
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
var option = $('#main').attr('value')
|
||||
$('#pxjhtable').datagrid({url:'api/examtest',queryParams:{a:option}});
|
||||
$('#pxjhtable').datagrid({url:'api/trainplan',queryParams:{a:'listall'}});
|
||||
setYears();
|
||||
$("#year").combobox()
|
||||
})
|
||||
function addks(obj){
|
||||
opendg('发布考试','html/examtest/add')
|
||||
function addplan(obj){
|
||||
opendg('创建计划','html/trainplan/add')
|
||||
}
|
||||
function kssearch() {
|
||||
function plansearch() {
|
||||
var querydata = $('#searchpxjhff').serializeJSON();
|
||||
querydata['a'] = 'listall'
|
||||
$('#pxjhtable').datagrid('load', querydata);
|
||||
}
|
||||
function ksreset() {
|
||||
function planresset() {
|
||||
$('#searchpxjhff').form('clear')
|
||||
$('#pxjhtable').datagrid('options').queryParams = {
|
||||
a:'listall'
|
||||
|
@ -58,9 +54,22 @@
|
|||
$('#pxjhtable').datagrid('load');
|
||||
|
||||
}
|
||||
function addks2(obj){
|
||||
opendg('发布考试','html/examtest/add2')
|
||||
}
|
||||
function setYears(){
|
||||
var anOption = document.createElement("option");
|
||||
var years= new Date().getFullYear()
|
||||
years = years + 1
|
||||
for(var i=0;i<=3;i++){
|
||||
var anOption = document.createElement("option");
|
||||
anOption.text=years-i;
|
||||
anOption.value=years-i;
|
||||
if(i==1){
|
||||
anOption.selected = true
|
||||
}
|
||||
document.getElementById("year").appendChild(anOption);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#pxjhtable').datagrid({
|
||||
url: '',
|
||||
rownumbers: true,
|
||||
|
@ -74,39 +83,32 @@
|
|||
border:false,
|
||||
columns: [[
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'num', title: '编号', width: 60 },
|
||||
{ field: 'type', title: '类型', width: 60 ,formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 1: return '正式考试'; break;
|
||||
case 2: return '模拟考试'; break;
|
||||
}
|
||||
} },
|
||||
{ field: 'name', title: '考试名', width: 160 },
|
||||
{ field: 'exampaper__name', title: '试卷名', width: 160 },
|
||||
{ field: 'duration', title: '答卷时长', width: 60 },
|
||||
{ field: 'starttime', title: '开启时间', width: 80 },
|
||||
{ field: 'createuser__name', title: '发布人', width: 80 },
|
||||
{ field: 'state', title: '状态', width: 40,styler: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 0: return 'background-color:yellow;'; break;
|
||||
case 1: return 'background-color:green;color:white'; break;
|
||||
}
|
||||
},formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 1: return '进行中'; break;
|
||||
case 0: return '已结束'; break;
|
||||
}
|
||||
} },
|
||||
{ field: 'year', title: '年份', width: 60 },
|
||||
{ field: 'month', title: '月份', width: 60 },
|
||||
{ field: 'purpose', title: '培训目的/内容概述', width: 160 },
|
||||
{ field: 'period', title: '预计学时', width: 60 },
|
||||
{ field: 'group__groupname', title: '培训对象', width: 100 },
|
||||
{ field: 'manager__name', title: '负责人', width: 80 },
|
||||
|
||||
]]
|
||||
});
|
||||
function delks(){
|
||||
function updateplan(){
|
||||
var row = $('#pxjhtable').datagrid('getSelected');
|
||||
if (row) {
|
||||
$.messager.confirm('提示', '将会删除该考试所有考生答题记录,确定删除吗?', function (r) {
|
||||
opendg('编辑','html/trainplan/edit/' + row.id)
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '未选择数据!');
|
||||
}
|
||||
}
|
||||
function delplan(){
|
||||
var row = $('#pxjhtable').datagrid('getSelected');
|
||||
if (row) {
|
||||
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'api/examtest?a=del',
|
||||
url: 'api/trainplan/?a=del',
|
||||
data: { 'id': row.id },
|
||||
datatype: "json",
|
||||
beforeSend: function () { },
|
||||
|
@ -131,50 +133,5 @@
|
|||
$.messager.alert('提示', '请选择一行数据!');
|
||||
}
|
||||
}
|
||||
function closeks(){
|
||||
var row = $('#pxjhtable').datagrid('getSelected');
|
||||
if (row) {
|
||||
$.messager.confirm('提示', '确定关闭考试吗?', function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'api/examtest?a=close',
|
||||
data: { 'id': row.id },
|
||||
datatype: "json",
|
||||
beforeSend: function () { },
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$("#pxjhtable").datagrid('reload');
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '你无权关闭该考试!');
|
||||
}
|
||||
},
|
||||
complete: function (XMLHttpRequest, textStatus) {
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '请选择一行数据!');
|
||||
}
|
||||
}
|
||||
function ksdetail(){
|
||||
var row = $('#pxjhtable').datagrid('getSelected');
|
||||
if (row) {
|
||||
var url = 'html/examtest/detail/' + row.id
|
||||
opendg('查看详情',url,1000)
|
||||
}
|
||||
else { $.messager.alert('提示', '请选择一行数据!'); }
|
||||
}
|
||||
function exportksexcel() {
|
||||
var querydata = $('#searchpxjhff').serialize();
|
||||
let url = 'api/suggest?a=exportexcel&'+querydata
|
||||
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
|
||||
|
||||
}
|
||||
|
||||
</script>
|
|
@ -0,0 +1,96 @@
|
|||
<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="pxjhsubmitForm()"
|
||||
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="pxjhff" method="post" name="pxjhff" enctype="multipart/form-data">
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="year" name="year" class="easyui-numberbox" style="width:90%"
|
||||
data-options="label:'年份',min:2020, max:2050, prompt:2020 " required=true/>
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<select id="month" name="month" class="easyui-combobox" style="width:90%"
|
||||
data-options="label:'月份'" editable=false required=true>
|
||||
<option value="1">1月</option>
|
||||
<option value="2">2月</option>
|
||||
<option value="3">3月</option>
|
||||
<option value="4">4月</option>
|
||||
<option value="5">5月</option>
|
||||
<option value="6">6月</option>
|
||||
<option value="7">7月</option>
|
||||
<option value="8">8月</option>
|
||||
<option value="9">9月</option>
|
||||
<option value="10">10月</option>
|
||||
<option value="11">11月</option>
|
||||
<option value="12">12月</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="purpose" class="easyui-textbox" name="purpose" style="width:90%;height:100px" data-options="label:'培训目的',multiline:true"
|
||||
required=true />
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="group" name="group" class="easyui-combobox" style="width:90%" data-options="label:'培训对象'"
|
||||
required=true editable=false/>
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="period" name="period" class="easyui-numberbox" style="width:90%"
|
||||
data-options="label:'培训学时',prompt:'学时',min:1" required=true />
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="managername" class="easyui-textbox" style="width:90%" data-options="label:'负责人'"
|
||||
required=true >
|
||||
<input type="hidden" name="manager" id="manager"/>
|
||||
<a id="choosemanager" class='easyui-linkbutton' onclick="choseuser()" style="width:auto">选择</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$.get('grouphandle?a=list', function (res) {
|
||||
$('#group').combobox({
|
||||
valueField: 'groupid',
|
||||
textField: 'groupname',
|
||||
data: res.rows,
|
||||
onSelect: function (node) {
|
||||
// $.get('api/exampaper?a=detail&id=' + node.id,function(res){
|
||||
// $('#totalscore').textbox('setValue',res.total.score);
|
||||
// })
|
||||
// $('#editpaper').show()
|
||||
}
|
||||
})
|
||||
})
|
||||
$()
|
||||
function pxjhsubmitForm() {
|
||||
var pxjhdata = $('#pxjhff').serializeJSON();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'api/trainplan/?a=add',
|
||||
data: JSON.stringify(pxjhdata),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
beforeSend: function () {
|
||||
var bo = $('#pxjhff').form('validate')
|
||||
if (bo == false) {
|
||||
return bo
|
||||
} else {
|
||||
$('#submitb').linkbutton('disable');
|
||||
}
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$('#pxjhtable').datagrid('reload');
|
||||
$("#dd").dialog("close");
|
||||
} else { $.messager.alert('提示', '失败!'); }
|
||||
$('#submitb').linkbutton('enable');
|
||||
},
|
||||
});
|
||||
}
|
||||
function aaa(x) {
|
||||
$('#manager').attr('value', top.$('#in').val());
|
||||
$('#managername').textbox('setValue', top.$('#in').attr('show'));
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,82 @@
|
|||
<table id="pxjhtable" style="width:auto;height:100%;"></table>
|
||||
<div id="pxjhtablebar" style="padding:4px;height:auto">
|
||||
<div>
|
||||
<form id='searchpxjhff'>
|
||||
<label>年份</label>
|
||||
<select id="year" name='year' style='width:150px' editable=false>
|
||||
</select>
|
||||
<a class="easyui-textbox" name="search" data-options="prompt:'培训目的/概述'"></a>
|
||||
<a onclick="plansearch()" class="easyui-linkbutton">查询</a>
|
||||
<a onclick="planresset()" class="easyui-linkbutton">重置</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
var option = $('#main').attr('value')
|
||||
$('#pxjhtable').datagrid({url:'api/trainplan',queryParams:{a:'listall'}});
|
||||
setYears();
|
||||
$("#year").combobox()
|
||||
})
|
||||
function plansearch() {
|
||||
var querydata = $('#searchpxjhff').serializeJSON();
|
||||
querydata['a'] = 'listall'
|
||||
$('#pxjhtable').datagrid('load', querydata);
|
||||
}
|
||||
function planresset() {
|
||||
$('#searchpxjhff').form('clear')
|
||||
$('#pxjhtable').datagrid('options').queryParams = {
|
||||
a:'listall'
|
||||
}
|
||||
$('#pxjhtable').datagrid('load');
|
||||
|
||||
}
|
||||
function setYears(){
|
||||
var anOption = document.createElement("option");
|
||||
var years= new Date().getFullYear()
|
||||
years = years + 1
|
||||
for(var i=0;i<=3;i++){
|
||||
var anOption = document.createElement("option");
|
||||
anOption.text=years-i;
|
||||
anOption.value=years-i;
|
||||
if(i==1){
|
||||
anOption.selected = true
|
||||
}
|
||||
document.getElementById("year").appendChild(anOption);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#pxjhtable').datagrid({
|
||||
url: '',
|
||||
rownumbers: true,
|
||||
singleSelect: true,
|
||||
striped: true,
|
||||
fitColumns: true,
|
||||
method: 'get',
|
||||
pagination: 'true',
|
||||
pageSize: 20,
|
||||
toolbar: '#pxjhtablebar',
|
||||
border:false,
|
||||
columns: [[
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'year', title: '年份', width: 60 },
|
||||
{ field: 'month', title: '月份', width: 60 },
|
||||
{ field: 'purpose', title: '培训目的/内容概述', width: 160 },
|
||||
{ field: 'period', title: '预计学时', width: 60 },
|
||||
{ field: 'group__groupname', title: '培训对象', width: 100 },
|
||||
{ field: 'manager__name', title: '负责人', width: 80 },
|
||||
|
||||
]],
|
||||
onClickRow: function (index, item) {
|
||||
var id = item.id;
|
||||
var name = item.year + '年' + item.month + '月' + '-' + item.purpose.substring(0,16) + '...';
|
||||
var a = GetQueryString2("a");
|
||||
top.$('#in').attr('value', id);
|
||||
top.$('#in').attr('show', name);
|
||||
top.$('#in').attr('target', a);
|
||||
aaa(a);
|
||||
closeForm2()
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,102 @@
|
|||
<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="pxjhsubmitForm()"
|
||||
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="pxjhff" method="post" name="pxjhff" enctype="multipart/form-data">
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="year" name="year" class="easyui-numberbox" style="width:90%"
|
||||
data-options="label:'年份',min:2020, max:2050, prompt:2020 " required=true/>
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<select id="month" name="month" class="easyui-combobox" style="width:90%"
|
||||
data-options="label:'月份'" editable=false required=true>
|
||||
<option value="1">1月</option>
|
||||
<option value="2">2月</option>
|
||||
<option value="3">3月</option>
|
||||
<option value="4">4月</option>
|
||||
<option value="5">5月</option>
|
||||
<option value="6">6月</option>
|
||||
<option value="7">7月</option>
|
||||
<option value="8">8月</option>
|
||||
<option value="9">9月</option>
|
||||
<option value="10">10月</option>
|
||||
<option value="11">11月</option>
|
||||
<option value="12">12月</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="purpose" class="easyui-textbox" name="purpose" style="width:90%;height:100px" data-options="label:'培训目的',multiline:true"
|
||||
required=true />
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="group" name="group" class="easyui-combobox" style="width:90%" data-options="label:'培训对象'"
|
||||
required=true editable=false/>
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="period" name="period" class="easyui-numberbox" style="width:90%"
|
||||
data-options="label:'培训学时',prompt:'学时',min:1" required=true />
|
||||
</div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="managername" class="easyui-textbox" style="width:90%" data-options="label:'负责人'"
|
||||
required=true >
|
||||
<input type="hidden" name="manager" id="manager"/>
|
||||
<a id="choosemanager" class='easyui-linkbutton' onclick="choseuser()" style="width:auto">选择</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var trainplanid = {{id}}
|
||||
$.get('api/trainplan?a=detail&id=' + trainplanid, function (res) {
|
||||
$('#pxjhff').form('load', res)
|
||||
$('#managername').textbox('setValue', res.manager__name)
|
||||
})
|
||||
$.get('grouphandle?a=list', function (res) {
|
||||
$('#group').combobox({
|
||||
valueField: 'groupid',
|
||||
textField: 'groupname',
|
||||
data: res.rows,
|
||||
onSelect: function (node) {
|
||||
// $.get('api/exampaper?a=detail&id=' + node.id,function(res){
|
||||
// $('#totalscore').textbox('setValue',res.total.score);
|
||||
// })
|
||||
// $('#editpaper').show()
|
||||
}
|
||||
})
|
||||
})
|
||||
$()
|
||||
function pxjhsubmitForm() {
|
||||
var pxjhdata = $('#pxjhff').serializeJSON();
|
||||
pxjhdata['id'] = trainplanid
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'api/trainplan/?a=edit',
|
||||
data: JSON.stringify(pxjhdata),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
beforeSend: function () {
|
||||
var bo = $('#pxjhff').form('validate')
|
||||
if (bo == false) {
|
||||
return bo
|
||||
} else {
|
||||
$('#submitb').linkbutton('disable');
|
||||
}
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$('#pxjhtable').datagrid('reload');
|
||||
$("#dd").dialog("close");
|
||||
} else { $.messager.alert('提示', '失败!'); }
|
||||
$('#submitb').linkbutton('enable');
|
||||
},
|
||||
});
|
||||
}
|
||||
function aaa(x) {
|
||||
$('#manager').attr('value', top.$('#in').val());
|
||||
$('#managername').textbox('setValue', top.$('#in').attr('show'));
|
||||
}
|
||||
</script>
|
|
@ -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/<int:id>/', 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/<int:id>/',views.schedulesetedit),
|
||||
|
||||
path('html/trainplan/', views.trainplanhtml),
|
||||
path('html/trainplan/add/', views.trainplanaddhtml),
|
||||
path('html/trainplan/edit/<int:id>/', 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),
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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 = '<iframe id="ifr" scrolling="auto" frameborder="0" src="' + url + '" style="width:100%;height:100%;"></iframe>';
|
||||
|
@ -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)
|
||||
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位包含数字,大小写字母'
|
||||
}
|
||||
})
|
||||
|
|
BIN
需求/~$培训系统建议.docx
BIN
需求/~$培训系统建议.docx
Binary file not shown.
Loading…
Reference in New Issue