1
This commit is contained in:
2026-01-12 14:39:07 +08:00
parent c78ef20b10
commit 4e20d62ae5

View File

@ -1959,14 +1959,14 @@ export default function App() {
// 1. 先获取所有字段的元数据
const fieldMetaList = await labelTable.getFieldMetaList();
// 2. 筛选出标签1-标签10的字段
// 2. 筛选出标签1-标签11的字段
const labelFields: {[key: string]: string} = {}; // 存储字段名到字段ID的映射
for (const fieldMeta of fieldMetaList) {
if (!fieldMeta || typeof (fieldMeta as any).name !== 'string' || typeof (fieldMeta as any).id !== 'string') {
continue;
}
const match = (fieldMeta as any).name.match(/^标签([1-9]|10)$/);
const match = (fieldMeta as any).name.match(/^标签([1-9]|10|11)$/);
if (match) {
const labelKey = `标签${match[1]}`;
labelFields[labelKey] = (fieldMeta as any).id;
@ -1978,8 +1978,8 @@ export default function App() {
// 3. 处理标签数据 - 从字段选项获取而不是从记录数据获取
const options: {[key: string]: any[]} = {};
// 初始化十个标签的选项数组
for (let i = 1; i <= 10; i++) {
// 初始化标签的选项数组
for (let i = 1; i <= 11; i++) {
options[`标签${i}`] = [];
}
@ -6878,20 +6878,21 @@ export default function App() {
{(mode === 'generate' || labelAdjustmentFlow) && labelOptions && Object.keys(labelOptions).length > 0 && (
<Card title="标签选择" className="card-enhanced" style={{ marginBottom: '24px' }}>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '16px' }}>
{Array.from({ length: 10 }, (_, i) => i + 1).map(num => {
{Array.from({ length: 11 }, (_, i) => i + 1).map(num => {
const labelKey = `标签${num}`;
const options = labelOptions[labelKey] || [];
const isMultiSelect = labelKey === '标签7' || labelKey === '标签8' || labelKey === '标签10';
const val = selectedLabels[labelKey];
const isMissing = Array.isArray(val) ? (val as string[]).length === 0 : !(typeof val === 'string' && (val as string).trim().length > 0);
const isRequired = labelKey !== '标签11';
return (
<div key={labelKey}>
<Text strong style={{ display: 'block', marginBottom: '8px' }}>{labelKey}</Text>
<Text strong style={{ display: 'block', marginBottom: '8px' }}>{labelKey}{isRequired ? '必填' : '非必填'}</Text>
<Select
className="select-enhanced"
style={{ width: '100%', borderColor: isMissing ? '#ff4d4f' : undefined }}
placeholder={`请选择${labelKey}(必填)`}
style={{ width: '100%', borderColor: isRequired && isMissing ? '#ff4d4f' : undefined }}
placeholder={`请选择${labelKey}${isRequired ? '(必填)' : ''}`}
value={selectedLabels[labelKey]}
onChange={(value) => {
const normalizeOne = (v: any) => {
@ -6931,7 +6932,7 @@ export default function App() {
</Select.Option>
))}
</Select>
{isMissing && (
{isRequired && isMissing && (
<Text type="danger" style={{ marginTop: '6px', display: 'block' }}></Text>
)}
</div>