ai助手1.0

This commit is contained in:
2026-07-07 17:53:32 +08:00
parent 9f9f7eb376
commit 67ec83832f
3 changed files with 19 additions and 15 deletions
+15 -4
View File
@@ -6,7 +6,7 @@
<div class="selected-tag workflow-tag">
<el-icon><Promotion /></el-icon>
<span>{{ commonWorkflows.find((w) => w.id === selectedWorkflowId)?.name }}</span>
<el-icon class="tag-close" @click="clearWorkflow"><Close /></el-icon>
<el-icon v-if="!workflowLocked" class="tag-close" @click="clearWorkflow"><Close /></el-icon>
</div>
</div>
@@ -47,9 +47,9 @@
</div>
<!-- 快捷工作流胶囊输入框下方 -->
<div v-if="commonWorkflows.length > 0" class="workflow-shortcuts">
<div v-if="visibleWorkflows.length > 0" class="workflow-shortcuts">
<button
v-for="wf in commonWorkflows"
v-for="wf in visibleWorkflows"
:key="wf.id"
class="shortcut-pill"
:class="{ active: selectedWorkflowId === wf.id }"
@@ -63,13 +63,14 @@
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ref, computed, onMounted } from 'vue';
import { Top, MagicStick, Promotion, Close, Paperclip } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
import { getWorkflowList } from '/@/api/settings/creation';
interface Props {
sendDisabled?: boolean;
workflowLocked?: boolean;
}
interface Emits {
@@ -85,6 +86,7 @@ interface Workflow {
const props = withDefaults(defineProps<Props>(), {
sendDisabled: false,
workflowLocked: false,
});
const emit = defineEmits<Emits>();
const message = ref('');
@@ -92,6 +94,13 @@ const isFocused = ref(false);
const selectedWorkflowId = ref<string | null>(null);
const commonWorkflows = ref<Workflow[]>([]);
const visibleWorkflows = computed(() => {
if (props.workflowLocked && selectedWorkflowId.value) {
return commonWorkflows.value.filter((w) => w.id === selectedWorkflowId.value);
}
return commonWorkflows.value;
});
const fetchWorkflows = async () => {
try {
const res = await getWorkflowList();
@@ -119,6 +128,7 @@ const handleAttachment = () => {
};
const toggleWorkflow = (id: string) => {
if (props.workflowLocked) return;
const newId = selectedWorkflowId.value === id ? null : id;
selectedWorkflowId.value = newId;
emit('workflow-select', newId);
@@ -131,6 +141,7 @@ const resetAll = () => {
};
const clearWorkflow = () => {
if (props.workflowLocked) return;
selectedWorkflowId.value = null;
emit('workflow-select', null);
};
@@ -8,7 +8,6 @@
<h3>{{ workflowDetail.flowName || '工作流表单' }}</h3>
<div class="workflow-form-sub">{{ workflowDetail.description || '请填写以下参数' }}</div>
</div>
<el-button size="small" @click="$emit('close-workflow')">返回对话</el-button>
</div>
<div class="workflow-form-scroll">
<el-form label-position="top" class="workflow-form">
@@ -201,10 +200,6 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {
activeHistoryId: null,
});
defineEmits<{
(e: 'close-workflow'): void;
}>();
const formValues = reactive<Record<string, any>>({});
const fieldFiles = reactive<Record<string, { name: string; url: string }[]>>({});
const uploadingFields = reactive<Record<string, boolean>>({});