Pr@dev v2@fixdstype (#15480)

* fix: 修复数据源类型错误

* fix:【数据源】远程excel数据源复制,出现多余的「合并数据」提示框

---------

Co-authored-by: taojinlong <jinlong@fit2cloud.com>
This commit is contained in:
taojinlong
2025-03-25 12:14:09 +08:00
committed by GitHub
parent 561eb2ae07
commit a13ad72b30
3 changed files with 29 additions and 142 deletions

View File

@@ -83,29 +83,10 @@ public class DataSourceManage {
return flag;
}
private String getName(String type) {
String name = null;
for (DatasourceConfiguration.DatasourceType datasourceType : DatasourceConfiguration.DatasourceType.values()) {
if (datasourceType.getType().equals(type)) {
name = datasourceType.getName();
}
}
if (StringUtils.isEmpty(name)) {
List<XpackPluginsDatasourceVO> xpackPluginsDatasourceVOS = pluginManage.queryPluginDs();
List<XpackPluginsDatasourceVO> list = xpackPluginsDatasourceVOS.stream().filter(ele -> StringUtils.equals(ele.getType(), type)).toList();
if (ObjectUtils.isNotEmpty(list)) {
XpackPluginsDatasourceVO first = list.getFirst();
name = first.getName();
}
}
return name;
}
private DatasourceNodeBO convert(DataSourceNodePO po) {
Integer flag = getFlag(po.getType());
int extraFlag = StringUtils.equalsIgnoreCase("error", po.getStatus()) ? Math.negateExact(flag) : flag;
return new DatasourceNodeBO(po.getId(), po.getName(), !StringUtils.equals(po.getType(), "folder"), 9, po.getPid(), extraFlag, getName(po.getType()));
return new DatasourceNodeBO(po.getId(), po.getName(), !StringUtils.equals(po.getType(), "folder"), 9, po.getPid(), extraFlag, po.getType());
}
@XpackInteract(value = "datasourceResourceTree", replace = true, invalid = true)

View File

@@ -337,68 +337,21 @@ const saveExcelData = (sheetFileMd5, table, params, successCb, finallyCb) => {
} else {
method = update
}
if (new Set(sheetFileMd5).size !== sheetFileMd5.length && !props.param.id) {
ElMessageBox.confirm(t('dataset.merge_title'), {
confirmButtonText: t('dataset.merge'),
tip: t('dataset.task.excel_replace_msg'),
cancelButtonText: t('dataset.no_merge'),
confirmButtonType: 'primary',
type: 'warning',
autofocus: false,
callback: (action: Action) => {
if (action === 'close') return
loading.value = true
table.mergeSheet = action === 'confirm'
if (action === 'confirm') {
method(table)
.then(res => {
emitter.emit('showFinishPage', res)
successCb?.()
ElMessage({
message: t('commons.save_success'),
type: 'success'
})
})
.finally(() => {
finallyCb?.()
loading.value = false
})
}
if (action === 'cancel') {
method(table)
.then(res => {
emitter.emit('showFinishPage', res)
successCb?.()
ElMessage({
message: t('commons.save_success'),
type: 'success'
})
})
.finally(() => {
finallyCb?.()
loading.value = false
})
}
}
if (loading.value) return
loading.value = true
method(table)
.then(res => {
emitter.emit('showFinishPage', res)
successCb?.()
ElMessage({
message: t('commons.save_success'),
type: 'success'
})
})
.finally(() => {
finallyCb?.()
loading.value = false
})
} else {
if (loading.value) return
loading.value = true
method(table)
.then(res => {
emitter.emit('showFinishPage', res)
successCb?.()
ElMessage({
message: t('commons.save_success'),
type: 'success'
})
})
.finally(() => {
finallyCb?.()
loading.value = false
})
}
}
const onChange = file => {

View File

@@ -648,68 +648,21 @@ const saveExcelData = (sheetFileMd5, table, params, successCb, finallyCb) => {
} else {
method = update
}
if (new Set(sheetFileMd5).size !== sheetFileMd5.length && !props.form.id) {
ElMessageBox.confirm(t('dataset.merge_title'), {
confirmButtonText: t('dataset.merge'),
tip: t('dataset.task.excel_replace_msg'),
cancelButtonText: t('dataset.no_merge'),
confirmButtonType: 'primary',
type: 'warning',
autofocus: false,
callback: (action: Action) => {
if (action === 'close') return
loading.value = true
table.mergeSheet = action === 'confirm'
if (action === 'confirm') {
method(table)
.then(res => {
emitter.emit('showFinishPage', res)
successCb?.()
ElMessage({
message: t('commons.save_success'),
type: 'success'
})
})
.finally(() => {
finallyCb?.()
loading.value = false
})
}
if (action === 'cancel') {
method(table)
.then(res => {
emitter.emit('showFinishPage', res)
successCb?.()
ElMessage({
message: t('commons.save_success'),
type: 'success'
})
})
.finally(() => {
finallyCb?.()
loading.value = false
})
}
}
if (loading.value) return
loading.value = true
method(table)
.then(res => {
emitter.emit('showFinishPage', res)
successCb?.()
ElMessage({
message: t('commons.save_success'),
type: 'success'
})
})
.finally(() => {
finallyCb?.()
loading.value = false
})
} else {
if (loading.value) return
loading.value = true
method(table)
.then(res => {
emitter.emit('showFinishPage', res)
successCb?.()
ElMessage({
message: t('commons.save_success'),
type: 'success'
})
})
.finally(() => {
finallyCb?.()
loading.value = false
})
}
}
defineExpose({