Преглед изворни кода

init

Signed-off-by: houyaf <houyaf@163.com>
houyaf пре 3 година
родитељ
комит
8670c25927

+ 10 - 10
src/api/daas/dbTypeApi.ts

@@ -5,9 +5,9 @@ import apiRequest from '@/network/http/apiRequest'
  * @param data
  * @returns
  */
-export function getDBTypeByList(data: any) {
+export function getDbTypeByList(data: any) {
   return apiRequest({
-    url: '/daas/db/type',
+    url: '/daas/dbType',
     method: 'GET',
     params: data,
   })
@@ -18,9 +18,9 @@ export function getDBTypeByList(data: any) {
  * @param dbTypeId
  * @returns
  */
-export function getDBTypeById(dbTypeId: number) {
+export function getDbTypeById(dbTypeId: number) {
   return apiRequest({
-    url: `/daas/db/type/${dbTypeId}`,
+    url: `/daas/dbType/${dbTypeId}`,
     method: 'GET',
   })
 }
@@ -30,9 +30,9 @@ export function getDBTypeById(dbTypeId: number) {
  * @param data
  * @returns
  */
-export function createDBType(data: any) {
+export function createDbType(data: any) {
   return apiRequest({
-    url: '/daas/db/type/add',
+    url: '/daas/dbType/add',
     method: 'POST',
     data,
   })
@@ -43,9 +43,9 @@ export function createDBType(data: any) {
  * @param data
  * @returns
  */
-export function updateDBType(data: any) {
+export function updateDbType(data: any) {
   return apiRequest({
-    url: '/daas/db/type/update',
+    url: '/daas/dbType/update',
     method: 'PUT',
     data,
   })
@@ -56,9 +56,9 @@ export function updateDBType(data: any) {
  * @param dbTypeId
  * @returns
  */
-export function deleteDBTypeById(dbTypeId: number) {
+export function deleteDbTypeById(dbTypeId: number) {
   return apiRequest({
-    url: `/daas/db/type/${dbTypeId}`,
+    url: `/daas/dbType/${dbTypeId}`,
     method: 'DELETE',
   })
 }

+ 1 - 1
src/api/system/userApi.ts

@@ -3,7 +3,7 @@ import apiRequest from '@/network/http/apiRequest'
 export function getUserList() {
   return apiRequest({
     url: '/user/select',
-    method: 'get',
+    method: 'GET',
   })
 }
 

+ 2 - 2
src/assets/styles/globals.scss

@@ -23,8 +23,8 @@
   // 工具栏高度
   --g-toolbar-height: 50px;
   // 标签页最大最小宽度,两个宽度为同一数值时,则为固定宽度,反之将宽度设置为 unset 则为自适应
-  --g-tabbar-tab-max-width: 150px;
-  --g-tabbar-tab-min-width: 150px;
+  --g-tabbar-tab-max-width: 125px;
+  --g-tabbar-tab-min-width: 125px;
 }
 
 // 明暗模式 CSS 变量

+ 1 - 0
src/network/http/apiRequest.ts

@@ -49,6 +49,7 @@ apiRequest.interceptors.request.use(
   },
 )
 
+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
 apiRequest.interceptors.response.use(
   (response: AxiosResponse<any>) => {
     /**

+ 0 - 22
src/router/modules/daas.ts

@@ -48,27 +48,5 @@ const routes: RouteRecordRaw[] = [
       },
     ],
   },
-  {
-    path: '/daas/data/database-type',
-    component: Layout,
-    redirect: '/daas/data/database-type/index',
-    name: 'dataTypeList',
-    meta: {
-      title: '数据库类型',
-      icon: 'ep:coin',
-    },
-    children: [
-      {
-        path: 'index',
-        name: 'database_type',
-        component: () => import('@/views/daas/database_type/index.vue'),
-        meta: {
-          title: '数据库类型',
-          sidebar: false,
-          activeMenu: '/daas/data/database-type',
-        },
-      },
-    ],
-  },
 ]
 export default routes

+ 8 - 1
src/router/modules/system.ts

@@ -113,7 +113,14 @@ const routes: RouteRecordRaw[] = [
           title: '应用分类',
         },
       },
-
+      {
+        path: 'database_type',
+        name: 'database_type',
+        component: () => import('@/views/daas/database_type/index.vue'),
+        meta: {
+          title: '数据库类型',
+        },
+      },
     ],
   },
 ]

+ 2 - 2
src/settings.ts

@@ -6,10 +6,10 @@ const globalSettings: Settings.all = {
     // 服务API地址
     // serverUrl: 'http://192.168.1.214:8080', // 正式环境
     serverUrl: 'http://127.0.0.1:8080',
-    devServerUrl: 'http://1.15.92.205:8080/', // 开发环境
+    // devServerUrl: 'http://1.15.92.205:8080/', // 开发环境
     // devServerUrl: 'http://113.141.88.27:8000', // 开发环境
     // devServerUrl: 'http://192.168.3.253:8000',
-    // devServerUrl: 'http://127.0.0.1:8000',
+    devServerUrl: 'http://127.0.0.1:8080',
     /**
      * websocket 地址
      * dev 开发环境

+ 3 - 0
src/types/global.d.ts

@@ -335,6 +335,7 @@ declare namespace Settings {
   interface all {
     /** 基本设置 */
     base: base
+
     /** 应用设置 */
     app?: app
     /** 主页设置 */
@@ -460,3 +461,5 @@ declare namespace Iframe {
     isLoading: boolean
   }
 }
+
+declare

+ 7 - 0
src/types/system.d.ts

@@ -3,6 +3,13 @@ export type UserLoginType = {
   password: string
 }
 
+export type apiResult = {
+  code: number
+  msg: string
+  data: any
+}
+
+
 export type UserType = {
   ocId: number
   ocName: string

+ 4 - 2
src/views/app_center/app_store/index.vue

@@ -39,10 +39,11 @@ const onAppEdit = (data: any) => {
 }
 
 const onAppPermit = (data: any) => {
+  const appId = data.appId
   tabbar.open({
     name: 'appPermit',
     params: {
-      appId: data.appId,
+      appId,
     },
   })
 }
@@ -64,6 +65,7 @@ const onAppRemove = (data: any) => {
     })
   }).catch(() => {})
 }
+
 onMounted(() => {
   getData()
 })
@@ -95,7 +97,7 @@ onMounted(() => {
         <el-card shadow="hover" class="action-card">
           <div class="content">
             <div class="item app_logo-wrap">
-              <img :src="item.appLogo" class="app_logo">
+              <img :src="item.appLogo" class="app_logo" alt="">
             </div>
             <div class="item">
               <div class="name">

+ 4 - 3
src/views/app_center/permit/index.vue

@@ -14,6 +14,7 @@ const settingsStore = useSettingsStore()
 const route = useRoute()
 const router = useRouter()
 const tabbar = useTabbar()
+const appId = parseInt(route.params.appId.toString())
 
 interface TreeNode {
   label: string
@@ -28,7 +29,7 @@ const state = reactive({
   roles: [] as TreeNode[],
   permitList: [],
   search: {
-    appId: 0,
+    appId,
     roleId: 0,
     keywords: '',
   },
@@ -72,7 +73,7 @@ const getRoleData = async () => {
       },
     ]
   }
-  nextTick(() => {
+  await nextTick(() => {
     roleTreeRef.value.setCurrentKey(data[0].roleId)
   })
 }
@@ -85,7 +86,7 @@ const permitTableRef = ref()
 const permitRef = ref()
 
 const onPermitAdd = () => {
-  permitRef.value.showAddModel(parseInt(route.params.appId.toString()), state.curRoleId)
+  permitRef.value.showAddModel(appId, state.curRoleId)
 }
 // 返回列表页
 function goBack() {

+ 4 - 4
src/views/daas/database_type/components/DBType.vue → src/views/daas/database_type/components/DbType.vue

@@ -6,7 +6,7 @@ meta:
 <script lang="ts" setup>
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
-import { createDBType, getDBTypeById, updateDBType } from '@/api/daas/dbTypeApi'
+import { createDbType, getDbTypeById, updateDbType } from '@/api/daas/dbTypeApi'
 const emit = defineEmits(['success'])
 
 const formRef = ref<FormInstance>()
@@ -35,7 +35,7 @@ onMounted(() => {})
 
 const getData = async (dbTypeId: number) => {
   state.loading = true
-  const { data } = await getDBTypeById(dbTypeId)
+  const { data } = await getDbTypeById(dbTypeId)
   state.loading = false
   state.formData = data
 }
@@ -44,12 +44,12 @@ function onSubmit() {
   formRef.value && formRef.value.validate(async (valid) => {
     if (valid) {
       if (state.actionType === 1) {
-        await createDBType(state.formData)
+        await createDbType(state.formData)
         state.dialogVisible = false
         emit('success')
       }
       else {
-        await updateDBType(state.formData)
+        await updateDbType(state.formData)
         state.dialogVisible = false
         emit('success')
       }

+ 14 - 16
src/views/daas/database_type/index.vue

@@ -1,7 +1,7 @@
-<script lang="ts" setup name="DBTypeIndex">
+<script lang="ts" setup name="DbTypeIndex">
 import { ElMessage, ElMessageBox } from 'element-plus'
-import DBType from './components/DBType.vue'
-import { deleteDBTypeById, getDBTypeByList } from '@/api/daas/dbTypeApi'
+import DbType from './components/DbType.vue'
+import { deleteDbTypeById, getDbTypeByList } from '@/api/daas/dbTypeApi'
 
 const state = reactive({
   loading: false,
@@ -19,7 +19,7 @@ const appCatRef = ref()
 
 const getDataList = async () => {
   state.loading = true
-  const { data } = await getDBTypeByList({})
+  const { data } = await getDbTypeByList({})
   state.dataList = data
   state.loading = false
 }
@@ -28,20 +28,18 @@ onMounted(() => {
   getDataList()
 })
 
-function onCreate() {}
-
-function onDBTypeAdd() {
+function onDbTypeAdd() {
   appCatRef.value.showAddModel()
 }
 
-function onDBTypeEdit(row: any) {
+function onDbTypeEdit(row: any) {
   const appCatId = row.appCatId
   appCatRef.value.showEditModel(appCatId)
 }
 
-function onDBTypeDel(row: any) {
+function onDbTypeDel(row: any) {
   ElMessageBox.confirm(`确认删除「${row.dbTypeTitle}」吗?`, '确认信息').then(async () => {
-    await deleteDBTypeById(row.appCatId)
+    await deleteDbTypeById(row.dbTypeId)
     await getDataList()
     ElMessage.success({
       message: '删除成功',
@@ -61,7 +59,7 @@ function onDBTypeDel(row: any) {
       </template>
 
       <el-button-group>
-        <el-button type="primary" size="large" plain @click="onDBTypeAdd">
+        <el-button type="primary" size="large" plain @click="onDbTypeAdd">
           <template #icon>
             <el-icon>
               <svg-icon name="ep:plus" />
@@ -76,23 +74,23 @@ function onDBTypeDel(row: any) {
       <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="dbTypeTitle" label="名称" header-align="center" align="center" width="200" />
 
-        <el-table-column prop="appCatDesc" label="说明" />
+        <el-table-column prop="dbTypeDesc" 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 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 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" />
+    <DbType ref="appCatRef" @success="getDataList" />
   </div>
 </template>
 

+ 8 - 3
src/views/paas/api/index.vue

@@ -140,8 +140,13 @@ const onApiDelete = (row: any) => {
   })
 }
 async function onChangeStatus(row: { modId: number;apiId: number; status: number }) {
-  await updateApiStatus(row.modId, row.apiId, row.status)
+  const res = await updateApiStatus(row.modId, row.apiId, row.status)
+  ElMessage.success({
+    message: res.msg,
+    center: true,
+  })
 }
+
 onMounted(() => {
   getModuleData()
 })
@@ -234,8 +239,8 @@ onMounted(() => {
               <template #default="{ row }">
                 <el-switch
                   v-model="row.status"
-                  :active-value="0"
-                  :inactive-value="1"
+                  :active-value="1"
+                  :inactive-value="0"
                   inline-prompt
                   active-text="启用"
                   inactive-text="禁用"

+ 1 - 1
src/views/system/group/index.vue

@@ -40,7 +40,7 @@ const getUserData = async () => {
     state.loading = true
     const { data } = await getUserByPage(params)
     state.loading = false
-    state.userList = data
+    state.userList = data.data
     state.loading = false
   }
 }