Import.cshtml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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", "AdultSpecialtyPlan", 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" 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>
  47. //保存数据
  48. function AdultSpecialtyPlan_ImportSave() {
  49. var filepath = $("input[name='file']").val();
  50. if (filepath == "") {
  51. $.messager.alert("系统提示", "请选择你要导入的Excel文件");
  52. return;
  53. }
  54. //加载中。。。
  55. $(document.forms[0]).submitWithLoading();
  56. }
  57. $(function () {
  58. var errorFile = '@ViewBag.ErrorFile';
  59. if (errorFile != '') {
  60. $('#error').show();
  61. }
  62. //批量导入专业计划信息模板(年级、专业信息)配置(AdultSpecialtyPlan),Excel表列名相同无需在Site.xml文件中配置
  63. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='AdultSpecialtyPlan']");
  64. if (customerUrl.attr("value")) {
  65. $("#importExcel").attr("href", customerUrl.attr("value"))
  66. }
  67. });
  68. </script>