Import.cshtml 2.5 KB

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