itemform.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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="itemform-edit">
  8. <input type="hidden" name="id" value="{$item.id}">
  9. {if $item.formid>0}
  10. <input type="hidden" name="formid" value="{$item.formid}">
  11. <div class="layui-form-item">
  12. <label class="layui-form-label">自定义表单</label>
  13. <div class="layui-input-block">
  14. <input type="text" name="formtitle" value="{$item.form.title}" placeholder="请输入..." autocomplete="off" readonly="readonly"
  15. class="layui-input layui-disabled">
  16. </div>
  17. </div>
  18. {else /}
  19. <div class="layui-form-item">
  20. <label class="layui-form-label"><span style="color:#f90c05;">*</span>自定义表单</label>
  21. <div class="layui-input-block">
  22. <select name="formid" lay-search lay-verify="required">
  23. <option value="">请选择(可搜索)...</option>
  24. {volist name="formlist" id="vo"}
  25. <option value="{$vo.id}" {$item.formid==$vo.id ? 'selected' : '' }>{$vo.title}</option>
  26. {/volist}
  27. </select>
  28. <div class="layui-form-mid layui-word-aux">选择后不可修改,请谨慎选择。</div>
  29. </div>
  30. </div>
  31. {/if}
  32. <div class="layui-form-item">
  33. <label class="layui-form-label"><span style="color:#f90c05;">*</span>字段名称</label>
  34. <div class="layui-input-block">
  35. <input type="text" name="title" value="{$item.title}" lay-verify="required" placeholder="请输入..." autocomplete="off"
  36. class="layui-input">
  37. </div>
  38. </div>
  39. <div class="layui-form-item" pane>
  40. <label class="layui-form-label">是否必填</label>
  41. <div class="layui-input-block">
  42. <input type="radio" name="imust" value="1" title="是" {eq name="item.imust|default=1" value="1"}checked{/eq} />
  43. <input type="radio" name="imust" value="2" title="否" {eq name="item.imust" value="2"}checked{/eq} />
  44. </div>
  45. </div>
  46. <div class="layui-form-item" pane>
  47. <label class="layui-form-label">类型</label>
  48. <div class="layui-input-block">
  49. <input type="radio" name="itype" lay-filter="itype" value="1" title="单行输入框" {eq name="item.itype|default=1" value="1"}checked{/eq} />
  50. <input type="radio" name="itype" lay-filter="itype" value="2" title="多行输入框" {eq name="item.itype" value="2"}checked{/eq} />
  51. <input type="radio" name="itype" lay-filter="itype" value="3" title="普通选择" {eq name="item.itype" value="3"}checked{/eq} />
  52. <input type="radio" name="itype" lay-filter="itype" value="4" title="单选选择" {eq name="item.itype" value="4"}checked{/eq} />
  53. <input type="radio" name="itype" lay-filter="itype" value="5" title="多选选择" {eq name="item.itype" value="5"}checked{/eq} />
  54. <input type="radio" name="itype" lay-filter="itype" value="6" title="日期选择" {eq name="item.itype" value="6"}checked{/eq} />
  55. <input type="radio" name="itype" lay-filter="itype" value="7" title="时间选择" {eq name="item.itype" value="7"}checked{/eq} />
  56. <input type="radio" name="itype" lay-filter="itype" value="8" title="图片上传" {eq name="item.itype" value="8"}checked{/eq} />
  57. </div>
  58. </div>
  59. <div class="layui-form-item itypebox itypebox3 itypebox4 itypebox5">
  60. <label class="layui-form-label">选择项集合</label>
  61. <div class="layui-input-block">
  62. <textarea name="options" placeholder="请输入..." class="layui-textarea">{$item.options}</textarea>
  63. <div class="layui-form-mid layui-word-aux">每行一个,并且不要有空行。</div>
  64. </div>
  65. </div>
  66. <div class="layui-form-item itypebox itypebox8">
  67. <label class="layui-form-label">图片数量</label>
  68. <div class="layui-input-block">
  69. <input type="text" name="picnumber" value="{$item.picnumber|default=1}" placeholder="请输入..."
  70. autocomplete="off" class="layui-input">
  71. <div class="layui-form-mid layui-word-aux">用户提交图片最多数量。</div>
  72. </div>
  73. </div>
  74. <div class="layui-form-item">
  75. <label class="layui-form-label">字段提示</label>
  76. <div class="layui-input-block">
  77. <input type="text" name="placeholder" value="{$item.placeholder}" placeholder="请输入..."
  78. autocomplete="off" class="layui-input">
  79. <div class="layui-form-mid layui-word-aux">字段输入提示信息,为空时不显示。</div>
  80. </div>
  81. </div>
  82. <div class="layui-form-item">
  83. <label class="layui-form-label"><span style="color:#f90c05;">*</span>排序</label>
  84. <div class="layui-input-block">
  85. <input type="text" name="priority" value="{$item.priority|default=0}" lay-verify="required" placeholder="请输入排序值(升序,值越小越靠前)"
  86. autocomplete="off" class="layui-input">
  87. <div class="layui-form-mid layui-word-aux">升序,值越小越靠前。</div>
  88. </div>
  89. </div>
  90. <div class="layui-form-item">
  91. <div class="layui-input-block">
  92. <input type="button" lay-submit lay-filter="itemform-edit-submit" value="确认提交" class="layui-btn">
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <script>
  102. layui.config({
  103. base: '/static/echoui/' //静态资源所在路径
  104. }).extend({
  105. index: 'lib/index' //主入口模块
  106. }).use(['index', 'form', 'set', 'upload'], function() {
  107. var $ = layui.$,
  108. setter = layui.setter,
  109. admin = layui.admin,
  110. form = layui.form,
  111. upload = layui.upload;
  112. form.render();
  113. function itypeChange(value) {
  114. $(".itypebox").hide();
  115. $(".itypebox" + value).show();
  116. }
  117. itypeChange({$item['itype']|default=1});
  118. form.on('radio(itype)', function(data) {
  119. itypeChange(data.value);
  120. });
  121. form.on('submit(itemform-edit-submit)', function(obj) {
  122. var index = parent.layer.getFrameIndex(window.name);
  123. admin.req({
  124. url: setter.baseAdminUrl + 'form/edititem',
  125. data: obj.field,
  126. done: function(res) {
  127. layer.msg("提交成功", {
  128. icon: 1
  129. });
  130. parent.layui.table.reload('itemlist-table'); //重载表格
  131. parent.layer.close(index);
  132. }
  133. });
  134. });
  135. });
  136. </script>