Browse Source

加载中

CzRger 2 days ago
parent
commit
58e375dd26

+ 4 - 0
src/api/modules/center/tenant.ts

@@ -8,3 +8,7 @@ export const tenantsAdd = (params) => post(`/tenants`, params, {})
 export const tenantsEdit = (params) => put(`/tenants`, params, {})
 // 租户管理-详情
 export const tenantsDetail = (id) => get(`/tenants/${id}`, {}, {})
+// 租户管理-删除
+export const tenantsDel = (id) => del(`/tenants/${id}`, {}, {})
+// 租户管理-删除管理员账号
+export const accountDel = (id) => del(`/account/${id}`, {}, {})

+ 1 - 1
src/layout/top-left/head/index.vue

@@ -146,7 +146,7 @@ const copyDict = (label, value) => {
 }
 const onChangeTenant = (row) => {
   DialogStore.confirm({
-    content: `请确认是否切换到租户 ${row.name} ?`,
+    content: `请确认是否切换到租户${row.name}?`,
     onSubmit: () => {
       loginChangeTenant(row.id)
         .then(({ data }: any) => {

+ 18 - 9
src/views/manage/app/make/index.vue

@@ -532,7 +532,7 @@
                               class="flex h-10 flex-1 items-center overflow-hidden rounded-sm bg-[#F6F8FC] px-2.5"
                             >
                               <img
-                                src="@/assets/images/knowledge/knowledge-item-icon-2.png"
+                                src="@/assets/images/knowledge/knowledge-item-icon.png"
                                 class="mr-4 size-6"
                               />
                               <div
@@ -1086,18 +1086,27 @@ const getWorkflow = (val) => {
   state.form.workflowId = val.id
 }
 const onTryVoice = (type) => {
+  const loading = ElLoading.service({
+    text: '语音包加载中……',
+    background: 'rgba(0, 0,0, 0.3)',
+  })
   appTextToAudio({
     voice: type,
     text: `您好,欢迎使用${(import.meta as any).env.VITE_TITLE}。`,
-  }).then((bolb: any) => {
-    const url = URL.createObjectURL(new Blob([bolb], { type: 'audio/mp3' }))
-    const audio = new Audio(url)
-    audio.play()
-    // 播放结束后释放内存
-    audio.onended = function () {
-      URL.revokeObjectURL(url)
-    }
   })
+    .then((bolb: any) => {
+      const url = URL.createObjectURL(new Blob([bolb], { type: 'audio/mp3' }))
+      const audio = new Audio(url)
+      audio.play()
+      // 播放结束后释放内存
+      audio.onended = function () {
+        URL.revokeObjectURL(url)
+      }
+    })
+    .catch(() => {})
+    .finally(() => {
+      loading.close()
+    })
 }
 onMounted(() => {
   initDictionary()

+ 1 - 1
src/views/manage/app/make/workflow-select.vue

@@ -239,7 +239,7 @@ const onAdd = () => {
 const onDel = (row) => {
   DialogStore.confirm({
     title: '删除确认',
-    content: `请确认是否删除 ${row.name} ?`,
+    content: `请确认是否删除${row.name}?`,
     onSubmit: () => {
       workflowMetaDel(row.id)
         .then(() => {

+ 20 - 0
src/views/manage/center/tenant/detail.vue

@@ -83,6 +83,11 @@
               no-foot
               maxHeight="300px"
             >
+              <template #caozuo-column-value="{ scope }">
+                <div class="__czr-table-operations">
+                  <CzrButton type="table-del" @click="onDel(scope.row)" />
+                </div>
+              </template>
             </CzrTable>
           </div>
         </template>
@@ -136,6 +141,7 @@ import { useRouter } from 'vue-router'
 import { CopyDocument } from '@element-plus/icons-vue'
 import { copy } from '@/utils/czr-util'
 import {
+  accountDel,
   tenantsAdd,
   tenantsDetail,
   tenantsEdit,
@@ -290,6 +296,20 @@ const onCopy = (str) => {
   copy(str)
   ElMessage.success('复制成功!')
 }
+const onDel = (row) => {
+  DialogStore.confirm({
+    title: '删除确认',
+    content: `请确认是否删除${row.name}?`,
+    onSubmit: () => {
+      accountDel(row.id)
+        .then(() => {
+          initData()
+        })
+        .catch(() => {})
+        .finally(() => {})
+    },
+  })
+}
 </script>
 
 <style lang="scss" scoped></style>

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

@@ -95,7 +95,7 @@ import { debounce } from 'lodash'
 import { useAppStore, useDialogStore, useDictionaryStore } from '@/stores'
 import { ElMessage } from 'element-plus'
 import detailCom from './detail.vue'
-import { tenantsPage } from '@/api/modules/center/tenant'
+import { tenantsDel, tenantsPage } from '@/api/modules/center/tenant'
 
 const AppStore = useAppStore()
 const DialogStore = useDialogStore()
@@ -241,16 +241,16 @@ const onEdit = (row) => {
 const onDel = (row: any) => {
   DialogStore.confirm({
     title: '删除确认',
-    content: `请确认是否删除`,
+    content: `请确认是否删除${row.name}?`,
     onSubmit: () => {
-      // appDel(row.id)
-      //   .then(() => {
-      //     ElMessage.success('删除成功!')
-      //   })
-      //   .catch(() => {})
-      //   .finally(() => {
-      //     onSearch()
-      //   })
+      tenantsDel(row.id)
+        .then(() => {
+          ElMessage.success('删除成功!')
+        })
+        .catch(() => {})
+        .finally(() => {
+          onSearch()
+        })
     },
   })
 }

+ 5 - 2
src/views/manage/center/user/index.vue

@@ -19,6 +19,7 @@
             link="select"
             :options="DictionaryStore.tenants.list"
             placeholder="全部租戶"
+            :clearable="false"
           />
           <CzrFormColumn
             width="18rem"
@@ -298,7 +299,9 @@ const onReset = () => {
     pageNum: 1,
     pageSize: 20,
   }
-  state.query.form = {}
+  state.query.form = {
+    tenantId: AppStore.tenantInfo.id,
+  }
   state.query.sort = {}
   onSearch()
 }
@@ -318,7 +321,7 @@ const onEdit = (row) => {
 const onDel = (row: any) => {
   DialogStore.confirm({
     title: '删除确认',
-    content: `请确认是否删除 ${row.name} ?`,
+    content: `请确认是否删除${row.name}?`,
     onSubmit: () => {
       userDel(row.id)
         .then(() => {