将FormItemsRenderer中的items的id字段更改为bianma

utils中处理getLabelName和getSelectAppointItemList同步修改
master
LiuJiaNan 2025-11-04 16:20:00 +08:00
parent 41a306b53c
commit ee184aa104
3 changed files with 5 additions and 5 deletions

View File

@ -30,7 +30,7 @@ export type FormItemRenderType
*/ */
export interface OptionItem { export interface OptionItem {
/** ID字段 */ /** ID字段 */
id?: any; bianma?: any;
/** 名称字段 */ /** 名称字段 */
name?: string; name?: string;
[key: string]: any; [key: string]: any;
@ -40,7 +40,7 @@ export interface OptionItem {
* *
*/ */
export interface itemsFieldConfig { export interface itemsFieldConfig {
/** 值字段的键名,默认为 'id' */ /** 值字段的键名,默认为 'bianma' */
valueKey?: string; valueKey?: string;
/** 标签字段的键名,默认为 'name' */ /** 标签字段的键名,默认为 'name' */
labelKey?: string; labelKey?: string;

View File

@ -87,7 +87,7 @@ const FormItemsRenderer = ({
// 获取items里的value和label字段key // 获取items里的value和label字段key
const getItemsFieldKey = (option) => { const getItemsFieldKey = (option) => {
return { return {
valueKey: option?.itemsField?.valueKey || "id", valueKey: option?.itemsField?.valueKey || "bianma",
labelKey: option?.itemsField?.labelKey || "name", labelKey: option?.itemsField?.labelKey || "name",
}; };
}; };

View File

@ -273,7 +273,7 @@ export function addingPrefixToFile(list, options = {}) {
* 翻译状态 * 翻译状态
*/ */
export function getLabelName(options) { export function getLabelName(options) {
const { status, list, idKey = "id", nameKey = "name" } = options; const { status, list, idKey = "bianma", nameKey = "name" } = options;
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
if (status?.toString() === list[i][idKey]?.toString()) { if (status?.toString() === list[i][idKey]?.toString()) {
return list[i][nameKey]; return list[i][nameKey];
@ -327,7 +327,7 @@ export function idCardGetDateAndGender(idCard) {
* 获取select中指定项组成的数组 * 获取select中指定项组成的数组
*/ */
export function getSelectAppointItemList(options) { export function getSelectAppointItemList(options) {
const { list, value, idKey = "id" } = options; const { list, value, idKey = "bianma" } = options;
return list.filter(item => value.includes(item[idKey])); return list.filter(item => value.includes(item[idKey]));
} }