Explorar o código

租户管理列表新增套餐列,新增和修改表单新增套餐编辑

zhontai %!s(int64=2) %!d(string=hai) anos
pai
achega
ed41063b07

+ 79 - 1
src/api/admin/data-contracts.ts

@@ -2221,6 +2221,71 @@ export interface PkgAddPkgTenantListInput {
   tenantIds?: number[] | null
 }
 
+/** 套餐 */
+export interface PkgEntity {
+  /**
+   * 主键Id
+   * @format int64
+   */
+  id?: number
+  /**
+   * 创建者Id
+   * @format int64
+   */
+  createdUserId?: number | null
+  /**
+   * 创建者
+   * @maxLength 50
+   */
+  createdUserName?: string | null
+  /**
+   * 创建时间
+   * @format date-time
+   */
+  createdTime?: string | null
+  /**
+   * 修改者Id
+   * @format int64
+   */
+  modifiedUserId?: number | null
+  /**
+   * 修改者
+   * @maxLength 50
+   */
+  modifiedUserName?: string | null
+  /**
+   * 修改时间
+   * @format date-time
+   */
+  modifiedTime?: string | null
+  /** 是否删除 */
+  isDeleted?: boolean
+  /**
+   * 父级Id
+   * @format int64
+   */
+  parentId?: number
+  /** 子级列表 */
+  childs?: PkgEntity[] | null
+  /** 名称 */
+  name?: string | null
+  /** 编码 */
+  code?: string | null
+  /** 说明 */
+  description?: string | null
+  /** 启用 */
+  enabled?: boolean
+  /**
+   * 排序
+   * @format int32
+   */
+  sort?: number
+  /** 租户列表 */
+  tenants?: TenantEntity[] | null
+  /** 权限列表 */
+  permissions?: PermissionEntity[] | null
+}
+
 export interface PkgGetListOutput {
   /**
    * 主键
@@ -3526,6 +3591,8 @@ export interface TenantAddInput {
    * @minLength 1
    */
   code: string
+  /** 套餐Ids */
+  pkgIds?: number[] | null
   /**
    * 姓名
    * @minLength 1
@@ -3617,6 +3684,8 @@ export interface TenantEntity {
   enabled?: boolean
   /** 说明 */
   description?: string | null
+  /** 套餐列表 */
+  pkgs?: PkgEntity[] | null
 }
 
 export interface TenantGetOutput {
@@ -3659,6 +3728,10 @@ export interface TenantGetOutput {
    * @format int64
    */
   id: number
+  /** 套餐列表 */
+  pkgs?: PkgEntity[] | null
+  /** 套餐Ids */
+  pkgIds?: number[] | null
 }
 
 export interface TenantGetPageDto {
@@ -3676,6 +3749,9 @@ export interface TenantListOutput {
   name?: string | null
   /** 企业编码 */
   code?: string | null
+  pkgs?: PkgEntity[] | null
+  /** 套餐 */
+  pkgNames?: string[] | null
   /** 姓名 */
   realName?: string | null
   /** 账号 */
@@ -3728,6 +3804,8 @@ export interface TenantUpdateInput {
    * @minLength 1
    */
   code: string
+  /** 套餐Ids */
+  pkgIds?: number[] | null
   /**
    * 姓名
    * @minLength 1
@@ -4036,13 +4114,13 @@ export interface UserGetPageOutput {
   email?: string | null
   /** 用户类型:Member=0,DefaultUser=1,TenantAdmin=10,PlatformAdmin=100 */
   type?: UserType
+  roles?: RoleEntity[] | null
   /** 角色 */
   roleNames?: string[] | null
   /** 是否主管 */
   isManager?: boolean
   /** 启用 */
   enabled?: boolean
-  roles?: RoleEntity[] | null
   /**
    * 创建时间
    * @format date-time

+ 32 - 3
src/views/admin/tenant/components/tenant-form.vue

@@ -11,7 +11,7 @@
     >
       <el-form ref="formRef" :model="form" size="default" label-width="80px">
         <el-row :gutter="35">
-          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
+          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
             <el-form-item label="企业名称" prop="name" :rules="[{ required: true, message: '请输入企业名称', trigger: ['blur', 'change'] }]">
               <el-input v-model="form.name" autocomplete="off" />
             </el-form-item>
@@ -21,6 +21,23 @@
               <el-input v-model="form.code" autocomplete="off" />
             </el-form-item>
           </el-col>
+          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
+            <!-- :rules="[{ required: true, message: '请选择套餐', trigger: ['change'] }]" -->
+            <el-form-item label="套餐" prop="pkgIds">
+              <el-select
+                v-model="form.pkgIds"
+                placeholder="请选择套餐"
+                clearable
+                multiple
+                collapse-tags
+                collapse-tags-tooltip
+                filterable
+                class="w100"
+              >
+                <el-option v-for="item in state.pkgData" :key="item.id" :label="item.name" :value="item.id" />
+              </el-select>
+            </el-form-item>
+          </el-col>
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
             <el-form-item label="姓名" prop="realName" :rules="[{ required: true, message: '请输入姓名', trigger: ['blur', 'change'] }]">
               <el-input v-model="form.realName" autocomplete="off" />
@@ -67,8 +84,9 @@
 
 <script lang="ts" setup name="admin/tenant/form">
 import { reactive, toRefs, getCurrentInstance, ref } from 'vue'
-import { TenantAddInput, TenantUpdateInput } from '/@/api/admin/data-contracts'
+import { TenantAddInput, TenantUpdateInput, PkgGetListOutput } from '/@/api/admin/data-contracts'
 import { TenantApi } from '/@/api/admin/Tenant'
+import { PkgApi } from '/@/api/admin/Pkg'
 import { isMobile, testMobile, testEmail } from '/@/utils/test'
 import eventBus from '/@/utils/mitt'
 
@@ -85,12 +103,23 @@ const formRef = ref()
 const state = reactive({
   showDialog: false,
   sureLoading: false,
+  pkgData: [] as PkgGetListOutput[],
   form: {} as TenantAddInput & TenantUpdateInput,
 })
 const { form } = toRefs(state)
 
+const getPkgs = async () => {
+  const res = await new PkgApi().getList().catch(() => {
+    state.pkgData = []
+  })
+
+  state.pkgData = res?.data ?? []
+}
+
 // 打开对话框
 const open = async (row: any = {}) => {
+  await getPkgs()
+
   if (row.id > 0) {
     const res = await new TenantApi().get({ id: row.id }, { loading: true }).catch(() => {
       proxy.$modal.closeLoading()
@@ -100,7 +129,7 @@ const open = async (row: any = {}) => {
       state.form = res.data as TenantAddInput & TenantUpdateInput
     }
   } else {
-    state.form = { enabled: true } as TenantAddInput & TenantUpdateInput
+    state.form = { pkgIds: [] as number[], enabled: true } as TenantAddInput & TenantUpdateInput
   }
   state.showDialog = true
 }

+ 8 - 3
src/views/admin/tenant/index.vue

@@ -2,8 +2,8 @@
   <div class="my-layout">
     <el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
       <el-form :inline="true" @submit.stop.prevent>
-        <el-form-item label="姓名">
-          <el-input v-model="state.filter.name" placeholder="姓名" @keyup.enter="onQuery" />
+        <el-form-item label="企业名称">
+          <el-input v-model="state.filter.name" placeholder="企业名称" @keyup.enter="onQuery" />
         </el-form-item>
         <el-form-item>
           <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
@@ -16,9 +16,14 @@
       <el-table v-loading="state.loading" :data="state.tenantListData" row-key="id" height="'100%'" style="width: 100%; height: 100%">
         <el-table-column prop="name" label="企业名称" min-width="120" show-overflow-tooltip />
         <el-table-column prop="code" label="企业编码" width="120" show-overflow-tooltip />
+        <el-table-column prop="pkgNames" label="套餐" width="140" show-overflow-tooltip>
+          <template #default="{ row }">
+            {{ row.pkgNames ? row.pkgNames.join(',') : '' }}
+          </template>
+        </el-table-column>
         <el-table-column prop="realName" label="姓名" width="120" show-overflow-tooltip />
         <el-table-column prop="phone" label="手机号" width="120" show-overflow-tooltip />
-        <el-table-column prop="email" label="邮箱" min-width="180" show-overflow-tooltip />
+        <!-- <el-table-column prop="email" label="邮箱" min-width="180" show-overflow-tooltip /> -->
         <el-table-column label="状态" width="80" align="center" fixed="right">
           <template #default="{ row }">
             <el-switch

+ 2 - 0
src/views/admin/user/components/user-form.vue

@@ -45,6 +45,7 @@
                 multiple
                 collapse-tags
                 collapse-tags-tooltip
+                filterable
                 class="w100"
               />
             </el-form-item>
@@ -92,6 +93,7 @@
                 multiple
                 collapse-tags
                 collapse-tags-tooltip
+                filterable
                 class="w100"
               />
             </el-form-item>