Index.cshtml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. @{
  2. ViewBag.Title = "表具类型管理";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script>
  6. $(function () {
  7. initControl();
  8. })
  9. //初始化控件
  10. function initControl() {
  11. //表类型
  12. $("#NBCompany").ComboBoxTree({
  13. url: "/NBManage/NBSystemSetting/GetManufacturerCode",
  14. id: "ItemValue",
  15. text: "ItemName",
  16. description: "==请选择==",
  17. height: "200px"
  18. });
  19. var data =@Html.Raw(ViewBag.settingData);
  20. if(data!=""){
  21. $("#form1").SetWebControls(data);
  22. }
  23. }
  24. //保存表单
  25. function AcceptClick() {
  26. if (!$('#form1').Validform()) {
  27. return false;
  28. }
  29. var postData = $("#form1").GetWebControls();
  30. //postData 格式化 将&nbsp; 替换为 ""
  31. for (var i in postData) {
  32. if (postData[i] == "&nbsp;") {
  33. postData[i] = "";
  34. }
  35. }
  36. $.SaveForm({
  37. url: "/NBManage/NBSystemSetting/SaveForm",
  38. param: { "strForm": JSON.stringify(postData) },
  39. loading: "正在保存数据...",
  40. success: function () {
  41. window.location.reload();
  42. }
  43. })
  44. }
  45. </script>
  46. <style type="text/css">
  47. .form .formTitle {
  48. width: 100px;
  49. }
  50. </style>
  51. <div style="margin-left: 10%; margin-top: 80px; margin-right: 70%;">
  52. <form action="" method="post">
  53. <table class="form">
  54. <tr>
  55. <th class="formTitle">读数小数位数<font face="宋体">*</font></th>
  56. <td class="formValue">
  57. <input id="ReaddingDecimalDigits" type="text" class="form-control" isvalid="yes" checkexpession="Num" errormsg="读数小数位数" placeholder="请输入读数小数位数" />
  58. </td>
  59. </tr>
  60. <tr>
  61. <th class="formTitle">用量小数位数<font face="宋体">*</font></th>
  62. <td class="formValue">
  63. <input id="UsingDecimalDigits" type="text" class="form-control" isvalid="yes" checkexpession="Num" errormsg="请输入起始流量" />
  64. </td>
  65. </tr>
  66. <tr>
  67. <th class="formTitle">厂商编码<font face="宋体">*</font></th>
  68. <td class="formValue">
  69. <input id="NBManufacturerCode" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" errormsg="厂商编码" />
  70. </td>
  71. </tr>
  72. <tr>
  73. <th class="formTitle">数据导出格式<font face="宋体">*</font></th>
  74. <td class="formValue">
  75. <div id="NBCompany" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull" errormsg="请选择表类型">
  76. </div>
  77. </td>
  78. </tr>
  79. <tr>
  80. <th></th>
  81. <td class="formValue">
  82. <input type="button" class="btn btn-primary form-control" value="保存" style="width:70%" onclick="AcceptClick()" />
  83. </td>
  84. </tr>
  85. </table>
  86. </form>
  87. </div>