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,10 +2,10 @@ | ||
| 2 | import { getAllPublicInterface } from '@/api/external/dynamicRequest' | 2 | import { getAllPublicInterface } from '@/api/external/dynamicRequest' |
| 3 | import { ParamsItemType, PublicInterfaceRecord, PublicInterfaceRequestParams, PublicInterfaceStateEnum } from '@/api/external/dynamicRequest/model'; | 3 | import { ParamsItemType, PublicInterfaceRecord, PublicInterfaceRequestParams, PublicInterfaceStateEnum } from '@/api/external/dynamicRequest/model'; |
| 4 | import { SettingItem, SettingItemBox } from '@/components/Pages/ChartItemSetting'; | 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 | import { RequestBodyEnum, RequestHttpEnum, RequestHttpIntervalEnum, RequestParams, RequestParamsTypeEnum } from '@/enums/httpEnum'; | 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 | import { selectTimeOptions, selectTypeOptions } from '../../../index.d'; | 9 | import { selectTimeOptions, selectTypeOptions } from '../../../index.d'; |
| 10 | import ParamsTable from '../RequestModal/ParamsTable.vue'; | 10 | import ParamsTable from '../RequestModal/ParamsTable.vue'; |
| 11 | import BodyContent from './BodyContent.vue' | 11 | import BodyContent from './BodyContent.vue' |
| @@ -141,6 +141,29 @@ const setConfigurationData = async (request: ExtraRequestConfigType) => { | @@ -141,6 +141,29 @@ const setConfigurationData = async (request: ExtraRequestConfigType) => { | ||
| 141 | setDynamicFormValue(request) | 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 | defineExpose({ | 167 | defineExpose({ |
| 145 | getConfigurationData, | 168 | getConfigurationData, |
| 146 | setConfigurationData, | 169 | setConfigurationData, |
| @@ -154,10 +177,19 @@ defineExpose({ | @@ -154,10 +177,19 @@ defineExpose({ | ||
| 154 | <SettingItemBox name="公共接口" :alone="true" :item-right-style="{ gridTemplateColumns: '5fr 2fr 1fr' }"> | 177 | <SettingItemBox name="公共接口" :alone="true" :item-right-style="{ gridTemplateColumns: '5fr 2fr 1fr' }"> |
| 155 | <SettingItem name="请求方式 & URL地址"> | 178 | <SettingItem name="请求方式 & URL地址"> |
| 156 | <NInputGroup> | 179 | <NInputGroup> |
| 180 | + <!-- | ||
| 181 | + /** | ||
| 182 | + * ft 修改在公共接口下拉框里加上接口类型 | ||
| 183 | + * 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯 | ||
| 184 | + * 源代码 无 | ||
| 185 | + * 修改后代码 新增一句 :render-label="renderOption" | ||
| 186 | + */ | ||
| 187 | + --> | ||
| 157 | <NSelect v-model:value="selectedPublicInterface" label-field="interfaceName" value-field="id" | 188 | <NSelect v-model:value="selectedPublicInterface" label-field="interfaceName" value-field="id" |
| 158 | :options="publicInterfaceList" :filter="handleFilter" filterable :reset-menu-on-options-change="false" | 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 | </NSelect> | 191 | </NSelect> |
| 192 | + <!-- ft --> | ||
| 161 | <NSelect v-if="requestContentTypeRef !== RequestContentTypeEnum.WEB_SOCKET" v-model:value="requestHttpTypeRef" | 193 | <NSelect v-if="requestContentTypeRef !== RequestContentTypeEnum.WEB_SOCKET" v-model:value="requestHttpTypeRef" |
| 162 | style="width: 150px;" size="small" :options="(selectTypeOptions as SelectOption[])" :disabled="true" /> | 194 | style="width: 150px;" size="small" :options="(selectTypeOptions as SelectOption[])" :disabled="true" /> |
| 163 | <NSelect v-if="requestContentTypeRef === RequestContentTypeEnum.WEB_SOCKET" :disabled="true" style="width: 150px;" | 195 | <NSelect v-if="requestContentTypeRef === RequestContentTypeEnum.WEB_SOCKET" :disabled="true" style="width: 150px;" |
| @@ -225,6 +257,7 @@ defineExpose({ | @@ -225,6 +257,7 @@ defineExpose({ | ||
| 225 | </NScrollbar> | 257 | </NScrollbar> |
| 226 | </NCard> | 258 | </NCard> |
| 227 | </SettingItemBox> | 259 | </SettingItemBox> |
| 260 | + <!-- ft --> | ||
| 228 | </template> | 261 | </template> |
| 229 | 262 | ||
| 230 | <style scoped lang="scss"> | 263 | <style scoped lang="scss"> |