Form.cshtml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. var $dbtype = $("#DbType")
  14. $dbtype.ComboBox({
  15. url: "../../SystemManage/DataItemDetail/GetDataItemListJson",
  16. param: { EnCode: "DbType" },
  17. id: "ItemValue",
  18. text: "ItemName",
  19. height: "200px",
  20. description: "==请选择=="
  21. });
  22. $dbtype.bind("change", function () {
  23. var value = $(this).attr('data-value');
  24. $("#Version").ComboBox({
  25. url: "../../SystemManage/DataItemDetail/GetSubDataItemListJson",
  26. param: { EnCode: "DbVersion", ItemValue: value },
  27. id: "ItemValue",
  28. text: "ItemName",
  29. height: "200px",
  30. description: "==请选择=="
  31. });
  32. });
  33. //库版本
  34. $("#Version").ComboBox({
  35. description: "==请选择=="
  36. });
  37. //获取表单
  38. if (!!keyValue) {
  39. $.SetForm({
  40. url: "../../SystemManage/DataBaseLink/GetFormJson",
  41. param: { keyValue: keyValue },
  42. success: function (data) {
  43. $("#form1").SetWebControls(data);
  44. $('#DbType').trigger("change");
  45. $("#Version").ComboBoxSetValue(data.Version);
  46. }
  47. });
  48. }
  49. }
  50. //测试连接
  51. function btn_TestConnection() {
  52. learun.saveForm({
  53. url: "../../SystemManage/DataBaseLink/TestConnection",
  54. param: { F_DatabaseLinkId: keyValue, F_DbType: $("#F_DbType").attr('data-value'), F_DbConnection: $("#F_DbConnection").val() },
  55. close: false
  56. });
  57. }
  58. //保存表单
  59. function AcceptClick() {
  60. if (!$('#form1').Validform()) {
  61. return false;
  62. }
  63. var postData = $("#form1").GetWebControls(keyValue);
  64. $.SaveForm({
  65. url: "../../SystemManage/DataBaseLink/SaveForm?keyValue=" + keyValue,
  66. param: postData,
  67. loading: "正在保存数据...",
  68. success: function () {
  69. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  70. }
  71. })
  72. }
  73. </script>
  74. <div style="margin-top: 20px; margin-right: 30px;">
  75. <table class="form">
  76. <tr>
  77. <th class="formTitle">库类型<font face="宋体">*</font></th>
  78. <td class="formValue">
  79. <div id="DbType" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
  80. </td>
  81. </tr>
  82. <tr>
  83. <th class="formTitle">库版本<font face="宋体">*</font></th>
  84. <td class="formValue">
  85. <div id="Version" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
  86. </td>
  87. </tr>
  88. <tr>
  89. <th class="formTitle">库名称<font face="宋体">*</font></th>
  90. <td class="formValue">
  91. <input id="DBName" type="text" class="form-control" placeholder="请输入名称" isvalid="yes" checkexpession="NotNull" />
  92. </td>
  93. </tr>
  94. <tr>
  95. <th class="formTitle">库别名<font face="宋体">*</font></th>
  96. <td class="formValue">
  97. <input id="DBAlias" type="text" class="form-control" placeholder="请输入别名" isvalid="yes" checkexpession="NotNull" />
  98. </td>
  99. </tr>
  100. <tr>
  101. <th class="formTitle">连接地址<font face="宋体">*</font></th>
  102. <td class="formValue">
  103. <input id="DbConnection" type="text" class="form-control" style="float: left; width: 311px" isvalid="yes" checkexpession="NotNull" />
  104. @*<div class="control-button" title="点击测试连接" onclick="btn_TestConnection()">
  105. 测试连接
  106. </div>*@
  107. </td>
  108. </tr>
  109. <tr>
  110. <th class="formTitle">备注
  111. </th>
  112. <td class="formValue">
  113. <textarea id="Description" class="form-control" style="height: 70px;"></textarea>
  114. </td>
  115. </tr>
  116. </table>
  117. </div>