v0.9.35
This commit is contained in:
parent
89c2157fea
commit
89e89ab2ba
3 changed files with 6 additions and 11 deletions
|
|
@ -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)
|
columns, rows := imp.DataGet(src, page, size, mapping)
|
||||||
for _, row := range rows {
|
for idx, row := range rows {
|
||||||
if len(row) != len(columns) {
|
if len(row) != len(columns) {
|
||||||
exception.New("数据异常, 请联系管理员", 500).Ctx(map[string]interface{}{"row": row, "columns": columns}).Throw()
|
exception.New("数据异常, 请联系管理员", 500).Ctx(map[string]interface{}{"row": row, "columns": columns}).Throw()
|
||||||
}
|
}
|
||||||
|
|
||||||
rs := map[string]interface{}{}
|
rs := map[string]interface{}{}
|
||||||
for i := range row {
|
for i := range row {
|
||||||
key := columns[i]
|
key := columns[i]
|
||||||
value := row[i]
|
value := row[i]
|
||||||
rs[key] = value
|
rs[key] = value
|
||||||
}
|
}
|
||||||
|
rs["id"] = idx + 1
|
||||||
data = append(data, rs)
|
data = append(data, rs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,10 +308,6 @@ func (imp *Importer) MappingSetting(src from.Source) map[string]interface{} {
|
||||||
Type: "label",
|
Type: "label",
|
||||||
Props: map[string]interface{}{"value": ":label"},
|
Props: map[string]interface{}{"value": ":label"},
|
||||||
},
|
},
|
||||||
Edit: share.Render{
|
|
||||||
Type: "select",
|
|
||||||
Props: map[string]interface{}{"options": imp.getFieldOption(), "value": ":field"},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"数据源": {
|
"数据源": {
|
||||||
Label: "数据源",
|
Label: "数据源",
|
||||||
|
|
@ -348,12 +343,12 @@ func (imp *Importer) MappingSetting(src from.Source) map[string]interface{} {
|
||||||
"columns": columns,
|
"columns": columns,
|
||||||
"filters": map[string]interface{}{},
|
"filters": map[string]interface{}{},
|
||||||
"list": share.Page{
|
"list": share.Page{
|
||||||
Primary: "id",
|
Primary: "field",
|
||||||
Layout: map[string]interface{}{
|
Layout: map[string]interface{}{
|
||||||
"columns": []map[string]interface{}{
|
"columns": []map[string]interface{}{
|
||||||
{"name": "字段名称"},
|
{"name": "字段名称"},
|
||||||
{"name": "数据源"},
|
{"name": "数据源"},
|
||||||
{"name": "清洗规则"},
|
{"name": "清洗规则", "width": 300},
|
||||||
{"name": "数据示例"},
|
{"name": "数据示例"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ func TestDataPreviewSimple(t *testing.T) {
|
||||||
assert.Equal(t, 3, res["pagesize"])
|
assert.Equal(t, 3, res["pagesize"])
|
||||||
assert.Equal(t, 1, res["prev"])
|
assert.Equal(t, 1, res["prev"])
|
||||||
assert.Equal(t, 1, len(data))
|
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) {
|
func TestMappingPreviewSimple(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package share
|
package share
|
||||||
|
|
||||||
// VERSION 版本号
|
// VERSION 版本号
|
||||||
const VERSION = "0.9.34"
|
const VERSION = "0.9.35"
|
||||||
|
|
||||||
// DOMAIN 许可域(废弃)
|
// DOMAIN 许可域(废弃)
|
||||||
const DOMAIN = "*.iqka.com"
|
const DOMAIN = "*.iqka.com"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue