fix: restore battery field input types
| | |
| | | 文本: 'text', 数字: 'number', 时间: 'time', 备注: 'remark', |
| | | } |
| | | |
| | | export function mapBatteryGroupFieldType(value: string | null | undefined): BatteryGroupFieldType { |
| | | return typeMap[value || ''] || '文本' |
| | | } |
| | | |
| | | export async function getBatteryGroupFields(): Promise<BatteryGroupField[]> { |
| | | const result = await request<BatteryGroupFieldListResponse>('/system/batteryGroupField/list?pageNum=1&pageSize=1000') |
| | | return (result.rows || []).map(item => ({ |
| | | id: item.fieldId, |
| | | name: item.fieldName || '', |
| | | type: typeMap[item.fieldType || ''] || '文本', |
| | | type: mapBatteryGroupFieldType(item.fieldType), |
| | | creator: item.createBy || '-', |
| | | createdAt: item.createTime || '', |
| | | status: item.status === '1' ? '禁用' : '启用', |
| | |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { useRoute, useRouter } from 'vue-router' |
| | | import { getUserInfo } from '@/api/auth' |
| | | import { getBatteryGroupFields, type BatteryGroupField, type BatteryGroupFieldType } from '@/api/batteryGroupFields' |
| | | import { getBatteryGroupFields, mapBatteryGroupFieldType, type BatteryGroupField, type BatteryGroupFieldType } from '@/api/batteryGroupFields' |
| | | import { buildBatteryGroupPayload, type GroupStatus } from '@/api/batteryGroupPayload' |
| | | import { createBatteryGroup, getBatteryGroupDetail, updateBatteryGroup } from '@/api/batteryGroups' |
| | | import { createBatteryGroupTemplate, getBatteryGroupTemplate, getBatteryGroupTemplateOptions, updateBatteryGroupTemplate, type BatteryGroupTemplateOption } from '@/api/batteryGroupTemplates' |
| | |
| | | key: `persisted-field-${field.batteryGroupFieldId}`, |
| | | fieldId: field.batteryGroupFieldId, |
| | | label: field.fieldName, |
| | | type: (field.fieldType === 'text' ? '文本' : field.fieldType) as BatteryGroupFieldType, |
| | | type: mapBatteryGroupFieldType(field.fieldType), |
| | | value: field.fieldValue, |
| | | })) |
| | | Object.assign(form, { |