task assignment

This commit is contained in:
2025-05-06 22:35:09 +08:00
parent 1982894b79
commit 44c1b3cf9b
8 changed files with 17862 additions and 0 deletions

View File

@ -0,0 +1,126 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>配置任务</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
margin: 0;
padding: 0;
}
h1 {
text-align: center;
color: #333;
margin-top: 20px;
}
form {
max-width: 600px;
margin: 20px auto;
padding: 20px;
background: #fff;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
#tasks div {
margin-bottom: 10px;
display: flex;
align-items: center;
gap: 10px;
}
label {
font-weight: bold;
flex: 1;
}
input[type="text"], input[type="number"] {
flex: 2;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
}
button {
display: inline-block;
padding: 10px 20px;
margin: 10px 5px 0;
font-size: 14px;
border: none;
border-radius: 4px;
cursor: pointer;
color: #fff;
}
button[type="button"] {
background-color: #28a745;
}
button.delete {
background-color: #dc3545;
}
button.clear {
background-color: #ffc107;
}
button[type="submit"] {
background-color: #007bff;
}
button:hover {
opacity: 0.9;
}
</style>
</head>
<body>
<h1>配置任务</h1>
<form method="POST">
<div id="tasks">
<div>
<label>任务:</label>
<input type="text" name="task" required>
<label>人数:</label>
<input type="number" name="count" min="1" required>
<button type="button" class="delete" onclick="deleteTask(this)">删除</button>
</div>
</div>
<div style="text-align: center;">
<button type="button" onclick="addTask()">添加任务</button>
<button type="button" class="clear" onclick="clearTasks()">清空任务</button>
<button type="submit">提交</button>
</div>
</form>
<script>
// 添加新任务行
function addTask() {
const tasksDiv = document.getElementById("tasks");
const newTaskDiv = document.createElement("div");
newTaskDiv.innerHTML = `
<label>任务:</label>
<input type="text" name="task" required>
<label>人数:</label>
<input type="number" name="count" min="1" required>
<button type="button" class="delete" onclick="deleteTask(this)">删除</button>
`;
tasksDiv.appendChild(newTaskDiv);
}
// 删除单行任务
function deleteTask(button) {
const taskDiv = button.parentElement;
taskDiv.remove();
}
// 清空所有任务
function clearTasks() {
const tasksDiv = document.getElementById("tasks");
tasksDiv.innerHTML = `
<div>
<label>任务:</label>
<input type="text" name="task" required>
<label>人数:</label>
<input type="number" name="count" min="1" required>
<button type="button" class="delete" onclick="deleteTask(this)">删除</button>
</div>
`;
}
</script>
</body>
</html>

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>任务意向与人数配置</title>
<style>
table {
width: 80%;
margin: 20px auto;
border-collapse: collapse;
}
th, td {
border: 1px solid #ccc;
text-align: center;
padding: 10px;
}
th {
background-color: #f4f4f4;
}
.red {
background-color: #ffcccc;
}
.green {
background-color: #ccffcc;
}
</style>
</head>
<body>
<h1 style="text-align: center;">任务意向与人数配置</h1>
<table>
<thead>
<tr>
<th>任务</th>
<th>最大人数</th>
<th>当前人数</th>
<th>意向人列表</th>
</tr>
</thead>
<tbody>
{% for task in task_status %}
<tr class="{{ task.status_color }}">
<td>{{ task.task }}</td>
<td>{{ task.max_count }}</td>
<td>{{ task.current_count }}</td>
<td>
{% for user in task.users %}
{{ user }}{% if not loop.last %}, {% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body {
background-color: #f8f9fa;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.modal-dialog {
max-width: 600px;
margin: auto;
border-radius: 15px;
overflow: hidden;
}
.modal-content {
border-radius: 15px;
padding: 20px;
background-color: #ffffff;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.modal-header {
background-color: #dc3545;
color: white;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
text-align: center;
}
.modal-title {
margin: 0 auto;
font-size: 1.5rem;
font-weight: bold;
}
.modal-body {
padding: 20px 30px;
font-size: 1.25rem;
color: #495057;
text-align: center;
line-height: 1.8;
}
</style>
</head>
<body>
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h5 class="modal-title w-100">{{ title }}</h5>
</div>
<!-- Modal Body -->
<div class="modal-body">
{{ content }}
</div>
</div>
</div>
<script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>分配结果</title>
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h1 class="text-center mb-4">任务分配结果</h1>
<div class="card shadow p-4">
<table class="table table-bordered table-striped">
<thead class="table-dark">
<tr>
<th scope="col">任务</th>
<th scope="col">分配人员</th>
</tr>
</thead>
<tbody>
{% for task, users in assignment_result.items() %}
<tr>
<td>{{ task }}</td>
<td>{{ users | join(', ') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户意向</title>
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h1 class="text-center mb-4">提交任务意向</h1>
<form method="POST" class="card shadow p-4">
<div class="mb-3">
<label for="name" class="form-label">姓名</label>
<input type="text" name="name" id="name" class="form-control" placeholder="请输入您的姓名" required>
</div>
<div class="mb-3">
<label for="intention" class="form-label">任务意向</label>
<select name="intention" id="intention" class="form-select" required onchange="updateTaskInfo()">
{% for task, count in tasks.items() %}
<option value="{{ task }}" data-max="{{ count }}">{{ task }}</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<p id="task-info" class="text-muted">任务人数:{{ init }}</p>
</div>
<button type="submit" class="btn btn-primary w-100">提交</button>
</form>
</div>
<script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
<script>
// 动态更新任务信息
function updateTaskInfo() {
const taskSelect = document.getElementById("intention");
const selectedOption = taskSelect.options[taskSelect.selectedIndex];
const maxCount = selectedOption.getAttribute("data-max");
const taskInfo = document.getElementById("task-info");
if (maxCount) {
taskInfo.textContent = `任务人数:${maxCount}`;
} else {
taskInfo.textContent = "请选择一个任务以查看最多人数。";
}
}
</script>
</body>
</html>