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

增加租户业务案例,包括创建业务菜单、api服务等

zuohuaijun пре 3 година
родитељ
комит
a1c727c9d6

+ 20 - 0
Admin.NET/Admin.NET.Application/SeedData/SysMenuSeedData.cs

@@ -0,0 +1,20 @@
+namespace Admin.NET.Application.SeedData;
+
+/// <summary>
+/// 系统菜单表种子数据
+/// </summary>
+public class SysMenuSeedData : ISqlSugarEntitySeedData<SysMenu>
+{
+    /// <summary>
+    /// 种子数据
+    /// </summary>
+    /// <returns></returns>
+    public IEnumerable<SysMenu> HasData()
+    {
+        return new[]
+        {
+            new SysMenu{ Id=252885263002120, Pid=0, Title="业务测试", Path="/test", Name="test", Component="Layout", Redirect="/test/tenant", Icon="ele-Position", Type=MenuTypeEnum.Dir, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Order=20 },
+            new SysMenu{ Id=252885263002121, Pid=252885263002120, Title="租户业务", Path="/test/tenant", Name="testTenant", Component="/test/tenant/index", Icon="ele-OfficeBuilding", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Order=100 },
+        };
+    }
+}

+ 0 - 2
Admin.NET/Admin.NET.Core/Service/Menu/SysMenuService.cs

@@ -1,5 +1,3 @@
-using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinUserInfoBatchGetResponse.Types;
-
 namespace Admin.NET.Core.Service;
 
 /// <summary>

+ 2 - 2
Admin.NET/Admin.NET.Core/Service/Org/SysOrgService.cs

@@ -68,7 +68,7 @@ public class SysOrgService : IDynamicApiController, ITransient
     [HttpPost("/sysOrg/add")]
     public async Task<long> AddOrg(AddOrgInput input)
     {
-        var isExist = await _sysOrgRep.IsAnyAsync(u => u.Code == input.Code && u.Name == input.Name);
+        var isExist = await _sysOrgRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code);
         if (isExist)
             throw Oops.Oh(ErrorCodeEnum.D2002);
 
@@ -108,7 +108,7 @@ public class SysOrgService : IDynamicApiController, ITransient
             throw Oops.Oh(ErrorCodeEnum.D2001);
 
         var sysOrg = await _sysOrgRep.GetFirstAsync(u => u.Id == input.Id);
-        var isExist = await _sysOrgRep.IsAnyAsync(u => (u.Name == input.Name && u.Code == input.Code) && u.Id != sysOrg.Id);
+        var isExist = await _sysOrgRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code && u.Id != sysOrg.Id);
         if (isExist)
             throw Oops.Oh(ErrorCodeEnum.D2002);
 

+ 1 - 1
Admin.NET/Admin.NET.Core/Service/Pos/SysPosService.cs

@@ -53,7 +53,7 @@ public class SysPosService : IDynamicApiController, ITransient
     [HttpPost("/sysPos/update")]
     public async Task UpdatePos(UpdatePosInput input)
     {
-        var isExist = await _sysPosRep.IsAnyAsync(u => (u.Name == input.Name || u.Code == input.Code) && u.Id != input.Id);
+        var isExist = await _sysPosRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code && u.Id != input.Id);
         if (isExist)
             throw Oops.Oh(ErrorCodeEnum.D6000);
 

+ 1 - 1
Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs

@@ -50,7 +50,7 @@ public class SysRegionService : IDynamicApiController, ITransient
     [HttpPost("/sysRegion/add")]
     public async Task<long> AddRegion(AddRegionInput input)
     {
-        var isExist = await _sysRegionRep.IsAnyAsync(u => u.Code == input.Code && u.Name == input.Name);
+        var isExist = await _sysRegionRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code);
         if (isExist)
             throw Oops.Oh(ErrorCodeEnum.R2002);
 

+ 2 - 2
Admin.NET/Admin.NET.Core/Service/Role/SysRoleService.cs

@@ -64,7 +64,7 @@ public class SysRoleService : IDynamicApiController, ITransient
     [HttpPost("/sysRole/add")]
     public async Task AddRole(AddRoleInput input)
     {
-        var isExist = await _sysRoleRep.IsAnyAsync(u => u.Name == input.Name);
+        var isExist = await _sysRoleRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code);
         if (isExist)
             throw Oops.Oh(ErrorCodeEnum.D1006);
 
