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

close task#36683,36685

上级 6a95e1b0
......@@ -95,7 +95,7 @@ fields:
- field: field_length # 指定宽度。
range: 1-99 # 01\t,02\t,03\t..., 99\t
length: 3 # 包含前后缀的宽度。
length: 3 # 包含前后缀的宽度。
leftpad: 0 # 宽度不够时,补充的字符。
postfix: "\t"
......
......@@ -45,18 +45,27 @@ func genFieldFromZdField(treeNode model.ZdField, refer model.ZdRefer, field *mod
// deal with refer
if refer.Type != "" {
logUtils.PrintTo(refer.Type)
if refer.Type == "excel" {
field.From = refer.File
field.Select = refer.ColName
field.Where = refer.Condition
} else if refer.Type == constant.ResTypeRanges || refer.Type == constant.ResTypeInstances { // medium{2}
field.From = refer.File
field.Use = refer.ColName
if refer.Count > 0 {
field.Use = fmt.Sprintf("%s{%d}", refer.ColName, refer.Count)
arr := strings.Split(refer.ColName, ",")
arrNew := make([]string, 0)
for _, item := range arr {
if refer.Count > 0 {
item = fmt.Sprintf("%s{%d}", item, refer.Count)
}
arrNew = append(arrNew, item)
}
field.From = refer.File
field.Use = strings.Join(arrNew, ",")
} else if refer.Type == constant.ResTypeYaml { // dir/content.yaml{3}
arr := strings.Split(refer.File, ",")
arrNew := make([]string, 0)
......
......@@ -290,7 +290,6 @@ func (s *DefService) saveFieldToDB(field *model.ZdField, def model.ZdDef, currPa
}
} else if field.Range != "" {
rangeSections := gen.ParseRangeProperty(field.Range)
if len(rangeSections) > 0 {
rangeSection := rangeSections[0] // deal with yaml and text refer using range prop
......
无法预览此类型文件
......@@ -39,8 +39,7 @@
<a-row v-if="showColSection" :gutter="colsFull">
<a-form-model-item :label="$t('form.col')" prop="colName" :labelCol="labelColFull" :wrapperCol="wrapperColFull">
<a-select v-model="refer.colName">
<a-select-option value="">{{$t('tips.pls.select')}}</a-select-option>
<a-select v-model="referColNames" :mode="fieldMultiple">
<a-select-option v-for="f in fields" :key="f.name">
{{ f.name }}
</a-select-option>
......@@ -116,6 +115,7 @@ export default {
refer: {},
referFiles: [], // for range's multi values
referColNames: [], // for ranges and instances refer to multi values
rules: {
},
......@@ -159,6 +159,13 @@ export default {
} else {
return ''
}
},
fieldMultiple() {
if (this.refer.type === 'ranges' || this.refer.type === 'instances') {
return 'multiple'
} else {
return ''
}
}
},
created () {
......@@ -180,8 +187,11 @@ export default {
getRefer(this.model.id, this.type).then(json => {
console.log('getRefer', json)
this.refer = json.data
this.referFiles = this.refer.file.split(',').map((fi) => {
return fi.split(':')[0]
this.referFiles = this.refer.file.split(',').map((file) => {
return file.split(':')[0]
})
this.referColNames = this.refer.colName.split(',').map((col) => {
return col.split(':')[0]
})
this.removeSheet()
......@@ -223,18 +233,16 @@ export default {
}
if (this.refer.type == 'text' || this.refer.type == 'yaml') {
// const temp = this.referFiles.map((fi) => {
// if (this.refer.rand) {
// fi += ':R'
// } else if (this.refer.step > 1) {
// fi += ':' + this.refer.step
// }
// return fi
// })
this.refer.file = this.referFiles.join(',')
this.refer.colName = this.referColNames
console.log(this.refer.file)
} else if (this.refer.type == 'ranges' || this.refer.type == 'instances') {
this.refer.colName = this.referColNames.join(',')
this.refer.file = this.referFiles
console.log(this.refer.colName)
} else {
this.refer.file = this.referFiles
this.refer.colName = this.referColNames
}
let data = JSON.parse(JSON.stringify(this.refer))
......@@ -273,6 +281,7 @@ export default {
}
} else {
this.referFiles = []
this.referColNames = []
this.refer.file = ''
this.refer.sheet = ''
this.refer.colName = ''
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册