user_form.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. {% extends "base.html" %}
  2. {% block title %}{% if user %}逐鹿人才-证件合同管理系统-编辑{% else %}逐鹿人才-证件合同管理系统-新建{% endif %}逐鹿人才-证件合同管理系统-用户{% endblock %}
  3. {% block content %}
  4. <div class="d-flex justify-content-between align-items-center mb-3">
  5. <h2>{% if user %}编辑{% else %}新建{% endif %}用户</h2>
  6. <a href="{{ url_for('user_list') }}" class="btn btn-outline-secondary">返回列表</a>
  7. </div>
  8. <div class="card">
  9. <div class="card-body">
  10. <form method="POST">
  11. <div class="row">
  12. <div class="col-md-6 mb-3">
  13. <label for="username" class="form-label">用户名</label>
  14. <input type="text" class="form-control" id="username" name="username"
  15. value="{{ user.username if user }}" required>
  16. </div>
  17. <div class="col-md-6 mb-3">
  18. <label for="password" class="form-label">密码</label>
  19. <input type="password" class="form-control" id="password" name="password"
  20. {% if not user %}required{% endif %}>
  21. {% if user %}
  22. <small class="text-muted">留空则不修改密码</small>
  23. {% endif %}
  24. </div>
  25. </div>
  26. <div class="row">
  27. <div class="col-md-6 mb-3">
  28. <label for="name" class="form-label">姓名</label>
  29. <input type="text" class="form-control" id="name" name="name"
  30. value="{{ user.name if user }}" required>
  31. </div>
  32. <div class="col-md-6 mb-3">
  33. <label for="department" class="form-label">部门</label>
  34. <input type="text" class="form-control" id="department" name="department"
  35. value="{{ user.department if user }}" required>
  36. </div>
  37. </div>
  38. <div class="mb-3">
  39. <label for="email" class="form-label">邮箱</label>
  40. <input type="email" class="form-control" id="email" name="email"
  41. value="{{ user.email if user }}" required>
  42. </div>
  43. <div class="mb-3">
  44. <div class="form-check">
  45. <input class="form-check-input" type="checkbox" id="is_admin" name="is_admin"
  46. {% if user and user.is_admin %}checked{% endif %}>
  47. <label class="form-check-label" for="is_admin">管理员</label>
  48. </div>
  49. </div>
  50. <div class="mb-3">
  51. <h5>权限设置</h5>
  52. <div class="form-check">
  53. <input class="form-check-input" type="checkbox" id="can_create" name="can_create"
  54. {% if user and user.can_create %}checked{% endif %}>
  55. <label class="form-check-label" for="can_create">创建合同</label>
  56. </div>
  57. <div class="form-check">
  58. <input class="form-check-input" type="checkbox" id="can_view" name="can_view"
  59. {% if user and user.can_view %}checked{% endif %}>
  60. <label class="form-check-label" for="can_view">查看合同</label>
  61. </div>
  62. <div class="form-check">
  63. <input class="form-check-input" type="checkbox" id="can_edit" name="can_edit"
  64. {% if user and user.can_edit %}checked{% endif %}>
  65. <label class="form-check-label" for="can_edit">编辑合同</label>
  66. </div>
  67. <div class="form-check">
  68. <input class="form-check-input" type="checkbox" id="can_delete" name="can_delete"
  69. {% if user and user.can_delete %}checked{% endif %}>
  70. <label class="form-check-label" for="can_delete">删除合同</label>
  71. </div>
  72. </div>
  73. <div class="d-grid gap-2 mt-4">
  74. <button type="submit" class="btn btn-primary">保存</button>
  75. </div>
  76. </form>
  77. </div>
  78. </div>
  79. {% endblock %}