...
|
...
|
@@ -2,10 +2,10 @@ |
2
|
2
|
import { getAllPublicInterface } from '@/api/external/dynamicRequest'
|
3
|
3
|
import { ParamsItemType, PublicInterfaceRecord, PublicInterfaceRequestParams, PublicInterfaceStateEnum } from '@/api/external/dynamicRequest/model';
|
4
|
4
|
import { SettingItem, SettingItemBox } from '@/components/Pages/ChartItemSetting';
|
5
|
|
-import { RequestContentTypeEnum, RequestContentTypeNameEnum } from '@/enums/external/httpEnum';
|
|
5
|
+import { RequestContentTypeEnum, RequestContentTypeNameEnum, RequestEnum } from '@/enums/external/httpEnum';
|
6
|
6
|
import { RequestBodyEnum, RequestHttpEnum, RequestHttpIntervalEnum, RequestParams, RequestParamsTypeEnum } from '@/enums/httpEnum';
|
7
|
|
-import { NCard, NEmpty, NInputGroup, NInputNumber, NScrollbar, NSelect, NTabPane, NTabs, SelectOption } from 'naive-ui';
|
8
|
|
-import { ref, computed, unref, nextTick } from 'vue'
|
|
7
|
+import { NCard, NEllipsis, NEmpty, NInputGroup, NInputNumber, NScrollbar, NSelect, NSpace, NTabPane, NTabs, SelectOption } from 'naive-ui';
|
|
8
|
+import { ref, computed, unref, nextTick, h } from 'vue'
|
9
|
9
|
import { selectTimeOptions, selectTypeOptions } from '../../../index.d';
|
10
|
10
|
import ParamsTable from '../RequestModal/ParamsTable.vue';
|
11
|
11
|
import BodyContent from './BodyContent.vue'
|
...
|
...
|
@@ -43,7 +43,14 @@ const getSelectedInterfaceParams = computed(() => { |
43
|
43
|
|
44
|
44
|
const getPublicInterfaceList = async () => {
|
45
|
45
|
if (unref(publicInterfaceList).length) return
|
46
|
|
- const result = await getAllPublicInterface({ state: PublicInterfaceStateEnum.PUBLISH })
|
|
46
|
+ /**
|
|
47
|
+ * ft 更换接口
|
|
48
|
+ * 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯
|
|
49
|
+ * 源代码 const result = await getAllPublicInterface({ state: PublicInterfaceStateEnum.PUBLISH })
|
|
50
|
+ * 修改后代码 const result = await getAllPublicInterface()
|
|
51
|
+ */
|
|
52
|
+ const result = await getAllPublicInterface()
|
|
53
|
+ //ft
|
47
|
54
|
publicInterfaceList.value = result
|
48
|
55
|
}
|
49
|
56
|
|
...
|
...
|
@@ -141,6 +148,30 @@ const setConfigurationData = async (request: ExtraRequestConfigType) => { |
141
|
148
|
setDynamicFormValue(request)
|
142
|
149
|
}
|
143
|
150
|
|
|
151
|
+ /**
|
|
152
|
+ * ft 修改在公共接口下拉框里加上接口类型
|
|
153
|
+ * 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯
|
|
154
|
+ * 源代码 属于新增代码,源代码无
|
|
155
|
+ * 修改后代码在//ft之间
|
|
156
|
+ */
|
|
157
|
+
|
|
158
|
+const getHttpType = (httpType:RequestEnum, contentType:number) => {
|
|
159
|
+ if(contentType===0){
|
|
160
|
+ if (httpType === RequestEnum[httpType]) return RequestEnum[httpType]
|
|
161
|
+ }
|
|
162
|
+ else if (contentType===2) return 'WebSocket'
|
|
163
|
+}
|
|
164
|
+
|
|
165
|
+const renderOption = (option: SelectOption) => {
|
|
166
|
+ const httpType = getHttpType(option?.requestHttpType as RequestEnum, option?.requestContentType as number)
|
|
167
|
+ const interfaceTypeName = option?.interfaceType === 'SYSTEM' ? '系统默认' :option?.interfaceType === 'CUSTOM'? '自定义':''
|
|
168
|
+ return h(NSpace, { justify: 'space-between', style: 'padding: 0 15px; height: 28px; line-height: 28px;' }, () => [
|
|
169
|
+ h(NEllipsis, null, () => `${!httpType?'':httpType+'/'}${interfaceTypeName}`),
|
|
170
|
+ h(NEllipsis, null, () => option.interfaceName),
|
|
171
|
+ ])
|
|
172
|
+}
|
|
173
|
+//ft
|
|
174
|
+
|
144
|
175
|
defineExpose({
|
145
|
176
|
getConfigurationData,
|
146
|
177
|
setConfigurationData,
|
...
|
...
|
@@ -154,10 +185,19 @@ defineExpose({ |
154
|
185
|
<SettingItemBox name="公共接口" :alone="true" :item-right-style="{ gridTemplateColumns: '5fr 2fr 1fr' }">
|
155
|
186
|
<SettingItem name="请求方式 & URL地址">
|
156
|
187
|
<NInputGroup>
|
|
188
|
+ <!--
|
|
189
|
+ /**
|
|
190
|
+ * ft 修改在公共接口下拉框里加上接口类型
|
|
191
|
+ * 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯
|
|
192
|
+ * 源代码 无
|
|
193
|
+ * 修改后代码 新增一句 :render-label="renderOption"
|
|
194
|
+ */
|
|
195
|
+ -->
|
157
|
196
|
<NSelect v-model:value="selectedPublicInterface" label-field="interfaceName" value-field="id"
|
158
|
197
|
:options="publicInterfaceList" :filter="handleFilter" filterable :reset-menu-on-options-change="false"
|
159
|
|
- @update-value="handleSelectedInterfaceChange" size="small">
|
|
198
|
+ @update-value="handleSelectedInterfaceChange" size="small" :render-label="renderOption">
|
160
|
199
|
</NSelect>
|
|
200
|
+ <!-- ft -->
|
161
|
201
|
<NSelect v-if="requestContentTypeRef !== RequestContentTypeEnum.WEB_SOCKET" v-model:value="requestHttpTypeRef"
|
162
|
202
|
style="width: 150px;" size="small" :options="(selectTypeOptions as SelectOption[])" :disabled="true" />
|
163
|
203
|
<NSelect v-if="requestContentTypeRef === RequestContentTypeEnum.WEB_SOCKET" :disabled="true" style="width: 150px;"
|
...
|
...
|
@@ -225,6 +265,7 @@ defineExpose({ |
225
|
265
|
</NScrollbar>
|
226
|
266
|
</NCard>
|
227
|
267
|
</SettingItemBox>
|
|
268
|
+ <!-- ft -->
|
228
|
269
|
</template>
|
229
|
270
|
|
230
|
271
|
<style scoped lang="scss">
|
...
|
...
|
|