|
@@ -96,7 +96,7 @@ func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64,
|
|
|
importDataNum := 0
|
|
|
binary, _ := io.ReadAll(mf)
|
|
|
xls, _ := xlsx.OpenBinary(binary)
|
|
|
- mField, _ := FiledFuc()
|
|
|
+ mField, _ := FiledFuc(eid)
|
|
|
fMap := make(map[int]string) //字段位置
|
|
|
|
|
|
sheet := xls.Sheets[0]
|
|
@@ -253,13 +253,15 @@ func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64,
|
|
|
return importDataNum, now.Unix(), "文档导入成功"
|
|
|
}
|
|
|
|
|
|
-func FiledFuc() (map[string]interface{}, map[string]interface{}) {
|
|
|
+func FiledFuc(eid int64) (map[string]interface{}, map[string]interface{}) {
|
|
|
mField := make(map[string]interface{}) // 字段名
|
|
|
fField := make(map[string]interface{}) // 字段类型
|
|
|
info := util.EntMysql.Find("field_mapping", nil, "", "", -1, -1)
|
|
|
for _, m := range *info {
|
|
|
- mField[common.ObjToString(m["zh_name"])] = common.ObjToString(m["fname"])
|
|
|
- fField[common.ObjToString(m["fname"])] = common.ObjToString(m["ftype"])
|
|
|
+ if e := common.Int64All(m["ent_id"]); e == 0 || e == eid {
|
|
|
+ mField[common.ObjToString(m["zh_name"])] = common.ObjToString(m["fname"])
|
|
|
+ fField[common.ObjToString(m["fname"])] = common.ObjToString(m["ftype"])
|
|
|
+ }
|
|
|
}
|
|
|
return mField, fField
|
|
|
}
|