diff --git a/src/model/definition.go b/src/model/definition.go index 9a28096c2850f121222fe0ffbdb9a54747e539a5..c503cd8730d81a8a119cec686447313b9e005123 100644 --- a/src/model/definition.go +++ b/src/model/definition.go @@ -100,6 +100,7 @@ type DefInfo struct { Title string `yaml:"title"` Desc string `yaml:"desc"` + Fields interface{} `yaml:"fields,omitempty"` // is yaml Range string `yaml:"range,omitempty"` // is config Ranges interface{} `yaml:"ranges,omitempty"` // is ranges Instances interface{} `yaml:"instances,omitempty"` // is instances diff --git a/src/service/list.go b/src/service/list.go index 14ef894d1e516d8560c6339bacdc88e3c7fa1838..4aeddf0ca12fb05d1107626b61f39797c4bc335c 100644 --- a/src/service/list.go +++ b/src/service/list.go @@ -73,8 +73,7 @@ func LoadRes(resType string) (res map[string][]model.ResFile, nameWidth, titleWi } } - if resType == "" || resType == item.ResType || - (resType == "yaml" && fileExt == ".yaml"){ + if resType == "" || resType == item.ResType { arr = append(arr, item) } } @@ -236,6 +235,8 @@ func GetYamlResType(def model.DefInfo) string { return constant.ResTypeRanges } else if def.Instances != nil { return constant.ResTypeInstances + } else if def.Fields != nil { + return constant.ResTypeYaml } return "" diff --git a/src/utils/const/const.go b/src/utils/const/const.go index ba47d68f6d5e8a77e6967cab1a97f4305586eb19..6e9570370c7179a3ab8b0eed472617c6004fcafd 100644 --- a/src/utils/const/const.go +++ b/src/utils/const/const.go @@ -71,6 +71,7 @@ var ( ResTypeConfig = "config" ResTypeRanges = "ranges" ResTypeInstances = "instances" + ResTypeYaml = "yaml" ResTypeExcel = "excel" ResTypeText = "text" ResTypes = []string{ResTypeConfig, ResTypeRanges, ResTypeInstances, ResTypeExcel, ResTypeText} diff --git a/src/utils/string/string.go b/src/utils/string/string.go index 459d83d16eb5d10cf227dfffceb1a52bd6476f05..b8a5918163e7a97e0de4a9d6016d628a18a5cc18 100644 --- a/src/utils/string/string.go +++ b/src/utils/string/string.go @@ -66,6 +66,10 @@ func BoolToPass(b bool) string { } } +func FindInArrBool(str string, arr []string) bool { + found, _ := FindInArr(str, arr) + return found +} func FindInArr(str string, arr []string) (bool,int) { for index, s := range arr { if str == s { @@ -240,4 +244,4 @@ func UrlEncode(str string) (ret string) { ret = base64.URLEncoding.EncodeToString([]byte(str)) return -} \ No newline at end of file +} diff --git a/ui/src/components/FieldRefer.vue b/ui/src/components/FieldRefer.vue index fafe5f91afb2c06d8e875acc5462d408b4cbfcaa..fb1a51bae155db3012f3d2861e75a8c816d1a83b 100644 --- a/ui/src/components/FieldRefer.vue +++ b/ui/src/components/FieldRefer.vue @@ -136,7 +136,7 @@ export default { }, onReferChanged(value) { console.log("onReferChanged") - this.refer.file = value + this.refer.file = value.split('-')[0] if (this.refer.type != 'yaml' && this.refer.type != 'text') { this.listDefFieldReferField() diff --git a/users/zentao/customer.yaml b/users/zentao/customer.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dd2c1e4237c49efbb8042540df614169d638fecd --- /dev/null +++ b/users/zentao/customer.yaml @@ -0,0 +1,18 @@ +title: YAML类型 +desc: +author: +version: 1.0 + +fields: + - field: t1 + range: a-z + postfix: "\t" + + - field: WC_SEX + range: sex.txt + #rand: true + postfix: "\t" + + - field: t2 + range: 1-9 + postfix: "\t"