Import.cshtml 2.6 KB

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