设备导入bug

This commit is contained in:
caoqianming 2021-11-10 09:49:57 +08:00
parent 68b2e848f2
commit 06d358c568
3 changed files with 6 additions and 9 deletions

View File

@ -457,9 +457,9 @@ def drequipments(companyid,path):
numsdict[num]=name
i = i+1
if numsdict:
return {'code':1,'msg':'全部导入成功!'}
else:
return {'code':2,'msg':'部分未导入成功!','info':numsdict}
else:
return {'code':1,'msg':'全部导入成功!'}
def drusers(companyid,path):

View File

@ -382,12 +382,12 @@
removeLoading();
if (data.code == 1) {
$.messager.alert('提示', data.msg, 'info', function () {
$("#main").panel({ href: 'html/equipment', title: '设备设施' });
$("#sbtable").datagrid('reload');
});
}
else if (data.code == 2) {
$.messager.alert('提示', data.msg + data.info, 'info', function () {
$("#main").panel({ href: 'html/equipment', title: '用户' });
$("#sbtable").datagrid('reload');
});
}
else {

View File

@ -4027,11 +4027,8 @@ def drapi(req):
with open(filepath, 'wb') as f:
f.write(req.FILES['upfile'].read())
# try:
equipmentdict = drequipments(companyid, filepath)
if equipmentdict:
return JsonResponse({"code": 2, "equipmentdict": equipmentdict})
else:
return JsonResponse({"code": 1})
ret = drequipments(companyid, filepath)
return JsonResponse(ret)
elif a == 'risk':
userid = req.session['userid']
companyid = getcompany(userid)