diff --git a/mayfly_go_web/src/common/utils/export.ts b/mayfly_go_web/src/common/utils/export.ts index f4430477..c1a87d27 100644 --- a/mayfly_go_web/src/common/utils/export.ts +++ b/mayfly_go_web/src/common/utils/export.ts @@ -7,24 +7,22 @@ export function exportCsv(filename: string, columns: string[], datas: []) { for (let column of columns) { let val: any = data[column]; if (val == null || val == undefined) { - dataValueArr.push(''); - continue; - } + val = ''; + } else if (val && typeof val == 'string') { + // 替换换行符 + val = val.replace(/[\r\n]/g, '\\n'); - if (typeof val == 'string' && val) { // csv格式如果有逗号,整体用双引号括起来;如果里面还有双引号就替换成两个双引号,这样导出来的格式就不会有问题了 if (val.indexOf(',') != -1) { // 如果还有双引号,先将双引号转义,避免两边加了双引号后转义错误 if (val.indexOf('"') != -1) { - val = val.replace(/\"/g, '""'); + val = val.replace(/"/g, '""'); } // 再将逗号转义 val = `"${val}"`; } - dataValueArr.push(val + '\t'); - } else { - dataValueArr.push(val + '\t'); } + dataValueArr.push(String(val)); } cvsData.push(dataValueArr); } diff --git a/mayfly_go_web/src/views/ops/db/DbEdit.vue b/mayfly_go_web/src/views/ops/db/DbEdit.vue index 9965dc93..af3ea840 100644 --- a/mayfly_go_web/src/views/ops/db/DbEdit.vue +++ b/mayfly_go_web/src/views/ops/db/DbEdit.vue @@ -95,6 +95,7 @@ import { ElMessage } from 'element-plus'; import TagTreeSelect from '../component/TagTreeSelect.vue'; import type { CheckboxValueType } from 'element-plus'; import ProcdefSelectFormItem from '@/views/flow/components/ProcdefSelectFormItem.vue'; +import { DbType } from '@/views/ops/db/dialect'; const props = defineProps({ visible: { @@ -196,7 +197,14 @@ const changeInstance = () => { const getAllDatabase = async () => { if (state.form.instanceId > 0) { - state.allDatabases = await dbApi.getAllDatabase.request({ instanceId: state.form.instanceId }); + let dbs = await dbApi.getAllDatabase.request({ instanceId: state.form.instanceId }); + state.allDatabases = dbs; + + // 如果是oracle,且没查出数据库列表,则取实例sid + let instance = state.instances.find((item: any) => item.id === state.form.instanceId); + if (instance && instance.type === DbType.oracle && dbs.length === 0) { + state.allDatabases = [instance.sid]; + } } }; diff --git a/mayfly_go_web/src/views/ops/db/InstanceList.vue b/mayfly_go_web/src/views/ops/db/InstanceList.vue index 8631fd02..f48237fc 100644 --- a/mayfly_go_web/src/views/ops/db/InstanceList.vue +++ b/mayfly_go_web/src/views/ops/db/InstanceList.vue @@ -61,7 +61,7 @@