fix: 数据库样式调整

This commit is contained in:
ssongliu
2022-11-23 19:23:41 +08:00
committed by ssongliu
parent a2fb8353de
commit e748f493da
7 changed files with 245 additions and 318 deletions

View File

@@ -1,77 +1,57 @@
<template>
<div>
<Submenu activeName="mysql" />
<div v-if="!mysqlInfo.isExist" style="margin-top: 20px">
<el-alert :closable="false" :title="$t('database.noMysql', ['Mysql'])" type="info">
<el-link icon="Position" @click="goRouter('/apps')" type="primary">
{{ $t('database.goInstall') }}
</el-link>
</el-alert>
</div>
<div v-else>
<el-button v-if="!isOnSetting" style="margin-top: 20px" size="default" icon="Setting" @click="onSetting">
{{ $t('database.setting') }}
</el-button>
<el-button v-if="isOnSetting" style="margin-top: 20px" size="default" icon="Back" @click="onBacklist">
{{ $t('database.backList') }}
</el-button>
<AppStatus :app-key="'mysql'" style="margin-top: 20px" @setting="onSetting"></AppStatus>
<Setting ref="settingRef"></Setting>
<Setting ref="settingRef"></Setting>
<el-card v-if="!isOnSetting" style="margin-top: 5px">
<ComplexTable
:pagination-config="paginationConfig"
v-model:selects="selects"
@search="search"
:data="data"
>
<template #toolbar>
<el-button type="primary" @click="onOpenDialog()">{{ $t('commons.button.create') }}</el-button>
<el-button>phpMyAdmin</el-button>
<el-button type="danger" plain :disabled="selects.length === 0" @click="onBatchDelete(null)">
{{ $t('commons.button.delete') }}
</el-button>
<el-card v-if="!isOnSetting" style="margin-top: 5px">
<ComplexTable :pagination-config="paginationConfig" v-model:selects="selects" @search="search" :data="data">
<template #toolbar>
<el-button type="primary" @click="onOpenDialog()">{{ $t('commons.button.create') }}</el-button>
<el-button>phpMyAdmin</el-button>
<el-button type="danger" plain :disabled="selects.length === 0" @click="onBatchDelete(null)">
{{ $t('commons.button.delete') }}
</el-button>
</template>
<el-table-column type="selection" fix />
<el-table-column :label="$t('commons.table.name')" prop="name" />
<el-table-column :label="$t('commons.login.username')" prop="username" />
<el-table-column :label="$t('commons.login.password')" prop="password">
<template #default="{ row }">
<div v-if="!row.showPassword">
<span style="float: left">***********</span>
<div style="margin-top: 2px; cursor: pointer">
<el-icon style="margin-left: 5px" @click="row.showPassword = true" :size="16">
<View />
</el-icon>
</div>
</div>
<div v-else>
<span style="float: left">{{ row.password }}</span>
<div style="margin-top: 4px; cursor: pointer">
<el-icon style="margin-left: 5px" @click="row.showPassword = false" :size="16">
<Hide />
</el-icon>
</div>
</div>
</template>
<el-table-column type="selection" fix />
<el-table-column :label="$t('commons.table.name')" prop="name" />
<el-table-column :label="$t('commons.login.username')" prop="username" />
<el-table-column :label="$t('commons.login.password')" prop="password">
<template #default="{ row }">
<div v-if="!row.showPassword">
<span style="float: left">***********</span>
<div style="margin-top: 2px; cursor: pointer">
<el-icon style="margin-left: 5px" @click="row.showPassword = true" :size="16">
<View />
</el-icon>
</div>
</div>
<div v-else>
<span style="float: left">{{ row.password }}</span>
<div style="margin-top: 4px; cursor: pointer">
<el-icon style="margin-left: 5px" @click="row.showPassword = false" :size="16">
<Hide />
</el-icon>
</div>
</div>
</template>
</el-table-column>
<el-table-column :label="$t('commons.table.description')" prop="description" />
<el-table-column
prop="createdAt"
:label="$t('commons.table.date')"
:formatter="dateFromat"
show-overflow-tooltip
/>
<fu-table-operations
width="300px"
:buttons="buttons"
:ellipsis="10"
:label="$t('commons.table.operate')"
fix
/>
</ComplexTable>
</el-card>
</div>
</el-table-column>
<el-table-column :label="$t('commons.table.description')" prop="description" />
<el-table-column
prop="createdAt"
:label="$t('commons.table.date')"
:formatter="dateFromat"
show-overflow-tooltip
/>
<fu-table-operations
width="300px"
:buttons="buttons"
:ellipsis="10"
:label="$t('commons.table.operate')"
fix
/>
</ComplexTable>
</el-card>
<el-dialog v-model="changeVisiable" :destroy-on-close="true" width="30%">
<template #header>
<div class="card-header">
@@ -132,18 +112,16 @@ import OperatrDialog from '@/views/database/mysql/create/index.vue';
import BackupRecords from '@/views/database/mysql/backup/index.vue';
import UploadDialog from '@/views/database/mysql/upload/index.vue';
import Setting from '@/views/database/mysql/setting/index.vue';
import AppStatus from '@/components/app-status/index.vue';
import Submenu from '@/views/database/index.vue';
import { dateFromat } from '@/utils/util';
import { onMounted, reactive, ref } from 'vue';
import { reactive, ref } from 'vue';
import { deleteMysqlDB, searchMysqlDBs, updateMysqlDBInfo } from '@/api/modules/database';
import i18n from '@/lang';
import { useDeleteData } from '@/hooks/use-delete-data';
import { ElForm, ElMessage } from 'element-plus';
import { Database } from '@/api/interface/database';
import { Rules } from '@/global/form-rules';
import { CheckAppInstalled } from '@/api/modules/app';
import { useRouter } from 'vue-router';
const router = useRouter();
const selects = ref<any>([]);
const mysqlInfo = reactive({
@@ -187,11 +165,6 @@ const onSetting = async () => {
};
settingRef.value!.acceptParams(params);
};
const onBacklist = async () => {
isOnSetting.value = false;
search();
settingRef.value!.onClose();
};
const changeVisiable = ref(false);
type FormInstance = InstanceType<typeof ElForm>;
@@ -219,20 +192,6 @@ const submitChangeInfo = async (formEl: FormInstance | undefined) => {
});
};
const checkMysqlInstalled = async () => {
const res = await CheckAppInstalled('mysql');
mysqlInfo.isExist = res.data.isExist;
mysqlInfo.name = res.data.name;
mysqlInfo.version = res.data.version;
if (mysqlInfo.isExist) {
search();
}
};
const goRouter = async (path: string) => {
router.push({ path: path });
};
const search = async () => {
let params = {
page: paginationConfig.currentPage,
@@ -302,8 +261,4 @@ const buttons = [
},
},
];
onMounted(() => {
checkMysqlInstalled();
});
</script>