Import.cshtml 2.7 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", "SpecialtyCourse", 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 style="color:red;">
  21. 文件:
  22. </label>
  23. </td>
  24. <td>
  25. <input type="file" name="file" accept="*.xls" value="" />
  26. </td>
  27. </tr>
  28. <tr>
  29. <td colspan="2" style="text-align: center;">
  30. <span style="color: Red">模板:
  31. <a id="importExcel" style="color: Red;" href="~/Content/TemplateFile/批量导入专业课程信息模板.xls" target="_blank">
  32. 点击下载...
  33. </a>
  34. </span>
  35. <span id="error" style="display: none; color:red">
  36. &nbsp;&nbsp;
  37. <a style="color: Red;" href="@ViewBag.ErrorFile" target="_blank">
  38. @ViewBag.operationTips
  39. </a>
  40. </span>
  41. </td>
  42. </tr>
  43. </table>
  44. </div>
  45. }
  46. </div>
  47. <script>
  48. //保存数据
  49. function SpecialtyCourse_ImportSave() {
  50. var filepath = $("input[name='file']").val();
  51. if (filepath == "") {
  52. $.messager.alert("系统提示", "请选择你要导入的Excel文件");
  53. return;
  54. }
  55. //加载中。。。
  56. $(document.forms[0]).submitWithLoading();
  57. }
  58. $(function () {
  59. var errorFile = '@ViewBag.ErrorFile';
  60. if (errorFile != '') {
  61. $('#error').show();
  62. }
  63. //批量导入专业课程信息模板配置(SpecialtyCourse),Excel表列名相同无需在Site.xml文件中配置
  64. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='SpecialtyCourse']");
  65. if (customerUrl.attr("value")) {
  66. $("#importExcel").attr("href", customerUrl.attr("value"))
  67. }
  68. });
  69. </script>