Update field type handling in data processing and configuration. Added support for multiple column types in table creation, enhanced datetime processing, and improved UI for field type selection. Updated configuration timestamp.
This commit is contained in:
+37
-8
@@ -1440,8 +1440,8 @@ body {
|
||||
|
||||
.field-mapping-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
align-items: flex-end;
|
||||
gap: 12px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid var(--td-border-color-light);
|
||||
margin-bottom: 10px;
|
||||
@@ -1450,25 +1450,54 @@ body {
|
||||
.field-name {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding-left: 28px;
|
||||
}
|
||||
|
||||
.field-name label {
|
||||
font-size: 13px;
|
||||
.field-name label,
|
||||
.field-type label {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
white-space: nowrap;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.field-name .field-input {
|
||||
flex: 0 0 75%;
|
||||
max-width: 75%;
|
||||
width: 100%;
|
||||
height: 28px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.field-type {
|
||||
flex: 0 0 160px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.field-type .type-select {
|
||||
height: 28px;
|
||||
font-size: 13px;
|
||||
padding: 0 8px;
|
||||
border: 1px solid var(--td-border-color);
|
||||
border-radius: var(--td-radius-default);
|
||||
background: var(--td-bg-color-container);
|
||||
color: var(--td-text-color-primary);
|
||||
cursor: pointer;
|
||||
transition: all var(--td-transition);
|
||||
}
|
||||
|
||||
.field-type .type-select:hover {
|
||||
border-color: var(--td-brand-color);
|
||||
}
|
||||
|
||||
.field-type .type-select:focus {
|
||||
border-color: var(--td-brand-color);
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px var(--td-brand-color-light);
|
||||
}
|
||||
|
||||
.extract-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -1689,6 +1689,15 @@ class SettingsManager {
|
||||
return;
|
||||
}
|
||||
|
||||
// 可用的字段类型
|
||||
const fieldTypes = [
|
||||
{ value: 'string', label: '字符串 (VARCHAR)' },
|
||||
{ value: 'datetime', label: '日期时间 (DATETIME)' },
|
||||
{ value: 'int', label: '整数 (INT)' },
|
||||
{ value: 'float', label: '浮点数 (DOUBLE)' },
|
||||
{ value: 'text', label: '长文本 (TEXT)' }
|
||||
];
|
||||
|
||||
container.innerHTML = this.extractFields.map((field, index) => `
|
||||
<div class="field-mapping-item" data-index="${index}">
|
||||
<span class="field-mapping-number">${index + 1}</span>
|
||||
@@ -1698,6 +1707,16 @@ class SettingsManager {
|
||||
<input type="text" class="form-input field-input" value="${field.Field || ''}"
|
||||
data-index="${index}" data-prop="Field" placeholder="输入字段名">
|
||||
</div>
|
||||
<div class="field-type">
|
||||
<label>字段类型</label>
|
||||
<select class="form-select type-select" data-index="${index}">
|
||||
${fieldTypes.map(t => `
|
||||
<option value="${t.value}" ${(field.Type || 'string') === t.value ? 'selected' : ''}>
|
||||
${t.label}
|
||||
</option>
|
||||
`).join('')}
|
||||
</select>
|
||||
</div>
|
||||
<button class="btn-icon remove-mapping" data-index="${index}" title="删除此映射">✕</button>
|
||||
</div>
|
||||
<div class="extract-list">
|
||||
@@ -1740,6 +1759,14 @@ class SettingsManager {
|
||||
});
|
||||
});
|
||||
|
||||
// 绑定字段类型修改事件
|
||||
container.querySelectorAll('.type-select').forEach(select => {
|
||||
select.addEventListener('change', () => {
|
||||
const index = parseInt(select.dataset.index);
|
||||
this.extractFields[index].Type = select.value;
|
||||
});
|
||||
});
|
||||
|
||||
// 绑定删除提取来源事件
|
||||
container.querySelectorAll('.tree-remove').forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
@@ -1786,6 +1813,7 @@ class SettingsManager {
|
||||
addFieldMapping() {
|
||||
this.extractFields.push({
|
||||
Field: '',
|
||||
Type: 'string',
|
||||
Extract: []
|
||||
});
|
||||
this.renderFieldMappings();
|
||||
|
||||
Reference in New Issue
Block a user