fix: SQL数据集快速点击保存报错

This commit is contained in:
dataeaseShu 2023-04-13 15:42:47 +08:00
parent ed3ddf8185
commit 8c0cfd3eb6
2 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="de-dataset-form"> <div class="de-dataset-form">
<div class="top"> <div class="top" v-loading="loading">
<span class="name"> <span class="name">
<i <i
class="el-icon-arrow-left" class="el-icon-arrow-left"
@ -43,7 +43,6 @@
<deBtn <deBtn
:disabled="['db', 'excel', 'api'].includes(datasetType) && !tableNum" :disabled="['db', 'excel', 'api'].includes(datasetType) && !tableNum"
type="primary" type="primary"
:loading="loading"
@click="datasetSave" @click="datasetSave"
>{{ >{{
$t('commons.save') $t('commons.save')
@ -58,6 +57,7 @@
:origin-name="originName" :origin-name="originName"
:name-list="nameList" :name-list="nameList"
@setTableNum="(val) => (tableNum = val)" @setTableNum="(val) => (tableNum = val)"
@datasourceLoading="(val) => loading = val"
/> />
</div> </div>
</div> </div>
@ -80,9 +80,9 @@ export default {
return { return {
originName: '', originName: '',
tableNum: 0, tableNum: 0,
loading: false,
showInput: false, showInput: false,
editType: '', editType: '',
loading: false,
selectDatasets: [], selectDatasets: [],
tData: [], tData: [],
datasetType: '', datasetType: '',
@ -185,7 +185,6 @@ export default {
return return
} }
} }
this.loading = true
this.$refs.addDataset.save() this.$refs.addDataset.save()
}, },
handleClick() { handleClick() {
@ -219,6 +218,7 @@ export default {
) )
}, },
initTable(id) { initTable(id) {
this.loading = true
post('/dataset/table/getWithPermission/' + id, null) post('/dataset/table/getWithPermission/' + id, null)
.then((response) => { .then((response) => {
const { sceneId: id, id: tableId, name } = response.data || {} const { sceneId: id, id: tableId, name } = response.data || {}
@ -234,7 +234,10 @@ export default {
this.table.editType = +this.editType this.table.editType = +this.editType
} }
}) })
.catch(() => {}) .catch(() => { })
.finally(() => {
this.loading = false
})
}, },
switchComponent(c) { switchComponent(c) {
switch (c) { switch (c) {

View File

@ -905,6 +905,7 @@ export default {
initTableInfo() { initTableInfo() {
const tableId = this.param.tableId || this.$route.query.id const tableId = this.param.tableId || this.$route.query.id
if (tableId) { if (tableId) {
this.$emit('datasourceLoading', true)
getTable(tableId).then((response) => { getTable(tableId).then((response) => {
const table = response.data const table = response.data
this.dataSource = table.dataSourceId this.dataSource = table.dataSourceId
@ -919,6 +920,8 @@ export default {
).sql ).sql
} }
this.variables = JSON.parse(table.sqlVariableDetails) this.variables = JSON.parse(table.sqlVariableDetails)
}).finally(() => {
this.$emit('datasourceLoading', false)
}) })
} }
}, },