list.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. {% if 'ajax' in value %}
  50. <button class="layui-btn" onclick="oper('{{value['name']}}','{{value['link']}}')"><i class="layui-icon">{% if 'icon' in value %}{% raw value['icon'] %}{% else %}&#xe608;{% end %}</i>{{value['name']}}</button>
  51. {% else %}
  52. <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">{% if 'icon' in value %}{% raw value['icon'] %}{% else %}&#xe608;{% end %}</i>{{value['name']}}</button>
  53. {% end %}
  54. {% end %}
  55. {% end %}
  56. {% else %}
  57. <button class="layui-btn" onclick="showPage('{{data['common']['path']}}?{{data['common']['argvs']}}')"><i class="layui-icon"></i>返回</button>
  58. {% end %}
  59. {% end %}
  60. {% block thead %}
  61. {% for value in data['common']['thead'] %}
  62. <th>
  63. {{value}}
  64. </th>
  65. {% end %}
  66. {% if 'edit' in data['common'] and data['common']['edit'] == False %}
  67. {% else %}
  68. <th>
  69. 操作
  70. </th>
  71. {% end %}
  72. {% end %}
  73. {% block tbody %}
  74. {% for value in data['list'] %}
  75. <tr>
  76. {% for key in data['common']['tbody'] %}
  77. <td>
  78. {% if key in value %}
  79. {% if 'date' in key %}
  80. {{datetime.datetime.fromtimestamp(value[key]).strftime('%Y-%m-%d %H:%M:%S')}}
  81. {% elif value[key] %}
  82. {% raw value[key] %}
  83. {% else %}
  84. 0
  85. {% end %}
  86. {% else %}
  87. {% raw key %}
  88. {% end %}
  89. </td>
  90. {% end %}
  91. {% if 'edit' in data['common'] and data['common']['edit'] == False %}
  92. {% else %}
  93. <td class="td-manage">
  94. {% if data['state'] == True %}
  95. <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 %})"
  96. class="ml-5" style="text-decoration:none">
  97. <i class="layui-icon">&#xe642;</i>
  98. </a>
  99. {% if data['common']['state'] == True %}
  100. <a title="删除" href="javascript:;" onclick="del(this,'{{value['id']}}', '{{data['common']['path']}}_update')"
  101. style="text-decoration:none">
  102. <i class="layui-icon">&#xe640;</i>
  103. </a>
  104. {% end %}
  105. {% else %}
  106. <a title="恢复" href="javascript:;" onclick="rec(this,'{{value['id']}}', '{{data['common']['path']}}_update')"
  107. style="text-decoration:none">
  108. <i class="layui-icon">&#xe618;</i>
  109. </a>
  110. {% end %}
  111. </td>
  112. {% end %}
  113. </tr>
  114. {% end %}
  115. {% end %}
  116. {% block script %}
  117. {% end %}