|
|
@@ -1,7 +1,12 @@
|
|
|
<script lang="ts" setup name="DBTypeIndex">
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
-import DBType from './components/RepoType.vue'
|
|
|
-import { deleteRepoTypeById, getRepoTypeByList } from '@/api/repo/repoTypeApi'
|
|
|
+import RepoComponent from './components/Repo.vue'
|
|
|
+import { deleteRepoById, getRepoListById } from '@/api/repo/repoApi'
|
|
|
+import useSettingsStore from '@/store/modules/settings'
|
|
|
+
|
|
|
+const settingsStore = useSettingsStore()
|
|
|
+const router = useRouter()
|
|
|
+const tabbar = useTabbar()
|
|
|
|
|
|
const state = reactive({
|
|
|
loading: false,
|
|
|
@@ -12,87 +17,245 @@ const state = reactive({
|
|
|
keywords: '',
|
|
|
},
|
|
|
// 列表数据
|
|
|
- dataList: [],
|
|
|
+ repoDBList: [],
|
|
|
+ repoFileList: [],
|
|
|
+ repoCacheList: [],
|
|
|
})
|
|
|
|
|
|
-const appCatRef = ref()
|
|
|
+const repoRef = ref()
|
|
|
|
|
|
-const getDataList = async () => {
|
|
|
+const getRepoList = async (repoTypeId: number) => {
|
|
|
state.loading = true
|
|
|
- const { data } = await getRepoTypeByList({})
|
|
|
- state.dataList = data
|
|
|
+ const { data } = await getRepoListById(repoTypeId)
|
|
|
+ if (repoTypeId === 1) {
|
|
|
+ state.repoDBList = data
|
|
|
+ }
|
|
|
+ else if (repoTypeId === 2) {
|
|
|
+ state.repoFileList = data
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ state.repoCacheList = data
|
|
|
+ }
|
|
|
state.loading = false
|
|
|
}
|
|
|
|
|
|
+const getRepoData = async () => {
|
|
|
+ await getRepoList(1)
|
|
|
+ await getRepoList(2)
|
|
|
+ await getRepoList(3)
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
- getDataList()
|
|
|
+ getRepoData()
|
|
|
})
|
|
|
|
|
|
-function onCreate() {}
|
|
|
+function onRepoAdd(repoTypeId: number) {
|
|
|
+ repoRef.value.showAddModel(repoTypeId)
|
|
|
+}
|
|
|
|
|
|
-function onDBTypeAdd() {
|
|
|
- appCatRef.value.showAddModel()
|
|
|
+function onRepoEdit(row: any) {
|
|
|
+ const { repoTypeId, repoId } = row
|
|
|
+ repoRef.value.showEditModel(repoTypeId, repoId)
|
|
|
}
|
|
|
|
|
|
-function onDBTypeEdit(row: any) {
|
|
|
- const appCatId = row.appCatId
|
|
|
- appCatRef.value.showEditModel(appCatId)
|
|
|
+function onRepoDel(row: any) {
|
|
|
+ const { repoId, repoTypeId, repoTitle } = row
|
|
|
+ ElMessageBox.confirm(`确认删除「${repoTitle}」吗?`, '确认信息').then(async () => {
|
|
|
+ const { msg } = await deleteRepoById(repoTypeId, repoId)
|
|
|
+ ElMessage.success(msg)
|
|
|
+ await getRepoList(repoTypeId)
|
|
|
+ }).catch(() => {})
|
|
|
}
|
|
|
|
|
|
-function onDBTypeDel(row: any) {
|
|
|
- ElMessageBox.confirm(`确认删除「${row.repoTypeTitle}」吗?`, '确认信息').then(async () => {
|
|
|
- await deleteRepoTypeById(row.repoId)
|
|
|
- await getDataList()
|
|
|
- ElMessage.success({
|
|
|
- message: '删除成功',
|
|
|
- center: true,
|
|
|
+// 编辑对象
|
|
|
+const onRepoDetails = (row: { repoTypeId: number; repoId: number }) => {
|
|
|
+ if (settingsStore.settings.tabbar.enable && settingsStore.settings.tabbar.mergeTabsBy !== 'activeMenu') {
|
|
|
+ tabbar.open({
|
|
|
+ name: 'repoDBDetails',
|
|
|
+ params: {
|
|
|
+ repoTypeId: row.repoTypeId,
|
|
|
+ repoId: row.repoId,
|
|
|
+ },
|
|
|
})
|
|
|
- }).catch(() => {})
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ router.push({
|
|
|
+ name: 'repoDBDetails',
|
|
|
+ params: {
|
|
|
+ repoTypeId: row.repoTypeId,
|
|
|
+ repoId: row.repoId,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div :class="{ 'absolute-container': state.tableAutoHeight }">
|
|
|
- <page-header title="数据库接入设定">
|
|
|
+ <div class="absolute-container">
|
|
|
+ <page-header title="数据仓库">
|
|
|
<template #content>
|
|
|
<div>
|
|
|
- 系统支持多种数据库接入,用于设定接入参数
|
|
|
+ 用于管理各种类型的数据仓库
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
- <el-button-group>
|
|
|
- <el-button type="primary" size="large" plain @click="onDBTypeAdd">
|
|
|
- <template #icon>
|
|
|
- <el-icon>
|
|
|
- <svg-icon name="ep:plus" />
|
|
|
- </el-icon>
|
|
|
- </template>
|
|
|
- 新增
|
|
|
- </el-button>
|
|
|
- </el-button-group>
|
|
|
</page-header>
|
|
|
|
|
|
- <page-main>
|
|
|
- <el-table v-loading="state.loading" class="list-table" :data="state.dataList" border stripe highlight-current-row height="100%">
|
|
|
- <el-table-column type="index" label="序号" width="60" header-align="center" align="center" />
|
|
|
-
|
|
|
- <el-table-column prop="appCatTitle" label="名称" header-align="center" align="center" width="200" />
|
|
|
-
|
|
|
- <el-table-column prop="appCatDesc" label="说明" />
|
|
|
-
|
|
|
- <el-table-column label="操作" width="250" align="center" fixed="right">
|
|
|
- <template #default="scope">
|
|
|
- <el-button type="primary" size="small" plain @click="onDBTypeEdit(scope.row)">
|
|
|
- 编辑
|
|
|
- </el-button>
|
|
|
- <el-button v-if="!scope.row.isFixed" type="danger" size="small" plain @click="onDBTypeDel(scope.row)">
|
|
|
- 删除
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </page-main>
|
|
|
- <DBType ref="appCatRef" @success="getDataList" />
|
|
|
+ <el-row :gutter="20" style="margin: -10px 10px;">
|
|
|
+ <el-col :md="16">
|
|
|
+ <page-main style="margin: 10px 0;">
|
|
|
+ <tool-bar>
|
|
|
+ <template #left>
|
|
|
+ <h3>数据库</h3>
|
|
|
+ </template>
|
|
|
+ <template #right>
|
|
|
+ <el-button type="success" plain @click="onRepoAdd(1)">
|
|
|
+ <template #icon>
|
|
|
+ <el-icon>
|
|
|
+ <svg-icon name="i-ep:plus" />
|
|
|
+ </el-icon>
|
|
|
+ </template>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </tool-bar>
|
|
|
+
|
|
|
+ <el-table v-loading="state.loading" class="list-table" :data="state.repoDBList" :border="false" :stripe="false" :show-header="false" height="100%">
|
|
|
+ <el-table-column type="index" width="50" fixed="left" />
|
|
|
+
|
|
|
+ <el-table-column prop="repoTitle" label="名称" header-align="center" align="center" width="150">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-icon size="16px" style="margin-right: 5px;">
|
|
|
+ <svg-icon name="ep:coin" />
|
|
|
+ </el-icon>
|
|
|
+ <span>{{ scope.row.repoTitle }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="repoCatTitle" label="类型" header-align="center" align="center" width="150">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-tag type="success">
|
|
|
+ {{ scope.row.repoCatTitle }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="repoDesc" label="说明" header-align="left" align="left">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ scope.row.repoDesc }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="操作" width="220" header-align="center" align="right" fixed="right">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button type="primary" size="small" plain @click="onRepoDetails(scope.row)">
|
|
|
+ 详情
|
|
|
+ </el-button>
|
|
|
+ <el-button type="warning" size="small" plain @click="onRepoEdit(scope.row)">
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="!scope.row.isFixed" type="danger" size="small" plain @click="onRepoDel(scope.row)">
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </page-main>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :md="8">
|
|
|
+ <page-main style="margin: 10px 0;">
|
|
|
+ <tool-bar>
|
|
|
+ <template #left>
|
|
|
+ <h3>文件服务器</h3>
|
|
|
+ </template>
|
|
|
+ <template #right>
|
|
|
+ <el-button type="success" plain @click="onRepoAdd(2)">
|
|
|
+ <template #icon>
|
|
|
+ <el-icon>
|
|
|
+ <svg-icon name="i-ep:plus" />
|
|
|
+ </el-icon>
|
|
|
+ </template>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </tool-bar>
|
|
|
+
|
|
|
+ <el-table v-loading="state.loading" class="list-table" :data="state.repoFileList" :border="false" :stripe="false" :show-header="false" height="100%">
|
|
|
+ <el-table-column type="index" label="序号" width="50" header-align="center" align="center" />
|
|
|
+
|
|
|
+ <el-table-column prop="repoTitle" label="名称" header-align="center" align="center" width="100">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-icon size="16px" style="margin-right: 5px;">
|
|
|
+ <svg-icon name="ep:files" />
|
|
|
+ </el-icon>
|
|
|
+ <span>{{ scope.row.repoTitle }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="repoTitle" label="名称" header-align="center" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-tag type="warning">
|
|
|
+ {{ scope.row.repoCatTitle }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="操作" width="150" align="center" fixed="right">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button type="warning" size="small" plain @click="onRepoEdit(scope.row)">
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="!scope.row.isFixed" type="danger" size="small" plain @click="onRepoDel(scope.row)">
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </page-main>
|
|
|
+
|
|
|
+ <page-main style="margin: 10px 0;">
|
|
|
+ <tool-bar>
|
|
|
+ <template #left>
|
|
|
+ <h3>高速缓存</h3>
|
|
|
+ </template>
|
|
|
+ <template #right>
|
|
|
+ <el-button type="success" plain @click="onRepoAdd(3)">
|
|
|
+ <template #icon>
|
|
|
+ <el-icon>
|
|
|
+ <svg-icon name="i-ep:plus" />
|
|
|
+ </el-icon>
|
|
|
+ </template>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </tool-bar>
|
|
|
+ <el-table v-loading="state.loading" class="list-table" :data="state.repoCacheList" :border="false" :stripe="false" :show-header="false" height="100%">
|
|
|
+ <el-table-column type="index" label="序号" width="50" header-align="center" align="center" />
|
|
|
+
|
|
|
+ <el-table-column prop="repoTitle" label="名称" header-align="center" align="center" width="100">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ scope.row.repoTitle }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="repoTitle" label="名称" header-align="center" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ scope.row.repoCatTitle }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="操作" width="150" align="center" fixed="right">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button type="warning" size="small" plain @click="onRepoEdit(scope.row)">
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="!scope.row.isFixed" type="danger" size="small" plain @click="onRepoDel(scope.row)">
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </page-main>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <RepoComponent ref="repoRef" @success="getRepoData" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -104,10 +267,6 @@ function onDBTypeDel(row: any) {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
|
|
|
- .page-header {
|
|
|
- margin-bottom: 0;
|
|
|
- }
|
|
|
-
|
|
|
.page-main {
|
|
|
// 让 page-main 的高度自适应
|
|
|
flex: 1;
|
|
|
@@ -115,6 +274,12 @@ function onDBTypeDel(row: any) {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
|
|
|
+ .tool-bar {
|
|
|
+ h3{
|
|
|
+ color: #757d87;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.search-container {
|
|
|
margin-bottom: 0;
|
|
|
}
|