设备导入bug
This commit is contained in:
parent
d00f530a93
commit
277c52057f
|
@ -364,7 +364,7 @@ def drequipments(companyid,path):
|
||||||
return {'code':0,'msg':'责任人列错误!'}
|
return {'code':0,'msg':'责任人列错误!'}
|
||||||
catedict = {}
|
catedict = {}
|
||||||
for i in Dickey.objects.filter(Q(dicparent__dicid=47),Q(usecomps__contains=','+str(companyid)+',')|Q(usecomps__contains=',1,')).exclude(usecomps__contains=','+str(companyid)+','):
|
for i in Dickey.objects.filter(Q(dicparent__dicid=47),Q(usecomps__contains=','+str(companyid)+',')|Q(usecomps__contains=',1,')).exclude(usecomps__contains=','+str(companyid)+','):
|
||||||
catedict[i.dicname] = i.dicid
|
catedict[i.dickeyname] = i.dickeyid
|
||||||
if '其他设备类' not in catedict:
|
if '其他设备类' not in catedict:
|
||||||
catedict['其它设备类'] = 361
|
catedict['其它设备类'] = 361
|
||||||
numdict = {}
|
numdict = {}
|
||||||
|
@ -458,9 +458,9 @@ def drequipments(companyid,path):
|
||||||
numsdict[num]=name
|
numsdict[num]=name
|
||||||
i = i+1
|
i = i+1
|
||||||
if numsdict:
|
if numsdict:
|
||||||
return {'code':1,'msg':'全部导入成功!'}
|
|
||||||
else:
|
|
||||||
return {'code':2,'msg':'部分未导入成功!','info':numsdict}
|
return {'code':2,'msg':'部分未导入成功!','info':numsdict}
|
||||||
|
else:
|
||||||
|
return {'code':1,'msg':'全部导入成功!'}
|
||||||
|
|
||||||
|
|
||||||
def drusers(companyid,path):
|
def drusers(companyid,path):
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
<p style="color:red;margin-left: 10px">请按模板录入后导入</p>
|
<p style="color:red;margin-left: 10px">请按模板录入后导入</p>
|
||||||
<p style="margin-left: 10px"><a href="/static/safesite/muban/equipment.xlsx" target="_blank">点击下载模板</a></p>
|
<p style="margin-left: 10px"><a href="/static/safesite/muban/equipment.xlsx" target="_blank">点击下载模板</a></p>
|
||||||
<p style="margin-left: 10px">录入完成后点击下方按钮上传文件</p>
|
<p style="margin-left: 10px">录入完成后点击下方按钮上传文件</p>
|
||||||
<input type="file" id="drfile" name="" accept=".xls,.xlsx" style="margin-left: 10px" />
|
<input type="file" id="drfile" name="" accept=".xlsx" style="margin-left: 10px" />
|
||||||
</div>
|
</div>
|
||||||
<div id="bindjcbdg" class="easyui-dialog" title="绑定检查表" style="width:400px;height:200px;padding: 10px;"
|
<div id="bindjcbdg" class="easyui-dialog" title="绑定检查表" style="width:400px;height:200px;padding: 10px;"
|
||||||
data-options="resizable:true,modal:true,closed:true,border:false,buttons:'#dlg-buttons'">
|
data-options="resizable:true,modal:true,closed:true,border:false,buttons:'#dlg-buttons'">
|
||||||
|
@ -382,12 +382,12 @@
|
||||||
removeLoading();
|
removeLoading();
|
||||||
if (data.code == 1) {
|
if (data.code == 1) {
|
||||||
$.messager.alert('提示', data.msg, 'info', function () {
|
$.messager.alert('提示', data.msg, 'info', function () {
|
||||||
$("#main").panel({ href: 'html/equipment', title: '设备设施' });
|
$("#sbtable").datagrid('reload');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (data.code == 2) {
|
else if (data.code == 2) {
|
||||||
$.messager.alert('提示', data.msg + data.info, 'info', function () {
|
$.messager.alert('提示', data.msg + data.info, 'info', function () {
|
||||||
$("#main").panel({ href: 'html/equipment', title: '用户' });
|
$("#sbtable").datagrid('reload');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -4026,11 +4026,8 @@ def drapi(req):
|
||||||
with open(filepath, 'wb') as f:
|
with open(filepath, 'wb') as f:
|
||||||
f.write(req.FILES['upfile'].read())
|
f.write(req.FILES['upfile'].read())
|
||||||
# try:
|
# try:
|
||||||
equipmentdict = drequipments(companyid, filepath)
|
ret = drequipments(companyid, filepath)
|
||||||
if equipmentdict:
|
return JsonResponse(ret)
|
||||||
return JsonResponse({"code": 2, "equipmentdict": equipmentdict})
|
|
||||||
else:
|
|
||||||
return JsonResponse({"code": 1})
|
|
||||||
elif a == 'risk':
|
elif a == 'risk':
|
||||||
userid = req.session['userid']
|
userid = req.session['userid']
|
||||||
companyid = getcompany(userid)
|
companyid = getcompany(userid)
|
||||||
|
|
Loading…
Reference in New Issue