import { defineComponent, ref } from 'vue' import { useWorkflowStore } from '../../store/workflow' import { ApplyNodeData } from '../../types' import configStyles from './Config.module.css' export default defineComponent({ name: 'ApplyNodeConfig', props: { nodeId: { type: String, required: true, }, nodeData: { type: Object as () => ApplyNodeData, required: true, }, }, setup(props) { const workflowStore = useWorkflowStore() const applicationContent = ref(props.nodeData.applicationContent || '') const applyStatus = ref<'idle' | 'applying' | 'success' | 'error'>('idle') const errorMessage = ref('') // 更新节点标签 const updateNodeLabel = (value: string) => { workflowStore.updateNodeData(props.nodeId, { label: value }) } // 更新申请内容 const updateApplicationContent = (value: string) => { applicationContent.value = value } // 提交申请 const submitApplication = () => { if (!applicationContent.value.trim()) { errorMessage.value = '请输入申请内容' return } // 模拟申请过程 applyStatus.value = 'applying' errorMessage.value = '' setTimeout(() => { applyStatus.value = 'success' workflowStore.updateNodeData(props.nodeId, { applicationContent: applicationContent.value, }) }, 1000) } return () => (