list.html 4.4 KB

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