fix: 创建数据集时数据源状态不正确

This commit is contained in:
taojinlong 2024-06-26 17:42:10 +08:00
parent cb2025164e
commit 689f4949d3
5 changed files with 58 additions and 28 deletions

View File

@ -366,7 +366,7 @@ const openMessageLoading = cb => {
}
const callbackExport = () => {
useEmitt().emitter.emit('data-export-center')
useEmitt().emitter.emit('data-export-center', { activeName: 'IN_PROGRESS' })
}
const exportAsExcel = () => {

View File

@ -264,7 +264,7 @@ const downloadViewDetails = () => {
}
const exportData = () => {
useEmitt().emitter.emit('data-export-center')
useEmitt().emitter.emit('data-export-center', { activeName: 'IN_PROGRESS' })
}
const openMessageLoading = cb => {

View File

@ -45,8 +45,8 @@ const activeIndex = computed(() => {
const permissionStore = usePermissionStore()
const ExportExcelRef = ref()
const downloadClick = () => {
ExportExcelRef.value.init()
const downloadClick = params => {
ExportExcelRef.value.init(params)
}
const routers: any[] = formatRoute(permissionStore.getRoutersNotHidden as AppCustomRouteRecordRaw[])
const showSystem = ref(false)
@ -94,7 +94,9 @@ onMounted(() => {
initAiBase()
useEmitt({
name: 'data-export-center',
callback: downloadClick
callback: function (params) {
ExportExcelRef.value.init(params)
}
})
})
</script>

View File

@ -105,8 +105,11 @@ const handleClick = tab => {
})
}
const init = () => {
const init = params => {
drawer.value = true
if (params && params.activeName !== undefined) {
activeName.value = params.activeName
}
handleClick()
timer = setInterval(() => {
if (activeName.value === 'IN_PROGRESS') {
@ -150,12 +153,16 @@ const taskExportTopicCall = task => {
openMessageLoading(
JSON.parse(task).exportFromName + ' 导出成功,前往',
'success',
callbackExport
callbackExportSuc
)
return
}
if (JSON.parse(task).exportStatus === 'FAILED') {
openMessageLoading(JSON.parse(task).exportFromName + ' 导出失败,前往', 'error', callbackExport)
openMessageLoading(
JSON.parse(task).exportFromName + ' 导出失败,前往',
'error',
callbackExportError
)
}
}
@ -185,8 +192,12 @@ const openMessageLoading = (text, type = 'success', cb) => {
})
}
const callbackExport = () => {
useEmitt().emitter.emit('data-export-center')
const callbackExportError = () => {
useEmitt().emitter.emit('data-export-center', { activeName: 'FAILED' })
}
const callbackExportSuc = () => {
useEmitt().emitter.emit('data-export-center', { activeName: 'SUCCESS' })
}
const downLoadAll = () => {
@ -424,17 +435,20 @@ defineExpose({
</el-table-column>
<el-table-column fixed="right" prop="operate" width="90" :label="$t('commons.operating')">
<template #default="scope">
<el-button
v-if="scope.row.exportStatus === 'SUCCESS'"
text
@click="downloadClick(scope.row)"
>
<template #icon>
<el-icon>
<Icon name="dv-preview-download"></Icon>
</el-icon>
</template>
</el-button>
<el-tooltip effect="dark" content="下载" placement="top">
<el-button
v-if="scope.row.exportStatus === 'SUCCESS'"
text
@click="downloadClick(scope.row)"
>
<template #icon>
<el-icon>
<Icon name="dv-preview-download"></Icon>
</el-icon>
</template>
</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="重新导出" placement="top">
<el-button v-if="scope.row.exportStatus === 'FAILED'" text @click="retry(scope.row)">
<template #icon>
@ -443,11 +457,13 @@ defineExpose({
</el-button>
</el-tooltip>
<el-button text @click="deleteField(scope.row)">
<template #icon>
<Icon name="de-delete"></Icon>
</template>
</el-button>
<el-tooltip effect="dark" content="删除" placement="top">
<el-button text @click="deleteField(scope.row)">
<template #icon>
<Icon name="de-delete"></Icon>
</template>
</el-button>
</el-tooltip>
</template>
</el-table-column>
<template #empty>

View File

@ -282,7 +282,8 @@ const validate = () => {
return
}
cancelMap['/datasource/checkApiDatasource']?.()
checkApiItem({ data: Base64.encode(JSON.stringify(apiItem)) })
const params = Base64.encode(JSON.stringify(paramsList))
checkApiItem({ data: Base64.encode(JSON.stringify(apiItem)), paramsList: params })
.then(response => {
apiItem.jsonFields = response.data.jsonFields
apiItem.fields = []
@ -308,6 +309,17 @@ const disabledByChildren = item => {
return false
}
}
const disabledChangeFieldByChildren = item => {
if (apiItem.type == 'params') {
return true
}
if (item.hasOwnProperty('children') && item.children.length > 0) {
return true
} else {
return false
}
}
const previewData = () => {
showEmpty.value = false
const data = []
@ -602,7 +614,7 @@ defineExpose({
<template #default="scope">
<el-select
v-model="scope.row.deExtractType"
:disabled="disabledByChildren(scope.row)"
:disabled="disabledChangeFieldByChildren(scope.row)"
class="select-type"
style="display: inline-block; width: 120px"
>