提交 7b46fb1d 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

convert refer path related to current zendata work dir

上级 91b8b740
......@@ -185,8 +185,10 @@ func (s *DefService) saveFieldToDB(item *model.ZdField, currPath string, parentI
if len(rangeSections) == 1 {
rangeSection := rangeSections[0]
desc, _, count := gen.ParseRangeSection(rangeSection)
refer.File = desc
refer.Count = count
path := FileToPath(desc, currPath)
refer.File = strings.Replace(path, vari.WorkDir, "", 1)
}
} else if item.Select != "" { // refer to excel
......@@ -220,8 +222,10 @@ func (s *DefService) saveFieldToDB(item *model.ZdField, currPath string, parentI
refer.Type = constant.ResTypeYaml
}
if path.Ext(desc) == ".txt" || path.Ext(desc) == ".yaml" {
refer.File = desc
refer.Count = count
path := FileToPath(desc, currPath)
refer.File = strings.Replace(path, vari.WorkDir, "", 1)
}
}
}
......
......@@ -273,6 +273,11 @@ func ConvertResExcelPath(from string) (ret, sheet string) {
return
}
func ConvertResTextPath(from string) (ret string) {
return
}
func GetFilesByExtInDir(folder, ext string, files *[]string) {
folder, _ = filepath.Abs(folder)
......
无法预览此类型文件
......@@ -18,7 +18,7 @@
<a-form-model-item label="文件" prop="file" :labelCol="labelColFull" :wrapperCol="wrapperColFull">
<a-select v-model="refer.file" @change="onReferFileChanged">
<a-select-option value="">选择</a-select-option>
<a-select-option v-for="(f, i) in files" :value="f.id" :key="i">
<a-select-option v-for="(f, i) in files" :value="f.referName" :key="i">
{{ f.title }}
</a-select-option>
</a-select>
......
......@@ -19,11 +19,11 @@ fields:
# range: 10-20
# prefix: int_
- field: field_text # 从一个文件中随机读取。
range: users.txt:R # 相对当前文件路径。
range: dir/users.txt:R # 相对当前文件路径。
postfix: "\t"
- field: field_yaml # 引用其他的定义文件整体内容。
range: test/test-nested2.yaml{3} # 相对当前文件路径。
range: dir/content.yaml{3} # 相对当前文件路径。
postfix: "\t"
- field: field_use_config # 引用其他的config定义文件。
......
title: 内容被引用
desc:
author: zentao
version: 1.0
fields:
- field: field1
range: 1-10
prefix: ""
postfix: "\t"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册