Commit 30344f6901bd4285f7ef59e8db26621b1e8e58c3
1 parent
263e9ac3
perf(views/chart/ContentConfigurations/components/ChartData/external): 公共接口下拉框里新增接口类型
Showing
1 changed file
with
37 additions
and
4 deletions
... | ... | @@ -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' |
... | ... | @@ -141,6 +141,29 @@ const setConfigurationData = async (request: ExtraRequestConfigType) => { |
141 | 141 | setDynamicFormValue(request) |
142 | 142 | } |
143 | 143 | |
144 | + /** | |
145 | + * ft 修改在公共接口下拉框里加上接口类型 | |
146 | + * 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯 | |
147 | + * 源代码 属于新增代码,源代码无 | |
148 | + * 修改后代码在//ft之间 | |
149 | + */ | |
150 | + | |
151 | +const getHttpType = (httpType:RequestEnum, contentType:number) => { | |
152 | + if(contentType===0){ | |
153 | + if (httpType === RequestEnum[httpType]) return RequestEnum[httpType] | |
154 | + } | |
155 | + else if (contentType===2) return 'WebSocket' | |
156 | +} | |
157 | + | |
158 | +const renderOption = (option: SelectOption) => { | |
159 | + const httpType = getHttpType(option?.requestHttpType as RequestEnum, option?.requestContentType as number) | |
160 | + return h(NSpace, { justify: 'space-between', style: 'padding: 0 15px; height: 28px; line-height: 28px;' }, () => [ | |
161 | + h(NEllipsis, null, () => httpType), | |
162 | + h(NEllipsis, null, () => option.interfaceName), | |
163 | + ]) | |
164 | +} | |
165 | +//ft | |
166 | + | |
144 | 167 | defineExpose({ |
145 | 168 | getConfigurationData, |
146 | 169 | setConfigurationData, |
... | ... | @@ -154,10 +177,19 @@ defineExpose({ |
154 | 177 | <SettingItemBox name="公共接口" :alone="true" :item-right-style="{ gridTemplateColumns: '5fr 2fr 1fr' }"> |
155 | 178 | <SettingItem name="请求方式 & URL地址"> |
156 | 179 | <NInputGroup> |
180 | + <!-- | |
181 | + /** | |
182 | + * ft 修改在公共接口下拉框里加上接口类型 | |
183 | + * 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯 | |
184 | + * 源代码 无 | |
185 | + * 修改后代码 新增一句 :render-label="renderOption" | |
186 | + */ | |
187 | + --> | |
157 | 188 | <NSelect v-model:value="selectedPublicInterface" label-field="interfaceName" value-field="id" |
158 | 189 | :options="publicInterfaceList" :filter="handleFilter" filterable :reset-menu-on-options-change="false" |
159 | - @update-value="handleSelectedInterfaceChange" size="small"> | |
190 | + @update-value="handleSelectedInterfaceChange" size="small" :render-label="renderOption"> | |
160 | 191 | </NSelect> |
192 | + <!-- ft --> | |
161 | 193 | <NSelect v-if="requestContentTypeRef !== RequestContentTypeEnum.WEB_SOCKET" v-model:value="requestHttpTypeRef" |
162 | 194 | style="width: 150px;" size="small" :options="(selectTypeOptions as SelectOption[])" :disabled="true" /> |
163 | 195 | <NSelect v-if="requestContentTypeRef === RequestContentTypeEnum.WEB_SOCKET" :disabled="true" style="width: 150px;" |
... | ... | @@ -225,6 +257,7 @@ defineExpose({ |
225 | 257 | </NScrollbar> |
226 | 258 | </NCard> |
227 | 259 | </SettingItemBox> |
260 | + <!-- ft --> | |
228 | 261 | </template> |
229 | 262 | |
230 | 263 | <style scoped lang="scss"> | ... | ... |