|
@@ -61,6 +61,16 @@
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <template v-else-if="currentType === 'parentKey'">
|
|
|
|
|
+
|
|
|
|
|
+ <a-form-item label="读取键">
|
|
|
|
|
+ <a-input
|
|
|
|
|
+ :value="(modelValue as IHomeCommonCategoryDynamicDataParentKey)?.key"
|
|
|
|
|
+ @change="(e: Event) => setParentKey((e.target as HTMLInputElement)?.value)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
<template v-else-if="currentType === 'serializedApi'">
|
|
<template v-else-if="currentType === 'serializedApi'">
|
|
|
<a-form-item label="序列化接口名称 (name)">
|
|
<a-form-item label="序列化接口名称 (name)">
|
|
|
<a-select
|
|
<a-select
|
|
@@ -131,6 +141,7 @@ import type {
|
|
|
IHomeCommonCategoryDynamicDataSerializedApi,
|
|
IHomeCommonCategoryDynamicDataSerializedApi,
|
|
|
IHomeCommonCategoryDynamicDataRequest,
|
|
IHomeCommonCategoryDynamicDataRequest,
|
|
|
IHomeCommonCategoryDynamicDataDetailContent,
|
|
IHomeCommonCategoryDynamicDataDetailContent,
|
|
|
|
|
+ IHomeCommonCategoryDynamicDataParentKey,
|
|
|
} from '@/pages/article/data/CommonCategoryDynamicData';
|
|
} from '@/pages/article/data/CommonCategoryDynamicData';
|
|
|
import { SerializedApiMap } from '@/pages/article/data/CommonCategoryDynamicData';
|
|
import { SerializedApiMap } from '@/pages/article/data/CommonCategoryDynamicData';
|
|
|
import KeyValueEditor from './KeyValueEditor.vue';
|
|
import KeyValueEditor from './KeyValueEditor.vue';
|
|
@@ -147,6 +158,7 @@ const typeOptions = [
|
|
|
{ value: 'commonContent', label: '通用内容 (commonContent)' },
|
|
{ value: 'commonContent', label: '通用内容 (commonContent)' },
|
|
|
{ value: 'detailContent', label: '详情内容 (detailContent)' },
|
|
{ value: 'detailContent', label: '详情内容 (detailContent)' },
|
|
|
{ value: 'serializedApi', label: '序列化接口 (serializedApi)' },
|
|
{ value: 'serializedApi', label: '序列化接口 (serializedApi)' },
|
|
|
|
|
+ { value: 'parentKey', label: '从父键读 (parentKey)' },
|
|
|
{ value: 'request', label: '请求 (request)' },
|
|
{ value: 'request', label: '请求 (request)' },
|
|
|
];
|
|
];
|
|
|
|
|
|
|
@@ -217,6 +229,11 @@ function onTypeChange(type: 'commonContent' | 'serializedApi' | 'request') {
|
|
|
params: { id: 0, modelId: 0 },
|
|
params: { id: 0, modelId: 0 },
|
|
|
otherParams: {},
|
|
otherParams: {},
|
|
|
});
|
|
});
|
|
|
|
|
+ } else if (type === 'parentKey') {
|
|
|
|
|
+ emit('update:modelValue', {
|
|
|
|
|
+ type: 'parentKey',
|
|
|
|
|
+ key: '',
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -245,6 +262,12 @@ function setMainBodyColumnId(source: 'commonContent' | 'serializedApi', input: s
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function setParentKey(key: string) {
|
|
|
|
|
+ const cur = props.modelValue as IHomeCommonCategoryDynamicDataParentKey | undefined;
|
|
|
|
|
+ if (!cur || cur.type !== 'parentKey') return;
|
|
|
|
|
+ emit('update:modelValue', { ...cur, key });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function setSerializedApi(key: 'name'|'otherParams', value: any) {
|
|
function setSerializedApi(key: 'name'|'otherParams', value: any) {
|
|
|
const cur = props.modelValue as IHomeCommonCategoryDynamicDataSerializedApi | undefined;
|
|
const cur = props.modelValue as IHomeCommonCategoryDynamicDataSerializedApi | undefined;
|
|
|
if (!cur || cur.type !== 'serializedApi') return;
|
|
if (!cur || cur.type !== 'serializedApi') return;
|