|
@@ -14,16 +14,25 @@ import type { SetupProtocolForm, UseGuideStepItemExpose, UseGuideStepItemProps }
|
|
|
const props = defineProps<UseGuideStepItemProps<SetupProtocolForm>>();
|
|
|
|
|
|
const { handleRequest } = useRequest();
|
|
|
-const fileName = '';
|
|
|
|
|
|
const exportData = () => {
|
|
|
handleRequest(async () => {
|
|
|
- const { id } = props.form.protocolInfo;
|
|
|
- if (id) {
|
|
|
- const file = await downloadUserProtocol(id);
|
|
|
- downloadBlob(file, fileName);
|
|
|
- message.success(t('setupProtocol.downloadProtocolSuccessful', { name: fileName }));
|
|
|
+ await protocolContentRef.value?.validateProtocolInfo();
|
|
|
+ await protocolContentRef.value?.isAtLeastOneParam();
|
|
|
+
|
|
|
+ if (props.form.protocolInfo.id) {
|
|
|
+ await updateProtocolBaseInfo(props.form.protocolInfo);
|
|
|
+ } else {
|
|
|
+ props.form.protocolInfo.id = await addProtocolBaseInfo(props.form.protocolInfo);
|
|
|
+ await protocolContentRef.value?.submitLocalParams();
|
|
|
+ protocolContentRef.value?.getCurrentProtocolParams();
|
|
|
}
|
|
|
+
|
|
|
+ const { id, protocolType, protocolName } = props.form.protocolInfo;
|
|
|
+ const fileName = `${protocolType} - ${protocolName}.xlsx`;
|
|
|
+ const file = await downloadUserProtocol(id);
|
|
|
+ downloadBlob(file, fileName);
|
|
|
+ message.success(t('setupProtocol.downloadProtocolSuccessful', { name: fileName }));
|
|
|
});
|
|
|
};
|
|
|
|