纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

232 lines
9.7 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. @{
  2. ViewBag.Title = "Form";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <link href="~/Content/css/CommonReport/CommonReport.css" rel="stylesheet" />
  6. <script src="~/Content/js/CommonReport/CommonReport.js"></script>
  7. <link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
  8. <script src="~/Content/js/bootstrap/bootstrap-select.min.js"></script>
  9. <style>
  10. * {
  11. box-sizing: border-box;
  12. }
  13. </style>
  14. <script>
  15. var ID = $.request("ID");
  16. $(function () {
  17. $(".HideTxt").css('display', 'none');
  18. GetAllDataBase();
  19. if (ID != "") {
  20. GetTXT();
  21. }
  22. });
  23. function GetTXT() {
  24. if (!!ID) {
  25. $.ajax({
  26. url: "/WMS/BasicSettings/GetTXT?ID=" + ID + "&" + Math.random(),
  27. dataType: "json",
  28. async: false,
  29. success: function (data) {
  30. debugger;
  31. $("#txtSourceName").val(data.rows[0].SourceName);
  32. if (data.rows[0].SysDataFlag= '1') {
  33. $("#chkSysDataFlag")[0].checked = true;
  34. }
  35. if (data.rows[0].WorkPointDataFlag = '1') {
  36. $("#chkWorkPointDataFlag")[0].checked = true;
  37. }
  38. $("#Select_DataBase").selectpicker('val', data.rows[0].OtherDataBaseID);
  39. $("#txtFormatSqlTxt").val(data.rows[0].FormatSqlTxt);
  40. $("#txtLinkCols").val(data.rows[0].LinkCols);
  41. $("#txtLink2Cols").val(data.rows[0].Link2Cols);
  42. $("#txtParas").val(data.rows[0].Paras);
  43. $("#txtDbParas").val(data.rows[0].DbParas);
  44. }
  45. });
  46. }
  47. };
  48. //加载所有DB选项
  49. function GetAllDataBase()
  50. {
  51. $.ajax({
  52. url: "/SystemManage/CommonReport/GetAllDataBase?" + Math.random(),
  53. dataType: "json",
  54. async: false,
  55. success: function (data) {
  56. if (data != false && data != null && data.length > 0) {
  57. $("#Select_DataBase").find("option").remove();
  58. $("#Select_DataBase").append("<option value=''></option>");
  59. for (var i = 0; i < data.length; i++) {
  60. $("#Select_DataBase").append("<option value='" + data[i].DbId + "'>" + data[i].DBSourceDesc + "</option>");
  61. }
  62. }
  63. $('#Select_DataBase').selectpicker('refresh');
  64. $('#Select_DataBase').selectpicker('render');
  65. }
  66. });
  67. }
  68. function submitForm() {
  69. var Sys_LableDataSource = [];
  70. var SysDataSourceFlag = "1";
  71. var WorkPointDataFlag = "1";
  72. var OtherDataBaseID = $("#Select_DataBase").val();//其他数据源
  73. var chkSysDataFlag = $("#chkSysDataFlag")[0];
  74. var chkWorkPointDataFlag = $("#chkWorkPointDataFlag")[0];
  75. var SourceName = $("#txtSourceName").val();//数据源名称
  76. var FormatSqlTxt = $("#txtFormatSqlTxt").val();//sql
  77. if (!chkSysDataFlag.checked) { SysDataSourceFlag = "0"; }//框架数据库
  78. if (!chkWorkPointDataFlag.checked) { WorkPointDataFlag = "0"; }//当前站点数据
  79. var LinkCols = $("#txtLinkCols").val();//主子关系
  80. var Link2Cols = $("#txtLink2Cols").val();//三级主子关系
  81. var Paras = $("#txtParas").val();//传入参数
  82. var DbParas = $("#txtDbParas").val();//跨库参数
  83. if (SourceName == '' || SourceName==undefined) {
  84. $.modalAlert("请输入数据源名称!");
  85. return;
  86. }
  87. if (FormatSqlTxt == '' || FormatSqlTxt==undefined) {
  88. $.modalAlert("请输入sql!");
  89. return;
  90. }
  91. if (SysDataSourceFlag == '0' && WorkPointDataFlag=='0') {
  92. $.modalAlert("请选择数据源!");
  93. return;
  94. }
  95. var obj = {
  96. ID:ID,
  97. OtherDataBaseID: OtherDataBaseID,//其他数据源
  98. SourceName: SourceName,//数据源名称
  99. FormatSqlTxt: FormatSqlTxt,//sql
  100. SysDataSourceFlag: SysDataSourceFlag,//框架数据库
  101. WorkPointDataFlag: WorkPointDataFlag,//当前站点数据
  102. LinkCols: LinkCols,//主子关系
  103. Link2Cols: Link2Cols,//三级主子关系
  104. Paras: Paras,//传入参数
  105. DbParas: DbParas//跨库参数
  106. }
  107. Sys_LableDataSource.push(obj);
  108. if (ID=='') {
  109. $.modalConfirm("确定新建吗?", function (r) {
  110. if (r) {
  111. $.submitForm({
  112. url: "/WMS/BasicSettings/CreateLableDataSource" + "?" + Math.random(),
  113. param: { Sys_LableDataSource: JSON.stringify(Sys_LableDataSource) },
  114. success: function () {
  115. $.currentWindow().$("#gridList").trigger("reloadGrid");
  116. }
  117. })
  118. }
  119. });
  120. } else {
  121. $.modalConfirm("确定修改吗?", function (r) {
  122. if (r) {
  123. $.submitForm({
  124. url: "/WMS/BasicSettings/updateLableDataSource" + "?" + Math.random(),
  125. param: { Sys_LableDataSource: JSON.stringify(Sys_LableDataSource) },
  126. success: function () {
  127. $.currentWindow().$("#gridList").trigger("reloadGrid");
  128. }
  129. })
  130. }
  131. });
  132. }
  133. }
  134. </script>
  135. <form id="form1">
  136. <div class="widget-body">
  137. <div style="padding-top: 5px; ">
  138. <div class="step-content" id="wizard-steps" style="border-left: none; border-bottom: none; border-right: none;">
  139. <div class="step-pane active" id="step-1" style="padding-left: 5px; padding-top: 20px; margin-right: 20px;">
  140. <table class="form">
  141. <tr>
  142. <th class="formTitle">数据源名称: </th>
  143. <td class="formValue" style="overflow:auto" colspan="4">
  144. <input class="form-control" name="txtSourceName" id="txtSourceName" style="width: 95%" />
  145. </td>
  146. </tr>
  147. <tr>
  148. <th class="formTitle" style="width:85px">数据库: </th>
  149. <td class="formValue" style="width:170px">
  150. <label class="radio-inline">
  151. <input type="checkbox" name="chkSysDataFlag" id="chkSysDataFlag" value="1" />框架数据库
  152. </label>
  153. </td>
  154. <td class="formValue" style="width:170px">
  155. <label class="radio-inline">
  156. <input type="checkbox" name="chkWorkPointDataFlag" id="chkWorkPointDataFlag" value="1" /> 当前站点数据
  157. </label>
  158. </td>
  159. <td colspan="1"></td>
  160. <td class="formValue">
  161. 其他数据源
  162. </td>
  163. <td class="formValue" style="width:175px">
  164. <select id="Select_DataBase" name="Select_DataBase" title="" class="selectpicker" data-width="140px"></select>
  165. </td>
  166. </tr>
  167. <tr>
  168. <th class="formTitle">数据源SQL: </th>
  169. <td class="formValue" style="height:300px;overflow:auto" colspan="5">
  170. <textarea class="form-control" name="txtFormatSqlTxt" id="txtFormatSqlTxt" style="width: 95%;height:100%" wrap="soft"></textarea>
  171. </td>
  172. </tr>
  173. <tr>
  174. <th class="formTitle">主子关系: </th>
  175. <td class="formValue" style="overflow:auto" colspan="1">
  176. <input class="form-control" name="txtLinkCols" id="txtLinkCols" style="width: 95%" />
  177. </td>
  178. <th class="formTitle HideTxt">三级主子关系: </th>
  179. <td class="formValue HideTxt" style="overflow:auto" colspan="1">
  180. <input class="form-control HideTxt" name="txtLink2Cols" id="txtLink2Cols" style="width: 95%" />
  181. </td>
  182. </tr>
  183. <tr>
  184. <th class="formTitle">传入参数(替代符): </th>
  185. <td class="formValue" style="overflow:auto" colspan="4">
  186. <input class="form-control" name="txtParas" id="txtParas" style="width: 95%" />
  187. </td>
  188. <td class="formValue" style="height:45px; ">多个参数用,分隔 </td>
  189. </tr>
  190. <tr>
  191. <th class="formTitle HideTxt">跨库参数: </th>
  192. <td class="formValue HideTxt" style="overflow:auto" colspan="4">
  193. <input class="form-control HideTxt" name="txtDbParas" id="txtDbParas" style="width: 95%" />
  194. </td>
  195. <td class="formValue" style="height:45px; ">多个参数用,分隔 </td>
  196. </tr>
  197. </table>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. </form>