Commit 88a8638770bff172245b886048d0edf6997bba0c
Merge branch 'perf/third-interface-05-23' into 'main_dev'
perf(src/views): 优化第三方接口 See merge request yunteng/thingskit-view!265
Showing
8 changed files
with
52 additions
and
69 deletions
| @@ -159,4 +159,7 @@ export const getAlarmList = (params?: object) => | @@ -159,4 +159,7 @@ export const getAlarmList = (params?: object) => | ||
| 159 | defHttp.get({ | 159 | defHttp.get({ |
| 160 | url: Api.ALARM_LIST, | 160 | url: Api.ALARM_LIST, |
| 161 | params | 161 | params |
| 162 | + }, | ||
| 163 | + { | ||
| 164 | + withShareToken: true | ||
| 162 | }) | 165 | }) |
| @@ -4,6 +4,7 @@ import { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore | @@ -4,6 +4,7 @@ import { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore | ||
| 4 | import { isShareMode } from '@/views/share/hook' | 4 | import { isShareMode } from '@/views/share/hook' |
| 5 | import { customHttp } from './http' | 5 | import { customHttp } from './http' |
| 6 | import { SelectTimeAggregationFieldEnum } from '@/views/chart/ContentConfigurations/components/ChartData/external/components/SelectTImeAggregation' | 6 | import { SelectTimeAggregationFieldEnum } from '@/views/chart/ContentConfigurations/components/ChartData/external/components/SelectTImeAggregation' |
| 7 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | ||
| 7 | 8 | ||
| 8 | export enum ParamsType { | 9 | export enum ParamsType { |
| 9 | REQUIRED, | 10 | REQUIRED, |
| @@ -146,8 +147,11 @@ export const customRequest = async (request: RequestConfigType) => { | @@ -146,8 +147,11 @@ export const customRequest = async (request: RequestConfigType) => { | ||
| 146 | pondRequestOriginUrl, | 147 | pondRequestOriginUrl, |
| 147 | pondRequestGlobalTokenKey, | 148 | pondRequestGlobalTokenKey, |
| 148 | pondRequestGlobalTokenSuffix, | 149 | pondRequestGlobalTokenSuffix, |
| 149 | - | ||
| 150 | } = request as ExtraRequestConfigType | 150 | } = request as ExtraRequestConfigType |
| 151 | + const chartEditStore = useChartEditStore() | ||
| 152 | + | ||
| 153 | + const {requestOriginUrl: globalRequestOriginUrl} = chartEditStore.getRequestGlobalConfig | ||
| 154 | + | ||
| 151 | let { requestUrl } = request as ExtraRequestConfigType | 155 | let { requestUrl } = request as ExtraRequestConfigType |
| 152 | const { Header, Body } = requestParams | 156 | const { Header, Body } = requestParams |
| 153 | let { Params } = requestParams | 157 | let { Params } = requestParams |
| @@ -171,7 +175,7 @@ export const customRequest = async (request: RequestConfigType) => { | @@ -171,7 +175,7 @@ export const customRequest = async (request: RequestConfigType) => { | ||
| 171 | { | 175 | { |
| 172 | url: | 176 | url: |
| 173 | requestHttpType === RequestHttpEnum.GET.toUpperCase() ? requestUrl : `${requestUrl}?${objConvertQuery(Params)}`, | 177 | requestHttpType === RequestHttpEnum.GET.toUpperCase() ? requestUrl : `${requestUrl}?${objConvertQuery(Params)}`, |
| 174 | - baseURL: requestVerificationToken ? pondRequestOriginUrl : getOriginUrl(requestOriginUrl!), | 178 | + baseURL: requestVerificationToken ? pondRequestOriginUrl : globalRequestOriginUrl ? globalRequestOriginUrl : getOriginUrl(requestOriginUrl!), |
| 175 | method: requestHttpType, | 179 | method: requestHttpType, |
| 176 | params: requestHttpType === RequestHttpEnum.GET.toUpperCase() ? Params : null, | 180 | params: requestHttpType === RequestHttpEnum.GET.toUpperCase() ? Params : null, |
| 177 | data: body, | 181 | data: body, |
| @@ -180,7 +184,8 @@ export const customRequest = async (request: RequestConfigType) => { | @@ -180,7 +184,8 @@ export const customRequest = async (request: RequestConfigType) => { | ||
| 180 | { | 184 | { |
| 181 | joinPrefix: false, | 185 | joinPrefix: false, |
| 182 | apiUrl: '', | 186 | apiUrl: '', |
| 183 | - withShareToken: isShareMode(), | 187 | + withToken:true, |
| 188 | + withShareToken: !requestVerificationToken ? isShareMode(): false, | ||
| 184 | withThirdTokenString: requestVerificationToken, | 189 | withThirdTokenString: requestVerificationToken, |
| 185 | withThirdTokenKey: pondRequestGlobalTokenKey, | 190 | withThirdTokenKey: pondRequestGlobalTokenKey, |
| 186 | withThirdTokenPrefix: pondRequestGlobalTokenSuffix | 191 | withThirdTokenPrefix: pondRequestGlobalTokenSuffix |
| @@ -236,11 +236,10 @@ export interface RequestConfigType extends RequestPublicConfigType { | @@ -236,11 +236,10 @@ export interface RequestConfigType extends RequestPublicConfigType { | ||
| 236 | pondRequestGlobalTokenKey?: string | 236 | pondRequestGlobalTokenKey?: string |
| 237 | pondRequestGlobalCascaderOption?: Recordable | 237 | pondRequestGlobalCascaderOption?: Recordable |
| 238 | pondRequestGlobalCascaderKey?: string | 238 | pondRequestGlobalCascaderKey?: string |
| 239 | - pondRequestHttpType?: string | 239 | + pondRequestHttpType?: RequestHttpEnum |
| 240 | pondRequestInterval?: number | 240 | pondRequestInterval?: number |
| 241 | pondRequestIntervalUnit?: string | 241 | pondRequestIntervalUnit?: string |
| 242 | pondRequestContentType?: number | 242 | pondRequestContentType?: number |
| 243 | - pondRequestHttpType?: string | ||
| 244 | pondRequestParams?: RequestParams | 243 | pondRequestParams?: RequestParams |
| 245 | pondRequestParamsBodyType?: RequestBodyEnum | 244 | pondRequestParamsBodyType?: RequestBodyEnum |
| 246 | pondRequestUrl?: string | 245 | pondRequestUrl?: string |
| @@ -250,6 +249,7 @@ export interface RequestConfigType extends RequestPublicConfigType { | @@ -250,6 +249,7 @@ export interface RequestConfigType extends RequestPublicConfigType { | ||
| 250 | thirdTokenIsExp?: boolean | 249 | thirdTokenIsExp?: boolean |
| 251 | thirdSelectCascaderLabel?: string | 250 | thirdSelectCascaderLabel?: string |
| 252 | publicInterfaceSelectId?: string | 251 | publicInterfaceSelectId?: string |
| 252 | + thirdRequestDataPondId?: string | ||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | // Store 类型 | 255 | // Store 类型 |
| @@ -52,58 +52,58 @@ | @@ -52,58 +52,58 @@ | ||
| 52 | <setting-item name="配置类型"> | 52 | <setting-item name="配置类型"> |
| 53 | <n-input | 53 | <n-input |
| 54 | size="small" | 54 | size="small" |
| 55 | - :placeholder="targetData && requestContentTypeObj[requestContentType]" | 55 | + :placeholder="targetData && requestContentTypeObj[pondRequestContentType!]" |
| 56 | :disabled="true" | 56 | :disabled="true" |
| 57 | ></n-input> | 57 | ></n-input> |
| 58 | </setting-item> | 58 | </setting-item> |
| 59 | - <setting-item name="body 类型" v-if="requestContentType === RequestContentTypeEnum.DEFAULT"> | 59 | + <setting-item name="body 类型" v-if="pondRequestContentType === RequestContentTypeEnum.DEFAULT"> |
| 60 | <n-input size="small" :placeholder="targetData && requestParamsBodyType" :disabled="true"></n-input> | 60 | <n-input size="small" :placeholder="targetData && requestParamsBodyType" :disabled="true"></n-input> |
| 61 | </setting-item> | 61 | </setting-item> |
| 62 | </setting-item-box> | 62 | </setting-item-box> |
| 63 | - <div v-if="requestContentType === RequestContentTypeEnum.DEFAULT"> | 63 | + <div v-if="pondRequestContentType === RequestContentTypeEnum.DEFAULT"> |
| 64 | <n-tabs type="line" animated v-model:value="tabValue"> | 64 | <n-tabs type="line" animated v-model:value="tabValue"> |
| 65 | <n-tab v-for="item in RequestParamsTypeEnum" :key="item" :name="item" :tab="item"> {{ item }} </n-tab> | 65 | <n-tab v-for="item in RequestParamsTypeEnum" :key="item" :name="item" :tab="item"> {{ item }} </n-tab> |
| 66 | </n-tabs> | 66 | </n-tabs> |
| 67 | <!-- 各个页面 --> | 67 | <!-- 各个页面 --> |
| 68 | <div class="go-mt-3"> | 68 | <div class="go-mt-3"> |
| 69 | <div v-if="tabValue !== RequestParamsTypeEnum.BODY"> | 69 | <div v-if="tabValue !== RequestParamsTypeEnum.BODY"> |
| 70 | - <display-table class="go-my-3" :target="requestParams[tabValue]"> </display-table> | 70 | + <display-table class="go-my-3" :target="pondRequestParams![tabValue]"> </display-table> |
| 71 | </div> | 71 | </div> |
| 72 | 72 | ||
| 73 | <!-- 选择了 body --> | 73 | <!-- 选择了 body --> |
| 74 | <div v-else> | 74 | <div v-else> |
| 75 | <!-- 为 none 时 --> | 75 | <!-- 为 none 时 --> |
| 76 | - <n-card class="go-mt-3 go-pb-3" v-if="requestParamsBodyType === RequestBodyEnum['NONE']"> | 76 | + <n-card class="go-mt-3 go-pb-3" v-if="pondRequestParamsBodyType === RequestBodyEnum['NONE']"> |
| 77 | <n-text depth="3">该接口没有 Body 体</n-text> | 77 | <n-text depth="3">该接口没有 Body 体</n-text> |
| 78 | </n-card> | 78 | </n-card> |
| 79 | 79 | ||
| 80 | <!-- 具有对象属性时 --> | 80 | <!-- 具有对象属性时 --> |
| 81 | <template | 81 | <template |
| 82 | v-else-if=" | 82 | v-else-if=" |
| 83 | - requestParamsBodyType === RequestBodyEnum['FORM_DATA'] || | ||
| 84 | - requestParamsBodyType === RequestBodyEnum['X_WWW_FORM_URLENCODED'] | 83 | + pondRequestParamsBodyType === RequestBodyEnum['FORM_DATA'] || |
| 84 | + pondRequestParamsBodyType === RequestBodyEnum['X_WWW_FORM_URLENCODED'] | ||
| 85 | " | 85 | " |
| 86 | > | 86 | > |
| 87 | <display-table | 87 | <display-table |
| 88 | class="go-my-3" | 88 | class="go-my-3" |
| 89 | - :target="requestParams[RequestParamsTypeEnum.BODY][requestParamsBodyType]" | 89 | + :target="pondRequestParams![RequestParamsTypeEnum.BODY][pondRequestParamsBodyType]" |
| 90 | ></display-table> | 90 | ></display-table> |
| 91 | </template> | 91 | </template> |
| 92 | 92 | ||
| 93 | <!-- json --> | 93 | <!-- json --> |
| 94 | - <template v-else-if="requestParamsBodyType === RequestBodyEnum['JSON']"> | 94 | + <template v-else-if="pondRequestParamsBodyType === RequestBodyEnum['JSON']"> |
| 95 | <n-card size="small" style="padding-bottom: 7px"> | 95 | <n-card size="small" style="padding-bottom: 7px"> |
| 96 | <n-code | 96 | <n-code |
| 97 | - :code="requestParams[RequestParamsTypeEnum.BODY][requestParamsBodyType] || '暂无内容'" | 97 | + :code="pondRequestParams![RequestParamsTypeEnum.BODY][pondRequestParamsBodyType] || '暂无内容'" |
| 98 | language="json" | 98 | language="json" |
| 99 | ></n-code> | 99 | ></n-code> |
| 100 | </n-card> | 100 | </n-card> |
| 101 | </template> | 101 | </template> |
| 102 | 102 | ||
| 103 | <!-- xml --> | 103 | <!-- xml --> |
| 104 | - <template v-else-if="requestParamsBodyType === RequestBodyEnum['XML']"> | 104 | + <template v-else-if="pondRequestParamsBodyType === RequestBodyEnum['XML']"> |
| 105 | <n-code | 105 | <n-code |
| 106 | - :code="requestParams[RequestParamsTypeEnum.BODY][requestParamsBodyType] || ''" | 106 | + :code="pondRequestParams![RequestParamsTypeEnum.BODY][pondRequestParamsBodyType!] || ''" |
| 107 | language="html" | 107 | language="html" |
| 108 | ></n-code> | 108 | ></n-code> |
| 109 | </template> | 109 | </template> |
| @@ -127,7 +127,6 @@ | @@ -127,7 +127,6 @@ | ||
| 127 | <script setup lang="ts"> | 127 | <script setup lang="ts"> |
| 128 | import { PropType, ref, toRefs } from 'vue' | 128 | import { PropType, ref, toRefs } from 'vue' |
| 129 | import { icon } from '@/plugins' | 129 | import { icon } from '@/plugins' |
| 130 | -import { MonacoEditor } from '@/components/Pages/MonacoEditor' | ||
| 131 | import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' | 130 | import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' |
| 132 | import { RequestDataPondItemType, RequestGlobalConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' | 131 | import { RequestDataPondItemType, RequestGlobalConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' |
| 133 | import displayTable from './displayTable.vue' | 132 | import displayTable from './displayTable.vue' |
| @@ -136,8 +135,6 @@ import { | @@ -136,8 +135,6 @@ import { | ||
| 136 | RequestParamsTypeEnum, | 135 | RequestParamsTypeEnum, |
| 137 | SelectHttpTimeNameObj, | 136 | SelectHttpTimeNameObj, |
| 138 | RequestContentTypeEnum, | 137 | RequestContentTypeEnum, |
| 139 | - RequestBodyEnumList, | ||
| 140 | - RequestParamsObjType | ||
| 141 | } from '@/enums/httpEnum' | 138 | } from '@/enums/httpEnum' |
| 142 | 139 | ||
| 143 | const props = defineProps({ | 140 | const props = defineProps({ |
| @@ -145,45 +142,28 @@ const props = defineProps({ | @@ -145,45 +142,28 @@ const props = defineProps({ | ||
| 145 | targetData: Object as PropType<RequestDataPondItemType> | 142 | targetData: Object as PropType<RequestDataPondItemType> |
| 146 | }) | 143 | }) |
| 147 | 144 | ||
| 148 | -const { HelpOutlineIcon, FlashIcon, PulseIcon } = icon.ionicons5 | 145 | +const { FlashIcon, PulseIcon } = icon.ionicons5 |
| 146 | + | ||
| 149 | const { | 147 | const { |
| 150 | - requestUrl, | ||
| 151 | requestInterval, | 148 | requestInterval, |
| 152 | - requestHttpType, | ||
| 153 | - requestContentType, | ||
| 154 | requestSQLContent, | 149 | requestSQLContent, |
| 155 | - requestParams, | ||
| 156 | requestParamsBodyType, | 150 | requestParamsBodyType, |
| 157 | requestIntervalUnit, | 151 | requestIntervalUnit, |
| 158 | pondRequestOriginUrl, | 152 | pondRequestOriginUrl, |
| 159 | pondRequestUrl, | 153 | pondRequestUrl, |
| 160 | - pondRequestHttpType | 154 | + pondRequestHttpType, |
| 155 | + pondRequestContentType, | ||
| 156 | + pondRequestParamsBodyType, | ||
| 157 | + pondRequestParams, | ||
| 161 | } = toRefs((props.targetData as RequestDataPondItemType).dataPondRequestConfig) | 158 | } = toRefs((props.targetData as RequestDataPondItemType).dataPondRequestConfig) |
| 162 | -const tabs = [RequestParamsTypeEnum.HEADER] | 159 | + |
| 163 | const requestContentTypeObj = { | 160 | const requestContentTypeObj = { |
| 164 | [RequestContentTypeEnum.DEFAULT]: '普通请求', | 161 | [RequestContentTypeEnum.DEFAULT]: '普通请求', |
| 165 | [RequestContentTypeEnum.SQL]: 'SQL 请求' | 162 | [RequestContentTypeEnum.SQL]: 'SQL 请求' |
| 166 | -} | ||
| 167 | -const tabValue = ref<RequestParamsTypeEnum>(RequestParamsTypeEnum.PARAMS) | 163 | +} as Recordable |
| 168 | 164 | ||
| 169 | -// 更新参数表格数据 | ||
| 170 | -const updateRequestParams = (paramsObj: RequestParamsObjType) => { | ||
| 171 | - if (tabValue.value !== RequestParamsTypeEnum.BODY) { | ||
| 172 | - requestParams.value[tabValue.value] = paramsObj | ||
| 173 | - } | ||
| 174 | -} | 165 | +const tabValue = ref<RequestParamsTypeEnum>(RequestParamsTypeEnum.PARAMS) |
| 175 | 166 | ||
| 176 | -// 更新参数表格数据 | ||
| 177 | -const updateRequestBodyTable = (paramsObj: RequestParamsObjType) => { | ||
| 178 | - if ( | ||
| 179 | - tabValue.value === RequestParamsTypeEnum.BODY && | ||
| 180 | - // 仅有两种类型有 body | ||
| 181 | - (requestParamsBodyType.value === RequestBodyEnum.FORM_DATA || | ||
| 182 | - requestParamsBodyType.value === RequestBodyEnum.X_WWW_FORM_URLENCODED) | ||
| 183 | - ) { | ||
| 184 | - requestParams.value[RequestParamsTypeEnum.BODY][requestParamsBodyType.value] = paramsObj | ||
| 185 | - } | ||
| 186 | -} | ||
| 187 | </script> | 167 | </script> |
| 188 | 168 | ||
| 189 | <style lang="scss" scoped> | 169 | <style lang="scss" scoped> |
| 1 | <template> | 1 | <template> |
| 2 | - <n-modal class="go-chart-data-pond-control" v-model:show="modelShowRef" :mask-closable="false"> | 2 | + <n-modal class="go-chart-data-pond-control" v-model:show="modelShow" :mask-closable="false"> |
| 3 | <n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 900px; height: 650px"> | 3 | <n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 900px; height: 650px"> |
| 4 | <template #header></template> | 4 | <template #header></template> |
| 5 | <template #header-extra> </template> | 5 | <template #header-extra> </template> |
| @@ -57,7 +57,7 @@ import { icon } from '@/plugins' | @@ -57,7 +57,7 @@ import { icon } from '@/plugins' | ||
| 57 | import { getUUID, goDialog } from '@/utils' | 57 | import { getUUID, goDialog } from '@/utils' |
| 58 | import { cloneDeep } from 'lodash' | 58 | import { cloneDeep } from 'lodash' |
| 59 | 59 | ||
| 60 | -const props = defineProps({ | 60 | +defineProps({ |
| 61 | modelShow: Boolean | 61 | modelShow: Boolean |
| 62 | }) | 62 | }) |
| 63 | 63 | ||
| @@ -71,8 +71,6 @@ const { requestDataPond } = toRefs(chartEditStore.getRequestGlobalConfig) | @@ -71,8 +71,6 @@ const { requestDataPond } = toRefs(chartEditStore.getRequestGlobalConfig) | ||
| 71 | 71 | ||
| 72 | const requestShow = ref(false) | 72 | const requestShow = ref(false) |
| 73 | 73 | ||
| 74 | -const modelShowRef = ref(false) | ||
| 75 | - | ||
| 76 | const loading = ref(false) | 74 | const loading = ref(false) |
| 77 | 75 | ||
| 78 | const isEdit = ref(false) | 76 | const isEdit = ref(false) |
| @@ -89,14 +87,6 @@ const pondData = computed(() => { | @@ -89,14 +87,6 @@ const pondData = computed(() => { | ||
| 89 | return data[0] | 87 | return data[0] |
| 90 | }) | 88 | }) |
| 91 | 89 | ||
| 92 | -watch(() => props.modelShow, (newValue) => { | ||
| 93 | - if (newValue) { | ||
| 94 | - modelShowRef.value = true | ||
| 95 | - } else { | ||
| 96 | - modelShowRef.value = false | ||
| 97 | - } | ||
| 98 | -}) | ||
| 99 | - | ||
| 100 | const cacheEditData = ref<RequestDataPondItemType>() | 90 | const cacheEditData = ref<RequestDataPondItemType>() |
| 101 | 91 | ||
| 102 | watch( | 92 | watch( |
| @@ -258,10 +248,10 @@ const deletePond = (targetData: RequestDataPondItemType) => { | @@ -258,10 +248,10 @@ const deletePond = (targetData: RequestDataPondItemType) => { | ||
| 258 | const closeHandle = () => { | 248 | const closeHandle = () => { |
| 259 | // 将所选内容赋值给对象 | 249 | // 将所选内容赋值给对象 |
| 260 | if (pondData.value) { | 250 | if (pondData.value) { |
| 261 | - targetData.value.request = { | ||
| 262 | - ...toRaw(pondData.value.dataPondRequestConfig), | ||
| 263 | - requestDataPondId: pondData.value.dataPondId | ||
| 264 | - } | 251 | + // targetData.value.request = { |
| 252 | + // ...toRaw(pondData.value.dataPondRequestConfig), | ||
| 253 | + // requestDataPondId: pondData.value.dataPondId | ||
| 254 | + // } | ||
| 265 | } | 255 | } |
| 266 | emit('update:modelShow', false) | 256 | emit('update:modelShow', false) |
| 267 | } | 257 | } |
| @@ -18,7 +18,7 @@ import { | @@ -18,7 +18,7 @@ import { | ||
| 18 | CascaderOption, | 18 | CascaderOption, |
| 19 | NCascader, | 19 | NCascader, |
| 20 | } from 'naive-ui' | 20 | } from 'naive-ui' |
| 21 | -import { computed, onMounted, reactive, ref, unref } from 'vue' | 21 | +import { computed, onMounted, reactive, ref, unref, watch } from 'vue' |
| 22 | import GlobalParamsConfiguration from './GlobalParamsConfiguration.vue' | 22 | import GlobalParamsConfiguration from './GlobalParamsConfiguration.vue' |
| 23 | import { ChevronDown, ChevronUp } from '@vicons/carbon' | 23 | import { ChevronDown, ChevronUp } from '@vicons/carbon' |
| 24 | import { useDesignStore } from '@/store/modules/designStore/designStore' | 24 | import { useDesignStore } from '@/store/modules/designStore/designStore' |
| @@ -109,7 +109,7 @@ const handleSelectGlobalPond = (_:string, options:RequestDataPondItemType & {lab | @@ -109,7 +109,7 @@ const handleSelectGlobalPond = (_:string, options:RequestDataPondItemType & {lab | ||
| 109 | targetData.value.request.requestDataPondId = options.dataPondId | 109 | targetData.value.request.requestDataPondId = options.dataPondId |
| 110 | getTokenString.value ='' | 110 | getTokenString.value ='' |
| 111 | resOptions.value = [] | 111 | resOptions.value = [] |
| 112 | - resValue.value=null | 112 | + resValue.value = null |
| 113 | handleExecuteRequest() | 113 | handleExecuteRequest() |
| 114 | } | 114 | } |
| 115 | 115 | ||
| @@ -126,6 +126,7 @@ const handleExecuteRequest = async () => { | @@ -126,6 +126,7 @@ const handleExecuteRequest = async () => { | ||
| 126 | } | 126 | } |
| 127 | const res = await customThirdInterfaceRequest(request as unknown as thirdInterfaceRequest) | 127 | const res = await customThirdInterfaceRequest(request as unknown as thirdInterfaceRequest) |
| 128 | resOptions.value = convertToCascadingData(res) as unknown as CascaderOption[] | 128 | resOptions.value = convertToCascadingData(res) as unknown as CascaderOption[] |
| 129 | + resValue.value = targetData.value?.request?.thirdSelectCascaderLabel | ||
| 129 | } | 130 | } |
| 130 | } catch (e) { | 131 | } catch (e) { |
| 131 | getTokenString.value = JSON.stringify(e) as string | 132 | getTokenString.value = JSON.stringify(e) as string |
| @@ -173,11 +173,11 @@ const props = withDefaults( | @@ -173,11 +173,11 @@ const props = withDefaults( | ||
| 173 | 173 | ||
| 174 | const emit = defineEmits(['update:value']) | 174 | const emit = defineEmits(['update:value']) |
| 175 | 175 | ||
| 176 | -const createNewRow = () => { | ||
| 177 | - return { id: getUUID(), result: true } as DataSource | 176 | +const createNewRow = (index?: number) => { |
| 177 | + return { id: getUUID(), result: true, indexName: index, typeName: DataTypeEnum.DATA_INPUT } as DataSource | ||
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | -const dataSource = ref<DataSource[]>([createNewRow()]) | 180 | +const dataSource = ref<DataSource[]>([createNewRow(0)]) |
| 181 | 181 | ||
| 182 | const blurFlag = ref(false) | 182 | const blurFlag = ref(false) |
| 183 | 183 | ||
| @@ -187,7 +187,7 @@ watch( | @@ -187,7 +187,7 @@ watch( | ||
| 187 | if (target && isObject(target) && Object.keys(target).length) { | 187 | if (target && isObject(target) && Object.keys(target).length) { |
| 188 | if (blurFlag.value) return | 188 | if (blurFlag.value) return |
| 189 | dataSource.value = Object.keys(props.value || {}).map((keyName, keyIndex) => ({ | 189 | dataSource.value = Object.keys(props.value || {}).map((keyName, keyIndex) => ({ |
| 190 | - ...createNewRow(), | 190 | + ...createNewRow(keyIndex), |
| 191 | keyName, | 191 | keyName, |
| 192 | indexName: keyIndex, | 192 | indexName: keyIndex, |
| 193 | typeName: isArray(props.value![keyName]) ? DataTypeEnum.DATA_RANGE : DataTypeEnum.DATA_INPUT, | 193 | typeName: isArray(props.value![keyName]) ? DataTypeEnum.DATA_RANGE : DataTypeEnum.DATA_INPUT, |
| @@ -207,12 +207,15 @@ const canAddRow = computed(() => { | @@ -207,12 +207,15 @@ const canAddRow = computed(() => { | ||
| 207 | 207 | ||
| 208 | const handleAddRow = (record: DataSource) => { | 208 | const handleAddRow = (record: DataSource) => { |
| 209 | const index = unref(dataSource).findIndex(item => item.id === record.id) | 209 | const index = unref(dataSource).findIndex(item => item.id === record.id) |
| 210 | - unref(dataSource).splice(index + 1, 0, createNewRow()) | 210 | + unref(dataSource).splice(index + 1, 0, createNewRow(index + 1)) |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | const handleSubtractRow = (record: DataSource) => { | 213 | const handleSubtractRow = (record: DataSource) => { |
| 214 | const index = unref(dataSource).findIndex(item => item.id === record.id) | 214 | const index = unref(dataSource).findIndex(item => item.id === record.id) |
| 215 | if (unref(dataSource).length === 1) { | 215 | if (unref(dataSource).length === 1) { |
| 216 | + unref(dataSource)[0].keyName = '' | ||
| 217 | + unref(dataSource)[0].value = '' | ||
| 218 | + unref(dataSource)[0].dateRange = [] | ||
| 216 | emit('update:value', {}) | 219 | emit('update:value', {}) |
| 217 | } else { | 220 | } else { |
| 218 | unref(dataSource).splice(index, 1) | 221 | unref(dataSource).splice(index, 1) |
| @@ -115,6 +115,7 @@ const onEsc = () => { | @@ -115,6 +115,7 @@ const onEsc = () => { | ||
| 115 | 115 | ||
| 116 | onMounted(()=>{ | 116 | onMounted(()=>{ |
| 117 | pondPublicConfigurationRef?.value?.setConfigurationData(targetData.value.request) | 117 | pondPublicConfigurationRef?.value?.setConfigurationData(targetData.value.request) |
| 118 | + pondRequestConfigurationRef?.value?.setConfigurationData(targetData.value.request) | ||
| 118 | }) | 119 | }) |
| 119 | </script> | 120 | </script> |
| 120 | 121 |