equipment daoru
This commit is contained in:
parent
d99b375c4d
commit
15ff36c244
|
@ -292,7 +292,10 @@ def drequipments(companyid,path):
|
||||||
else:
|
else:
|
||||||
numsdict[num]=name
|
numsdict[num]=name
|
||||||
i = i+1
|
i = i+1
|
||||||
return numsdict
|
if numsdict:
|
||||||
|
return {'code':1,'msg':'全部导入成功!'}
|
||||||
|
else:
|
||||||
|
return {'code':2,'msg':'部分未导入成功!','info':numsdict}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -311,23 +311,17 @@
|
||||||
var data = JSON.parse(evt.target.responseText);
|
var data = JSON.parse(evt.target.responseText);
|
||||||
removeLoading();
|
removeLoading();
|
||||||
if (data.code == 1) {
|
if (data.code == 1) {
|
||||||
$.messager.alert('提示', '上传成功!', 'info', function () {
|
$.messager.alert('提示', data.msg, 'info', function () {
|
||||||
$("#main").panel({ href: 'html/equipment', title: '设备设施' });
|
$("#main").panel({ href: 'html/equipment', title: '设备设施' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (data.code == 2) {
|
else if (data.code == 2) {
|
||||||
msg = ''
|
$.messager.alert('提示', data.msg+data.info, 'info', function () {
|
||||||
equipmentdict = data.equipmentdict
|
|
||||||
// for (var key in equipmentdict) {
|
|
||||||
// msg += key + ','
|
|
||||||
// }
|
|
||||||
msg += '部分因编号重复未成功上传!'
|
|
||||||
$.messager.alert('提示', msg, 'info', function () {
|
|
||||||
$("#main").panel({ href: 'html/equipment', title: '用户' });
|
$("#main").panel({ href: 'html/equipment', title: '用户' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$.messager.alert('提示', '失败!文件内容有误');
|
$.messager.alert('提示', data.msg);
|
||||||
}
|
}
|
||||||
document.getElementById('drfile').value = '';
|
document.getElementById('drfile').value = '';
|
||||||
|
|
||||||
|
|
|
@ -3271,12 +3271,7 @@ def drapi(req):
|
||||||
filepath = filepath.replace('\\','/')
|
filepath = filepath.replace('\\','/')
|
||||||
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:
|
return JsonResponse(drequipments(companyid,filepath))
|
||||||
equipmentdict = drequipments(companyid,filepath)
|
|
||||||
if equipmentdict:
|
|
||||||
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