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 = () => { const callbackExport = () => {
useEmitt().emitter.emit('data-export-center') useEmitt().emitter.emit('data-export-center', { activeName: 'IN_PROGRESS' })
} }
const exportAsExcel = () => { const exportAsExcel = () => {

View File

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

View File

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

View File

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

View File

@ -282,7 +282,8 @@ const validate = () => {
return return
} }
cancelMap['/datasource/checkApiDatasource']?.() 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 => { .then(response => {
apiItem.jsonFields = response.data.jsonFields apiItem.jsonFields = response.data.jsonFields
apiItem.fields = [] apiItem.fields = []
@ -308,6 +309,17 @@ const disabledByChildren = item => {
return false 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 = () => { const previewData = () => {
showEmpty.value = false showEmpty.value = false
const data = [] const data = []
@ -602,7 +614,7 @@ defineExpose({
<template #default="scope"> <template #default="scope">
<el-select <el-select
v-model="scope.row.deExtractType" v-model="scope.row.deExtractType"
:disabled="disabledByChildren(scope.row)" :disabled="disabledChangeFieldByChildren(scope.row)"
class="select-type" class="select-type"
style="display: inline-block; width: 120px" style="display: inline-block; width: 120px"
> >