Import.cshtml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. @using EMIS.Web.Controls;
  2. @using Bowin.Web.Controls.Mvc;
  3. @{
  4. ViewBag.Title = "Import";
  5. }
  6. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  7. @using (Html.BeginForm("Import", "NewStudent", new
  8. {
  9. MNU = Request["MNU"],
  10. WindowID = Request["WindowID"]
  11. }, FormMethod.Post, new { enctype = "multipart/form-data" }))
  12. {
  13. <div class="p_title">
  14. <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">@Html.ContextMenuBar("Import")</div>
  15. </div>
  16. <div class="search_list">
  17. <table cellpadding="0" cellspacing="1">
  18. <tr>
  19. <td>
  20. <label>
  21. 文件:</label>
  22. </td>
  23. <td>
  24. <input type="file" name="file" accept="*.xls;*.xlsx;" value="" />
  25. </td>
  26. </tr>
  27. <tr>
  28. <td colspan="2" style="text-align: center;">
  29. <span style="color: Red">模板:
  30. <a id="importExcel" style="color: Red;" href="~/Content/TemplateFile/批量导入新生信息模板.xls" target="_blank">
  31. 点击下载...
  32. </a>
  33. </span>
  34. <span id="error" style="display: none; color:red">
  35. &nbsp;&nbsp;
  36. <a style="color: Red;" href="@ViewBag.ErrorFile" target="_blank">
  37. @ViewBag.operationTips
  38. </a>
  39. </span>
  40. </td>
  41. </tr>
  42. </table>
  43. </div>
  44. }
  45. </div>
  46. <script type="text/javascript">
  47. //保存数据
  48. function NewStudent_ImportSave() {
  49. var filepath = $("input[name='file']").val();
  50. if (filepath == "") {
  51. $.messager.alert("系统提示", "请选择你要导入的Excel文件。");
  52. return;
  53. }
  54. //else {
  55. // $.messager.alert("系统提示", "正在导入数据,请稍候...")
  56. //}
  57. //加载中。。。
  58. $(document.forms[0]).submitWithLoading();
  59. }
  60. $(function () {
  61. var errorFile = '@ViewBag.ErrorFile';
  62. if (errorFile != '') {
  63. $('#error').show();
  64. }
  65. //批量导入新生信息模板配置(NewStudentImport),Excel表列名相同无需在Site.xml文件中配置
  66. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='NewStudentImport']");
  67. if (customerUrl.attr("value")) {
  68. $("#importExcel").attr("href", customerUrl.attr("value"))
  69. }
  70. });
  71. </script>