Brak opisu

addRiskLevel.html 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <script src="../Script/Common/huayi.load.js"></script>
  7. <script src="../Script/Common/huayi.config.js"></script>
  8. <script src="../js/laydate/laydate.js"></script>
  9. <script src="../js/bootstrap-select/js/bootstrap-select.js"></script>
  10. <script src="../js/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
  11. <script src="../Script/Common/regexs.js"></script>
  12. <script src="../js/autosize/autosize.min.js"></script>
  13. <link href="../css/plugins/cropper/cropper.min.css" rel="stylesheet">
  14. <link href="../js/bootstrap-select/css/bootstrap-select.css" rel="stylesheet" />
  15. <link href="../css/init.css" rel="stylesheet" />
  16. <link rel="stylesheet" type="text/css" href="../css/Table/table1.css" />
  17. <title>新增风险等级</title>
  18. <style>
  19. .btnn {
  20. background: #2f4050;
  21. color: #fff;
  22. padding: 3px 10px;
  23. border: 0;
  24. border-radius: 3px;
  25. cursor: pointer;
  26. }
  27. .crop_left {
  28. width: 40%;
  29. float: left;
  30. }
  31. .crop_right {
  32. width: 30%;
  33. float: right;
  34. margin-right: 25px;
  35. }
  36. .time-box .dates {
  37. width: 100% !important;
  38. }
  39. i.tub {
  40. right: 25px !important;
  41. }
  42. b.text_require {
  43. color: red;
  44. }
  45. .provCity > div > div {
  46. width: 49.5% !important;
  47. display: inline-block ;
  48. vertical-align: middle !important;
  49. }
  50. .repeat-btn{
  51. width: 50px;
  52. margin: 20px auto;
  53. }
  54. </style>
  55. </head>
  56. <body class="gray-bg">
  57. <div class="container wrapper-content animated fadeInRight">
  58. <div class="form-horizontal">
  59. <div class="form-group">
  60. <label for="riskname" class="col-sm-3 control-label text-right"><b class="text_require">*</b>风险等级名称</label>
  61. <div class="col-sm-9">
  62. <input id="riskname" class="form-control" type="text" autocomplete="off" placeholder="请输入风险等级名称"/>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="repeat-btn">
  67. <button class="btns" id="HY_save">提&nbsp;交</button>
  68. </div>
  69. </div>
  70. <script>
  71. $(document).ready(function() {
  72. var ajaxUrl;
  73. var ids = helper.request.queryString("edit_id");
  74. if (ids) {
  75. ajaxUrl = "testusertypeapi/api/TestUserType/upFxdjtabs";
  76. getValue(ids);
  77. } else {
  78. ajaxUrl = "testusertypeapi/api/TestUserType/AddFxdjtabs";
  79. }
  80. //保存
  81. $("#HY_save").click(function() {
  82. if(!$("#riskname").val()) {
  83. layer.confirm('请输入风险等级名称!', {
  84. icon: 2,
  85. btn: ['确定'] //按钮
  86. });
  87. return;
  88. }
  89. addValue(ajaxUrl, ids);
  90. })
  91. })
  92. //获取详情
  93. function getValue(ids) {
  94. $.ajax({
  95. type: "get",
  96. url: huayi.config.callcenter_url + "testusertypeapi/api/TestUserType/GetFxdjtabsbyid",
  97. async: true,
  98. dataType: 'json',
  99. data: {
  100. id: ids
  101. },
  102. success: function(data) {
  103. if (data.state.toLowerCase() == 'success') {
  104. $('#riskname').val(data.data[0].Fxdjname); //
  105. }
  106. }
  107. });
  108. }
  109. //添加
  110. function addValue(ajaxUrl, ids) {
  111. $.ajax({
  112. type: "get",
  113. url: huayi.config.callcenter_url + ajaxUrl,
  114. // url: "http://192.168.1.21:28230/api/Equipment/update",
  115. async: true,
  116. beforeSend: function() {
  117. //注意,layer.msg默认3秒自动关闭,如果数据加载耗时比较长,需要设置time
  118. layer.msg('正在更新数据,请稍候……', {
  119. icon: 16,
  120. shade: 0.01,
  121. shadeClose: false,
  122. time: 3000*6
  123. });
  124. },
  125. dataType: 'json',
  126. data: {
  127. id: ids,
  128. Fxdjname: $('#riskname').val(), //风险等级名称
  129. },
  130. success: function(data) {
  131. console.log(1)
  132. if (data.state.toLowerCase() == 'success') {
  133. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  134. parent.layer.close(index); //再执行关闭
  135. layer.msg(data.message);
  136. parent.initTable();
  137. }
  138. }
  139. });
  140. }
  141. </script>
  142. </body>
  143. </html>