diff --git a/importer/importer.go b/importer/importer.go index 9fe1c5bc..c116dc58 100644 --- a/importer/importer.go +++ b/importer/importer.go @@ -196,18 +196,17 @@ func (imp *Importer) DataPreview(src from.Source, page int, size int, mapping *M } columns, rows := imp.DataGet(src, page, size, mapping) - for _, row := range rows { + for idx, row := range rows { if len(row) != len(columns) { exception.New("数据异常, 请联系管理员", 500).Ctx(map[string]interface{}{"row": row, "columns": columns}).Throw() } - rs := map[string]interface{}{} for i := range row { key := columns[i] value := row[i] rs[key] = value } - + rs["id"] = idx + 1 data = append(data, rs) } @@ -309,10 +308,6 @@ func (imp *Importer) MappingSetting(src from.Source) map[string]interface{} { Type: "label", Props: map[string]interface{}{"value": ":label"}, }, - Edit: share.Render{ - Type: "select", - Props: map[string]interface{}{"options": imp.getFieldOption(), "value": ":field"}, - }, }, "数据源": { Label: "数据源", @@ -348,12 +343,12 @@ func (imp *Importer) MappingSetting(src from.Source) map[string]interface{} { "columns": columns, "filters": map[string]interface{}{}, "list": share.Page{ - Primary: "id", + Primary: "field", Layout: map[string]interface{}{ "columns": []map[string]interface{}{ {"name": "字段名称"}, {"name": "数据源"}, - {"name": "清洗规则"}, + {"name": "清洗规则", "width": 300}, {"name": "数据示例"}, }, }, diff --git a/importer/importer_test.go b/importer/importer_test.go index a3059bb4..e9989991 100644 --- a/importer/importer_test.go +++ b/importer/importer_test.go @@ -111,7 +111,7 @@ func TestDataPreviewSimple(t *testing.T) { assert.Equal(t, 3, res["pagesize"]) assert.Equal(t, 1, res["prev"]) assert.Equal(t, 1, len(data)) - assert.Equal(t, 11, len(data[0])) + assert.Equal(t, 12, len(data[0])) } func TestMappingPreviewSimple(t *testing.T) { diff --git a/share/const.go b/share/const.go index 1c45d8fe..7b7a5ad8 100644 --- a/share/const.go +++ b/share/const.go @@ -1,7 +1,7 @@ package share // VERSION 版本号 -const VERSION = "0.9.34" +const VERSION = "0.9.35" // DOMAIN 许可域(废弃) const DOMAIN = "*.iqka.com"