| | |
| | | import { SaveRoute } from '/@/api/tigerapi/mes/router'; |
| | | import { formSchema } from './route.data'; |
| | | import LogicFlow from '@logicflow/core'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | |
| | | const { t } = useI18n(); |
| | | const { createErrorModal } = useMessage(); |
| | | const isUpdate = ref(true); |
| | | const lfInstance = ref(null) as Ref<LogicFlow | null>; |
| | | const emit = defineEmits(['success']); |
| | |
| | | const values = await validate(); |
| | | setModalProps({ confirmLoading: true }); |
| | | // TODO custom api |
| | | values.ID = buildUUID(); |
| | | const apiAction = await SaveRoute(values); |
| | | if (apiAction.IsSuccessed) { |
| | | closeModal(); |
| | | emit('success', lfInstance, values); |
| | | } else { |
| | | createErrorModal({ |
| | | title: t('提示'), |
| | | content: t(apiAction.Message), |
| | | getContainer: () => document.body, |
| | | }); |
| | | } |
| | | } finally { |
| | | setModalProps({ confirmLoading: false }); |