设备导入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 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):

View File

@ -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 {

View File

@ -4027,11 +4027,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)