recordAdmin.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  9. <link rel="stylesheet" href="../../static/css/font-awesome.min.css">
  10. <link rel="stylesheet" href="../../static/css/weadmin.css">
  11. <link rel="stylesheet" href="../../static/css/style.css">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <style>
  18. html{
  19. overflow-y: auto;
  20. }
  21. .layui-form-label{
  22. width: 100px;
  23. }
  24. .layui-input-block{
  25. margin-left: 138px;
  26. }
  27. .w-e-toolbar{
  28. padding: 0 !important;
  29. }
  30. .w-e-toolbar .w-e-menu{
  31. padding: 5px 4px !important;
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <div class="weadmin-body">
  37. <form class="layui-form">
  38. <div class="layui-form-item">
  39. <label class="layui-form-label">
  40. 记录管理名称:
  41. </label>
  42. <div class="layui-input-block steta_grouds">
  43. <input type="text" placeholder="请输入设备铭牌名称" class="layui-input recordName" oninput="recordTextTitles(this.value)">
  44. </div>
  45. </div>
  46. <div class="layui-form-item">
  47. <label class="layui-form-label">记录模板</label>
  48. <div class="layui-input-block">
  49. <table class="layui-table table-bordered table-bg">
  50. <thead>
  51. <tr class="text-c">
  52. <th>记录模板</th>
  53. <th>维护部门</th>
  54. <th>操作</th>
  55. </tr>
  56. </thead>
  57. <tbody class="tbodys">
  58. <!--<tr class="text-c">-->
  59. <!--<td>苹果记录</td>-->
  60. <!--<td>-->
  61. <!--<span class="cursor_p">111</span>-->
  62. <!--</td>-->
  63. <!--<td>-->
  64. <!--<i class="fa fa-trash-o cursor_p"></i>-->
  65. <!--</td>-->
  66. <!--</tr>-->
  67. </tbody>
  68. </table>
  69. </div>
  70. <div class="layui-input-block" style="margin-top: 10px">
  71. <a href="javascript:;" class="layui-btn layui-btn-normal addRecord">添加其他参数</a>
  72. </div>
  73. </div>
  74. </form>
  75. <div class="layui-form-item" style="text-align: center;padding-top: 50px">
  76. <button class="layui-btn recordBtn">提交</button>
  77. </div>
  78. <span class="text" style="display: none"></span>
  79. </div>
  80. <script src="../../lib/layui/layui.js" charset="utf-8"></script>
  81. <script>
  82. layui.use(['form','layer','jquery','laydate'], function(){
  83. var form = layui.form,
  84. $ = layui.jquery,
  85. laydate= layui.laydate,
  86. layer = layui.layer;
  87. form.render();
  88. $("body").on('click','.addRecord',function () {
  89. var tbodys = $(".tbodys");
  90. parent.depMaintainFun(tbodys);
  91. });
  92. window.recordTextTitles = function (title) {
  93. parent.onFocus();
  94. parent.addrecord(title)
  95. };
  96. $('body').on("click",".recordBtn",function () {
  97. var recordTemplate = [] , tr = $('.tbodys tr');
  98. var recordTemplateobj = {organizationId:"",organizationName:'',pageId:'',recordName:'',stepIndex:'',templateId:'',templateName:''};
  99. var num = 0;
  100. if ($('.recordName').val() === "") {
  101. layer.msg('记录模版信息不能为空');
  102. return false;
  103. }
  104. tr.each(function () {
  105. recordTemplateobj = {};
  106. recordTemplateobj.pageId = sessionStorage.getItem("QRcodeID");
  107. recordTemplateobj.organizationId = $(this).attr('parent-id') +','+ $(this).attr("son-id");
  108. recordTemplateobj.organizationName = $(this).find('.cursor_p').html();
  109. recordTemplateobj.stepIndex = num++ +1;
  110. recordTemplateobj.recordName = $('.recordName').val();
  111. recordTemplateobj.templateId = $(this).find('.depsName').attr('dep-id');
  112. recordTemplateobj.templateName = $(this).find(".depsName").html();
  113. recordTemplate.push(recordTemplateobj)
  114. });
  115. console.log(recordTemplate,'recordTemplate');
  116. $.ajax({
  117. url:'http://apptest.jieweizhineng.com/api/swagger/api/page/v1/addPageRecord',
  118. type:'post',
  119. data:JSON.stringify(recordTemplate),
  120. contentType:'application/json;charset=utf-8',
  121. dataType:'json',
  122. success:function (res) {
  123. if (res.code === '200'){
  124. parent.pageRelationIdFun(res.data);
  125. parent.QRcodeIndexas();
  126. layer.msg('记录模版新增成功');
  127. }else {
  128. layer.msg('记录模版新增失败,请检查信息');
  129. }
  130. },
  131. error:function () {
  132. layer.msg('网络错误,请检查网络');
  133. }
  134. })
  135. });
  136. });
  137. </script>
  138. </body>
  139. </html>