...
|
...
|
@@ -5,24 +5,28 @@ import { CreateComponentType } from '@/packages/index.d'; |
5
|
5
|
import { CreateComponentGroupType } from '@/packages/index.d';
|
6
|
6
|
import { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d';
|
7
|
7
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore';
|
8
|
|
-import { GlobalComponentConfig, NButton, NDivider, NModal, NSpace, NTag } from 'naive-ui';
|
|
8
|
+import { NButton, NDivider, NModal, NSpace, NTag } from 'naive-ui';
|
9
|
9
|
import { ref, unref, computed, nextTick } from 'vue';
|
10
|
10
|
import { PublicInterfaceForm } from '../PublicInterfaceForm';
|
11
|
11
|
import ComponentConfiguration from './ComponentConfiguration.vue';
|
12
|
12
|
import GlobalPublicConfiguration from './GlobalPublicConfiguration.vue';
|
13
|
13
|
import { createRequestModalContext } from './useRequestModalContext';
|
14
|
14
|
|
|
15
|
+interface ComponentExpose {
|
|
16
|
+ getConfigurationData: () => RequestConfigType
|
|
17
|
+ setConfigurationData: (request: RequestConfigType) => void
|
|
18
|
+ validate: () => Promise<boolean>
|
|
19
|
+}
|
|
20
|
+
|
15
|
21
|
const requestDataType = ref<RequestDataTypeEnum>(RequestDataTypeEnum.AJAX)
|
16
|
22
|
|
17
|
23
|
const showModal = ref(false)
|
18
|
24
|
|
19
|
25
|
const chartEditStore = useChartEditStore()
|
20
|
26
|
|
21
|
|
-const globalConfigurationEl = ref<Nullable<InstanceType<typeof GlobalPublicConfiguration>>>()
|
|
27
|
+const componentConfigurationEl = ref<ComponentExpose>()
|
22
|
28
|
|
23
|
|
-const componentConfigurationEl = ref<Nullable<InstanceType<typeof ComponentConfiguration>>>()
|
24
|
|
-
|
25
|
|
-const publicInterfaceFormEl = ref<Nullable<InstanceType<typeof PublicInterfaceForm>>>()
|
|
29
|
+const publicInterfaceFormEl = ref<ComponentExpose>()
|
26
|
30
|
|
27
|
31
|
const getRequestTypeName = computed(() => {
|
28
|
32
|
return RequestDataTypeNameEnum[RequestDataTypeEnum[unref(requestDataType)] as keyof typeof RequestDataTypeEnum]
|
...
|
...
|
@@ -34,6 +38,7 @@ const openModal = async (flag = true, type: RequestDataTypeEnum) => { |
34
|
38
|
requestDataType.value = type
|
35
|
39
|
showModal.value = flag
|
36
|
40
|
await nextTick()
|
|
41
|
+
|
37
|
42
|
unref(componentConfigurationEl)?.setConfigurationData(unref(selectTarget)!.request || {})
|
38
|
43
|
unref(publicInterfaceFormEl)?.setConfigurationData(unref(selectTarget)!.request || {})
|
39
|
44
|
}
|
...
|
...
|
@@ -92,7 +97,7 @@ defineExpose({ |
92
|
97
|
|
93
|
98
|
<template>
|
94
|
99
|
<NModal :class="prefixCls" v-model:show="showModal" preset="card" style="width: 1000px;" title="请求配置">
|
95
|
|
- <GlobalPublicConfiguration v-if="requestDataType === RequestDataTypeEnum.AJAX" ref="globalConfigurationEl" />
|
|
100
|
+ <GlobalPublicConfiguration v-if="requestDataType === RequestDataTypeEnum.AJAX" />
|
96
|
101
|
<NDivider v-if="requestDataType === RequestDataTypeEnum.AJAX" />
|
97
|
102
|
<ComponentConfiguration v-if="requestDataType === RequestDataTypeEnum.AJAX" ref="componentConfigurationEl" />
|
98
|
103
|
<PublicInterfaceForm v-if="requestDataType === RequestDataTypeEnum.Pond" ref="publicInterfaceFormEl" />
|
...
|
...
|
|