0
0

add.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <!--<div class="ibox-title">-->
  7. <!--<h5>{$meta_title}</h5>-->
  8. <!--<div class="ibox-tools">-->
  9. <!--<a class="toback" href="{:url('index')}">-->
  10. <!--返回上一页-->
  11. <!--</a>-->
  12. <!--</div>-->
  13. <!--</div>-->
  14. <div class="ibox-content">
  15. <form method="post" action="{:url('add')}" class="form-horizontal">
  16. <input type="hidden" name="id" value="{$info['id']|default='0'}">
  17. <div class="form-group">
  18. <label class="col-sm-2 control-label">配置标识</label>
  19. <div class="col-sm-4">
  20. <input type="text" class="form-control" name="name" value="{$info.name|default=''}">
  21. <span class="help-block m-b-none">用于config函数调用,只能使用英文且不能重复</span>
  22. </div>
  23. </div>
  24. <div class="form-group">
  25. <label class="col-sm-2 control-label">配置标题</label>
  26. <div class="col-sm-4">
  27. <input type="text" class="form-control" name="title" value="{$info.title|default=''}">
  28. <span class="help-block m-b-none">用于后台显示的配置标题</span>
  29. </div>
  30. </div>
  31. <div class="form-group">
  32. <label class="col-sm-2 control-label">排序</label>
  33. <div class="col-sm-4">
  34. <input type="text" class="form-control" name="sort" value="{$info.sort|default=0}">
  35. <span class="help-block m-b-none">用于分组显示的顺序</span>
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. <label class="col-sm-2 control-label">配置类型</label>
  40. <div class="col-sm-4">
  41. <select class="form-control m-b" name="type">
  42. {volist name="type_list" id="v"}
  43. <option value="{$key}">{$v}</option>
  44. {/volist}
  45. </select>
  46. <span class="help-block m-b-none">系统会根据不同类型解析配置值</span>
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label class="col-sm-2 control-label">配置属性</label>
  51. <div class="col-sm-4">
  52. <select class="form-control m-b" name="cate" onchange="changeCate(this)">
  53. <option value="1">系统配置</option>
  54. <option value="2">组织配置</option>
  55. </select>
  56. <span class="help-block m-b-none">配置属性 用于区分系统配置和组织配置</span>
  57. </div>
  58. </div>
  59. <div class="form-group">
  60. <label class="col-sm-2 control-label">配置分组</label>
  61. <div class="col-sm-4">
  62. {if condition="!empty($info)"}
  63. {if condition="$info['cate'] eq 1"}
  64. <select class="form-control m-b" id="group" name="group">
  65. <option value="0">不分组</option>
  66. {volist name="group_list" id="v"}
  67. <option value="{$key}">{$v}</option>
  68. {/volist}
  69. </select>
  70. {else /}
  71. <select class="form-control m-b" id="group" name="group">
  72. <option value="0">不分组</option>
  73. {volist name="org_group_list" id="v"}
  74. <option value="{$key}">{$v}</option>
  75. {/volist}
  76. </select>
  77. {/if}
  78. {else /}
  79. <select class="form-control m-b" id="group" name="group">
  80. <option value="0">不分组</option>
  81. {volist name="group_list" id="v"}
  82. <option value="{$key}">{$v}</option>
  83. {/volist}
  84. </select>
  85. {/if}
  86. <span class="help-block m-b-none">配置分组 用于批量设置 不分组则不会显示在系统设置中</span>
  87. </div>
  88. </div>
  89. <div class="form-group">
  90. <label class="col-sm-2 control-label">配置值</label>
  91. <div class="col-sm-4">
  92. <textarea name="value" class="form-control" rows="3">{$info['value']|default=''}</textarea>
  93. </div>
  94. </div>
  95. <div class="form-group">
  96. <label class="col-sm-2 control-label">配置项</label>
  97. <div class="col-sm-4">
  98. <textarea name="extra" class="form-control" rows="3">{$info['extra']|default=''}</textarea>
  99. <span class="help-block m-b-none">如果是枚举型 需要配置该项</span>
  100. </div>
  101. </div>
  102. <div class="form-group">
  103. <label class="col-sm-2 control-label">说明</label>
  104. <div class="col-sm-4">
  105. <textarea name="remark" class="form-control" rows="3">{$info['remark']|default=''}</textarea>
  106. </div>
  107. </div>
  108. <div class="hr-line-dashed"></div>
  109. <div class="form-group">
  110. <div class="col-sm-4 col-sm-offset-2">
  111. <button class="btn btn-primary ajax-post" target-form="form-horizontal" data-layer_c="1" type="submit">确 定</button>
  112. <!--<a href="{:url('index')}" class="btn btn-default">取 消</a>-->
  113. <button class="btn cancel-btn btn-default" type="button">取 消</button>
  114. </div>
  115. </div>
  116. </form>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. {/block}
  122. {block name="script"}
  123. <script>
  124. $(document).ready(function(){
  125. formSetValue("type", {$info.type|default=0});
  126. formSetValue("group", {$info.group|default=0});
  127. formSetValue("cate", {$info.cate|default=1});
  128. });
  129. var group = {:json_encode($group_list)};
  130. var orggroup = {:json_encode($org_group_list)};
  131. function changeCate(_self) {
  132. var cate = $(_self).val();
  133. var str = '<option value="0">不分组</option>';
  134. if(cate == 1){
  135. for(let o in group){
  136. str += '<option value="'+o+'">'+group[o]+'</option>';
  137. }
  138. }else{
  139. for(let o in orggroup){
  140. str += '<option value="'+o+'">'+orggroup[o]+'</option>';
  141. }
  142. }
  143. $('#group').html(str);
  144. formSetValue("group", {$info.group|default=0});
  145. }
  146. </script>
  147. {/block}