list.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {% extends "../theme/list.html" %}
  2. {% block search %}
  3. {% for index,key in enumerate(data['common']['search'][0]) %}
  4. {%set value = data['common']['search'][1][index] %}
  5. {%set param = key.split('-') %}
  6. {%set length = len(param) %}
  7. {% if 'label' in key %}
  8. <label class="layui-form-label">{{value}}</label>
  9. {% elif param[1] == 'input' %}
  10. <div class="layui-input-inline" style="width:auto" >
  11. <input type="text" name="search_{{key}}"id="search_{{key}}" placeholder="{{value}}" autocomplete="off" class="layui-input" value="{% if data['search'] and key in data['search'] %}{{data['search'][key]}}{% end %}">
  12. </div>
  13. {% elif param[1] == 'hidden' %}
  14. <div class="layui-input-inline" style="width:auto" >
  15. <input type="hidden" name="search_{{key}}" id="search_{{key}}" placeholder="{{value}}" autocomplete="off" class="layui-input" value="{% if data['search'] and key in data['search'] %}{{data['search'][key]}}{% end %}">
  16. </div>
  17. {% elif param[1] == 'time' %}
  18. <div class="layui-input-inline" style="width:auto">
  19. <input type="text" name="search_{{key}}" id="search_{{key}}" placeholder="{{value}}" autocomplete="off" class="layui-input time" value="{% if data['search'] and key in data['search'] %}{{data['search'][key]}}{% end %}">
  20. </div>
  21. {% elif param[1] == 'select' %}
  22. <label class="layui-form-label">{{value}}</label>
  23. <div class="layui-input-inline" style="width:auto">
  24. {%set option = 'search_' + key %}
  25. {% if option in data['common'] %}
  26. {%set select = data['common'][option] %}
  27. <select class="layui-select selectLoad" name="search_{{key}}" id="search_{{key}}" lay-verify="" lay-search="" {% if length > 3 and param[3]%} change="{{param[3]}}" lay-filter="yes"{% end %}>
  28. <option value="">请选择一项</option>
  29. {% for v in select %}
  30. <option value="{{v['id']}}" {% if length > 4 and param[4] %}parent="{% if param[4] in v %}{{v[param[4]]}}{% end %}"{% end %} {% if data['search'] and key in data['search'] and data['search'][key] == str(v['id']) %}selected{% end %}>{{v['name']}}</option>
  31. {% end %}
  32. </select>
  33. {% end %}
  34. </div>
  35. {% end %}
  36. {% end %}
  37. {% end %}
  38. {% block button %}
  39. {% if data['state'] == True %}
  40. {% if 'add' in data['common'] and data['common']['add'] == False %}
  41. {% else %}
  42. <button class="layui-btn" onclick="show('添加{{data['common']['name']}}','{{data['common']['path']}}_update?{{data['common']['argvs']}}','{{data['common']['width']}}','{{data['common']['height']}}'{% if 'full' in data['common'] %},'{{data['common']['full']}}'{% end %})"><i class="layui-icon">&#xe608;</i>添加</button>
  43. {% end %}
  44. {% if data['common']['state'] == True %}
  45. <button class="layui-btn layui-btn-danger" onclick="showPage('{{data['common']['path']}}?state=False{{data['common']['argvs']}}')"><i class="layui-icon"></i>回收站</button>
  46. {% end %}
  47. {% if 'button' in data['common'] %}
  48. {% for value in data['common']['button'] %}
  49. <button class="layui-btn" onclick="show('{{value['name']}}','{{value['link']}}','{{data['common']['width']}}','{{data['common']['height']}}'{% if 'full' in data['common'] %},'{{data['common']['full']}}'{% end %})"><i class="layui-icon">&#xe608;</i>{{value['name']}}</button>
  50. {% end %}
  51. {% end %}
  52. {% else %}
  53. <button class="layui-btn" onclick="showPage('{{data['common']['path']}}?{{data['common']['argvs']}}')"><i class="layui-icon"></i>返回</button>
  54. {% end %}
  55. {% end %}
  56. {% block thead %}
  57. {% for value in data['common']['thead'] %}
  58. <th>
  59. {{value}}
  60. </th>
  61. {% end %}
  62. {% if 'edit' in data['common'] and data['common']['edit'] == False %}
  63. {% else %}
  64. <th>
  65. 操作
  66. </th>
  67. {% end %}
  68. {% end %}
  69. {% block tbody %}
  70. {% for value in data['list'] %}
  71. <tr>
  72. {% for key in data['common']['tbody'] %}
  73. <td>
  74. {% if key in value %}
  75. {% if 'date' in key %}
  76. {{datetime.datetime.fromtimestamp(value[key]).strftime('%Y-%m-%d %H:%M:%S')}}
  77. {% elif value[key] %}
  78. {% raw value[key] %}
  79. {% else %}
  80. 0
  81. {% end %}
  82. {% else %}
  83. {% raw key %}
  84. {% end %}
  85. </td>
  86. {% end %}
  87. {% if 'edit' in data['common'] and data['common']['edit'] == False %}
  88. {% else %}
  89. <td class="td-manage">
  90. {% if data['state'] == True %}
  91. <a title="编辑" href="javascript:;" onclick="show('编辑{{data['common']['name']}}','{{data['common']['path']}}_update?id={{value['id']}}{{data['common']['argvs']}}','{{data['common']['width']}}','{{data['common']['height']}}'{% if 'full' in data['common'] %},'{{data['common']['full']}}'{% end %})"
  92. class="ml-5" style="text-decoration:none">
  93. <i class="layui-icon">&#xe642;</i>
  94. </a>
  95. {% if data['common']['state'] == True %}
  96. <a title="删除" href="javascript:;" onclick="del(this,'{{value['id']}}', '{{data['common']['path']}}_update')"
  97. style="text-decoration:none">
  98. <i class="layui-icon">&#xe640;</i>
  99. </a>
  100. {% end %}
  101. {% else %}
  102. <a title="恢复" href="javascript:;" onclick="rec(this,'{{value['id']}}', '{{data['common']['path']}}_update')"
  103. style="text-decoration:none">
  104. <i class="layui-icon">&#xe618;</i>
  105. </a>
  106. {% end %}
  107. </td>
  108. {% end %}
  109. </tr>
  110. {% end %}
  111. {% end %}
  112. {% block script %}
  113. {% end %}