题目批量删除
This commit is contained in:
parent
f2610f1193
commit
8107a0ff14
|
@ -44,11 +44,11 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request|has_permission:'b_question_upd' %}
|
{% if request|has_permission:'b_question_upd' %}
|
||||||
<a id="edittm" onclick="edittm()" class="easyui-linkbutton"
|
<a id="edittm" onclick="edittm()" class="easyui-linkbutton"
|
||||||
data-options="iconCls:'fa-pencil',plain:true">编辑</a>
|
data-options="iconCls:'fa-pencil',plain:true">单题编辑</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request|has_permission:'b_question_del' %}
|
{% if request|has_permission:'b_question_del' %}
|
||||||
<a id="deltm" onclick="deltm()" class="easyui-linkbutton"
|
<a id="deltms" onclick="deltms()" class="easyui-linkbutton"
|
||||||
data-options="iconCls:'fa-trash',plain:true">删除</a>
|
data-options="iconCls:'fa-trash',plain:true">批量删除</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request|has_permission:'b_question_daoru' %}
|
{% if request|has_permission:'b_question_daoru' %}
|
||||||
<a id="drtms" onclick="javascript:$('#drtmdg').dialog('open').window('center');" class="easyui-linkbutton"
|
<a id="drtms" onclick="javascript:$('#drtmdg').dialog('open').window('center');" class="easyui-linkbutton"
|
||||||
|
@ -232,14 +232,19 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
//ajax接收的才是js对象
|
//ajax接收的才是js对象
|
||||||
function deltm() {
|
function deltms() {
|
||||||
var row = $('#tmtable').datagrid('getSelected');
|
var rows = $('#tmtable').datagrid('getSelections');
|
||||||
if (row) {
|
if(rows.length>0){
|
||||||
|
var data = {'ids':[]}
|
||||||
|
for(var i=0;i<rows.length;i++){
|
||||||
|
data.ids.push(rows[i].id)
|
||||||
|
}
|
||||||
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
||||||
if (r) {
|
if (r) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "POST",
|
||||||
url: 'api/question?a=del&id=' + row.id,
|
url: 'api/question?a=dels',
|
||||||
|
data: JSON.stringify(data),
|
||||||
datatype: "json",
|
datatype: "json",
|
||||||
beforeSend: function () { },
|
beforeSend: function () { },
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
|
@ -5881,6 +5881,21 @@ def apiquestion(req):
|
||||||
return JsonResponse({"code": 1})
|
return JsonResponse({"code": 1})
|
||||||
else:
|
else:
|
||||||
return JsonResponse({"code": 0})
|
return JsonResponse({"code": 0})
|
||||||
|
elif a == 'dels':
|
||||||
|
data = json.loads(req.body.decode('utf-8'))
|
||||||
|
ids = data['ids']
|
||||||
|
user = User.objects.get(userid=userid)
|
||||||
|
objs = Question.objects.filter(id__in=ids)
|
||||||
|
if user.issuper == 1:
|
||||||
|
for i in objs:
|
||||||
|
nl = i.nousecomps.split(',')
|
||||||
|
nl.append(companyid)
|
||||||
|
nl = ','+','.join(list(set(list(filter(None, nl)))))+','
|
||||||
|
i.nousecomps = nl
|
||||||
|
i.save()
|
||||||
|
return JsonResponse({"code": 1})
|
||||||
|
else:
|
||||||
|
return JsonResponse({"code": 0})
|
||||||
elif a == 'detail':
|
elif a == 'detail':
|
||||||
id = req.GET.get('id')
|
id = req.GET.get('id')
|
||||||
a = Question.objects.filter(id=id).values(
|
a = Question.objects.filter(id=id).values(
|
||||||
|
|
Loading…
Reference in New Issue