Răsfoiți Sursa

Add 添加租户套餐同步功能

YueYunyun 1 an în urmă
părinte
comite
cb31f749cc

+ 3 - 1
UI/VAP_V3.VUE/src/api/system/_tenant.ts

@@ -72,9 +72,11 @@ class tenantApi {
 	}
 	// 同步租户套餐
 	syncTenantPackage = (tenantId: string | number, packageId: string | number) => {
+		console.log("----R`", tenantId, packageId)
+
 		return Rs.get({
 			url: "/system/tenant/syncTenantPackage",
-			data: { tenantId, packageId }
+			params: { tenantId, packageId }
 		})
 	}
 	// 动态切换租户

+ 24 - 0
UI/VAP_V3.VUE/src/views/system/tenant/index.vue

@@ -326,6 +326,12 @@ function handleStatusChange(row: any) {
 			row.status = row.status === "0" ? "1" : "0"
 		})
 }
+
+function handleSyncTenantPackage(row: any) {
+	apis.system.tenantApi.syncTenantPackage(row.tenantId, row.packageId).then(() => {
+		message.msgSuccess("同步成功")
+	})
+}
 /** 提交按钮 */
 function submitForm() {
 	apis.system.tenantApi.addOrUpdate(form.value).then(() => {
@@ -362,6 +368,24 @@ function getPackages() {
 			:check-multiple="true"
 			:reset-search-form-fun="resetQuery"
 			:custom-search-fun="handleQuery">
+			<template #packageName="{ row }">
+				<span v-if="row.packageName" class="w-100 position-relative d-block">
+					{{ row.packageName }}
+					<vb-tooltip content="同步套餐" placement="top">
+						<el-button
+							style="right: 0px; position: absolute; top: 50%; transform: translateY(-50%)"
+							link
+							type="primary"
+							@click="handleSyncTenantPackage(row)"
+							v-hasPermission="'system:tenant:edit'">
+							<template #icon>
+								<VbIcon icon-name="arrows-loop" icon-type="solid" class="fs-3"></VbIcon>
+							</template>
+						</el-button>
+					</vb-tooltip>
+				</span>
+				<span class="text-muted" v-else>未配置套餐</span>
+			</template>
 			<template #expireTime="{ row }">
 				{{ row.expireTime ? dayjs(row.expireTime).format("YYYY-MM-DD") : "永久" }}
 			</template>