Explorar o código

fix: 修改数据库链接页面

wanggaokun hai 1 ano
pai
achega
5e513d26f6
Modificáronse 3 ficheiros con 15 adicións e 96 borrados
  1. 0 24
      src/api/modules/db/connection.ts
  2. 12 69
      src/views/db/connection/index.vue
  3. 3 3
      yarn.lock

+ 0 - 24
src/api/modules/db/connection.ts

@@ -44,27 +44,3 @@ export const updateConnectionApi = (data: ConnectionForm) => {
 export const delConnectionApi = (id: string | number | Array<string | number>) => {
   return http.delete<any>(`/db/connection/${id}`)
 }
-
-/**
- * @name 下载模板
- * @returns returns
- */
-export const importTemplateApi = () => {
-  return http.downloadPost('/db/connection/importTemplate', {})
-}
-
-/**
- * @name 导入数据
- * @returns returns
- */
-export const importConnectionDataApi = (data: any) => {
-  return http.post('/db/connection/importData', data)
-}
-
-/**
- * @name 导出数据
- * @returns returns
- */
-export const exportConnectionApi = (data: any) => {
-  return http.downloadPost('/db/connection/export', data)
-}

+ 12 - 69
src/views/db/connection/index.vue

@@ -4,8 +4,6 @@
       <!-- 表格 header 按钮 -->
       <template #tableHeader="scope">
         <el-button type="primary" v-auth="['db:connection:add']" icon="CirclePlus" @click="openDialog(1, '数据库链接新增')"> 新增 </el-button>
-        <el-button type="primary" v-auth="['db:connection:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button>
-        <el-button type="primary" v-auth="['db:connection:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
         <el-button
           type="danger"
           v-auth="['db:connection:remove']"
@@ -29,29 +27,16 @@
       </template>
     </ProTable>
     <FormDialog ref="formDialogRef" />
-    <ImportExcel ref="dialogRef" />
   </div>
 </template>
 
 <script setup lang="tsx" name="Connection">
 import { ref, reactive } from 'vue'
 import { useHandleData } from '@/hooks/useHandleData'
-import { useDownload } from '@/hooks/useDownload'
-import { ElMessageBox } from 'element-plus'
 import ProTable from '@/components/ProTable/index.vue'
-import ImportExcel from '@/components/ImportExcel/index.vue'
 import FormDialog from '@/components/FormDialog/index.vue'
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
-import {
-  listConnectionApi,
-  delConnectionApi,
-  addConnectionApi,
-  updateConnectionApi,
-  importTemplateApi,
-  importConnectionDataApi,
-  exportConnectionApi,
-  getConnectionApi
-} from '@/api/modules/db/connection'
+import { listConnectionApi, delConnectionApi, addConnectionApi, updateConnectionApi, getConnectionApi } from '@/api/modules/db/connection'
 
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
@@ -69,25 +54,6 @@ const batchDelete = async (ids: string[]) => {
   proTable.value?.getTableList()
 }
 
-// 导出数据库链接列表
-const downloadFile = async () => {
-  ElMessageBox.confirm('确认导出数据库链接数据?', '温馨提示', { type: 'warning' }).then(() =>
-    useDownload(exportConnectionApi, '数据库链接列表', proTable.value?.searchParam)
-  )
-}
-
-// 批量添加数据库链接
-const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
-const batchAdd = () => {
-  const params = {
-    title: '数据库链接',
-    tempApi: importTemplateApi,
-    importApi: importConnectionDataApi,
-    getTableList: proTable.value?.getTableList
-  }
-  dialogRef.value?.acceptParams(params)
-}
-
 const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
 // 打开弹框的功能
 const openDialog = async (type: number, title: string, row?: any) => {
@@ -114,64 +80,47 @@ const columns = reactive<ColumnProps<any>[]>([
   { type: 'selection', fixed: 'left', width: 70 },
   {
     prop: 'id',
-    label: '唯一主键',
-    width: 120
+    label: '编号'
   },
   {
     prop: 'name',
     label: '链接名称',
     search: {
       el: 'input'
-    },
-    width: 120
+    }
   },
   {
     prop: 'type',
     label: '数据库类型',
     search: {
       el: 'input'
-    },
-    width: 120
+    }
   },
   {
     prop: 'driverVersion',
     label: '驱动版本',
     search: {
       el: 'input'
-    },
-    width: 120
+    }
   },
   {
     prop: 'driver',
     label: '驱动类名',
     search: {
       el: 'input'
-    },
-    width: 120
+    }
   },
   {
     prop: 'url',
-    label: 'jdbc-url连接串',
-    search: {
-      el: 'input'
-    },
-    width: 120
+    label: 'jdbc-url连接串'
   },
   {
     prop: 'userName',
-    label: '数据库账号',
-    search: {
-      el: 'input'
-    },
-    width: 120
+    label: '数据库账号'
   },
   {
     prop: 'password',
-    label: '账号密码',
-    search: {
-      el: 'input'
-    },
-    width: 120
+    label: '账号密码'
   },
   { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
 ])
@@ -179,14 +128,6 @@ const columns = reactive<ColumnProps<any>[]>([
 let itemsOptions: ProForm.ItemsOptions[] = []
 const setItemsOptions = () => {
   itemsOptions = [
-    {
-      label: '唯一主键',
-      prop: 'id',
-      rules: [{ required: true, message: '唯一主键不能为空', trigger: 'blur' }],
-      compOptions: {
-        placeholder: '请输入唯一主键'
-      }
-    },
     {
       label: '链接名称',
       prop: 'name',
@@ -242,7 +183,9 @@ const setItemsOptions = () => {
       prop: 'password',
       rules: [{ required: true, message: '账号密码不能为空', trigger: 'blur' }],
       compOptions: {
-        placeholder: '请输入账号密码'
+        placeholder: '请输入账号密码',
+        type: 'password',
+        showPassword: true
       }
     }
   ]

+ 3 - 3
yarn.lock

@@ -7763,9 +7763,9 @@ vue-tsc@^1.8.25:
     semver "^7.5.4"
 
 vue-types@^5.1.1:
-  version "5.1.1"
-  resolved "https://registry.npmmirror.com/vue-types/-/vue-types-5.1.1.tgz#1052b85f440a90ad4ea8249d5aa6f231b92d062e"
-  integrity sha512-FMY/JCLWePXgGIcMDqYdJsQm1G0CDxEjq6W0+tZMJZlX37q/61eSGSIa/XFRwa9T7kkKXuxxl94/2kgxyWQqKw==
+  version "5.1.2"
+  resolved "https://registry.npmmirror.com/vue-types/-/vue-types-5.1.2.tgz#8733d8c52e5e95fa9718e3d362760d1516320c87"
+  integrity sha512-NdwLhEl2hn2PRsHb+eYgwBfimFZB2Y0s11YqFRX0VEMrDZZvzPXYxcUJ+aH7AIHyxGc47qdgakVzcjw6bZElBw==
   dependencies:
     is-plain-object "5.0.0"