-
+
-
-
+
+
+ {{ item.name }}
+
+
+ {{ item.type }} / {{ item.host }}:{{ item.port }}
+
+ {{ item.username }}
+
@@ -17,20 +42,20 @@
-
-
-
+
+
+
@@ -146,21 +171,28 @@ const changeDatabase = () => {
};
const getAllDatabase = async () => {
- const reqForm = { ...state.form };
if (state.form.instanceId > 0) {
- state.allDatabases = await dbApi.getAllDatabase.request(reqForm);
+ state.allDatabases = await dbApi.getAllDatabase.request({ instanceId: state.form.instanceId });
}
};
-const getAllInstances = async () => {
- const data = await dbApi.instances.request(null);
+const getInstances = async (instanceName: string = '', id = 0) => {
+ if (!id && !instanceName) {
+ state.instances = [];
+ return;
+ }
+ const data = await dbApi.instances.request({ id, name: instanceName });
if (data) {
state.instances = data.list;
}
-}
+};
+
const open = async () => {
- await getAllInstances()
- await getAllDatabase()
+ if (state.form.instanceId) {
+ // 根据id获取,因为需要回显实例名称
+ getInstances('', state.form.instanceId);
+ }
+ await getAllDatabase();
};
const btnOk = async () => {
diff --git a/mayfly_go_web/src/views/ops/db/DbList.vue b/mayfly_go_web/src/views/ops/db/DbList.vue
index bdd08ada..3fa32a72 100644
--- a/mayfly_go_web/src/views/ops/db/DbList.vue
+++ b/mayfly_go_web/src/views/ops/db/DbList.vue
@@ -20,8 +20,23 @@
-
-
+
+
+ {{ item.name }}
+
+
+ {{ item.type }} / {{ item.host }}:{{ item.port }}
+
+ {{ item.username }}
+
@@ -234,21 +249,21 @@
- {{ infoDialog.data.tagPath }}
- {{ infoDialog.data.name }}
- {{ infoDialog.data.id }}
- {{ infoDialog.data.database }}
- {{ infoDialog.data.remark }}
- {{ dateFormat(infoDialog.data.createTime) }}
- {{ infoDialog.data.creator }}
- {{ dateFormat(infoDialog.data.updateTime) }}
- {{ infoDialog.data.modifier }}
+ {{ infoDialog.data?.tagPath }}
+ {{ infoDialog.data?.name }}
+ {{ infoDialog.data?.id }}
+ {{ infoDialog.data?.database }}
+ {{ infoDialog.data?.remark }}
+ {{ dateFormat(infoDialog.data?.createTime) }}
+ {{ infoDialog.data?.creator }}
+ {{ dateFormat(infoDialog.data?.updateTime) }}
+ {{ infoDialog.data?.modifier }}
- {{ infoDialog.instance.name }}
- {{ infoDialog.instance.host }}
- {{ infoDialog.instance.port }}
- {{ infoDialog.instance.username }}
- {{ infoDialog.instance.type }}
+ {{ infoDialog.instance?.name }}
+ {{ infoDialog.instance?.host }}
+ {{ infoDialog.instance?.port }}
+ {{ infoDialog.instance?.username }}
+ {{ infoDialog.instance?.type }}
@@ -291,10 +306,7 @@ const perms = {
delDb: 'db:del',
};
-const queryConfig = [
- TableQuery.slot('tagPath', '标签', 'tagPathSelect'),
- TableQuery.slot('instanceId', '实例', 'instanceSelect'),
-];
+const queryConfig = [TableQuery.slot('tagPath', '标签', 'tagPathSelect'), TableQuery.slot('instanceId', '实例', 'instanceSelect')];
const columns = ref([
TableColumn.new('tagPath', '标签路径').isSlot().setAddWidth(20),
@@ -315,7 +327,7 @@ const state = reactive({
dbId: 0,
db: '',
tags: [],
- instances: [],
+ instances: [] as any,
/**
* 选中的数据
*/
@@ -337,7 +349,7 @@ const state = reactive({
instance: null as any,
query: {
instanceId: 0,
- }
+ },
},
showDumpInfo: false,
dumpInfo: {
@@ -504,19 +516,23 @@ const showInfo = async (info: any) => {
};
const onBeforeCloseInfoDialog = () => {
- state.infoDialog.visible = false;
- state.infoDialog.data = null;
- state.infoDialog.instance = null;
+ state.infoDialog.visible = false;
+ state.infoDialog.data = null;
+ state.infoDialog.instance = null;
};
const getTags = async () => {
state.tags = await dbApi.dbTags.request(null);
};
-const getInstances = async () => {
- const data = await dbApi.instances.request(null);
+const getInstances = async (instanceName = '') => {
+ if (!instanceName) {
+ state.instances = [];
+ return;
+ }
+ const data = await dbApi.instances.request({ name: instanceName });
if (data) {
- state.instances = data.list;
+ state.instances = data.list;
}
};
diff --git a/mayfly_go_web/src/views/ops/db/InstanceEdit.vue b/mayfly_go_web/src/views/ops/db/InstanceEdit.vue
index 24e92475..bb3f8ac6 100644
--- a/mayfly_go_web/src/views/ops/db/InstanceEdit.vue
+++ b/mayfly_go_web/src/views/ops/db/InstanceEdit.vue
@@ -26,13 +26,17 @@
-
+
+
+
+
+ 原密码
+
+
+
+
+
@@ -79,7 +83,6 @@ import { dbApi } from './api';
import { ElMessage } from 'element-plus';
import { notBlank } from '@/common/assert';
import { RsaEncrypt } from '@/common/rsa';
-import TagSelect from '../component/TagSelect.vue';
import SshTunnelSelect from '../component/SshTunnelSelect.vue';
const props = defineProps({
@@ -161,11 +164,11 @@ watch(props, (newValue: any) => {
}
state.tabActiveName = 'basic';
if (newValue.data) {
- state.form = { ...newValue.data};
- state.oldUserName = state.form.username
+ state.form = { ...newValue.data };
+ state.oldUserName = state.form.username;
} else {
state.form = { port: 3306 } as any;
- state.oldUserName = null
+ state.oldUserName = null;
}
});
@@ -177,7 +180,7 @@ const btnOk = async () => {
if (!state.form.id) {
notBlank(state.form.password, '新增操作,密码不可为空');
} else if (state.form.username != state.oldUserName) {
- notBlank(state.form.password, '已修改用户名,请输入密码');
+ notBlank(state.form.password, '已修改用户名,请输入密码');
}
dbForm.value.validate(async (valid: boolean) => {
diff --git a/mayfly_go_web/src/views/ops/db/InstanceList.vue b/mayfly_go_web/src/views/ops/db/InstanceList.vue
index 03710b4d..74edec62 100644
--- a/mayfly_go_web/src/views/ops/db/InstanceList.vue
+++ b/mayfly_go_web/src/views/ops/db/InstanceList.vue
@@ -15,7 +15,9 @@
>
添加
- 删除
+ 删除
@@ -50,12 +52,17 @@
-
+
diff --git a/mayfly_go_web/src/views/ops/db/SqlExec.vue b/mayfly_go_web/src/views/ops/db/SqlExec.vue
index 78f8b137..1c1bb68a 100644
--- a/mayfly_go_web/src/views/ops/db/SqlExec.vue
+++ b/mayfly_go_web/src/views/ops/db/SqlExec.vue
@@ -44,8 +44,7 @@