mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
feat: 控件加入Header 参数控制
This commit is contained in:
parent
35664e7e3d
commit
3f3f54f3b7
@ -15,9 +15,14 @@ export const eventsCreate = (chartConfig: CreateComponentType, useChartEditStore
|
|||||||
if (fnOnEvevnt.length === 0) return
|
if (fnOnEvevnt.length === 0) return
|
||||||
fnOnEvevnt.forEach((item) => {
|
fnOnEvevnt.forEach((item) => {
|
||||||
const index = chartEditStore.fetchTargetIndex(item.components)
|
const index = chartEditStore.fetchTargetIndex(item.components)
|
||||||
const { Params } = toRefs(chartEditStore.componentList[index].request.requestParams)
|
const { Params, Header } = toRefs(chartEditStore.componentList[index].request.requestParams)
|
||||||
Object.keys(item.fn).forEach((key) => {
|
Object.keys(item.fn).forEach((key) => {
|
||||||
Params.value[key] = param[item.fn[key]]
|
if (Params.value[key]) {
|
||||||
|
Params.value[key] = param[item.fn[key]]
|
||||||
|
}
|
||||||
|
if (Header.value[key]) {
|
||||||
|
Header.value[key] = param[item.fn[key]]
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
@ -37,7 +37,16 @@
|
|||||||
<CollapseItem name="请求数据绑定" :expanded="false">
|
<CollapseItem name="请求数据绑定" :expanded="false">
|
||||||
<SettingItemBox name="Params">
|
<SettingItemBox name="Params">
|
||||||
<SettingItem
|
<SettingItem
|
||||||
v-for="(ovlValue, ovlKey, index) in fnGetRequest(item.components)"
|
v-for="(ovlValue, ovlKey, index) in fnGetRequest(item.components, 'Params')"
|
||||||
|
:key="ovlKey"
|
||||||
|
:name="`${ovlKey}`"
|
||||||
|
>
|
||||||
|
<n-select size="small" v-model:value="item.fn[ovlKey]" :options="fnDimensionsAndSource(item.on)"></n-select>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
<SettingItemBox name="Header">
|
||||||
|
<SettingItem
|
||||||
|
v-for="(ovlValue, ovlKey, index) in fnGetRequest(item.components, 'Header')"
|
||||||
:key="ovlKey"
|
:key="ovlKey"
|
||||||
:name="`${ovlKey}`"
|
:name="`${ovlKey}`"
|
||||||
>
|
>
|
||||||
@ -70,9 +79,9 @@ const option = computed(() => {
|
|||||||
return chartEditStore.componentList[chartEditStore.fetchTargetIndex()].option
|
return chartEditStore.componentList[chartEditStore.fetchTargetIndex()].option
|
||||||
})
|
})
|
||||||
// 绑定组件数据request
|
// 绑定组件数据request
|
||||||
const fnGetRequest = (id: string | undefined) => {
|
const fnGetRequest = (id: string | undefined, key: 'Params' | 'Header') => {
|
||||||
if (!id) return {}
|
if (!id) return {}
|
||||||
return chartEditStore.componentList[chartEditStore.fetchTargetIndex(id)]?.request.requestParams.Params
|
return chartEditStore.componentList[chartEditStore.fetchTargetIndex(id)]?.request.requestParams[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnDimensionsAndSource = (on: any) => {
|
const fnDimensionsAndSource = (on: any) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user