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

fix issues

上级 518e4fc5
...@@ -54,13 +54,28 @@ ...@@ -54,13 +54,28 @@
</a-form-model-item> </a-form-model-item>
</a-row> </a-row>
<!-- column list -->
<a-row v-if="showColSection" :gutter="colsFull"> <a-row v-if="showColSection" :gutter="colsFull">
<a-form-model-item :label="$t('form.col')" prop="colName" :labelCol="labelColFull" :wrapperCol="wrapperColFull"> <a-form-model-item :label="$t('form.col')" prop="colName" :labelCol="labelColFull" :wrapperCol="wrapperColFull">
<a-select v-model="referColNames" :mode="fieldMultiple"> <a-select v-if="fileMultiple === 'multiple'" v-model="referColNames" :mode="fieldMultiple">
<a-select-option v-for="f in fields" :key="f.name"> <a-select-option v-for="f in fields" :key="f.name">
{{ f.name }} {{ f.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
<a-select v-if="fileMultiple !== 'multiple'" v-model="refer.colName">
<a-select-option v-for="f in fields" :key="f.name">
{{ f.name }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-row>
<!-- sql where -->
<a-row v-if="refer.type==='excel'" :gutter="colsFull">
<a-form-model-item :label="$t('form.where')" prop="colName" :labelCol="labelColFull" :wrapperCol="wrapperColFull">
<a-input v-model="refer.condition" />
</a-form-model-item> </a-form-model-item>
</a-row> </a-row>
...@@ -211,7 +226,7 @@ export default { ...@@ -211,7 +226,7 @@ export default {
return col.split(':')[0] return col.split(':')[0]
}) })
this.removeSheet() this.convertExcelFileColToPath()
this.listReferFileForSelection(this.refer.type, true) this.listReferFileForSelection(this.refer.type, true)
}) })
}, },
...@@ -224,7 +239,7 @@ export default { ...@@ -224,7 +239,7 @@ export default {
this.listReferFileForSelection(this.refer.type, false) this.listReferFileForSelection(this.refer.type, false)
}, },
onReferFileChanged() { onReferFileChanged() {
console.log("onReferFileChanged", this.referFiles, this.refer.file) console.log("onReferFileChanged")
if (this.refer.type == 'excel') { if (this.refer.type == 'excel') {
this.listReferSheetForSelection(false) this.listReferSheetForSelection(false)
...@@ -258,24 +273,27 @@ export default { ...@@ -258,24 +273,27 @@ export default {
this.refer.file = this.referFiles this.refer.file = this.referFiles
} else if (this.refer.type === 'excel') { } else if (this.refer.type === 'excel') {
console.log('use this.refer.file') if (this.refer.file.lastIndexOf('.xlsx') > 0) {
this.refer.colName = this.referColNames this.refer.file = this.refer.file.substring(0, this.refer.file.lastIndexOf('.xlsx'))
}
} else { } else {
this.refer.file = this.referFiles this.refer.file = this.referFiles
this.refer.colName = this.referColNames this.refer.colName = this.referColNames
} }
console.log('###')
console.log(this.refer.file)
let data = JSON.parse(JSON.stringify(this.refer)) let data = JSON.parse(JSON.stringify(this.refer))
if (data.type === 'excel') data.file = data.file + '.' + data.sheet if (data.type === 'excel') data.file = data.file + '.' + data.sheet
data.count = parseInt(data.count) data.count = parseInt(data.count)
data.step = parseInt(data.step) data.step = parseInt(data.step)
console.log('###', data)
updateRefer(data, this.type).then(json => { updateRefer(data, this.type).then(json => {
console.log('updateRefer', json) console.log('updateRefer', json)
if (json.code == 1) { if (json.code == 1) {
this.loadData()
this.$notification['success']({ this.$notification['success']({
message: this.$i18n.t('tips.success.to.submit'), message: this.$i18n.t('tips.success.to.submit'),
duration: 3, duration: 3,
...@@ -356,9 +374,9 @@ export default { ...@@ -356,9 +374,9 @@ export default {
}) })
} }
}, },
removeSheet() { convertExcelFileColToPath() {
if (this.refer.type == 'excel') { if (this.refer.type == 'excel') {
this.refer.file = this.refer.file.substring(0, this.refer.file.lastIndexOf('.')) this.refer.file = this.refer.file.substring(0, this.refer.file.lastIndexOf('.')) + '.xlsx'
} }
} }
} }
......
...@@ -146,6 +146,7 @@ const locale = { ...@@ -146,6 +146,7 @@ const locale = {
'form.reset': 'Reset', 'form.reset': 'Reset',
'form.cancel': 'Cancel', 'form.cancel': 'Cancel',
'form.close': 'Close', 'form.close': 'Close',
'form.where': 'Where',
'valid.required': 'Can not be empty.', 'valid.required': 'Can not be empty.',
'valid.type.empty': 'Type cannot be empty.', 'valid.type.empty': 'Type cannot be empty.',
......
...@@ -146,6 +146,7 @@ const locale = { ...@@ -146,6 +146,7 @@ const locale = {
'form.reset': '重置', 'form.reset': '重置',
'form.cancel': '取消', 'form.cancel': '取消',
'form.close': '关闭', 'form.close': '关闭',
'form.where': 'Where条件',
'valid.required': '该字段不能为空。', 'valid.required': '该字段不能为空。',
'valid.type.empty': '类型不能为空', 'valid.type.empty': '类型不能为空',
......
title: 测试 title: 测试
desc: "" desc: ""
fields: fields:
- field: 新字段 - field: 新字段222
range: 1-9 range: 1-9
prefix: = prefix: =
postfix: '-' postfix: '-'
from: color.v1.xlsx.color from: city.v1.city
select: english select: name
where: state like '%山东%'
- field: 新字段333
range: 1-3
title: 测试 title: 测试
desc: "" desc: ""
fields: fields:
- field: 新字段 - field: 新字段1111
range: 1-9 range: 1-9
prefix: "=" prefix: =
postfix: "-" postfix: '-'
...@@ -44,11 +44,11 @@ fields: ...@@ -44,11 +44,11 @@ fields:
postfix: "\t" postfix: "\t"
from: ip.v1.yaml from: ip.v1.yaml
use: privateC{1} use: privateC{1}
- field: field_use_excel - field: field_use_excel666
postfix: "\t" postfix: "\t"
rand: true rand: true
from: city.v1.city from: xiehouyu.v1.xiehouyu
select: name select: riddle
where: state like '%山东%' where: state like '%山东%'
- field: field_with_children - field: field_with_children
fields: fields:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册