feat: 组件交互对公共api支持配置页
This commit is contained in:
parent
cd1f8e259a
commit
71acbc6188
@ -58,7 +58,7 @@
|
|||||||
<help-outline-icon></help-outline-icon>
|
<help-outline-icon></help-outline-icon>
|
||||||
</n-icon>
|
</n-icon>
|
||||||
</template>
|
</template>
|
||||||
<n-text>不支持「静态组件」</n-text>
|
<n-text>不支持「静态组件」支持「组件」「公共APi」</n-text>
|
||||||
</n-tooltip>
|
</n-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<n-select
|
<n-select
|
||||||
@ -89,7 +89,7 @@
|
|||||||
</n-table>
|
</n-table>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
|
|
||||||
<n-tag :bordered="false" type="primary"> 关联目标组件请求参数 </n-tag>
|
<n-tag :bordered="false" type="primary"> 关联目标请求参数 </n-tag>
|
||||||
|
|
||||||
<setting-item-box
|
<setting-item-box
|
||||||
:name="requestParamsItem"
|
:name="requestParamsItem"
|
||||||
@ -125,7 +125,7 @@ import { VNodeChild, computed } from 'vue'
|
|||||||
import { SelectOption, SelectGroupOption } from 'naive-ui'
|
import { SelectOption, SelectGroupOption } from 'naive-ui'
|
||||||
import { SettingItemBox, SettingItem, CollapseItem } from '@/components/Pages/ChartItemSetting'
|
import { SettingItemBox, SettingItem, CollapseItem } from '@/components/Pages/ChartItemSetting'
|
||||||
import { CreateComponentType, CreateComponentGroupType, ChartFrameEnum } from '@/packages/index.d'
|
import { CreateComponentType, CreateComponentGroupType, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { RequestParamsTypeEnum } from '@/enums/httpEnum'
|
import { RequestParamsTypeEnum, RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||||
import { InteractEventOn, COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
|
import { InteractEventOn, COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
import noData from '@/assets/images/canvas/noData.png'
|
import noData from '@/assets/images/canvas/noData.png'
|
||||||
@ -154,6 +154,11 @@ const option = computed(() => {
|
|||||||
// 绑定组件数据 request
|
// 绑定组件数据 request
|
||||||
const fnGetRequest = (id: string | undefined, key: RequestParamsTypeEnum) => {
|
const fnGetRequest = (id: string | undefined, key: RequestParamsTypeEnum) => {
|
||||||
if (!id) return {}
|
if (!id) return {}
|
||||||
|
const globalConfigPindApr = chartEditStore.requestGlobalConfig.requestDataPond.find(item => {
|
||||||
|
return item.dataPondId === id
|
||||||
|
})?.dataPondRequestConfig.requestParams
|
||||||
|
|
||||||
|
if (globalConfigPindApr) return globalConfigPindApr[key]
|
||||||
return chartEditStore.componentList[chartEditStore.fetchTargetIndex(id)]?.request.requestParams[key]
|
return chartEditStore.componentList[chartEditStore.fetchTargetIndex(id)]?.request.requestParams[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,12 +183,10 @@ const fnEventsOptions = (): Array<SelectOption | SelectGroupOption> => {
|
|||||||
iter: Array<CreateComponentType | CreateComponentGroupType>,
|
iter: Array<CreateComponentType | CreateComponentGroupType>,
|
||||||
val: CreateComponentType | CreateComponentGroupType
|
val: CreateComponentType | CreateComponentGroupType
|
||||||
) => {
|
) => {
|
||||||
if (val.groupList && val.groupList.length > 0) {
|
if (!val.groupList && val.request.requestDataType === RequestDataTypeEnum.AJAX && val.request.requestUrl) {
|
||||||
iter.push(val)
|
|
||||||
} else {
|
|
||||||
iter.push(val)
|
iter.push(val)
|
||||||
}
|
}
|
||||||
return val.groupList ? [...iter, ...fnFlattern(val.groupList)] : iter
|
return val.groupList && val.groupList.length > 0 ? [...iter, ...fnFlattern(val.groupList)] : iter
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
@ -203,18 +206,26 @@ const fnEventsOptions = (): Array<SelectOption | SelectGroupOption> => {
|
|||||||
const mapOptionList = filterOptionList.map(item => ({
|
const mapOptionList = filterOptionList.map(item => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
title: item.chartConfig.title,
|
title: item.chartConfig.title,
|
||||||
disabled: false
|
disabled: false,
|
||||||
|
type: 'componentList'
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
const requestDataPond = chartEditStore.requestGlobalConfig.requestDataPond.map(item => ({
|
||||||
|
id: item.dataPondId,
|
||||||
|
title: item.dataPondName,
|
||||||
|
disabled: false,
|
||||||
|
type: 'requestDataPond'
|
||||||
|
}))
|
||||||
|
const tarArr = requestDataPond.concat(mapOptionList)
|
||||||
targetData.value.events.interactEvents?.forEach(iaItem => {
|
targetData.value.events.interactEvents?.forEach(iaItem => {
|
||||||
mapOptionList.forEach(optionItem => {
|
tarArr.forEach(optionItem => {
|
||||||
if (optionItem.id === iaItem.interactComponentId) {
|
if (optionItem.id === iaItem.interactComponentId) {
|
||||||
optionItem.disabled = true
|
optionItem.disabled = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return mapOptionList
|
return tarArr
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增模块
|
// 新增模块
|
||||||
|
Loading…
x
Reference in New Issue
Block a user