Kaynağa Gözat

feat:【system】租户管理:100%

YunaiV 4 ay önce
ebeveyn
işleme
ba84f64e37

+ 1 - 1
src/api/system/tenant/index.ts

@@ -9,7 +9,7 @@ export interface Tenant {
   contactName: string
   contactName: string
   contactMobile: string
   contactMobile: string
   accountCount: number
   accountCount: number
-  expireTime: Date
+  expireTime: Date | any
   websites: string[]
   websites: string[]
   status: number
   status: number
   createTime?: Date
   createTime?: Date

src/api/system/tenant-package/index.ts → src/api/system/tenant/package/index.ts


+ 2 - 2
src/pages-system/tenant/components/package-list.vue

@@ -56,10 +56,10 @@
 </template>
 </template>
 
 
 <script lang="ts" setup>
 <script lang="ts" setup>
-import type { TenantPackage } from '@/api/system/tenant-package'
+import type { TenantPackage } from '@/api/system/tenant/package'
 import type { LoadMoreState } from '@/http/types'
 import type { LoadMoreState } from '@/http/types'
 import { onMounted, ref } from 'vue'
 import { onMounted, ref } from 'vue'
-import { getTenantPackagePage } from '@/api/system/tenant-package'
+import { getTenantPackagePage } from '@/api/system/tenant/package'
 import { useAccess } from '@/hooks/useAccess'
 import { useAccess } from '@/hooks/useAccess'
 import { DICT_TYPE } from '@/utils/constants'
 import { DICT_TYPE } from '@/utils/constants'
 import { formatDateTime } from '@/utils/date'
 import { formatDateTime } from '@/utils/date'

+ 23 - 1
src/pages-system/tenant/components/tenant-list.vue

@@ -22,6 +22,10 @@
             <text class="mr-8rpx shrink-0 text-[#999]">联系人:</text>
             <text class="mr-8rpx shrink-0 text-[#999]">联系人:</text>
             <text class="min-w-0 flex-1 truncate">{{ item.contactName || '-' }}</text>
             <text class="min-w-0 flex-1 truncate">{{ item.contactName || '-' }}</text>
           </view>
           </view>
+          <view class="mb-12rpx flex items-center text-28rpx text-[#666]">
+            <text class="mr-8rpx text-[#999]">租户套餐:</text>
+            <text>{{ getPackageName(item.packageId) }}</text>
+          </view>
           <view class="mb-12rpx flex items-center text-28rpx text-[#666]">
           <view class="mb-12rpx flex items-center text-28rpx text-[#666]">
             <text class="mr-8rpx text-[#999]">联系手机:</text>
             <text class="mr-8rpx text-[#999]">联系手机:</text>
             <text>{{ item.contactMobile || '-' }}</text>
             <text>{{ item.contactMobile || '-' }}</text>
@@ -65,9 +69,11 @@
 
 
 <script lang="ts" setup>
 <script lang="ts" setup>
 import type { Tenant } from '@/api/system/tenant'
 import type { Tenant } from '@/api/system/tenant'
+import type { TenantPackage } from '@/api/system/tenant/package'
 import type { LoadMoreState } from '@/http/types'
 import type { LoadMoreState } from '@/http/types'
 import { onMounted, ref } from 'vue'
 import { onMounted, ref } from 'vue'
 import { getTenantPage } from '@/api/system/tenant'
 import { getTenantPage } from '@/api/system/tenant'
+import { getTenantPackageList } from '@/api/system/tenant/package'
 import { useAccess } from '@/hooks/useAccess'
 import { useAccess } from '@/hooks/useAccess'
 import { DICT_TYPE } from '@/utils/constants'
 import { DICT_TYPE } from '@/utils/constants'
 import { formatDateTime } from '@/utils/date'
 import { formatDateTime } from '@/utils/date'
@@ -76,12 +82,27 @@ import TenantSearchForm from './tenant-search-form.vue'
 const { hasAccessByCodes } = useAccess()
 const { hasAccessByCodes } = useAccess()
 const total = ref(0)
 const total = ref(0)
 const list = ref<Tenant[]>([])
 const list = ref<Tenant[]>([])
+const packageList = ref<TenantPackage[]>([])
 const loadMoreState = ref<LoadMoreState>('loading')
 const loadMoreState = ref<LoadMoreState>('loading')
 const queryParams = ref({
 const queryParams = ref({
   pageNo: 1,
   pageNo: 1,
   pageSize: 10,
   pageSize: 10,
 })
 })
 
 
+/** 获取套餐名称 */
+function getPackageName(packageId?: number) {
+  if (packageId === 0) {
+    return '系统租户'
+  }
+  const pkg = packageList.value.find(item => item.id === packageId)
+  return pkg?.name || '-'
+}
+
+/** 加载租户套餐列表 */
+async function loadPackageList() {
+  packageList.value = await getTenantPackageList()
+}
+
 /** 查询租户列表 */
 /** 查询租户列表 */
 async function getList() {
 async function getList() {
   loadMoreState.value = 'loading'
   loadMoreState.value = 'loading'
@@ -141,7 +162,8 @@ onReachBottom(() => {
 })
 })
 
 
 /** 初始化 */
 /** 初始化 */
-onMounted(() => {
+onMounted(async () => {
+  await loadPackageList()
   getList()
   getList()
 })
 })
 </script>
 </script>

+ 1 - 1
src/pages-system/tenant/index.vue

@@ -24,8 +24,8 @@
 <script lang="ts" setup>
 <script lang="ts" setup>
 import { computed, ref } from 'vue'
 import { computed, ref } from 'vue'
 import { navigateBackPlus } from '@/utils'
 import { navigateBackPlus } from '@/utils'
-import TenantList from './components/tenant-list.vue'
 import PackageList from './components/package-list.vue'
 import PackageList from './components/package-list.vue'
+import TenantList from './components/tenant-list.vue'
 
 
 definePage({
 definePage({
   style: {
   style: {

+ 2 - 2
src/pages-system/tenant/package/detail/index.vue

@@ -41,10 +41,10 @@
 </template>
 </template>
 
 
 <script lang="ts" setup>
 <script lang="ts" setup>
-import type { TenantPackage } from '@/api/system/tenant-package'
+import type { TenantPackage } from '@/api/system/tenant/package'
 import { onMounted, ref } from 'vue'
 import { onMounted, ref } from 'vue'
 import { useToast } from 'wot-design-uni'
 import { useToast } from 'wot-design-uni'
-import { deleteTenantPackage, getTenantPackage } from '@/api/system/tenant-package'
+import { deleteTenantPackage, getTenantPackage } from '@/api/system/tenant/package'
 import { useAccess } from '@/hooks/useAccess'
 import { useAccess } from '@/hooks/useAccess'
 import { navigateBackPlus } from '@/utils'
 import { navigateBackPlus } from '@/utils'
 import { DICT_TYPE } from '@/utils/constants'
 import { DICT_TYPE } from '@/utils/constants'

+ 3 - 2
src/pages-system/tenant/package/form/index.vue

@@ -57,10 +57,10 @@
 </template>
 </template>
 
 
 <script lang="ts" setup>
 <script lang="ts" setup>
-import type { TenantPackage } from '@/api/system/tenant-package'
+import type { TenantPackage } from '@/api/system/tenant/package'
 import { computed, onMounted, ref } from 'vue'
 import { computed, onMounted, ref } from 'vue'
 import { useToast } from 'wot-design-uni'
 import { useToast } from 'wot-design-uni'
-import { createTenantPackage, getTenantPackage, updateTenantPackage } from '@/api/system/tenant-package'
+import { createTenantPackage, getTenantPackage, updateTenantPackage } from '@/api/system/tenant/package'
 import { getIntDictOptions } from '@/hooks/useDict'
 import { getIntDictOptions } from '@/hooks/useDict'
 import { navigateBackPlus } from '@/utils'
 import { navigateBackPlus } from '@/utils'
 import { DICT_TYPE } from '@/utils/constants'
 import { DICT_TYPE } from '@/utils/constants'
@@ -130,6 +130,7 @@ async function handleSubmit() {
 }
 }
 
 
 /** 初始化 */
 /** 初始化 */
+// TODO @芋艿:这里有个租户套餐的设置;只支持 pc 操作;
 onMounted(() => {
 onMounted(() => {
   getDetail()
   getDetail()
 })
 })

+ 2 - 2
src/pages-system/tenant/tenant/detail/index.vue

@@ -47,11 +47,11 @@
 
 
 <script lang="ts" setup>
 <script lang="ts" setup>
 import type { Tenant } from '@/api/system/tenant'
 import type { Tenant } from '@/api/system/tenant'
-import type { TenantPackage } from '@/api/system/tenant-package'
+import type { TenantPackage } from '@/api/system/tenant/package'
 import { onMounted, ref } from 'vue'
 import { onMounted, ref } from 'vue'
 import { useToast } from 'wot-design-uni'
 import { useToast } from 'wot-design-uni'
 import { deleteTenant, getTenant } from '@/api/system/tenant'
 import { deleteTenant, getTenant } from '@/api/system/tenant'
-import { getTenantPackageList } from '@/api/system/tenant-package'
+import { getTenantPackageList } from '@/api/system/tenant/package'
 import { useAccess } from '@/hooks/useAccess'
 import { useAccess } from '@/hooks/useAccess'
 import { navigateBackPlus } from '@/utils'
 import { navigateBackPlus } from '@/utils'
 import { DICT_TYPE } from '@/utils/constants'
 import { DICT_TYPE } from '@/utils/constants'

+ 4 - 4
src/pages-system/tenant/tenant/form/index.vue

@@ -60,7 +60,7 @@
             label="用户密码"
             label="用户密码"
             label-width="200rpx"
             label-width="200rpx"
             prop="password"
             prop="password"
-            type="password"
+            show-password
             clearable
             clearable
             placeholder="请输入用户密码"
             placeholder="请输入用户密码"
           />
           />
@@ -111,11 +111,11 @@
 
 
 <script lang="ts" setup>
 <script lang="ts" setup>
 import type { Tenant } from '@/api/system/tenant'
 import type { Tenant } from '@/api/system/tenant'
-import type { TenantPackage } from '@/api/system/tenant-package'
+import type { TenantPackage } from '@/api/system/tenant/package'
 import { computed, onMounted, ref } from 'vue'
 import { computed, onMounted, ref } from 'vue'
 import { useToast } from 'wot-design-uni'
 import { useToast } from 'wot-design-uni'
 import { createTenant, getTenant, updateTenant } from '@/api/system/tenant'
 import { createTenant, getTenant, updateTenant } from '@/api/system/tenant'
-import { getTenantPackageList } from '@/api/system/tenant-package'
+import { getTenantPackageList } from '@/api/system/tenant/package'
 import { getIntDictOptions } from '@/hooks/useDict'
 import { getIntDictOptions } from '@/hooks/useDict'
 import { navigateBackPlus } from '@/utils'
 import { navigateBackPlus } from '@/utils'
 import { DICT_TYPE } from '@/utils/constants'
 import { DICT_TYPE } from '@/utils/constants'
@@ -135,7 +135,7 @@ const toast = useToast()
 const getTitle = computed(() => props.id ? '编辑租户' : '新增租户')
 const getTitle = computed(() => props.id ? '编辑租户' : '新增租户')
 const formLoading = ref(false)
 const formLoading = ref(false)
 const packageOptions = ref<TenantPackage[]>([])
 const packageOptions = ref<TenantPackage[]>([])
-const formData = ref<Tenant & { username?: string; password?: string }>({
+const formData = ref<Tenant & { username?: string, password?: string }>({
   id: undefined,
   id: undefined,
   name: '',
   name: '',
   packageId: 0,
   packageId: 0,

+ 40 - 0
src/pages/index/index.ts

@@ -117,6 +117,30 @@ const menuGroupsData: MenuGroup[] = [
         iconColor: '#ff85c0',
         iconColor: '#ff85c0',
         permission: 'system:notify-template:query',
         permission: 'system:notify-template:query',
       },
       },
+      {
+        key: 'tenant',
+        name: '租户管理',
+        icon: 'shop',
+        url: '/pages-system/tenant/index',
+        iconColor: '#9254de',
+        permission: 'system:tenant:query',
+      },
+      {
+        key: 'social',
+        name: '社交用户',
+        icon: 'share',
+        url: '/pages-system/social/index',
+        iconColor: '#08979c',
+        permission: 'system:social-client:query',
+      },
+      {
+        key: 'oauth2',
+        name: 'OAuth2 管理',
+        icon: 'shield-check',
+        url: '/pages-system/oauth2/index',
+        iconColor: '#d48806',
+        permission: 'system:oauth2-client:query',
+      },
     ],
     ],
   },
   },
   {
   {
@@ -139,6 +163,22 @@ const menuGroupsData: MenuGroup[] = [
         iconColor: '#f5222d',
         iconColor: '#f5222d',
         permission: 'infra:api-error-log:query',
         permission: 'infra:api-error-log:query',
       },
       },
+      {
+        key: 'config',
+        name: '参数配置',
+        icon: 'setting',
+        url: '/pages-infra/config/index',
+        iconColor: '#597ef7',
+        permission: 'infra:config:query',
+      },
+      {
+        key: 'dataSourceConfig',
+        name: '数据源配置',
+        icon: 'database',
+        url: '/pages-infra/data-source-config/index',
+        iconColor: '#13c2c2',
+        permission: 'infra:data-source-config:query',
+      },
       {
       {
         key: 'websocket',
         key: 'websocket',
         name: 'WebSocket',
         name: 'WebSocket',