feat: mysql 列表读写切换

This commit is contained in:
ssongliu
2022-12-24 13:31:30 +08:00
committed by ssongliu
parent e1c2348e44
commit 44df6acb5d
13 changed files with 207 additions and 99 deletions

View File

@@ -75,7 +75,13 @@
</div>
</template>
</el-table-column>
<el-table-column :label="$t('commons.table.description')" prop="description" />
<el-table-column :label="$t('commons.table.description')" prop="description">
<template #default="{ row }">
<fu-read-write-switch :data="row.description" v-model="row.edit" @change="onChange(row)">
<el-input v-model="row.description" @blur="row.edit = false" />
</fu-read-write-switch>
</template>
</el-table-column>
<el-table-column
prop="createdAt"
:label="$t('commons.table.date')"
@@ -193,6 +199,7 @@ import {
loadRemoteAccess,
searchMysqlDBs,
updateMysqlAccess,
updateMysqlDescription,
updateMysqlPassword,
} from '@/api/modules/database';
import i18n from '@/lang';
@@ -343,6 +350,13 @@ const search = async () => {
paginationConfig.total = res.data.total;
};
const onChange = async (info: any) => {
if (!info.edit) {
await updateMysqlDescription({ id: info.id, description: info.description });
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));
}
};
const goRouter = async (path: string) => {
router.push({ path: path });
};