ExcelWinJs.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <script>
  2. /**
  3. * [ExcelImportCallback excel导入回调(公共表单方法校验需要放在这里,不能校验其它文件的方法)]
  4. * @author Devil
  5. * @blog http://gong.gg/
  6. * @version 0.0.1
  7. * @datetime 2017-02-11T21:46:50+0800
  8. * @param {[object]} data [回调数据]
  9. */
  10. function ExcelImportCallback(data)
  11. {
  12. if(data.code == 0)
  13. {
  14. // 成功
  15. if(data.data.success > 0)
  16. {
  17. $('.excel-import-success').removeClass('none');
  18. $('.excel-import-success').find('strong').text(data.data.success);
  19. } else {
  20. $('.excel-import-success').addClass('none');
  21. }
  22. // 失败
  23. if(data.data.error.length == 0)
  24. {
  25. $('.excel-import-error').addClass('none');
  26. } else {
  27. $('.excel-import-error').removeClass('none');
  28. $('.excel-import-error').find('strong').text(data.data.error.length);
  29. var html = '';
  30. for(var i in data.data.error)
  31. {
  32. html += '<tr><td>'+data.data.error[i]+'</td></tr>';
  33. }
  34. $('.excel-import-error').find('table tbody').html(html);
  35. }
  36. } else {
  37. Prompt(data.msg);
  38. }
  39. $.AMUI.progress.done();
  40. $('.form-validation').find('button[type="submit"]').button('reset');
  41. }
  42. </script>