集团内共享题库前端页面
This commit is contained in:
parent
9a805efd6e
commit
a5b9773594
|
@ -12,7 +12,7 @@ class Group(models.Model):
|
||||||
groupname = models.CharField(max_length=128, unique=True)
|
groupname = models.CharField(max_length=128, unique=True)
|
||||||
type = models.CharField(max_length=32, choices=grouptype, default="集团")
|
type = models.CharField(max_length=32, choices=grouptype, default="集团")
|
||||||
createtime = models.DateTimeField(auto_now_add=True)
|
createtime = models.DateTimeField(auto_now_add=True)
|
||||||
members = models.ManyToManyField(s_models.Partment,through='Groupmember')
|
members = models.ManyToManyField(s_models.Partment,through='Groupmember', related_name='group_members')
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.groupname
|
return self.groupname
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ class Group(models.Model):
|
||||||
verbose_name_plural="集团"
|
verbose_name_plural="集团"
|
||||||
|
|
||||||
class Groupmember(models.Model):
|
class Groupmember(models.Model):
|
||||||
group = models.ForeignKey(Group,on_delete=models.CASCADE)
|
group = models.ForeignKey(Group,on_delete=models.CASCADE, related_name='groupmember_group')
|
||||||
member = models.ForeignKey(s_models.Partment,on_delete=models.CASCADE)
|
member = models.ForeignKey(s_models.Partment,on_delete=models.CASCADE, related_name='groupmember_member')
|
||||||
|
|
||||||
class GroupUser(models.Model):
|
class GroupUser(models.Model):
|
||||||
username = models.CharField(max_length=128, unique=True)
|
username = models.CharField(max_length=128, unique=True)
|
||||||
|
|
|
@ -97,7 +97,8 @@
|
||||||
function reset() {
|
function reset() {
|
||||||
$('#searchgcff').form('clear')
|
$('#searchgcff').form('clear')
|
||||||
$('#gctable').datagrid('options').queryParams = {
|
$('#gctable').datagrid('options').queryParams = {
|
||||||
a:'listall'
|
a:'listall',
|
||||||
|
|
||||||
}
|
}
|
||||||
$('#gctable').datagrid('load');
|
$('#gctable').datagrid('load');
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<div class="easyui-layout" style="width:100%;height:100%;">
|
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||||
<div data-options="region:'west',split:true,border:false" style="width:240px;height:100%;">
|
<div data-options="region:'west',split:true,border:false" style="width:260px;height:100%;">
|
||||||
<div id="mrfl" height="40%" title="默认分类">
|
<div id="mrfl" height="30%" title="默认分类">
|
||||||
<ul id="mrfltree" data-options="animate:true,toolbar:'#mrflbar'"></ul>
|
<ul id="mrfltree" data-options="animate:true,toolbar:'#mrflbar'"></ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div id="gwfl" height="30%"></div> -->
|
<!-- <div id="gwfl" height="30%"></div> -->
|
||||||
<div id="zjfl" height="60%" title="自建分类">
|
<div id="zjfl" height="40%" title="自建分类">
|
||||||
<div id="zjflbar" style="padding:5px;height:auto">
|
<div id="zjflbar" style="padding:5px;height:auto">
|
||||||
|
|
||||||
{% load myfilter %}
|
{% load myfilter %}
|
||||||
|
@ -25,6 +25,9 @@
|
||||||
</div>
|
</div>
|
||||||
<ul id="zjfltree" data-options="animate:true,toolbar:'#zjflbar'"></ul>
|
<ul id="zjfltree" data-options="animate:true,toolbar:'#zjflbar'"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="gxfl" height="30%" title="集团共享分类" class="easyui-panel">
|
||||||
|
<ul id="gxfltree" data-options="animate:true"></ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div data-options="region:'center',title:'题目',split:true,border:false" style="height:100%;">
|
<div data-options="region:'center',title:'题目',split:true,border:false" style="height:100%;">
|
||||||
|
|
||||||
|
@ -149,6 +152,25 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$('#gxfltree').tree({
|
||||||
|
url: 'api/questioncat?a=tree3',
|
||||||
|
animate: true,
|
||||||
|
loadFilter: function (rows) {
|
||||||
|
return convert(rows);
|
||||||
|
},
|
||||||
|
formatter: function (node) {
|
||||||
|
var s = node.text;
|
||||||
|
if (node.children) {
|
||||||
|
s += ' <span style=\'color:blue\'>(' + node.children.length + ')</span>';
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
},
|
||||||
|
onSelect: function (row) {
|
||||||
|
$("#tmtable").datagrid({
|
||||||
|
url: 'api/question?a=listall&tmlx=' + row.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
$('#gwfl').datagrid({
|
$('#gwfl').datagrid({
|
||||||
url: 'grouphandle?a=list',
|
url: 'grouphandle?a=list',
|
||||||
|
|
||||||
|
@ -314,7 +336,8 @@
|
||||||
var querydata = $('#searchtmff').serializeJSON();
|
var querydata = $('#searchtmff').serializeJSON();
|
||||||
querydata['a'] = 'listall'
|
querydata['a'] = 'listall'
|
||||||
querydata['tmlx'] = ''
|
querydata['tmlx'] = ''
|
||||||
$('#tmtable').datagrid('reload', querydata);
|
$('#tmtable').datagrid('options').queryParams = querydata
|
||||||
|
$('#tmtable').datagrid('reload');
|
||||||
}
|
}
|
||||||
function confirmfz() {
|
function confirmfz() {
|
||||||
var rows = $('#tmtable').datagrid('getSelections');
|
var rows = $('#tmtable').datagrid('getSelections');
|
||||||
|
@ -362,9 +385,10 @@
|
||||||
}
|
}
|
||||||
function reset() {
|
function reset() {
|
||||||
$('#searchtmff').form('clear')
|
$('#searchtmff').form('clear')
|
||||||
var querydata = $('#searchtmff').serializeJSON();
|
$('#tmtable').datagrid('options').queryParams = {
|
||||||
querydata['tmlx'] = ''
|
a:'listall'
|
||||||
$('#tmtable').datagrid('reload', querydata);
|
}
|
||||||
|
$('#tmtable').datagrid('reload');
|
||||||
}
|
}
|
||||||
document.getElementById('drfile').onchange = function () {
|
document.getElementById('drfile').onchange = function () {
|
||||||
var fileObj = this.files[0];
|
var fileObj = this.files[0];
|
||||||
|
|
|
@ -6519,6 +6519,7 @@ def apitrain(req):
|
||||||
res = exportxlsx('grpxjl', a)
|
res = exportxlsx('grpxjl', a)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
from groups import models as g_models
|
||||||
def apiquestioncat(req):
|
def apiquestioncat(req):
|
||||||
a = req.GET.get('a')
|
a = req.GET.get('a')
|
||||||
userid = req.session['userid']
|
userid = req.session['userid']
|
||||||
|
@ -6531,6 +6532,15 @@ def apiquestioncat(req):
|
||||||
list_items = (Questioncat.objects.filter(usecomp__partid=companyid, deletemark=1)).annotate(
|
list_items = (Questioncat.objects.filter(usecomp__partid=companyid, deletemark=1)).annotate(
|
||||||
parentId=F('parent__id')).values('id', 'parentId', 'name')
|
parentId=F('parent__id')).values('id', 'parentId', 'name')
|
||||||
return HttpResponse(json.dumps(list(list_items)), content_type="application/json")
|
return HttpResponse(json.dumps(list(list_items)), content_type="application/json")
|
||||||
|
elif a == 'tree3':
|
||||||
|
groups = g_models.Groupmember.objects.filter(member__partid=companyid).values_list('group__id', flat=True)
|
||||||
|
companys = g_models.Groupmember.objects.filter(group__id__in=groups).values_list('member__partid', flat=True).distinct()
|
||||||
|
list_items = []
|
||||||
|
for i in companys:
|
||||||
|
list_item = (Questioncat.objects.filter(usecomp__partid=i, deletemark=1)).annotate(
|
||||||
|
parentId=F('parent__id')).values('id', 'parentId', 'name')
|
||||||
|
list_items.append(list_item)
|
||||||
|
return HttpResponse(json.dumps(list(list_items)), content_type="application/json")
|
||||||
elif a == 'tree':
|
elif a == 'tree':
|
||||||
list_items = (Questioncat.objects.filter(usecomp__partid=1, deletemark=1) | Questioncat.objects.filter(
|
list_items = (Questioncat.objects.filter(usecomp__partid=1, deletemark=1) | Questioncat.objects.filter(
|
||||||
usecomp__partid=companyid, deletemark=1)).annotate(parentId=F('parent__id')).values('id', 'parentId', 'name')
|
usecomp__partid=companyid, deletemark=1)).annotate(parentId=F('parent__id')).values('id', 'parentId', 'name')
|
||||||
|
|
Loading…
Reference in New Issue