浏览代码

管理中心

CzRger 1 月之前
父节点
当前提交
4a998ae98b

+ 1 - 1
src/components/czr-ui/CzrTable.vue

@@ -420,7 +420,7 @@ const handleCurrentChange = (val: Number) => {
 const handleSort = ({ column, prop, order }: any) => {
   emit('handleSort', {
     key: prop,
-    value: order,
+    value: order === 'ascending' ? 'ASC' : 'DESC',
   })
 }
 const handleFilter = (val: any) => {

+ 1 - 1
src/components/czr-ui/CzrTableColumn.vue

@@ -2,7 +2,7 @@
   <slot :name="`${item?.value}-column`" :column="item">
     <el-table-column
       :class-name="`${item?.popover === false ? 'no-popover' : ''}`"
-      :show-overflow-tooltip="item?.popover === false ? false : true"
+      :show-overflow-tooltip="item?.popover !== false"
       :label="item?.label"
       :prop="item?.value"
       :column-key="item?.value"

+ 7 - 2
src/components/czr-ui/czr-form-link/upload.vue

@@ -98,7 +98,12 @@
                 <img
                   class="file __hover"
                   :src="getFileImgByUrl(file[urlKey])"
-                  @click="downloadFileByUrl(file[urlKey], file[nameKey])"
+                  @click="
+                    downloadFileByUrl(
+                      file[urlKey],
+                      file[nameKey] ?? file[urlKey],
+                    )
+                  "
                 />
               </template>
               <img
@@ -117,7 +122,7 @@
             @click="
               validImgByUrl(file[urlKey])
                 ? viewImg(file[urlKey])
-                : downloadFileByUrl(file[urlKey], file[nameKey])
+                : downloadFileByUrl(file[urlKey], file[nameKey] ?? file[urlKey])
             "
           >
             <img class="file-type-img" :src="getFileImgByUrl(file[urlKey])" />

+ 37 - 21
src/views/global/invite/index.vue

@@ -9,25 +9,36 @@
     <div
       class="absolute top-0 right-0 flex h-full w-[42.5rem] items-center justify-center bg-[var(--czr-dialog-bg)]"
     >
-      <div class="flex w-[26.5rem] flex-col">
-        <div class="text-[1.88rem] font-bold text-[#373D4C]">
-          {{ state.detail.userName }}邀请您加入
-        </div>
-        <div class="mt-4 text-[1.88rem] font-bold text-[#3363DE]">
-          {{ state.detail.tenantName }}组织
-        </div>
-        <div
-          class="__hover mt-2 mt-12 flex h-[2.5rem] w-full items-center justify-center bg-[#3363DE] text-sm text-[#ffffff]"
-          @click="onSubmit"
-          v-loading="state.loading"
-        >
-          加入组织
-        </div>
-        <div class="mt-3 text-sm text-[#576275]">
-          链接将在
-          <span class="text-[#3363DE]">{{ state.detail.validateTime }}</span>
-          失效
-        </div>
+      <div class="flex w-[26.5rem] flex-col" v-loading="state.loading">
+        <template v-if="state.detail">
+          <div class="text-[1.88rem] font-bold text-[#373D4C]">
+            {{ state.detail.userName }}邀请您加入
+          </div>
+          <div class="mt-4 text-[1.88rem] font-bold text-[#3363DE]">
+            {{ state.detail.tenantName }}组织
+          </div>
+          <div
+            class="mt-4 text-[1.88rem] font-bold text-[#3363DE]"
+            v-if="state.detail.type == 0"
+          >
+            成为管理员
+          </div>
+          <div
+            class="__hover mt-2 mt-12 flex h-[2.5rem] w-full items-center justify-center bg-[#3363DE] text-sm text-[#ffffff]"
+            @click="onSubmit"
+            v-loading="state.loading"
+          >
+            加入组织
+          </div>
+          <div class="mt-3 text-sm text-[#576275]">
+            链接将在
+            <span class="text-[#3363DE]">{{ state.detail.validateTime }}</span>
+            失效
+          </div>
+        </template>
+        <template v-else>
+          <div class="text-[1.88rem] font-bold text-[#373D4C]">无效的链接</div>
+        </template>
       </div>
     </div>
   </div>
@@ -50,18 +61,20 @@ const { proxy }: any = getCurrentInstance()
 const state: any = reactive({
   inviteCode: route.query.inviteCode,
   loading: false,
-  detail: {},
+  detail: null,
 })
 const onSubmit = () => {
   if (!state.loading) {
     state.loading = true
     accountLinkAccess({
       tenantId: state.detail.tenantId,
+      type: state.detail.type,
       userId: AppStore.userInfo?.id,
     })
       .then(({ data }: any) => {
         ElMessage.success('加入组织成功!')
         router.replace({ name: 'root' })
+        AppStore.initUserInfo()
       })
       .catch(() => {})
       .finally(() => {})
@@ -72,13 +85,16 @@ onMounted(() => {
   initDetail()
 })
 const initDetail = () => {
+  state.loading = true
   if (state.inviteCode) {
     accountOpenLink(state.inviteCode)
       .then(({ data }: any) => {
         state.detail = data
       })
       .catch(() => {})
-      .finally(() => {})
+      .finally(() => {
+        state.loading = false
+      })
   } else {
     errorMsg()
   }

+ 49 - 3
src/views/manage/center/tenant/detail.vue

@@ -62,6 +62,7 @@
               cardWidth="9rem"
               cardHeight="9rem"
               :limit="1"
+              :delRule="(file) => true"
             />
           </el-row>
         </el-col>
@@ -83,6 +84,18 @@
               no-foot
               maxHeight="300px"
             >
+              <template #status-column-value="{ scope }">
+                <div class="m-auto" @click.capture.stop="onSwitch(scope.row)">
+                  <a-switch
+                    v-model:checked="scope.row.status"
+                    checked-children="启用"
+                    un-checked-children="停用"
+                    checked-value="0"
+                    un-checked-value="1"
+                    size="small"
+                  />
+                </div>
+              </template>
               <template #caozuo-column-value="{ scope }">
                 <div class="__czr-table-operations">
                   <CzrButton type="table-del" @click="onDel(scope.row)" />
@@ -147,6 +160,7 @@ import {
   tenantsEdit,
 } from '@/api/modules/center/tenant'
 import { accountGenerateFriendlyCode } from '@/api/modules/global/invite'
+import { pluginUpdateStatus } from '@/api/modules/model'
 
 const router = useRouter()
 const AppStore = useAppStore()
@@ -165,8 +179,8 @@ const state: any = reactive({
   admins: {
     head: [
       { value: 'loginId', label: '账号', show: true },
-      { value: 'name', label: '用户名', show: true },
-      { value: 'status', label: '状态', show: true },
+      { value: 'username', label: '用户名', show: true },
+      { value: 'status', label: '状态', show: true, popover: false },
       {
         value: 'caozuo',
         label: '操作',
@@ -222,6 +236,9 @@ const initData = () => {
   tenantsDetail(props.transfer.id)
     .then(({ data }: any) => {
       state.form = data
+      if (state.form.picture) {
+        state.file = [{ url: state.form.picture }]
+      }
     })
     .catch(() => {})
     .finally(() => {
@@ -278,6 +295,7 @@ const onInvite = () => {
   accountGenerateFriendlyCode({
     userId: AppStore.userInfo?.id,
     tenantId: state.form.id,
+    type: 0,
   })
     .then(({ data }: any) => {
       const routerUrl = router.resolve({
@@ -299,7 +317,7 @@ const onCopy = (str) => {
 const onDel = (row) => {
   DialogStore.confirm({
     title: '删除确认',
-    content: `请确认是否删除${row.name}?`,
+    content: `请确认是否删除${row.username}?`,
     onSubmit: () => {
       accountDel(row.id)
         .then(() => {
@@ -310,6 +328,34 @@ const onDel = (row) => {
     },
   })
 }
+const onSwitch = (row) => {
+  if (row.status == 0) {
+    DialogStore.confirm({
+      title: '停用确认',
+      content: `请确认是否停用管理员账号${row.username}?`,
+      onSubmit: () => {
+        // pluginUpdateStatus({ ids: [row.id], status: '1' })
+        //   .then(() => {
+        //     ElMessage.success('停用成功!')
+        //   })
+        //   .catch(() => {})
+        //   .finally(() => {
+        //     row.status = '1'
+        //   })
+      },
+      onCancel: () => {},
+    })
+  } else {
+    // pluginUpdateStatus({ ids: [row.id], status: 0 })
+    //   .then(() => {
+    //     ElMessage.success('启用成功!')
+    //   })
+    //   .catch(() => {})
+    //   .finally(() => {
+    // row.status = '0'
+    //   })
+  }
+}
 </script>
 
 <style lang="scss" scoped></style>

+ 10 - 1
src/views/manage/center/tenant/index.vue

@@ -112,7 +112,12 @@ const state: any = reactive({
       { value: 'name', label: '租户名称', show: true },
       { value: 'code', label: '租户编号', show: true },
       { value: 'userQuota', label: '用户配额', show: true },
-      { value: 'enabled', label: '租户状态', show: true },
+      {
+        value: 'enabled',
+        label: '租户状态',
+        show: true,
+        dictList: computed(() => DictionaryStore.trueFalseStatus),
+      },
       { value: 'userCounts', label: '用户数量', show: true, sort: true },
       {
         value: 'createTime',
@@ -200,6 +205,10 @@ const onPage = (pageNum, pageSize) => {
 
   //  添加排序参数
   for (const [k, v] of Object.entries(state.query.sort)) {
+    if (v) {
+      params['sort'] = k
+      params['direction'] = v
+    }
   }
   state.query.loading = true
   tenantsPage(params)

+ 2 - 0
src/views/manage/center/user/detail.vue

@@ -195,6 +195,8 @@ const onSubmit = () => {
           } else {
             if (!state.editPassword) {
               delete state.form.pass
+            } else {
+              state.form.password = state.form.pass
             }
             userEdit(state.form)
               .then(({ data }: any) => {

+ 1 - 0
src/views/manage/center/user/index.vue

@@ -348,6 +348,7 @@ const onInvite = () => {
   accountGenerateFriendlyCode({
     userId: AppStore.userInfo?.id,
     tenantId: AppStore.tenantInfo?.id,
+    type: 1,
   })
     .then(({ data }: any) => {
       const routerUrl = router.resolve({