certform.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <div class="layui-fluid">
  2. <div class="layui-row layui-col-space15">
  3. <div class="layui-col-md12">
  4. <div class="layui-card">
  5. <div class="layui-card-header">证书信息</div>
  6. <div class="layui-card-body" pad15>
  7. <div class="layui-form layui-form-pane" lay-filter="LAY-certform-edit">
  8. <input type="hidden" name="id" value="{$cert.id}">
  9. <div class="layui-form-item">
  10. <label class="layui-form-label"><span style="color:#f90c05;">*</span>认证名称</label>
  11. <div class="layui-input-block">
  12. <input type="text" name="title" value="{$cert.title}" lay-verify="required" placeholder="请输入..." autocomplete="off"
  13. class="layui-input">
  14. </div>
  15. </div>
  16. <div class="layui-form-item">
  17. <label class="layui-form-label"><span style="color:#f90c05;">*</span>证书编号</label>
  18. <div class="layui-input-block">
  19. <input type="text" name="cnumber" value="{$cert.cnumber}" lay-verify="required" placeholder="请输入..." autocomplete="off"
  20. class="layui-input">
  21. </div>
  22. </div>
  23. <div class="layui-form-item">
  24. <label class="layui-form-label">证书照片</label>
  25. <div class="layui-input-block">
  26. <div class="layui-upload">
  27. <button type="button" class="layui-btn attachment-upload-images" data-input="tilpic" data-amount="1">上传图片</button>
  28. <div class="layui-inline layui-word-aux"> </div>
  29. <div class="layui-upload-list echo-attachment-image-list" id="tilpic">
  30. {notempty name="cert.tilpic"}
  31. <div>
  32. <input type="hidden" name="tilpic" value="{$cert.tilpic}">
  33. <img src="{$cert.tilpic}">
  34. </div>
  35. {/notempty}
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="layui-form-item">
  41. <label class="layui-form-label"><span style="color:#f90c05;">*</span>备注信息</label>
  42. <div class="layui-input-block">
  43. <input type="text" name="remark" value="{$cert.remark}" lay-verify="required" placeholder="请输入..." autocomplete="off"
  44. class="layui-input">
  45. </div>
  46. </div>
  47. <div class="layui-form-item">
  48. <label class="layui-form-label"><span style="color:#f90c05;">*</span>创建时间</label>
  49. <div class="layui-input-block">
  50. <input type="text" name="createtime" id="createtime" value="{$cert.createtime|default=date('Y-m-d H:i:s')}" lay-verify="required"
  51. placeholder="请选择..." autocomplete="off" class="layui-input">
  52. </div>
  53. </div>
  54. <div class="layui-form-item">
  55. <div class="layui-input-block">
  56. <input type="button" lay-submit lay-filter="LAY-certform-edit-submit" value="确认提交" class="layui-btn">
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <script>
  66. layui.config({
  67. base: '/static/echoui/' //静态资源所在路径
  68. }).extend({
  69. index: 'lib/index' //主入口模块
  70. }).use(['index', 'form', 'set', 'laydate', 'upload'], function() {
  71. var $ = layui.$,
  72. setter = layui.setter,
  73. admin = layui.admin,
  74. form = layui.form,
  75. laydate = layui.laydate,
  76. upload = layui.upload;
  77. form.render();
  78. laydate.render({
  79. elem: '#createtime',
  80. type: 'datetime'
  81. });
  82. form.on('submit(LAY-certform-edit-submit)', function(obj) {
  83. var index = parent.layer.getFrameIndex(window.name);
  84. admin.req({
  85. url: setter.baseAdminUrl + 'cert/editcert',
  86. data: obj.field,
  87. done: function(res) {
  88. layer.msg("提交成功", { icon: 1 });
  89. parent.layui.table.reload('LAY-certlist-table'); //重载表格
  90. parent.layer.close(index);
  91. }
  92. });
  93. });
  94. $('.echo-attachment-image-list').on('click', '.attachmentdel', function() {
  95. $(this).parent().remove();
  96. });
  97. upload.render({
  98. elem: '.attachment-upload-images',
  99. url: setter.baseAdminUrl + 'attachment/tplfieldimage',
  100. accept: 'images',
  101. exits: 'jpg|png|jpeg',
  102. acceptMime: 'image/*',
  103. size: 2048,
  104. number: 1,
  105. method: 'post',
  106. before: function(obj) {
  107. var item = this.item;
  108. upload_input = $(item).data('input');
  109. upload_amount = $(item).data('amount');
  110. layer.load();
  111. },
  112. done: function(res, index, upload) {
  113. layer.closeAll('loading');
  114. var html = "";
  115. if (upload_amount == 1) {
  116. html += '<div> <input type="hidden" name="' + upload_input + '" value="' + res.data.src + '"> ';
  117. html += '<img src="' + res.data.src + '"></div>';
  118. $("#" + upload_input).html(html);
  119. } else {
  120. html += '<div> <input type="hidden" name="' + upload_input + '[]" value="' + res.data.src + '"> ';
  121. html += '<img src="' + res.data.src +
  122. '"> <button type="button" class="attachmentdel layui-btn layui-btn-primary layui-btn-xs layui-btn-fluid">删除</button></div>';
  123. $("#" + upload_input).append(html);
  124. }
  125. },
  126. error: function(index, upload) {
  127. layer.closeAll('loading');
  128. }
  129. });
  130. });
  131. </script>