feat(数据集): 添加表搜索fix;上传excel增加进度条

This commit is contained in:
junjie 2021-04-30 16:18:18 +08:00
parent 54d775de0b
commit 9c09d8f8fc
3 changed files with 18 additions and 4 deletions

View File

@ -797,7 +797,8 @@ export default {
preview_total: '共', preview_total: '共',
pls_input_less_9: '请输入9位以内的正整数', pls_input_less_9: '请输入9位以内的正整数',
field_edit: '编辑字段', field_edit: '编辑字段',
table_already_add_to: '该表已添加至' table_already_add_to: '该表已添加至',
uploading: '上传中...'
}, },
datasource: { datasource: {
datasource: '数据源', datasource: '数据源',

View File

@ -90,7 +90,7 @@ export default {
}, },
searchTable(val) { searchTable(val) {
if (val && val !== '') { if (val && val !== '') {
this.tableData = JSON.parse(JSON.stringify(this.tables.filter(ele => { return ele.includes(val) }))) this.tableData = JSON.parse(JSON.stringify(this.tables.filter(ele => { return ele.name.includes(val) })))
} else { } else {
this.tableData = JSON.parse(JSON.stringify(this.tables)) this.tableData = JSON.parse(JSON.stringify(this.tables))
} }

View File

@ -29,11 +29,16 @@
:show-file-list="false" :show-file-list="false"
:file-list="fileList" :file-list="fileList"
accept=".xls,.xlsx,.csv" accept=".xls,.xlsx,.csv"
:before-upload="beforeUpload"
:on-success="uploadSuccess" :on-success="uploadSuccess"
:on-error="uploadFail"
name="file" name="file"
:headers="headers" :headers="headers"
> >
<el-button size="mini" type="primary">{{ $t('dataset.upload_file') }}</el-button> <el-button size="mini" type="primary" :disabled="uploading">
<span v-if="!uploading" style="font-size: 12px;">{{ $t('dataset.upload_file') }}</span>
<span v-if="uploading" style="font-size: 12px;"><i class="el-icon-loading" /> {{ $t('dataset.uploading') }}</span>
</el-button>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -96,7 +101,8 @@ export default {
fileList: [], fileList: [],
headers: { Authorization: token }, headers: { Authorization: token },
baseUrl: process.env.VUE_APP_BASE_API, baseUrl: process.env.VUE_APP_BASE_API,
path: '' path: '',
uploading: false
} }
}, },
watch: { watch: {
@ -121,6 +127,12 @@ export default {
that.height = currentHeight - 56 - 30 - 26 - 25 - 35 - 10 - 37 - 20 - 10 that.height = currentHeight - 56 - 30 - 26 - 25 - 35 - 10 - 37 - 20 - 10
}, 10) }, 10)
}, },
beforeUpload(file) {
this.uploading = true
},
uploadFail(response, file, fileList) {
this.uploading = false
},
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
// console.log(response) // console.log(response)
// console.log(file) // console.log(file)
@ -135,6 +147,7 @@ export default {
this.name = file.name.substring(0, file.name.lastIndexOf('.')) this.name = file.name.substring(0, file.name.lastIndexOf('.'))
} }
this.fileList = fileList this.fileList = fileList
this.uploading = false
}, },
save() { save() {