@@ -97,7 +97,7 @@ public class SysRoleService : IDynamicApiController, ITransient
     [HttpPost("/sysRole/update")]
     public async Task UpdateRole(UpdateRoleInput input)
     {
-        var isExist = await _sysRoleRep.IsAnyAsync(u => u.Name == input.Name && u.Id != input.Id);
+        var isExist = await _sysRoleRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code && u.Id != input.Id);
         if (isExist)
             throw Oops.Oh(ErrorCodeEnum.D1006);
 

+ 14 - 0
Web/src/api-services/_business/api.ts

@@ -0,0 +1,14 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * 租户业务服务
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */export * from './apis/tenant-business-api';
+

+ 191 - 0
Web/src/api-services/_business/apis/tenant-business-api.ts

@@ -0,0 +1,191 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * 租户业务服务
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios';
+import { Configuration } from '../../configuration';
+// Some imports not used depending on template conditions
+// @ts-ignore
+import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../base';
+import { AdminResultBoolean } from '../models';
+import { AdminResultListTenantBusiness } from '../models';
+/**
+ * TenantBusinessApi - axios parameter creator
+ * @export
+ */
+export const TenantBusinessApiAxiosParamCreator = function (configuration?: Configuration) {
+    return {
+        /**
+         * 
+         * @summary 增加租户业务数据
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        apiTenantBusinessAddBusinessPost: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
+            const localVarPath = `/api/tenantBusiness/addBusiness`;
+            // use dummy base URL string because the URL constructor only accepts absolute URLs.
+            const localVarUrlObj = new URL(localVarPath, 'https://example.com');
+            let baseOptions;
+            if (configuration) {
+                baseOptions = configuration.baseOptions;
+            }
+            const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
+            const localVarHeaderParameter = {} as any;
+            const localVarQueryParameter = {} as any;
+
+            // authentication Bearer required
+
+            const query = new URLSearchParams(localVarUrlObj.search);
+            for (const key in localVarQueryParameter) {
+                query.set(key, localVarQueryParameter[key]);
+            }
+            for (const key in options.params) {
+                query.set(key, options.params[key]);
+            }
+            localVarUrlObj.search = (new URLSearchParams(query)).toString();
+            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
+            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
+
+            return {
+                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
+                options: localVarRequestOptions,
+            };
+        },
+        /**
+         * 
+         * @summary 查询租户业务数据
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        apiTenantBusinessGetBusinessListGet: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
+            const localVarPath = `/api/tenantBusiness/getBusinessList`;
+            // use dummy base URL string because the URL constructor only accepts absolute URLs.
+            const localVarUrlObj = new URL(localVarPath, 'https://example.com');
+            let baseOptions;
+            if (configuration) {
+                baseOptions = configuration.baseOptions;
+            }
+            const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
+            const localVarHeaderParameter = {} as any;
+            const localVarQueryParameter = {} as any;
+
+            // authentication Bearer required
+
+            const query = new URLSearchParams(localVarUrlObj.search);
+            for (const key in localVarQueryParameter) {
+                query.set(key, localVarQueryParameter[key]);
+            }
+            for (const key in options.params) {
+                query.set(key, options.params[key]);
+            }
+            localVarUrlObj.search = (new URLSearchParams(query)).toString();
+            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
+            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
+
+            return {
+                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
+                options: localVarRequestOptions,
+            };
+        },
+    }
+};
+
+/**
+ * TenantBusinessApi - functional programming interface
+ * @export
+ */
+export const TenantBusinessApiFp = function(configuration?: Configuration) {
+    return {
+        /**
+         * 
+         * @summary 增加租户业务数据
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        async apiTenantBusinessAddBusinessPost(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultBoolean>>> {
+            const localVarAxiosArgs = await TenantBusinessApiAxiosParamCreator(configuration).apiTenantBusinessAddBusinessPost(options);
+            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
+                const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
+                return axios.request(axiosRequestArgs);
+            };
+        },
+        /**
+         * 
+         * @summary 查询租户业务数据
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        async apiTenantBusinessGetBusinessListGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultListTenantBusiness>>> {
+            const localVarAxiosArgs = await TenantBusinessApiAxiosParamCreator(configuration).apiTenantBusinessGetBusinessListGet(options);
+            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
+                const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
+                return axios.request(axiosRequestArgs);
+            };
+        },
+    }
+};
+
+/**
+ * TenantBusinessApi - factory interface
+ * @export
+ */
+export const TenantBusinessApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
+    return {
+        /**
+         * 
+         * @summary 增加租户业务数据
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        async apiTenantBusinessAddBusinessPost(options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultBoolean>> {
+            return TenantBusinessApiFp(configuration).apiTenantBusinessAddBusinessPost(options).then((request) => request(axios, basePath));
+        },
+        /**
+         * 
+         * @summary 查询租户业务数据
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        async apiTenantBusinessGetBusinessListGet(options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultListTenantBusiness>> {
+            return TenantBusinessApiFp(configuration).apiTenantBusinessGetBusinessListGet(options).then((request) => request(axios, basePath));
+        },
+    };
+};
+
+/**
+ * TenantBusinessApi - object-oriented interface
+ * @export
+ * @class TenantBusinessApi
+ * @extends {BaseAPI}
+ */
+export class TenantBusinessApi extends BaseAPI {
+    /**
+     * 
+     * @summary 增加租户业务数据
+     * @param {*} [options] Override http request option.
+     * @throws {RequiredError}
+     * @memberof TenantBusinessApi
+     */
+    public async apiTenantBusinessAddBusinessPost(options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultBoolean>> {
+        return TenantBusinessApiFp(this.configuration).apiTenantBusinessAddBusinessPost(options).then((request) => request(this.axios, this.basePath));
+    }
+    /**
+     * 
+     * @summary 查询租户业务数据
+     * @param {*} [options] Override http request option.
+     * @throws {RequiredError}
+     * @memberof TenantBusinessApi
+     */
+    public async apiTenantBusinessGetBusinessListGet(options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultListTenantBusiness>> {
+        return TenantBusinessApiFp(this.configuration).apiTenantBusinessGetBusinessListGet(options).then((request) => request(this.axios, this.basePath));
+    }
+}

+ 16 - 0
Web/src/api-services/_business/index.ts

@@ -0,0 +1,16 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * 租户业务服务
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+export * from "./api";
+export * from "./models";
+

+ 56 - 0
Web/src/api-services/_business/models/admin-result-boolean.ts

@@ -0,0 +1,56 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * 租户业务服务
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+/**
+ * 全局返回结果
+ * @export
+ * @interface AdminResultBoolean
+ */
+export interface AdminResultBoolean {
+    /**
+     * 状态码
+     * @type {number}
+     * @memberof AdminResultBoolean
+     */
+    code?: number;
+    /**
+     * 类型success、warning、error
+     * @type {string}
+     * @memberof AdminResultBoolean
+     */
+    type?: string | null;
+    /**
+     * 错误信息
+     * @type {string}
+     * @memberof AdminResultBoolean
+     */
+    message?: string | null;
+    /**
+     * 数据
+     * @type {boolean}
+     * @memberof AdminResultBoolean
+     */
+    result?: boolean;
+    /**
+     * 附加数据
+     * @type {any}
+     * @memberof AdminResultBoolean
+     */
+    extras?: any | null;
+    /**
+     * 时间
+     * @type {Date}
+     * @memberof AdminResultBoolean
+     */
+    time?: Date;
+}

+ 57 - 0
Web/src/api-services/_business/models/admin-result-list-tenant-business.ts

@@ -0,0 +1,57 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * 租户业务服务
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+import { TenantBusiness } from './tenant-business';
+/**
+ * 全局返回结果
+ * @export
+ * @interface AdminResultListTenantBusiness
+ */
+export interface AdminResultListTenantBusiness {
+    /**
+     * 状态码
+     * @type {number}
+     * @memberof AdminResultListTenantBusiness
+     */
+    code?: number;
+    /**
+     * 类型success、warning、error
+     * @type {string}
+     * @memberof AdminResultListTenantBusiness
+     */
+    type?: string | null;
+    /**
+     * 错误信息
+     * @type {string}
+     * @memberof AdminResultListTenantBusiness
+     */
+    message?: string | null;
+    /**
+     * 数据
+     * @type {Array<TenantBusiness>}
+     * @memberof AdminResultListTenantBusiness
+     */
+    result?: Array<TenantBusiness> | null;
+    /**
+     * 附加数据
+     * @type {any}
+     * @memberof AdminResultListTenantBusiness
+     */
+    extras?: any | null;
+    /**
+     * 时间
+     * @type {Date}
+     * @memberof AdminResultListTenantBusiness
+     */
+    time?: Date;
+}

+ 3 - 0
Web/src/api-services/_business/models/index.ts

@@ -0,0 +1,3 @@
+export * from './admin-result-boolean';
+export * from './admin-result-list-tenant-business';
+export * from './tenant-business';

+ 74 - 0
Web/src/api-services/_business/models/tenant-business.ts

@@ -0,0 +1,74 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * 租户业务服务
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+/**
+ * 租户业务分库表
+ * @export
+ * @interface TenantBusiness
+ */
+export interface TenantBusiness {
+    /**
+     * 雪花Id
+     * @type {number}
+     * @memberof TenantBusiness
+     */
+    id?: number;
+    /**
+     * 创建时间
+     * @type {Date}
+     * @memberof TenantBusiness
+     */
+    createTime?: Date | null;
+    /**
+     * 更新时间
+     * @type {Date}
+     * @memberof TenantBusiness
+     */
+    updateTime?: Date | null;
+    /**
+     * 创建者Id
+     * @type {number}
+     * @memberof TenantBusiness
+     */
+    createUserId?: number | null;
+    /**
+     * 修改者Id
+     * @type {number}
+     * @memberof TenantBusiness
+     */
+    updateUserId?: number | null;
+    /**
+     * 软删除
+     * @type {boolean}
+     * @memberof TenantBusiness
+     */
+    isDelete?: boolean;
+    /**
+     * 姓名
+     * @type {string}
+     * @memberof TenantBusiness
+     */
+    name: string;
+    /**
+     * 年龄
+     * @type {number}
+     * @memberof TenantBusiness
+     */
+    age?: number;
+    /**
+     * 出生日期
+     * @type {Date}
+     * @memberof TenantBusiness
+     */
+    birthDate?: Date;
+}

+ 1 - 1
Web/src/theme/element.scss

@@ -259,7 +259,7 @@
 	margin-right: 0;
 	padding-top: 10px;
 	// border-bottom: 1px solid var(--el-color-primary-light-1);
-	background: var(--el-color-primary);
+	background: var(--el-color-primary-light-1);
 
 }
 .el-dialog__footer {

+ 1 - 1
Web/src/views/system/config/component/editConfig.vue

@@ -64,7 +64,7 @@ import { SysConfigApi } from '/@/api-services/api';
 import { UpdateConfigInput } from '/@/api-services/models';
 
 export default defineComponent({
-	name: 'sysEditPos',
+	name: 'sysEditConfig',
 	components: {},
 	props: {
 		title: {

+ 1 - 1
Web/src/views/system/role/component/editRole.vue

@@ -9,7 +9,7 @@
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
-						<el-form-item label="角色编码" prop="code">
+						<el-form-item label="角色编码" prop="code" :rules="[{ required: true, message: '角色编码不能为空', trigger: 'blur' }]">
 							<el-input v-model="ruleForm.code" placeholder="角色编码" clearable />
 						</el-form-item>
 					</el-col>

+ 78 - 0
Web/src/views/test/tenant/component/editTenant.vue

@@ -0,0 +1,78 @@
+<template>
+	<div class="tenant-container">
+		<el-dialog v-model="isShowDialog" :title="title" draggable width="600px">
+			<el-form :model="ruleForm" ref="ruleFormRef" size="default" label-width="80px">
+				<el-row :gutter="35">
+					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
+						<el-form-item label="名称" prop="name" :rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]">
+							<el-input v-model="ruleForm.name" placeholder="名称" clearable />
+						</el-form-item>
+					</el-col>
+				</el-row>
+			</el-form>
+			<template #footer>
+				<span class="dialog-footer">
+					<el-button @click="cancel" size="default">取 消</el-button>
+					<el-button type="primary" @click="submit" size="default">确 定</el-button>
+				</span>
+			</template>
+		</el-dialog>
+	</div>
+</template>
+
+<script lang="ts">
+import { reactive, toRefs, defineComponent, getCurrentInstance, ref } from 'vue';
+
+import { getAPI } from '/@/utils/axios-utils';
+import { TenantBusinessApi } from '/@/api-services/_business/api';
+import { TenantBusiness } from '/@/api-services/_business/models';
+
+export default defineComponent({
+	name: 'sysEditTenant',
+	components: {},
+	props: {
+		title: {
+			type: String,
+			default: '',
+		},
+	},
+	setup() {
+		const { proxy } = getCurrentInstance() as any;
+		const ruleFormRef = ref();
+		const state = reactive({
+			isShowDialog: false,
+			ruleForm: {} as TenantBusiness,
+		});
+		// 打开弹窗
+		const openDialog = (row: any) => {
+			state.ruleForm = row;
+			state.isShowDialog = true;
+		};
+		// 关闭弹窗
+		const closeDialog = () => {
+			proxy.mittBus.emit('submitRefresh');
+			state.isShowDialog = false;
+		};
+		// 取消
+		const cancel = () => {
+			state.isShowDialog = false;
+		};
+		// 提交
+		const submit = () => {
+			ruleFormRef.value.validate(async (valid: boolean) => {
+				if (!valid) return;
+				await getAPI(TenantBusinessApi).apiTenantBusinessAddBusinessPost();
+				closeDialog();
+			});
+		};
+		return {
+			ruleFormRef,
+			openDialog,
+			closeDialog,
+			cancel,
+			submit,
+			...toRefs(state),
+		};
+	},
+});
+</script>

+ 113 - 0
Web/src/views/test/tenant/index.vue

@@ -0,0 +1,113 @@
+<template>
+	<div class="tenant-container">
+		<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
+			<el-form :model="queryParams" ref="queryForm" :inline="true">
+				<el-form-item label="名称" prop="name">
+					<el-input placeholder="名称" clearable @keyup.enter="handleQuery" v-model="queryParams.name" />
+				</el-form-item>
+				<el-form-item>
+					<el-button icon="ele-Refresh" @click="resetQuery"> 重置 </el-button>
+					<el-button type="primary" icon="ele-Search" @click="handleQuery"> 查询 </el-button>
+					<el-button icon="ele-Plus" @click="openAddTenant"> 新增 </el-button>
+				</el-form-item>
+			</el-form>
+		</el-card>
+
+		<el-card shadow="hover" style="margin-top: 8px">
+			<el-table :data="tenantData" style="width: 100%" v-loading="loading" border>
+				<el-table-column type="index" label="序号" width="55" align="center" />
+				<el-table-column prop="name" label="名称" show-overflow-tooltip />
+				<el-table-column prop="createTime" label="修改时间" align="center" show-overflow-tooltip />
+				<el-table-column label="操作" width="140" fixed="right" align="center" show-overflow-tooltip>
+					<template #default="scope">
+						<el-button icon="ele-Edit" size="small" text type="primary" @click="openEditTenant(scope.row)"> 编辑 </el-button>
+						<el-button icon="ele-Delete" size="small" text type="danger" @click="delTenant(scope.row)"> 删除 </el-button>
+					</template>
+				</el-table-column>
+			</el-table>
+		</el-card>
+		<EditTenant ref="editTenantRef" :title="editTenantTitle" />
+	</div>
+</template>
+
+<script lang="ts">
+import { toRefs, reactive, onMounted, ref, defineComponent, onUnmounted, getCurrentInstance } from 'vue';
+import { ElMessageBox } from 'element-plus';
+import EditTenant from '/@/views/test/tenant/component/editTenant.vue';
+
+import { getAPI } from '/@/utils/axios-utils';
+import { TenantBusinessApi } from '/@/api-services/_business/api';
+import { TenantBusiness } from '/@/api-services/_business/models';
+
+export default defineComponent({
+	name: 'testTenant',
+	components: { EditTenant },
+	setup() {
+		const { proxy } = getCurrentInstance() as any;
+		const editTenantRef = ref();
+		const state = reactive({
+			loading: false,
+			tenantData: [] as Array<TenantBusiness>,
+			queryParams: {
+				name: undefined,
+			},
+			editTenantTitle: '',
+		});
+		onMounted(async () => {
+			handleQuery();
+
+			proxy.mittBus.on('submitRefresh', () => {
+				handleQuery();
+			});
+		});
+		onUnmounted(() => {
+			proxy.mittBus.off('submitRefresh');
+		});
+		// 查询操作
+		const handleQuery = async () => {
+			state.loading = true;
+			var res = await getAPI(TenantBusinessApi).apiTenantBusinessGetBusinessListGet();
+			state.tenantData = res.data.result ?? [];
+			state.loading = false;
+		};
+		// 重置操作
+		const resetQuery = () => {
+			state.queryParams.name = undefined;
+			handleQuery();
+		};
+		// 打开新增页面
+		const openAddTenant = () => {
+			state.editTenantTitle = '添加业务';
+			editTenantRef.value.openDialog({});
+		};
+		// 打开编辑页面
+		const openEditTenant = (row: any) => {
+			state.editTenantTitle = '编辑业务';
+			editTenantRef.value.openDialog(row);
+		};
+		// 删除
+		const delTenant = (row: any) => {
+			ElMessageBox.confirm(`确定删除业务:【${row.name}】?`, '提示', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+			});
+			// .then(async () => {
+			// 	await getAPI(TenantBusinessApi).sysConfigDeletePost({ id: row.id });
+			// 	handleQuery();
+			// 	ElMessage.success('删除成功');
+			// })
+			// .catch(() => {});
+		};
+		return {
+			handleQuery,
+			resetQuery,
+			editTenantRef,
+			openAddTenant,
+			openEditTenant,
+			delTenant,
+			...toRefs(state),
+		};
+	},
+});
+</script>