From 4ffb0acc35d85a78959edb97ef80e23a92cefc89 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期六, 11 三月 2023 23:59:05 +0800
Subject: [PATCH] fix 修复 超管切换租户后 点击个人中心报错

---
 ruoyi-ui/src/views/system/tenant/index.vue |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/ruoyi-ui/src/views/system/tenant/index.vue b/ruoyi-ui/src/views/system/tenant/index.vue
index 3aa20f4..3b877f9 100644
--- a/ruoyi-ui/src/views/system/tenant/index.vue
+++ b/ruoyi-ui/src/views/system/tenant/index.vue
@@ -120,6 +120,13 @@
           <el-button
             size="mini"
             type="text"
+            icon="el-icon-edit"
+            @click="handleSyncTenantPackage(scope.row)"
+            v-hasPermi="['system:tenant:edit']"
+          >鍚屾濂楅</el-button>
+          <el-button
+            size="mini"
+            type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['system:tenant:remove']"
@@ -192,7 +199,7 @@
 </template>
 
 <script>
-import { listTenant, getTenant, delTenant, addTenant, updateTenant, changeTenantStatus } from "@/api/system/tenant";
+import { listTenant, getTenant, delTenant, addTenant, updateTenant, changeTenantStatus, syncTenantPackage} from "@/api/system/tenant";
 import { listTenantPackage } from "@/api/system/tenantPackage";
 
 export default {
@@ -264,9 +271,6 @@
         password: [
           { required: true, message: "瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" },
           { min: 5, max: 20, message: '鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿', trigger: 'blur' }
-        ],
-        packageId: [
-          { required: true, message: "绉熸埛濂楅涓嶈兘涓虹┖", trigger: "blur" }
         ]
       }
     };
@@ -294,7 +298,7 @@
     handleStatusChange(row) {
       let text = row.status === "0" ? "鍚敤" : "鍋滅敤";
       this.$modal.confirm('纭瑕�"' + text + '""' + row.companyName + '"绉熸埛鍚楋紵').then(function() {
-        return changeTenantStatus(row.id, row.status);
+        return changeTenantStatus(row.id, row.tenantId, row.status);
       }).then(() => {
         this.$modal.msgSuccess(text + "鎴愬姛");
       }).catch(function() {
@@ -360,6 +364,7 @@
     handleUpdate(row) {
       this.loading = true;
       this.reset();
+      this.getTenantPackage();
       const id = row.id || this.ids
       getTenant(id).then(response => {
         this.loading = false;
@@ -396,7 +401,7 @@
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('鏄惁纭鍒犻櫎绉熸埛缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(() => {
+      this.$modal.confirm('鏄惁纭鍒犻櫎绉熸埛缂栧彿涓�"' + row.tenantId + '"鐨勬暟鎹」锛�').then(() => {
         this.loading = true;
         return delTenant(ids);
       }).then(() => {
@@ -408,6 +413,20 @@
         this.loading = false;
       });
     },
+    /** 鍚屾绉熸埛濂楅鎸夐挳鎿嶄綔 */
+    handleSyncTenantPackage(row) {
+      this.$modal.confirm('鏄惁纭鍚屾绉熸埛濂楅绉熸埛缂栧彿涓�"' + row.tenantId + '"鐨勬暟鎹」锛�').then(() => {
+        this.loading = true;
+        return syncTenantPackage(row.tenantId, row.packageId);
+      }).then(() => {
+        this.loading = false;
+        this.getList();
+        this.$modal.msgSuccess("鍚屾鎴愬姛");
+      }).catch(() => {
+      }).finally(() => {
+        this.loading = false;
+      });
+    },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
       this.download('system/tenant/export', {

--
Gitblit v1.9.3