diff --git a/admin-web/src/views/SendRecord.vue b/admin-web/src/views/SendRecord.vue index 2c75a17..ee93354 100644 --- a/admin-web/src/views/SendRecord.vue +++ b/admin-web/src/views/SendRecord.vue @@ -46,6 +46,8 @@ + + @@ -61,6 +63,31 @@ + + + + + + + + + + + + + + + @@ -214,6 +241,7 @@ import { type QueryRecordsParams, } from '@/api/sendRecord' import { listConversations } from '@/api/channel' +import { listTags } from '@/api/crm' interface RecordItem { id: number @@ -262,8 +290,12 @@ const testForm = reactive({ }) const selectedConversationId = ref(null) const personIdInput = ref('') +const selectedTagId = ref(null) +const tagScope = ref<'all' | 'conversation' | 'person'>('all') +const ruleJson = ref('') const textContent = ref('') const conversations = ref([]) +const tags = ref([]) function buildTargetValue() { if (testForm.targetType === 'conversation' && selectedConversationId.value) { @@ -272,6 +304,19 @@ function buildTargetValue() { if (testForm.targetType === 'person' && personIdInput.value) { return { person_id: Number(personIdInput.value) } } + if (testForm.targetType === 'tag' && selectedTagId.value != null) { + return { tag_id: selectedTagId.value, scope: tagScope.value } + } + if (testForm.targetType === 'rule') { + const raw = ruleJson.value.trim() + if (!raw) return {} + try { + return JSON.parse(raw) + } catch { + ElMessage.warning('规则 JSON 格式错误') + return {} + } + } return {} } @@ -396,8 +441,18 @@ async function loadConversations() { } } +async function loadTags() { + try { + const res: any = await listTags() + tags.value = res.data || [] + } catch (e: any) { + ElMessage.error(e.message) + } +} + onMounted(() => { loadConversations() + loadTags() loadRecords() loadStatistics() })