BatchAdd.cshtml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. @{
  2. ViewBag.Title = "批量添加视图";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script type="text/javascript">
  6. var moduleId = request('moduleId');
  7. $(function () {
  8. initControl();
  9. })
  10. //初始化控件
  11. function initControl() {
  12. $("#ModuleId").val(moduleId);
  13. }
  14. //保存表单
  15. function AcceptClick(callback) {
  16. try {
  17. var data = [];
  18. var JsonText = eval($("#JSONText").val());
  19. $.each(JsonText, function (i) {
  20. var row = JsonText[i];
  21. data.push({
  22. EnCode: row.name,
  23. FullName: row.label,
  24. SortCode: i + 1,
  25. ModuleId: moduleId,
  26. ModuleColumnId: newGuid(),
  27. ParentId: "0"
  28. })
  29. });
  30. callback(data);
  31. dialogClose();
  32. } catch (e) {
  33. alert(e)
  34. }
  35. }
  36. </script>
  37. <div style="margin-top: 10px; margin-right: 30px;">
  38. <table class="form">
  39. <tr>
  40. <th class="formTitle">JSON</th>
  41. <td class="formValue">
  42. <textarea id="JSONText" class="form-control" style="height: 190px;"></textarea>
  43. </td>
  44. </tr>
  45. </table>
  46. </div>