add.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <style>
  2. .relation-item {margin-top:10px;}
  3. legend {padding-bottom:5px;font-size:14px;font-weight:600;}
  4. label {font-weight:normal;}
  5. .form-control{padding:6px 8px;}
  6. #extend-zone .col-xs-2 {margin-top:10px;padding-right:0;}
  7. #extend-zone .col-xs-2:nth-child(6n+0) {padding-right:15px;}
  8. </style>
  9. <div class="panel panel-default panel-intro">
  10. <div class="panel-heading">
  11. <ul class="nav nav-tabs">
  12. <li class="active"><a href="#crud" data-toggle="tab">{:__('一键生成CRUD')}</a></li>
  13. <li><a href="#menu" data-toggle="tab">{:__('一键生成菜单')}</a></li>
  14. <li><a href="#min" data-toggle="tab">{:__('一键压缩打包')}</a></li>
  15. <li><a href="#api" data-toggle="tab">{:__('一键生成API文档')}</a></li>
  16. </ul>
  17. </div>
  18. <div class="panel-body">
  19. <div id="myTabContent" class="tab-content">
  20. <div class="tab-pane fade active in" id="crud">
  21. <div class="row">
  22. <div class="col-xs-12">
  23. <form role="form">
  24. <input type="hidden" name="commandtype" value="crud" />
  25. <div class="form-group">
  26. <div class="row">
  27. <div class="col-xs-3">
  28. <input checked="" name="isrelation" type="hidden" value="0">
  29. <label class="control-label" data-toggle="tooltip" title="当前只支持生成1对1关联模型,选中后请配置关联表和字段">
  30. <input name="isrelation" type="checkbox" value="1">
  31. 关联模型
  32. </label>
  33. </div>
  34. <div class="col-xs-3">
  35. <input checked="" name="local" type="hidden" value="1">
  36. <label class="control-label" data-toggle="tooltip" title="默认模型生成在application/admin/model目录下,选中后将生成在application/common/model目录下">
  37. <input name="local" type="checkbox" value="0"> 全局模型类
  38. </label>
  39. </div>
  40. <div class="col-xs-3">
  41. <input checked="" name="delete" type="hidden" value="0">
  42. <label class="control-label" data-toggle="tooltip" title="删除CRUD生成的相关文件">
  43. <input name="delete" type="checkbox" value="1"> 删除模式
  44. </label>
  45. </div>
  46. <div class="col-xs-3">
  47. <input checked="" name="force" type="hidden" value="0">
  48. <label class="control-label" data-toggle="tooltip" title="选中后,如果已经存在同名文件将被覆盖。如果是删除将不再提醒">
  49. <input name="force" type="checkbox" value="1">
  50. 强制覆盖模式
  51. </label>
  52. </div>
  53. <!--
  54. <div class="col-xs-3">
  55. <input checked="" name="menu" type="hidden" value="0">
  56. <label class="control-label" data-toggle="tooltip" title="选中后,将同时生成后台菜单规则">
  57. <input name="menu" type="checkbox" value="1">
  58. 生成菜单
  59. </label>
  60. </div>
  61. -->
  62. </div>
  63. </div>
  64. <div class="form-group">
  65. <legend>主表设置</legend>
  66. <div class="row">
  67. <div class="col-xs-3">
  68. <label>请选择主表</label>
  69. {:build_select('table',$tableList,null,['class'=>'form-control selectpicker', 'data-live-search'=>'true']);}
  70. </div>
  71. <div class="col-xs-3">
  72. <label>自定义控制器名</label>
  73. <input type="text" class="form-control" name="controller" data-toggle="tooltip" title="默认根据表名自动生成,如果需要放在二级目录请手动填写" placeholder="支持目录层级,以/分隔">
  74. </div>
  75. <div class="col-xs-3">
  76. <label>自定义模型名</label>
  77. <input type="text" class="form-control" name="model" data-toggle="tooltip" title="默认根据表名自动生成" placeholder="不支持目录层级">
  78. </div>
  79. <div class="col-xs-3">
  80. <label>显示字段(默认全部)</label>
  81. <select name="fields[]" id="fields" multiple style="height:30px;" class="form-control selectpicker"></select>
  82. </div>
  83. </div>
  84. </div>
  85. <div class="form-group hide" id="relation-zone">
  86. <legend>关联表设置</legend>
  87. <div class="row" style="margin-top:15px;">
  88. <div class="col-xs-12">
  89. <a href="javascript:;" class="btn btn-primary btn-sm btn-newrelation" data-index="1">追加关联模型</a>
  90. </div>
  91. </div>
  92. </div>
  93. <hr>
  94. <div class="form-group" id="extend-zone">
  95. <legend>字段识别设置 <span style="font-size:12px;font-weight: normal;">(与之匹配的字段都将生成相应组件)</span></legend>
  96. <div class="row">
  97. <div class="col-xs-2">
  98. <label>复选框后缀</label>
  99. <input type="text" class="form-control" name="setcheckboxsuffix" placeholder="默认为set类型" />
  100. </div>
  101. <div class="col-xs-2">
  102. <label>单选框后缀</label>
  103. <input type="text" class="form-control" name="enumradiosuffix" placeholder="默认为enum类型" />
  104. </div>
  105. <div class="col-xs-2">
  106. <label>图片类型后缀</label>
  107. <input type="text" class="form-control" name="imagefield" placeholder="默认为image,images,avatar,avatars" />
  108. </div>
  109. <div class="col-xs-2">
  110. <label>文件类型后缀</label>
  111. <input type="text" class="form-control" name="filefield" placeholder="默认为file,files" />
  112. </div>
  113. <div class="col-xs-2">
  114. <label>日期时间后缀</label>
  115. <input type="text" class="form-control" name="intdatesuffix" placeholder="默认为time" />
  116. </div>
  117. <div class="col-xs-2">
  118. <label>开关后缀</label>
  119. <input type="text" class="form-control" name="switchsuffix" placeholder="默认为switch" />
  120. </div>
  121. <div class="col-xs-2">
  122. <label>城市选择后缀</label>
  123. <input type="text" class="form-control" name="citysuffix" placeholder="默认为city" />
  124. </div>
  125. <div class="col-xs-2">
  126. <label>动态下拉后缀(单)</label>
  127. <input type="text" class="form-control" name="selectpagesuffix" placeholder="默认为_id" />
  128. </div>
  129. <div class="col-xs-2">
  130. <label>动态下拉后缀(多)</label>
  131. <input type="text" class="form-control" name="selectpagessuffix" placeholder="默认为_ids" />
  132. </div>
  133. <div class="col-xs-2">
  134. <label>忽略的字段</label>
  135. <input type="text" class="form-control" name="ignorefields" placeholder="默认无" />
  136. </div>
  137. <div class="col-xs-2">
  138. <label>排序字段</label>
  139. <input type="text" class="form-control" name="sortfield" placeholder="默认为weigh" />
  140. </div>
  141. <div class="col-xs-2">
  142. <label>富文本编辑器</label>
  143. <input type="text" class="form-control" name="editorsuffix" placeholder="默认为content" />
  144. </div>
  145. <div class="col-xs-2">
  146. <label>选项卡过滤字段</label>
  147. <input type="text" class="form-control" name="headingfilterfield" placeholder="默认为status" />
  148. </div>
  149. <div class="col-xs-2">
  150. <label>标签后缀 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本"></i></label>
  151. <input type="text" class="form-control" name="tagsuffix" placeholder="默认为tag,tags" />
  152. </div>
  153. <div class="col-xs-2">
  154. <label>JSON后缀 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本"></i></label>
  155. <input type="text" class="form-control" name="jsonsuffix" placeholder="默认为json" />
  156. </div>
  157. <div class="col-xs-2">
  158. <label>固定列数量 <i class="fa fa-info-circle" data-toggle="tooltip" data-title="只支持1.3.0+版本,大于0时为右侧固定列数量,小于0时为左侧固定列数量"></i></label>
  159. <input type="text" class="form-control" name="fixedcolumns" placeholder="默认不启用" />
  160. </div>
  161. </div>
  162. </div>
  163. <div class="form-group">
  164. <legend>生成命令行</legend>
  165. <textarea class="form-control" data-toggle="tooltip" title="如果在线执行命令失败,可以将命令复制到命令行进行执行" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
  166. </div>
  167. <div class="form-group">
  168. <legend>返回结果</legend>
  169. <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
  170. </div>
  171. <div class="form-group">
  172. <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
  173. <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
  174. </div>
  175. </form>
  176. </div>
  177. </div>
  178. </div>
  179. <div class="tab-pane fade" id="menu">
  180. <div class="row">
  181. <div class="col-xs-12">
  182. <form role="form">
  183. <input type="hidden" name="commandtype" value="menu" />
  184. <div class="form-group">
  185. <div class="row">
  186. <div class="col-xs-3">
  187. <input checked="" name="allcontroller" type="hidden" value="0">
  188. <label class="control-label" data-toggle="tooltip" title="将删除全部的菜单规则,重新按控制器进行生成,请做好备份,谨慎选择">
  189. <input name="allcontroller" data-toggle="collapse" data-target="#controller" type="checkbox" value="1"> 一键生成全部控制器
  190. </label>
  191. </div>
  192. <div class="col-xs-3">
  193. <input checked="" name="delete" type="hidden" value="0">
  194. <label class="control-label" data-toggle="tooltip" title="删除控制器菜单规则">
  195. <input name="delete" type="checkbox" value="1"> 删除模式
  196. </label>
  197. </div>
  198. <div class="col-xs-3">
  199. <input checked="" name="force" type="hidden" value="0">
  200. <label class="control-label" data-toggle="tooltip" title="如果菜单规则已经存在则覆盖">
  201. <input name="force" type="checkbox" value="1"> 强制覆盖模式
  202. </label>
  203. </div>
  204. </div>
  205. </div>
  206. <div class="form-group in" id="controller">
  207. <legend>控制器设置</legend>
  208. <div class="row" style="margin-top:15px;">
  209. <div class="col-xs-12">
  210. <input type="text" name="controllerfile" class="form-control selectpage" style="width:720px;" data-source="command/get_controller_list" data-multiple="true" name="controller" placeholder="请选择控制器" />
  211. </div>
  212. </div>
  213. </div>
  214. <div class="form-group">
  215. <legend>生成命令行</legend>
  216. <textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
  217. </div>
  218. <div class="form-group">
  219. <legend>返回结果</legend>
  220. <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
  221. </div>
  222. <div class="form-group">
  223. <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
  224. <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
  225. </div>
  226. </form>
  227. </div>
  228. </div>
  229. </div>
  230. <div class="tab-pane fade" id="min">
  231. <div class="row">
  232. <div class="col-xs-12">
  233. <form role="form">
  234. <input type="hidden" name="commandtype" value="min" />
  235. <div class="form-group">
  236. <legend>基础设置</legend>
  237. <div class="row">
  238. <div class="col-xs-3">
  239. <label>请选择压缩模块</label>
  240. <select name="module" class="form-control selectpicker">
  241. <option value="all" selected>全部</option>
  242. <option value="backend">后台Backend</option>
  243. <option value="frontend">前台Frontend</option>
  244. </select>
  245. </div>
  246. <div class="col-xs-3">
  247. <label>请选择压缩资源</label>
  248. <select name="resource" class="form-control selectpicker">
  249. <option value="all" selected>全部</option>
  250. <option value="js">JS</option>
  251. <option value="css">CSS</option>
  252. </select>
  253. </div>
  254. <div class="col-xs-3">
  255. <label>请选择压缩模式</label>
  256. <select name="optimize" class="form-control selectpicker">
  257. <option value="">无</option>
  258. <option value="uglify">uglify</option>
  259. <option value="closure">closure</option>
  260. </select>
  261. </div>
  262. </div>
  263. </div>
  264. <div class="form-group">
  265. <legend>生成命令行</legend>
  266. <textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
  267. </div>
  268. <div class="form-group">
  269. <legend>返回结果</legend>
  270. <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
  271. </div>
  272. <div class="form-group">
  273. <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
  274. <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
  275. </div>
  276. </form>
  277. </div>
  278. </div>
  279. </div>
  280. <div class="tab-pane fade" id="api">
  281. <div class="row">
  282. <div class="col-xs-12">
  283. <form role="form">
  284. <input type="hidden" name="commandtype" value="api" />
  285. <div class="form-group">
  286. <div class="row">
  287. <div class="col-xs-3">
  288. <input checked="" name="force" type="hidden" value="0">
  289. <label class="control-label" data-toggle="tooltip" title="如果已经存在则覆盖">
  290. <input name="force" type="checkbox" value="1">
  291. 覆盖模式
  292. </label>
  293. </div>
  294. </div>
  295. </div>
  296. <div class="form-group">
  297. <legend>文档设置</legend>
  298. <div class="row">
  299. <div class="col-xs-3">
  300. <label>请输入接口URL</label>
  301. <input type="text" name="url" class="form-control" placeholder="API URL,可留空" />
  302. </div>
  303. <div class="col-xs-3">
  304. <label>接口生成文件</label>
  305. <input type="text" name="output" class="form-control" placeholder="留空则使用api.html" />
  306. </div>
  307. <div class="col-xs-3">
  308. <label>模板文件</label>
  309. <input type="text" name="template" class="form-control" placeholder="如果不清楚请留空" />
  310. </div>
  311. <div class="col-xs-3">
  312. <label>文档语言</label>
  313. <select name="language" class="form-control">
  314. <option value="" selected>请选择语言</option>
  315. <option value="zh-cn">中文</option>
  316. <option value="en">英文</option>
  317. </select>
  318. </div>
  319. </div>
  320. <div class="row" style="margin-top:10px;">
  321. <div class="col-xs-3">
  322. <label>文档标题</label>
  323. <input type="text" name="title" class="form-control" placeholder="默认为{$site.name}" />
  324. </div>
  325. <div class="col-xs-3">
  326. <label>文档作者</label>
  327. <input type="text" name="author" class="form-control" placeholder="默认为{$site.name}" />
  328. </div>
  329. <div class="col-xs-3">
  330. <label>生成模块</label>
  331. <select name="module" class="form-control selectpicker">
  332. <option value="" selected>请选择模块</option>
  333. <option value="api">API</option>
  334. <option value="backend">后台</option>
  335. <option value="frontend">前台</option>
  336. </select>
  337. </div>
  338. <div class="col-xs-3">
  339. <label>生成插件文档</label>
  340. <select name="addon" class="form-control selectpicker" data-live-search="true">
  341. <option value="" selected>请选择插件</option>
  342. {foreach name=":get_addon_list()" id="item"}
  343. <option value="{$item.name}">{$item.title}</option>
  344. {/foreach}
  345. </select>
  346. </div>
  347. </div>
  348. </div>
  349. <div class="form-group">
  350. <legend>生成命令行</legend>
  351. <textarea class="form-control" rel="command" rows="1" placeholder="请点击生成命令行"></textarea>
  352. </div>
  353. <div class="form-group">
  354. <legend>返回结果</legend>
  355. <textarea class="form-control" rel="result" rows="5" placeholder="请点击立即执行"></textarea>
  356. </div>
  357. <div class="form-group">
  358. <button type="button" class="btn btn-info btn-embossed btn-command">{:__('生成命令行')}</button>
  359. <button type="button" class="btn btn-success btn-embossed btn-execute">{:__('立即执行')}</button>
  360. </div>
  361. </form>
  362. </div>
  363. </div>
  364. </div>
  365. </div>
  366. </div>
  367. </div>
  368. <script id="relationtpl" type="text/html">
  369. <div class="row relation-item">
  370. <div class="col-xs-2">
  371. <label>请选择关联表</label>
  372. <select name="relation[<%=index%>][relation]" class="form-control relationtable" data-live-search="true"></select>
  373. </div>
  374. <div class="col-xs-2">
  375. <label>请选择关联类型</label>
  376. <select name="relation[<%=index%>][relationmode]" class="form-control relationmode"></select>
  377. </div>
  378. <div class="col-xs-2">
  379. <label>关联外键</label>
  380. <select name="relation[<%=index%>][relationforeignkey]" class="form-control relationforeignkey"></select>
  381. </div>
  382. <div class="col-xs-2">
  383. <label>关联主键</label>
  384. <select name="relation[<%=index%>][relationprimarykey]" class="form-control relationprimarykey"></select>
  385. </div>
  386. <div class="col-xs-2">
  387. <label>请选择显示字段</label>
  388. <select name="relation[<%=index%>][relationfields][]" multiple class="form-control relationfields"></select>
  389. </div>
  390. <div class="col-xs-2">
  391. <label>&nbsp;</label>
  392. <a href="javascript:;" class="btn btn-danger btn-block btn-removerelation">移除</a>
  393. </div>
  394. </div>
  395. </script>