update.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. {% extends "../theme/update.html" %}
  2. {% block action %}{{data['common']['path']}}_update{% end %}
  3. {% block url %}{{data['common']['path']}}?{{data['common']['argvs']}}{% end %}
  4. {% block form %}
  5. {% for index,name in enumerate(data['common']['label']) %}
  6. {%set value = data['common']['update'][index] %}
  7. {%set value = value.split('-') %}
  8. {%set length = len(value) %}
  9. <div class="layui-form-item {% if value[1] in ('text',) %}layui-form-text{% end %}">
  10. <label for="{{value[0]}}" class="layui-form-label">
  11. {% if value[2] or (value[1] == 'password' and not data['info']) %}<span class="x-red">*</span>{% end %}
  12. {{name}}
  13. </label>
  14. <div class="layui-input-block">
  15. {% if value[1] == 'input' %}
  16. <input type="text" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  17. autocomplete="off" class="layui-input" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" />
  18. {% elif value[1] == 'date' %}
  19. <input type="text" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  20. autocomplete="off" class="layui-input time" value="{% if data['info'] and value[0] in data['info'] %}{{datetime.datetime.fromtimestamp(data['info'][value[0]]).strftime('%Y-%m-%d %H:%M:%S')}}{% end %}" readonly />
  21. {% elif value[1] == 'show' %}
  22. <input type="text" lay-verify="{{value[2]}}"
  23. autocomplete="off" class="layui-input" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" readonly />
  24. {% elif value[1] == 'password' %}
  25. <input type="password" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{% if not data['info'] %}required{% end %}"
  26. autocomplete="off" class="layui-input" value="" />
  27. {% elif value[1] == 'text' %}
  28. <textarea {% if length > 3 %}placeholder="{{value[3]}}"{% end %} class="layui-textarea" id="update_{{value[0]}}" name="update_{{value[0]}}" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" lay-verify="{{value[2]}}">{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}</textarea>
  29. {% elif value[1] == 'editor' %}
  30. <textarea {% if length > 3 %}placeholder="{{value[3]}}"{% end %} class="layui-form layui-textarea layui-editor" id="update_{{value[0]}}" name="update_{{value[0]}}" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" lay-verify="{{value[2]}}">{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}</textarea>
  31. {% elif value[1] == 'pic' %}
  32. <div class="site-demo-upbar">
  33. <img id="upload_{{value[0]}}_show" width="200" src="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}" style="{% if data['info'] and value[0] in data['info'] and data['info'][value[0]] %}display:;{% else %}display:none;{% end %}margin-left:10px;"/>
  34. <input type="file" class="layui-upload-file" lay-type="images" name="file" id="upload_{{value[0]}}"/>
  35. <input class="layui-input" type="hidden" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% end %}"/>
  36. </div>
  37. {% elif value[1] == 'switch' %}
  38. <input class="layui-input" type="checkbox" lay-skin="switch" lay-text="{{value[3]}}" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  39. autocomplete="off" class="layui-input" value="{% if data['info'] and value[0] in data['info'] %}{{data['info'][value[0]]}}{% else %}True{% end %}" />
  40. {% elif value[1] == 'radio' %}
  41. {%set option = 'update_' + value[0] %}
  42. {% if option in data['common'] %}
  43. {%set select = data['common'][option] %}
  44. {% for v in select %}
  45. <input {% if length > 3 %}parent="{% if value[3] in v %}{{v[value[3]]}}{% end %}"{% end %} class="layui-input" type="radio" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  46. autocomplete="off" class="layui-input" value="{{v['id']}}" title="{{v['name']}}" {% if data['info'] and value[0] in data['info'] and data['info'][value[0]] == v['id'] %}checked{% end %}/>
  47. {% end %}
  48. {% end %}
  49. {% elif value[1] == 'checkbox' %}
  50. {%set option = 'update_' + value[0] %}
  51. {% if option in data['common'] %}
  52. {%set select = data['common'][option] %}
  53. {% for v in select %}
  54. <input {% if length > 3 %}parent="{% if value[3] in v %}{{v[value[3]]}}{% end %}"{% end %} class="layui-input" type="checkbox" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  55. autocomplete="off" class="layui-input" value="{{v['id']}}" title="{{v['name']}}" {% if data['info'] and value[0] in data['info'] and data['info'][value[0]] and v['id'] and str(v['id'])+',' in data['info'][value[0]]+',' %}checked{% end %}/>
  56. {% end %}
  57. {% end %}
  58. {% elif value[1] == 'checkboxs' %}
  59. {%set option = 'update_' + value[0] %}
  60. {% if option in data['common'] %}
  61. {%set select = data['common'][option] %}
  62. {% for v in select %}
  63. <div class="site-demo-upbar">
  64. <label for="{{value[0]}}" class="layui-form-label">
  65. {{v['name']}}
  66. </label>
  67. {% if v['child'] %}
  68. {% for m in v['child'] %}
  69. <input class="layui-input" type="checkbox" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  70. autocomplete="off" class="layui-input" value="{{m['id']}}" title="{{m['name']}}" {% if data['info'] and value[0] in data['info'] and data['info'][value[0]] and m['id'] and str(m['id'])+',' in data['info'][value[0]]+',' %}checked{% end %}/>
  71. {% end %}
  72. {% end %}
  73. </div>
  74. {% end %}
  75. {% end %}
  76. {% elif value[1] == 'checkmenu' %}
  77. {%set option = 'update_' + value[0] %}
  78. {% if option in data['common'] %}
  79. {%set select = data['common'][option] %}
  80. {% for i,j in enumerate(select[0][0]) %}
  81. <div class="site-demo-upbar">
  82. <label for="{{value[0]}}" class="layui-form-label">
  83. {{j}}
  84. </label>
  85. {% for m,n in enumerate(select[1][i][0]) %}
  86. {%set v = select[1][i][1][m] %}
  87. <input class="layui-input" type="checkbox" id="update_{{value[0]}}" name="update_{{value[0]}}" lay-verify="{{value[2]}}"
  88. autocomplete="off" class="layui-input" value="{{n}}" title="{{v}}" {% if data['info'] and value[0] in data['info'] and data['info'][value[0]] and n and str(n)+',' in data['info'][value[0]]+',' %}checked{% end %}/>
  89. {% end %}
  90. </div>
  91. {% end %}
  92. {% end %}
  93. {% elif value[1] == 'select' %}
  94. {%set option = 'update_' + value[0] %}
  95. {% if option in data['common'] %}
  96. {%set select = data['common'][option] %}
  97. <select class="layui-select selectLoad" name="update_{{value[0]}}" id="update_{{value[0]}}" lay-verify="{{value[2]}}" lay-search="" {% if length > 3 %} change="{{value[3]}}" lay-filter="yes"{% end %}>
  98. <option value="">请选择</option>
  99. {% for v in select %}
  100. <option value="{{v['id']}}" {% if length > 3 %}parent="{% if value[3] in v %}{{v[value[3]]}}{% end %}"{% end %} name="{{v['name']}}" {% if data['info'] and value[0] in data['info'] and int(data['info'][value[0]]) == v['id'] %}selected{% end %}>{{v['name']}}</option>
  101. {% end %}
  102. </select>
  103. {% end %}
  104. {% end %}
  105. </div>
  106. </div>
  107. {% end %}
  108. {% end %}
  109. {% block script %}
  110. {% end %}