Form.cshtml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. @{;
  2. ViewBag.Title = "表单页面";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script>
  6. var keyValue = request('keyValue');
  7. $(function () {
  8. initControl();
  9. });
  10. //初始化控件
  11. function initControl() {
  12. //客户名称
  13. $("#CustomerId").ComboBox({
  14. url: "../../CustomerManage/Customer/GetListJson",
  15. id: "CustomerId",
  16. text: "FullName",
  17. description: "==请选择==",
  18. height: "220px",
  19. allowSearch: true
  20. });
  21. //获取表单
  22. if (!!keyValue) {
  23. $.SetForm({
  24. url: "../../CustomerManage/Invoice/GetFormJson",
  25. param: { keyValue: keyValue },
  26. success: function (data) {
  27. $("#form1").SetWebControls(data);
  28. }
  29. })
  30. }
  31. }
  32. //保存表单;
  33. function AcceptClick() {
  34. if (!$('#form1').Validform()) {
  35. return false;
  36. }
  37. var postData = $("#form1").GetWebControls(keyValue);
  38. postData["CustomerName"] = $("#CustomerId").attr('data-text');
  39. $.SaveForm({
  40. url: "../../CustomerManage/Invoice/SaveForm?keyValue=" + keyValue,
  41. param: postData,
  42. loading: "正在保存数据...",
  43. success: function () {
  44. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  45. }
  46. })
  47. }
  48. </script>
  49. <div style="margin-top: 20px; margin-right: 30px;">
  50. <table class="form">
  51. <tr>
  52. <th class="formTitle" >客户名称</th>
  53. <td class="formValue">
  54. <div id="CustomerId" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
  55. </td>
  56. </tr>
  57. <tr>
  58. <th class="formTitle" valign="top" style="padding-top: 4px;">开票信息</th>
  59. <td class="formValue">
  60. <textarea id="InvoiceContent" class="form-control" style="height: 230px;" isvalid="yes" checkexpession="NotNull"></textarea>
  61. </td>
  62. </tr>
  63. </table>
  64. </div>