新增: 任务创建关联灵感下拉(F-260619-01 补创建入口)

This commit is contained in:
lxy
2026-08-01 12:47:12 +08:00
parent c34ad062e7
commit 438f9692f2
3 changed files with 21 additions and 0 deletions
+3
View File
@@ -53,6 +53,9 @@ export default {
desc: 'Description', desc: 'Description',
branch: 'Branch', branch: 'Branch',
priority: 'Priority', priority: 'Priority',
// F-260619-01: related idea (1:1, optional)
idea: 'Related Idea',
ideaPlaceholder: 'None (optional)',
titlePlaceholder: 'Enter task title...', titlePlaceholder: 'Enter task title...',
descPlaceholder: 'Brief description (optional)', descPlaceholder: 'Brief description (optional)',
branchPlaceholder: 'feature/xxx (optional)', branchPlaceholder: 'feature/xxx (optional)',
+3
View File
@@ -53,6 +53,9 @@ export default {
desc: '描述', desc: '描述',
branch: '分支', branch: '分支',
priority: '优先级', priority: '优先级',
// F-260619-01:关联灵感(1对1 单向,可选)
idea: '关联灵感',
ideaPlaceholder: '不关联(可选)',
titlePlaceholder: '输入任务标题...', titlePlaceholder: '输入任务标题...',
descPlaceholder: '简要描述(可选)', descPlaceholder: '简要描述(可选)',
branchPlaceholder: 'feature/xxx(可选)', branchPlaceholder: 'feature/xxx(可选)',
+15
View File
@@ -149,6 +149,14 @@
<option :value="3">{{ $t('tasks.modal.priorityLow') }}</option> <option :value="3">{{ $t('tasks.modal.priorityLow') }}</option>
</select> </select>
</div> </div>
<!-- F-260619-01:关联灵感(1对1 单向,可选)空串=不关联,与后端/AI 工具层一致 -->
<div class="modal-field">
<label>{{ $t('tasks.modal.idea') }}</label>
<select v-model="newTaskIdeaId">
<option value="">{{ $t('tasks.modal.ideaPlaceholder') }}</option>
<option v-for="idea in store.ideas" :key="idea.id" :value="idea.id">{{ idea.title }}</option>
</select>
</div>
<div class="modal-actions"> <div class="modal-actions">
<button class="btn btn-ghost" @click="showCreateModal = false">{{ $t('common.cancel') }}</button> <button class="btn btn-ghost" @click="showCreateModal = false">{{ $t('common.cancel') }}</button>
<button class="btn btn-primary" @click="confirmCreate" :disabled="submitting || !newTaskTitle.trim()">{{ $t('common.confirm') }}</button> <button class="btn btn-primary" @click="confirmCreate" :disabled="submitting || !newTaskTitle.trim()">{{ $t('common.confirm') }}</button>
@@ -272,6 +280,8 @@ const newTaskTitle = ref('')
const newTaskDesc = ref('') const newTaskDesc = ref('')
const newTaskBranch = ref('') const newTaskBranch = ref('')
const newTaskPriority = ref(2) const newTaskPriority = ref(2)
// F-260619-01:关联灵感(空串=不关联,与后端 idea_id 空串处理一致)
const newTaskIdeaId = ref('')
const submitting = ref(false) const submitting = ref(false)
interface TaskGroup { interface TaskGroup {
@@ -355,6 +365,7 @@ function openCreateModal() {
newTaskDesc.value = '' newTaskDesc.value = ''
newTaskBranch.value = '' newTaskBranch.value = ''
newTaskPriority.value = 2 newTaskPriority.value = 2
newTaskIdeaId.value = ''
showCreateModal.value = true showCreateModal.value = true
} }
@@ -368,6 +379,8 @@ async function confirmCreate() {
description: newTaskDesc.value.trim(), description: newTaskDesc.value.trim(),
branch_name: newTaskBranch.value.trim() || undefined, branch_name: newTaskBranch.value.trim() || undefined,
priority: newTaskPriority.value, priority: newTaskPriority.value,
// F-260619-01:空串=不关联(对齐后端 idea_id 空串语义)
idea_id: newTaskIdeaId.value.trim() || undefined,
}) })
if (!r) return if (!r) return
showCreateModal.value = false showCreateModal.value = false
@@ -434,6 +447,8 @@ onMounted(async () => {
await Promise.all([ await Promise.all([
store.loadProjects(), store.loadProjects(),
store.loadTasks(), store.loadTasks(),
// F-260619-01:加载灵感供新建任务模态关联下拉选择(幂等,已加载则 no-op)
store.loadIdeas(),
taskApi.count().then(n => totalTasks.value = n), taskApi.count().then(n => totalTasks.value = n),
]) ])
} finally { } finally {