feat: add IM governance admin enhancements
This commit is contained in:
@@ -36,6 +36,42 @@ export function Governance(params) {
|
||||
});
|
||||
}
|
||||
|
||||
// 更新IM群治理配置
|
||||
export function GovernanceUpdate(params) {
|
||||
return http.request({
|
||||
url: '/imGroup/governanceUpdate',
|
||||
method: 'POST',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 解散IM群
|
||||
export function Dissolve(params) {
|
||||
return http.request({
|
||||
url: '/imGroup/dissolve',
|
||||
method: 'POST',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 禁言IM群成员
|
||||
export function Mute(params) {
|
||||
return http.request({
|
||||
url: '/imGroup/mute',
|
||||
method: 'POST',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 解除IM群成员禁言
|
||||
export function Unmute(params) {
|
||||
return http.request({
|
||||
url: '/imGroup/unmute',
|
||||
method: 'POST',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 获取IM入群申请列表
|
||||
export function JoinRequestList(params) {
|
||||
return http.request({
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { http } from '@/utils/http/axios';
|
||||
|
||||
export function List(params) {
|
||||
return http.request({
|
||||
url: '/imOutbox/list',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
export function View(params) {
|
||||
return http.request({
|
||||
url: '/imOutbox/view',
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
export function Retry(params) {
|
||||
return http.request({
|
||||
url: '/imOutbox/retry',
|
||||
method: 'POST',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
export function Dead(params) {
|
||||
return http.request({
|
||||
url: '/imOutbox/dead',
|
||||
method: 'POST',
|
||||
params,
|
||||
});
|
||||
}
|
||||
@@ -15,21 +15,84 @@
|
||||
<n-descriptions label-placement="left" bordered :column="settingStore.isMobile ? 1 : 2">
|
||||
<n-descriptions-item label="群名称">{{ governance.name || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="业务状态">{{ groupStatusLabel }}</n-descriptions-item>
|
||||
<n-descriptions-item label="群主ID">{{ governance.ownerUserId || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员数">{{ governance.memberCount || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="入群审批">{{ governance.joinApproval ? '开启' : '关闭' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="全员禁言">{{ governance.muteAll ? '开启' : '关闭' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员上传文件">{{ governance.memberUploadFiles ? '允许' : '禁止' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员私聊">{{ governance.memberPrivateChat ? '允许' : '禁止' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员邀请">{{ governance.memberInvite ? '允许' : '禁止' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="最大成员数">{{ governance.maxMemberCount || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="最大管理员数">{{ governance.maxAdminCount || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="版本">{{ governance.version || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="创建人">{{ governance.createdBy || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="创建时间">{{ governance.createdAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="解散人">{{ governance.dissolvedBy || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="解散时间">{{ governance.dissolvedAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="简介" :span="2">{{ governance.description || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="群主ID">{{
|
||||
governance.ownerUserId || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员数">{{
|
||||
governance.memberCount || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="入群审批">
|
||||
<n-switch
|
||||
v-model:value="governance.joinApproval"
|
||||
:checked-value="1"
|
||||
:unchecked-value="0"
|
||||
:disabled="!canUpdateGovernance"
|
||||
/>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="全员禁言">
|
||||
<n-switch
|
||||
v-model:value="governance.muteAll"
|
||||
:checked-value="1"
|
||||
:unchecked-value="0"
|
||||
:disabled="!canUpdateGovernance"
|
||||
/>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="成员上传文件">
|
||||
<n-switch
|
||||
v-model:value="governance.memberUploadFiles"
|
||||
:checked-value="1"
|
||||
:unchecked-value="0"
|
||||
:disabled="!canUpdateGovernance"
|
||||
/>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="成员私聊">
|
||||
<n-switch
|
||||
v-model:value="governance.memberPrivateChat"
|
||||
:checked-value="1"
|
||||
:unchecked-value="0"
|
||||
:disabled="!canUpdateGovernance"
|
||||
/>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="成员邀请">
|
||||
<n-switch
|
||||
v-model:value="governance.memberInvite"
|
||||
:checked-value="1"
|
||||
:unchecked-value="0"
|
||||
:disabled="!canUpdateGovernance"
|
||||
/>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="最大成员数">
|
||||
<n-input-number
|
||||
v-model:value="governance.maxMemberCount"
|
||||
:min="0"
|
||||
:disabled="!canUpdateGovernance"
|
||||
/>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="最大管理员数">
|
||||
<n-input-number
|
||||
v-model:value="governance.maxAdminCount"
|
||||
:min="0"
|
||||
:disabled="!canUpdateGovernance"
|
||||
/>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="版本">{{
|
||||
governance.version || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="创建人">{{
|
||||
governance.createdBy || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="创建时间">{{
|
||||
governance.createdAt || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="解散人">{{
|
||||
governance.dissolvedBy || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="解散时间">{{
|
||||
governance.dissolvedAt || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="简介" :span="2">{{
|
||||
governance.description || '-'
|
||||
}}</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
</n-spin>
|
||||
</n-tab-pane>
|
||||
@@ -69,6 +132,7 @@
|
||||
:columns="muteColumns"
|
||||
:request="muteData"
|
||||
:row-key="(row) => row.topic + '-' + row.userId"
|
||||
:actionColumn="muteActionColumn"
|
||||
:scroll-x="muteScrollX"
|
||||
:resizeHeightOffset="-10000"
|
||||
/>
|
||||
@@ -86,6 +150,22 @@
|
||||
</n-tabs>
|
||||
<template #action>
|
||||
<n-space>
|
||||
<n-button
|
||||
v-if="activeTab === 'settings' && canUpdateGovernance"
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="handleSaveGovernance"
|
||||
>
|
||||
保存治理配置
|
||||
</n-button>
|
||||
<n-button
|
||||
v-if="activeTab === 'settings' && canDissolve && governance.groupStatus !== 'dissolved'"
|
||||
type="error"
|
||||
:loading="submitLoading"
|
||||
@click="handleDissolve"
|
||||
>
|
||||
解散群
|
||||
</n-button>
|
||||
<n-button @click="closeForm">关闭</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
@@ -94,16 +174,21 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
import { computed, h, nextTick, reactive, ref, watch } from 'vue';
|
||||
import { useDialog, useMessage } from 'naive-ui';
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
import { BasicTable } from '@/components/Table';
|
||||
import { usePermission } from '@/hooks/web/usePermission';
|
||||
import { BasicTable, TableAction } from '@/components/Table';
|
||||
import {
|
||||
AdminLogList,
|
||||
AnnouncementList,
|
||||
Dissolve,
|
||||
Governance,
|
||||
GovernanceUpdate,
|
||||
InvitationList,
|
||||
JoinRequestList,
|
||||
MuteList,
|
||||
Unmute,
|
||||
} from '@/api/imGroup';
|
||||
import {
|
||||
adminLogColumns,
|
||||
@@ -120,24 +205,52 @@
|
||||
|
||||
const settingStore = useProjectSettingStore();
|
||||
const dict = useDictStore();
|
||||
const message = useMessage();
|
||||
const dialog = useDialog();
|
||||
const { hasPermission } = usePermission();
|
||||
const showModal = ref(false);
|
||||
const loading = ref(false);
|
||||
const submitLoading = ref(false);
|
||||
const activeTab = ref('settings');
|
||||
const current = ref<State>(newState(null));
|
||||
const governance = ref<GovernanceState>(new GovernanceState());
|
||||
const dialogWidth = computed(() => adaModalWidth(1120));
|
||||
const groupStatusLabel = computed(() => dict.getLabel('ImGroupStatusOptions', governance.value.groupStatus) || '-');
|
||||
const canUpdateGovernance = computed(() => hasPermission(['/imGroup/governanceUpdate']));
|
||||
const canDissolve = computed(() => hasPermission(['/imGroup/dissolve']));
|
||||
const groupStatusLabel = computed(
|
||||
() => dict.getLabel('ImGroupStatusOptions', governance.value.groupStatus) || '-'
|
||||
);
|
||||
|
||||
const joinRequestRef = ref();
|
||||
const invitationRef = ref();
|
||||
const announcementRef = ref();
|
||||
const muteRef = ref();
|
||||
const adminLogRef = ref();
|
||||
const muteActionColumn = reactive({
|
||||
width: 110,
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
render(record) {
|
||||
return h(TableAction as any, {
|
||||
style: 'button',
|
||||
actions: [
|
||||
{
|
||||
label: '解除',
|
||||
type: 'warning',
|
||||
ifShow: () => record.status === 'active',
|
||||
auth: ['/imGroup/unmute'],
|
||||
onClick: () => handleUnmute(record),
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const joinRequestScrollX = computed(() => adaTableScrollX(joinRequestColumns, 0));
|
||||
const invitationScrollX = computed(() => adaTableScrollX(invitationColumns, 0));
|
||||
const announcementScrollX = computed(() => adaTableScrollX(announcementColumns, 0));
|
||||
const muteScrollX = computed(() => adaTableScrollX(muteColumns, 0));
|
||||
const muteScrollX = computed(() => adaTableScrollX(muteColumns, muteActionColumn.width));
|
||||
const adminLogScrollX = computed(() => adaTableScrollX(adminLogColumns, 0));
|
||||
|
||||
function baseParams(res) {
|
||||
@@ -176,13 +289,78 @@
|
||||
async function loadGovernance() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await Governance({ tenantId: current.value.tenantId, topic: current.value.topic });
|
||||
const res = await Governance({
|
||||
tenantId: current.value.tenantId,
|
||||
topic: current.value.topic,
|
||||
});
|
||||
governance.value = Object.assign(new GovernanceState(), res || {});
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSaveGovernance() {
|
||||
submitLoading.value = true;
|
||||
try {
|
||||
await GovernanceUpdate({
|
||||
tenantId: current.value.tenantId,
|
||||
topic: current.value.topic,
|
||||
joinApproval: governance.value.joinApproval,
|
||||
muteAll: governance.value.muteAll,
|
||||
memberUploadFiles: governance.value.memberUploadFiles,
|
||||
memberPrivateChat: governance.value.memberPrivateChat,
|
||||
memberInvite: governance.value.memberInvite,
|
||||
maxMemberCount: governance.value.maxMemberCount,
|
||||
maxAdminCount: governance.value.maxAdminCount,
|
||||
});
|
||||
message.success('操作成功');
|
||||
await loadGovernance();
|
||||
} finally {
|
||||
submitLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handleDissolve() {
|
||||
dialog.error({
|
||||
title: '解散群',
|
||||
content: '解散后该群将进入不可用状态,并写入群事件等待 IM 服务端同步,是否确认?',
|
||||
positiveText: '确认',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
submitLoading.value = true;
|
||||
try {
|
||||
await Dissolve({
|
||||
tenantId: current.value.tenantId,
|
||||
topic: current.value.topic,
|
||||
reason: '后台管理员解散',
|
||||
});
|
||||
message.success('操作成功');
|
||||
await loadGovernance();
|
||||
} finally {
|
||||
submitLoading.value = false;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleUnmute(record) {
|
||||
dialog.warning({
|
||||
title: '解除禁言',
|
||||
content: '确定解除该成员禁言?',
|
||||
positiveText: '确认',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
await Unmute({
|
||||
tenantId: current.value.tenantId,
|
||||
topic: current.value.topic,
|
||||
userId: record.userId,
|
||||
});
|
||||
message.success('操作成功');
|
||||
muteRef.value?.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function reloadActiveTable() {
|
||||
const refs = {
|
||||
joinRequests: joinRequestRef,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="n-layout-page-header">
|
||||
<n-card :bordered="false" title="IM群组管理"></n-card>
|
||||
<n-card :bordered="false" title="IM群组管理" />
|
||||
</div>
|
||||
<n-card :bordered="false" class="proCard">
|
||||
<BasicForm
|
||||
@@ -32,6 +32,7 @@
|
||||
import { useMessage } from 'naive-ui';
|
||||
import { BasicTable, TableAction } from '@/components/Table';
|
||||
import { BasicForm, useForm } from '@/components/Form/index';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { List } from '@/api/imGroup';
|
||||
import { columns, loadOptions, loadTenantOptions, schemas, State, tenantOptions } from './model';
|
||||
import { adaTableScrollX } from '@/utils/hotgo';
|
||||
@@ -40,12 +41,19 @@
|
||||
import GovernanceModal from './governance.vue';
|
||||
|
||||
const message = useMessage();
|
||||
const userStore = useUserStore();
|
||||
const isPlatformAdmin = computed(() => userStore.isCompanyDept);
|
||||
const actionRef = ref();
|
||||
const searchFormRef = ref<any>({});
|
||||
const viewRef = ref();
|
||||
const membersRef = ref();
|
||||
const governanceRef = ref();
|
||||
|
||||
const tenantSchema = schemas.value.find((item) => item.field === 'tenantId');
|
||||
if (tenantSchema) {
|
||||
tenantSchema.ifShow = () => isPlatformAdmin.value;
|
||||
}
|
||||
|
||||
const actionColumn = reactive({
|
||||
width: 220,
|
||||
title: '操作',
|
||||
@@ -88,7 +96,7 @@
|
||||
// 加载表格数据
|
||||
const loadDataTable = async (res) => {
|
||||
const params = { ...searchFormRef.value?.formModel, ...res };
|
||||
if (!params.tenantId) {
|
||||
if (isPlatformAdmin.value && !params.tenantId) {
|
||||
return { list: [], page: 1, pageCount: 0, totalCount: 0 };
|
||||
}
|
||||
return await List(params);
|
||||
@@ -116,13 +124,15 @@
|
||||
|
||||
onMounted(async () => {
|
||||
loadOptions();
|
||||
await loadTenantOptions();
|
||||
if (tenantOptions.value.length > 0) {
|
||||
await setFieldsValue({ tenantId: tenantOptions.value[0].value });
|
||||
reloadTable();
|
||||
} else {
|
||||
message.warning('暂无可用租户');
|
||||
if (isPlatformAdmin.value) {
|
||||
await loadTenantOptions();
|
||||
if (tenantOptions.value.length > 0) {
|
||||
await setFieldsValue({ tenantId: tenantOptions.value[0].value });
|
||||
} else {
|
||||
message.warning('暂无可用租户');
|
||||
}
|
||||
}
|
||||
reloadTable();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
:columns="memberColumns"
|
||||
:request="loadDataTable"
|
||||
:row-key="(row) => row.userId"
|
||||
:actionColumn="actionColumn"
|
||||
:scroll-x="scrollX"
|
||||
:resizeHeightOffset="-10000"
|
||||
/>
|
||||
@@ -27,17 +28,42 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { BasicTable } from '@/components/Table';
|
||||
import { MemberList } from '@/api/imGroup';
|
||||
import { computed, h, reactive, ref } from 'vue';
|
||||
import { useDialog, useMessage } from 'naive-ui';
|
||||
import { BasicTable, TableAction } from '@/components/Table';
|
||||
import { usePermission } from '@/hooks/web/usePermission';
|
||||
import { MemberList, Mute } from '@/api/imGroup';
|
||||
import { memberColumns, newState, State } from './model';
|
||||
import { adaModalWidth, adaTableScrollX } from '@/utils/hotgo';
|
||||
|
||||
const message = useMessage();
|
||||
const dialog = useDialog();
|
||||
const { hasPermission } = usePermission();
|
||||
const showModal = ref(false);
|
||||
const current = ref<State>(newState(null));
|
||||
const actionRef = ref();
|
||||
const dialogWidth = computed(() => adaModalWidth(980));
|
||||
const scrollX = computed(() => adaTableScrollX(memberColumns, 0));
|
||||
const actionColumn = reactive({
|
||||
width: 100,
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
render(record) {
|
||||
return h(TableAction as any, {
|
||||
style: 'button',
|
||||
actions: [
|
||||
{
|
||||
label: '禁言',
|
||||
type: 'warning',
|
||||
ifShow: () => record.memberStatus === 'active',
|
||||
disabled: !hasPermission(['/imGroup/mute']),
|
||||
onClick: () => handleMute(record),
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
const scrollX = computed(() => adaTableScrollX(memberColumns, actionColumn.width));
|
||||
|
||||
// 加载表格数据
|
||||
const loadDataTable = async (res) => {
|
||||
@@ -56,6 +82,26 @@
|
||||
showModal.value = false;
|
||||
}
|
||||
|
||||
function handleMute(record) {
|
||||
dialog.warning({
|
||||
title: '禁言成员',
|
||||
content: '将该成员禁言 24 小时,是否确认?',
|
||||
positiveText: '确认',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
await Mute({
|
||||
tenantId: current.value.tenantId,
|
||||
topic: current.value.topic,
|
||||
userId: record.userId,
|
||||
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
|
||||
reason: '后台管理员禁言',
|
||||
});
|
||||
message.success('操作成功');
|
||||
actionRef.value?.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
function openModal(state: State) {
|
||||
current.value = newState(state);
|
||||
|
||||
@@ -287,7 +287,10 @@ export const memberColumns = [
|
||||
align: 'left',
|
||||
width: 110,
|
||||
render(row: MemberState) {
|
||||
return dict.getLabel('ImGroupMemberStatusOptions', row.memberStatus) || dict.getLabel('ImUserStateOptions', row.state);
|
||||
return (
|
||||
dict.getLabel('ImGroupMemberStatusOptions', row.memberStatus) ||
|
||||
dict.getLabel('ImUserStateOptions', row.state)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -17,24 +17,56 @@
|
||||
<n-descriptions-item label="状态">{{ stateLabel }}</n-descriptions-item>
|
||||
<n-descriptions-item label="群主ID">{{ formValue.ownerId }}</n-descriptions-item>
|
||||
<n-descriptions-item label="业务状态">{{ groupStatusLabel }}</n-descriptions-item>
|
||||
<n-descriptions-item label="群名称">{{ formValue.groupName || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员数">{{ formValue.businessMemberCount || formValue.subCnt }}</n-descriptions-item>
|
||||
<n-descriptions-item label="入群审批">{{ formValue.joinApproval ? '开启' : '关闭' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="全员禁言">{{ formValue.muteAll ? '开启' : '关闭' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员上传文件">{{ formValue.memberUploadFiles ? '允许' : '禁止' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员私聊">{{ formValue.memberPrivateChat ? '允许' : '禁止' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员邀请">{{ formValue.memberInvite ? '允许' : '禁止' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="最大成员数">{{ formValue.maxMemberCount || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="最大管理员数">{{ formValue.maxAdminCount || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="治理版本">{{ formValue.settingsVersion || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="群名称">{{
|
||||
formValue.groupName || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员数">{{
|
||||
formValue.businessMemberCount || formValue.subCnt
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="入群审批">{{
|
||||
formValue.joinApproval ? '开启' : '关闭'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="全员禁言">{{
|
||||
formValue.muteAll ? '开启' : '关闭'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员上传文件">{{
|
||||
formValue.memberUploadFiles ? '允许' : '禁止'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员私聊">{{
|
||||
formValue.memberPrivateChat ? '允许' : '禁止'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="成员邀请">{{
|
||||
formValue.memberInvite ? '允许' : '禁止'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="最大成员数">{{
|
||||
formValue.maxMemberCount || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="最大管理员数">{{
|
||||
formValue.maxAdminCount || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="治理版本">{{
|
||||
formValue.settingsVersion || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="最新序号">{{ formValue.seqId }}</n-descriptions-item>
|
||||
<n-descriptions-item label="删除序号">{{ formValue.delId }}</n-descriptions-item>
|
||||
<n-descriptions-item label="BT">{{ formValue.useBt ? '开启' : '关闭' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="活跃时间">{{ formValue.touchedAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="创建时间">{{ formValue.createdAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="修改时间">{{ formValue.updatedAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="治理更新时间">{{ formValue.settingsUpdatedAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="简介" :span="2">{{ formValue.description || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="BT">{{
|
||||
formValue.useBt ? '开启' : '关闭'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="活跃时间">{{
|
||||
formValue.touchedAt || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="创建时间">{{
|
||||
formValue.createdAt || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="修改时间">{{
|
||||
formValue.updatedAt || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="治理更新时间">{{
|
||||
formValue.settingsUpdatedAt || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="简介" :span="2">{{
|
||||
formValue.description || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="访问权限" :span="2">
|
||||
<n-code :code="formValue.accessJson || '-'" language="json" word-wrap />
|
||||
</n-descriptions-item>
|
||||
@@ -77,7 +109,9 @@
|
||||
const formValue = ref<State>(newState(null));
|
||||
const dialogWidth = computed(() => adaModalWidth(960));
|
||||
const stateLabel = computed(() => dict.getLabel('ImGroupStateOptions', formValue.value.state));
|
||||
const groupStatusLabel = computed(() => dict.getLabel('ImGroupStatusOptions', formValue.value.groupStatus) || '-');
|
||||
const groupStatusLabel = computed(
|
||||
() => dict.getLabel('ImGroupStatusOptions', formValue.value.groupStatus) || '-'
|
||||
);
|
||||
|
||||
// 关闭弹窗
|
||||
function closeForm() {
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="n-layout-page-header">
|
||||
<n-card :bordered="false" title="IM Outbox运维" />
|
||||
</div>
|
||||
<n-card :bordered="false" class="proCard">
|
||||
<BasicForm
|
||||
ref="searchFormRef"
|
||||
@register="register"
|
||||
@submit="reloadTable"
|
||||
@reset="handleReset"
|
||||
@keyup.enter="reloadTable"
|
||||
/>
|
||||
<BasicTable
|
||||
ref="actionRef"
|
||||
:columns="columns"
|
||||
:request="loadDataTable"
|
||||
:row-key="(row) => row.tenantId + '-' + row.source + '-' + row.id"
|
||||
:actionColumn="actionColumn"
|
||||
:scroll-x="scrollX"
|
||||
:resizeHeightOffset="-10000"
|
||||
/>
|
||||
</n-card>
|
||||
<ViewModal ref="viewRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, h, onMounted, reactive, ref } from 'vue';
|
||||
import { useDialog, useMessage } from 'naive-ui';
|
||||
import { BasicTable, TableAction } from '@/components/Table';
|
||||
import { BasicForm, useForm } from '@/components/Form/index';
|
||||
import { usePermission } from '@/hooks/web/usePermission';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { Dead, List, Retry } from '@/api/imOutbox';
|
||||
import { columns, loadOptions, loadTenantOptions, schemas, State, tenantOptions } from './model';
|
||||
import { adaTableScrollX } from '@/utils/hotgo';
|
||||
import ViewModal from './view.vue';
|
||||
|
||||
const message = useMessage();
|
||||
const dialog = useDialog();
|
||||
const { hasPermission } = usePermission();
|
||||
const userStore = useUserStore();
|
||||
const isPlatformAdmin = computed(() => userStore.isCompanyDept);
|
||||
const actionRef = ref();
|
||||
const searchFormRef = ref<any>({});
|
||||
const viewRef = ref();
|
||||
|
||||
const tenantSchema = schemas.value.find((item) => item.field === 'tenantId');
|
||||
if (tenantSchema) {
|
||||
tenantSchema.ifShow = () => isPlatformAdmin.value;
|
||||
}
|
||||
|
||||
const actionColumn = reactive({
|
||||
width: 210,
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
render(record: State) {
|
||||
return h(TableAction as any, {
|
||||
style: 'button',
|
||||
actions: [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: () => viewRef.value.openModal(record),
|
||||
auth: ['/imOutbox/view'],
|
||||
},
|
||||
{
|
||||
label: '重试',
|
||||
type: 'warning',
|
||||
ifShow: () => record.status !== 'delivered',
|
||||
onClick: () => handleRetry(record),
|
||||
auth: ['/imOutbox/retry'],
|
||||
},
|
||||
{
|
||||
label: '死信',
|
||||
type: 'error',
|
||||
ifShow: () => !['delivered', 'dead'].includes(record.status),
|
||||
onClick: () => handleDead(record),
|
||||
auth: ['/imOutbox/dead'],
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const scrollX = computed(() => adaTableScrollX(columns, actionColumn.width));
|
||||
|
||||
const [register, { setFieldsValue }] = useForm({
|
||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||
labelWidth: 90,
|
||||
schemas,
|
||||
});
|
||||
|
||||
const loadDataTable = async (res) => {
|
||||
const params = { ...searchFormRef.value?.formModel, ...res };
|
||||
if (isPlatformAdmin.value && !params.tenantId)
|
||||
return { list: [], page: 1, pageCount: 0, totalCount: 0 };
|
||||
if (!params.source) params.source = 'business';
|
||||
return await List(params);
|
||||
};
|
||||
|
||||
function reloadTable() {
|
||||
actionRef.value?.reload();
|
||||
}
|
||||
|
||||
async function handleReset() {
|
||||
const defaults: Recordable = { source: 'business' };
|
||||
if (isPlatformAdmin.value && tenantOptions.value.length > 0)
|
||||
defaults.tenantId = tenantOptions.value[0].value;
|
||||
await setFieldsValue(defaults);
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
function handleRetry(record: State) {
|
||||
dialog.warning({
|
||||
title: '重试Outbox事件',
|
||||
content: '将事件状态改回待投递,并清空下次重试时间,等待 IM 服务端消费,是否确认?',
|
||||
positiveText: '确认',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
await Retry({ tenantId: record.tenantId, source: record.source, id: record.id });
|
||||
message.success('操作成功');
|
||||
reloadTable();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDead(record: State) {
|
||||
dialog.error({
|
||||
title: '标记死信',
|
||||
content: '标记死信后 IM 服务端不会自动重试该事件,是否确认?',
|
||||
positiveText: '确认',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
await Dead({ tenantId: record.tenantId, source: record.source, id: record.id });
|
||||
message.success('操作成功');
|
||||
reloadTable();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
loadOptions();
|
||||
await setFieldsValue({ source: 'business' });
|
||||
if (isPlatformAdmin.value) {
|
||||
await loadTenantOptions();
|
||||
if (tenantOptions.value.length > 0) {
|
||||
await setFieldsValue({ tenantId: tenantOptions.value[0].value });
|
||||
} else {
|
||||
message.warning('暂无可用租户');
|
||||
}
|
||||
}
|
||||
reloadTable();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -0,0 +1,148 @@
|
||||
import { computed, ref } from 'vue';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { FormSchema } from '@/components/Form';
|
||||
import { defRangeShortcuts } from '@/utils/dateUtil';
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
import { List as TenantList } from '@/api/imTenant';
|
||||
|
||||
const dict = useDictStore();
|
||||
|
||||
export const tenantOptions = ref<any[]>([]);
|
||||
|
||||
export class State {
|
||||
public tenantId = 0;
|
||||
public tenantName = '';
|
||||
public source = 'business';
|
||||
public id = 0;
|
||||
public eventId = '';
|
||||
public targetType = '';
|
||||
public target = '';
|
||||
public actorUserId = 0;
|
||||
public eventType = '';
|
||||
public payload = '';
|
||||
public status = '';
|
||||
public attempts = 0;
|
||||
public nextRetryAt = '';
|
||||
public deliveredAt = '';
|
||||
public createdAt = '';
|
||||
public updatedAt = '';
|
||||
|
||||
constructor(state?: Partial<State>) {
|
||||
if (state) Object.assign(this, state);
|
||||
}
|
||||
}
|
||||
|
||||
export function newState(state: State | Record<string, any> | null): State {
|
||||
if (state !== null) {
|
||||
if (state instanceof State) return cloneDeep(state);
|
||||
return new State(state);
|
||||
}
|
||||
return new State();
|
||||
}
|
||||
|
||||
export const schemas = ref<FormSchema[]>([
|
||||
{
|
||||
field: 'tenantId',
|
||||
component: 'NSelect',
|
||||
label: '租户',
|
||||
componentProps: {
|
||||
clearable: false,
|
||||
options: computed(() => tenantOptions.value),
|
||||
placeholder: '请选择租户',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'source',
|
||||
component: 'NSelect',
|
||||
label: '来源',
|
||||
defaultValue: 'business',
|
||||
componentProps: {
|
||||
clearable: false,
|
||||
options: computed(() => dict.getOptions('ImOutboxSourceOptions')),
|
||||
placeholder: '请选择来源',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
component: 'NSelect',
|
||||
label: '状态',
|
||||
componentProps: {
|
||||
clearable: true,
|
||||
options: computed(() => dict.getOptions('ImOutboxStatusOptions')),
|
||||
placeholder: '请选择状态',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'eventType',
|
||||
component: 'NInput',
|
||||
label: '事件类型',
|
||||
componentProps: { placeholder: '请输入事件类型' },
|
||||
},
|
||||
{
|
||||
field: 'eventId',
|
||||
component: 'NInput',
|
||||
label: '事件ID',
|
||||
componentProps: { placeholder: '请输入事件ID' },
|
||||
},
|
||||
{
|
||||
field: 'target',
|
||||
component: 'NInput',
|
||||
label: '目标',
|
||||
componentProps: { placeholder: '请输入目标/Topic' },
|
||||
},
|
||||
{
|
||||
field: 'createdAt',
|
||||
component: 'NDatePicker',
|
||||
label: '创建时间',
|
||||
componentProps: {
|
||||
type: 'datetimerange',
|
||||
clearable: true,
|
||||
shortcuts: defRangeShortcuts(),
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
export const columns = [
|
||||
{ title: 'ID', key: 'id', align: 'left', width: 90 },
|
||||
{
|
||||
title: '来源',
|
||||
key: 'source',
|
||||
align: 'left',
|
||||
width: 110,
|
||||
render(row: State) {
|
||||
return dict.getLabel('ImOutboxSourceOptions', row.source);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
key: 'status',
|
||||
align: 'left',
|
||||
width: 110,
|
||||
render(row: State) {
|
||||
return dict.getLabel('ImOutboxStatusOptions', row.status);
|
||||
},
|
||||
},
|
||||
{ title: '事件类型', key: 'eventType', align: 'left', width: 220 },
|
||||
{ title: '事件ID', key: 'eventId', align: 'left', width: 240 },
|
||||
{ title: '目标类型', key: 'targetType', align: 'left', width: 120 },
|
||||
{ title: '目标', key: 'target', align: 'left', width: 180 },
|
||||
{ title: '操作用户', key: 'actorUserId', align: 'left', width: 120 },
|
||||
{ title: '尝试次数', key: 'attempts', align: 'left', width: 100 },
|
||||
{ title: '下次重试', key: 'nextRetryAt', align: 'left', width: 180 },
|
||||
{ title: '投递时间', key: 'deliveredAt', align: 'left', width: 180 },
|
||||
{ title: '创建时间', key: 'createdAt', align: 'left', width: 180 },
|
||||
{ title: '更新时间', key: 'updatedAt', align: 'left', width: 180 },
|
||||
];
|
||||
|
||||
export function loadOptions() {
|
||||
dict.loadOptions(['ImOutboxSourceOptions', 'ImOutboxStatusOptions']);
|
||||
}
|
||||
|
||||
export async function loadTenantOptions() {
|
||||
const res = await TenantList({ page: 1, perPage: 20 });
|
||||
tenantOptions.value = (res?.list || []).map((item) => ({
|
||||
label: `${item.name}(${item.code})`,
|
||||
value: item.id,
|
||||
}));
|
||||
return tenantOptions.value;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<n-modal
|
||||
v-model:show="showModal"
|
||||
preset="dialog"
|
||||
:show-icon="false"
|
||||
:title="'Outbox详情 #' + formValue.id"
|
||||
:style="{ width: dialogWidth }"
|
||||
>
|
||||
<n-spin :show="loading" description="请稍候...">
|
||||
<n-descriptions label-placement="left" bordered :column="settingStore.isMobile ? 1 : 2">
|
||||
<n-descriptions-item label="租户">{{ formValue.tenantName }}</n-descriptions-item>
|
||||
<n-descriptions-item label="来源">{{ sourceLabel }}</n-descriptions-item>
|
||||
<n-descriptions-item label="事件ID">{{ formValue.eventId }}</n-descriptions-item>
|
||||
<n-descriptions-item label="事件类型">{{ formValue.eventType }}</n-descriptions-item>
|
||||
<n-descriptions-item label="状态">{{ statusLabel }}</n-descriptions-item>
|
||||
<n-descriptions-item label="尝试次数">{{ formValue.attempts }}</n-descriptions-item>
|
||||
<n-descriptions-item label="目标类型">{{ formValue.targetType }}</n-descriptions-item>
|
||||
<n-descriptions-item label="目标">{{ formValue.target }}</n-descriptions-item>
|
||||
<n-descriptions-item label="操作用户">{{ formValue.actorUserId }}</n-descriptions-item>
|
||||
<n-descriptions-item label="下次重试">
|
||||
{{ formValue.nextRetryAt || '-' }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="投递时间">
|
||||
{{ formValue.deliveredAt || '-' }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="创建时间">{{ formValue.createdAt }}</n-descriptions-item>
|
||||
<n-descriptions-item label="Payload" :span="2">
|
||||
<n-code :code="formValue.payload || '{}'" language="json" word-wrap />
|
||||
</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
</n-spin>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
import { useProjectSettingStore } from '@/store/modules/projectSetting';
|
||||
import { adaModalWidth } from '@/utils/hotgo';
|
||||
import { newState, State } from './model';
|
||||
import { View } from '@/api/imOutbox';
|
||||
|
||||
const dict = useDictStore();
|
||||
const settingStore = useProjectSettingStore();
|
||||
const showModal = ref(false);
|
||||
const loading = ref(false);
|
||||
const formValue = ref<State>(newState(null));
|
||||
const dialogWidth = computed(() => adaModalWidth(920));
|
||||
const sourceLabel = computed(() =>
|
||||
dict.getLabel('ImOutboxSourceOptions', formValue.value.source)
|
||||
);
|
||||
const statusLabel = computed(() =>
|
||||
dict.getLabel('ImOutboxStatusOptions', formValue.value.status)
|
||||
);
|
||||
|
||||
function openModal(state: State) {
|
||||
showModal.value = true;
|
||||
formValue.value = newState(state);
|
||||
loading.value = true;
|
||||
View({ tenantId: state.tenantId, source: state.source, id: state.id })
|
||||
.then((res) => {
|
||||
formValue.value = newState(res);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({ openModal });
|
||||
</script>
|
||||
@@ -1,10 +1,15 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="n-layout-page-header">
|
||||
<n-card :bordered="false" title="IM实名审核"></n-card>
|
||||
<n-card :bordered="false" title="IM实名审核" />
|
||||
</div>
|
||||
<n-card :bordered="false" class="proCard">
|
||||
<BasicForm ref="searchFormRef" @register="register" @submit="reloadTable" @reset="reloadTable" />
|
||||
<BasicForm
|
||||
ref="searchFormRef"
|
||||
@register="register"
|
||||
@submit="reloadTable"
|
||||
@reset="reloadTable"
|
||||
/>
|
||||
<BasicTable
|
||||
ref="actionRef"
|
||||
:columns="columns"
|
||||
@@ -24,6 +29,7 @@
|
||||
import { useDialog, useMessage } from 'naive-ui';
|
||||
import { BasicTable, TableAction } from '@/components/Table';
|
||||
import { BasicForm, useForm } from '@/components/Form/index';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { List, Review } from '@/api/imRealname';
|
||||
import { columns, loadOptions, loadTenantOptions, schemas, State, tenantOptions } from './model';
|
||||
import { adaTableScrollX } from '@/utils/hotgo';
|
||||
@@ -31,10 +37,17 @@
|
||||
|
||||
const message = useMessage();
|
||||
const dialog = useDialog();
|
||||
const userStore = useUserStore();
|
||||
const isPlatformAdmin = computed(() => userStore.isCompanyDept);
|
||||
const actionRef = ref();
|
||||
const searchFormRef = ref<any>({});
|
||||
const viewRef = ref();
|
||||
|
||||
const tenantSchema = schemas.value.find((item) => item.field === 'tenantId');
|
||||
if (tenantSchema) {
|
||||
tenantSchema.ifShow = () => isPlatformAdmin.value;
|
||||
}
|
||||
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
title: '操作',
|
||||
@@ -44,7 +57,11 @@
|
||||
return h(TableAction as any, {
|
||||
style: 'button',
|
||||
actions: [
|
||||
{ label: '详情', onClick: () => viewRef.value.openModal(record), auth: ['/imRealname/view'] },
|
||||
{
|
||||
label: '详情',
|
||||
onClick: () => viewRef.value.openModal(record),
|
||||
auth: ['/imRealname/view'],
|
||||
},
|
||||
{
|
||||
label: '通过',
|
||||
onClick: () => handleReview(record, 'verified'),
|
||||
@@ -71,7 +88,8 @@
|
||||
|
||||
const loadDataTable = async (res) => {
|
||||
const params = { ...searchFormRef.value?.formModel, ...res };
|
||||
if (!params.tenantId) return { list: [], page: 1, pageCount: 0, totalCount: 0 };
|
||||
if (isPlatformAdmin.value && !params.tenantId)
|
||||
return { list: [], page: 1, pageCount: 0, totalCount: 0 };
|
||||
return await List(params);
|
||||
};
|
||||
|
||||
@@ -98,10 +116,12 @@
|
||||
|
||||
onMounted(async () => {
|
||||
loadOptions();
|
||||
await loadTenantOptions();
|
||||
if (tenantOptions.value.length > 0) {
|
||||
await setFieldsValue({ tenantId: tenantOptions.value[0].value });
|
||||
reloadTable();
|
||||
if (isPlatformAdmin.value) {
|
||||
await loadTenantOptions();
|
||||
if (tenantOptions.value.length > 0) {
|
||||
await setFieldsValue({ tenantId: tenantOptions.value[0].value });
|
||||
}
|
||||
}
|
||||
reloadTable();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,18 +1,34 @@
|
||||
<template>
|
||||
<n-modal v-model:show="showModal" preset="dialog" :show-icon="false" :title="'实名审核详情 #' + formValue.id" :style="{ width: dialogWidth }">
|
||||
<n-modal
|
||||
v-model:show="showModal"
|
||||
preset="dialog"
|
||||
:show-icon="false"
|
||||
:title="'实名审核详情 #' + formValue.id"
|
||||
:style="{ width: dialogWidth }"
|
||||
>
|
||||
<n-spin :show="loading">
|
||||
<n-descriptions label-placement="left" bordered :column="settingStore.isMobile ? 1 : 2">
|
||||
<n-descriptions-item label="租户">{{ formValue.tenantName }}</n-descriptions-item>
|
||||
<n-descriptions-item label="用户ID">{{ formValue.userId }}</n-descriptions-item>
|
||||
<n-descriptions-item label="提交ID">{{ formValue.submissionId }}</n-descriptions-item>
|
||||
<n-descriptions-item label="状态">{{ statusLabel }}</n-descriptions-item>
|
||||
<n-descriptions-item label="脱敏姓名">{{ formValue.maskedName || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="脱敏证件">{{ formValue.maskedIdNumber || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="脱敏姓名">{{
|
||||
formValue.maskedName || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="脱敏证件">{{
|
||||
formValue.maskedIdNumber || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="证件类型">{{ formValue.idType || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="证件哈希">{{ formValue.idNumberHash || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="通过时间">{{ formValue.verifiedAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="证件哈希">{{
|
||||
formValue.idNumberHash || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="通过时间">{{
|
||||
formValue.verifiedAt || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="创建时间">{{ formValue.createdAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="审核原因" :span="2">{{ formValue.reviewReason || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="审核原因" :span="2">{{
|
||||
formValue.reviewReason || '-'
|
||||
}}</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
</n-spin>
|
||||
<template #action>
|
||||
@@ -35,7 +51,9 @@
|
||||
const loading = ref(false);
|
||||
const formValue = ref<State>(newState(null));
|
||||
const dialogWidth = computed(() => adaModalWidth(820));
|
||||
const statusLabel = computed(() => dict.getLabel('ImRealnameStatusOptions', formValue.value.status));
|
||||
const statusLabel = computed(() =>
|
||||
dict.getLabel('ImRealnameStatusOptions', formValue.value.status)
|
||||
);
|
||||
|
||||
function openModal(state: State) {
|
||||
showModal.value = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="n-layout-page-header">
|
||||
<n-card :bordered="false" title="IM举报反馈"></n-card>
|
||||
<n-card :bordered="false" title="IM举报反馈" />
|
||||
</div>
|
||||
<n-card :bordered="false" class="proCard">
|
||||
<BasicForm
|
||||
@@ -30,6 +30,7 @@
|
||||
import { useDialog, useMessage } from 'naive-ui';
|
||||
import { BasicTable, TableAction } from '@/components/Table';
|
||||
import { BasicForm, useForm } from '@/components/Form/index';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { List, Status } from '@/api/imWorkOrder';
|
||||
import { columns, loadOptions, loadTenantOptions, schemas, State, tenantOptions } from './model';
|
||||
import { adaTableScrollX } from '@/utils/hotgo';
|
||||
@@ -37,10 +38,17 @@
|
||||
|
||||
const message = useMessage();
|
||||
const dialog = useDialog();
|
||||
const userStore = useUserStore();
|
||||
const isPlatformAdmin = computed(() => userStore.isCompanyDept);
|
||||
const actionRef = ref();
|
||||
const searchFormRef = ref<any>({});
|
||||
const viewRef = ref();
|
||||
|
||||
const tenantSchema = schemas.value.find((item) => item.field === 'tenantId');
|
||||
if (tenantSchema) {
|
||||
tenantSchema.ifShow = () => isPlatformAdmin.value;
|
||||
}
|
||||
|
||||
const actionColumn = reactive({
|
||||
width: 240,
|
||||
title: '操作',
|
||||
@@ -50,7 +58,11 @@
|
||||
return h(TableAction as any, {
|
||||
style: 'button',
|
||||
actions: [
|
||||
{ label: '详情', onClick: () => viewRef.value.openModal(record), auth: ['/imWorkOrder/view'] },
|
||||
{
|
||||
label: '详情',
|
||||
onClick: () => viewRef.value.openModal(record),
|
||||
auth: ['/imWorkOrder/view'],
|
||||
},
|
||||
{
|
||||
label: '处理中',
|
||||
onClick: () => handleStatus(record, 'processing'),
|
||||
@@ -90,7 +102,8 @@
|
||||
|
||||
const loadDataTable = async (res) => {
|
||||
const params = { ...searchFormRef.value?.formModel, ...res };
|
||||
if (!params.tenantId || !params.type) return { list: [], page: 1, pageCount: 0, totalCount: 0 };
|
||||
if ((isPlatformAdmin.value && !params.tenantId) || !params.type)
|
||||
return { list: [], page: 1, pageCount: 0, totalCount: 0 };
|
||||
return await List(params);
|
||||
};
|
||||
|
||||
@@ -100,7 +113,8 @@
|
||||
|
||||
async function handleReset() {
|
||||
const defaults: Recordable = { type: 'abuse' };
|
||||
if (tenantOptions.value.length > 0) defaults.tenantId = tenantOptions.value[0].value;
|
||||
if (isPlatformAdmin.value && tenantOptions.value.length > 0)
|
||||
defaults.tenantId = tenantOptions.value[0].value;
|
||||
await setFieldsValue(defaults);
|
||||
reloadTable();
|
||||
}
|
||||
@@ -112,23 +126,28 @@
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: () => {
|
||||
return Status({ tenantId: record.tenantId, type: record.type, id: record.id, status }).then(() => {
|
||||
message.success('操作成功');
|
||||
reloadTable();
|
||||
});
|
||||
return Status({ tenantId: record.tenantId, type: record.type, id: record.id, status }).then(
|
||||
() => {
|
||||
message.success('操作成功');
|
||||
reloadTable();
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
loadOptions();
|
||||
await loadTenantOptions();
|
||||
if (tenantOptions.value.length > 0) {
|
||||
await setFieldsValue({ tenantId: tenantOptions.value[0].value, type: 'abuse' });
|
||||
reloadTable();
|
||||
} else {
|
||||
message.warning('暂无可用租户');
|
||||
await setFieldsValue({ type: 'abuse' });
|
||||
if (isPlatformAdmin.value) {
|
||||
await loadTenantOptions();
|
||||
if (tenantOptions.value.length > 0) {
|
||||
await setFieldsValue({ tenantId: tenantOptions.value[0].value, type: 'abuse' });
|
||||
} else {
|
||||
message.warning('暂无可用租户');
|
||||
}
|
||||
}
|
||||
reloadTable();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -18,13 +18,27 @@
|
||||
<n-descriptions-item label="状态">{{ statusLabel }}</n-descriptions-item>
|
||||
<n-descriptions-item label="提交人ID">{{ formValue.userId }}</n-descriptions-item>
|
||||
<n-descriptions-item label="分类">{{ formValue.category || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="目标类型">{{ formValue.targetType || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="目标摘要">{{ formValue.targetSummary || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="联系方式">{{ formValue.contact || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="包含诊断">{{ formValue.includeDiagnostics ? '是' : '否' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="创建时间">{{ formValue.createdAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="修改时间">{{ formValue.updatedAt || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="内容" :span="2">{{ formValue.content || formValue.description || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="目标类型">{{
|
||||
formValue.targetType || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="目标摘要">{{
|
||||
formValue.targetSummary || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="联系方式">{{
|
||||
formValue.contact || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="包含诊断">{{
|
||||
formValue.includeDiagnostics ? '是' : '否'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="创建时间">{{
|
||||
formValue.createdAt || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="修改时间">{{
|
||||
formValue.updatedAt || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="内容" :span="2">{{
|
||||
formValue.content || formValue.description || '-'
|
||||
}}</n-descriptions-item>
|
||||
<n-descriptions-item label="证据/附件" :span="2">
|
||||
<n-code :code="formValue.evidenceJson || '-'" language="json" word-wrap />
|
||||
</n-descriptions-item>
|
||||
@@ -34,7 +48,9 @@
|
||||
<n-descriptions-item label="客户端上下文" :span="2">
|
||||
<n-code :code="formValue.clientContextJson || '-'" language="json" word-wrap />
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="幂等键" :span="2">{{ formValue.idempotencyKey || '-' }}</n-descriptions-item>
|
||||
<n-descriptions-item label="幂等键" :span="2">{{
|
||||
formValue.idempotencyKey || '-'
|
||||
}}</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
</n-spin>
|
||||
</n-scrollbar>
|
||||
@@ -61,7 +77,9 @@
|
||||
const showModal = ref(false);
|
||||
const formValue = ref<State>(newState(null));
|
||||
const dialogWidth = computed(() => adaModalWidth(980));
|
||||
const statusLabel = computed(() => dict.getLabel('ImWorkOrderStatusOptions', formValue.value.status));
|
||||
const statusLabel = computed(() =>
|
||||
dict.getLabel('ImWorkOrderStatusOptions', formValue.value.status)
|
||||
);
|
||||
const typeLabel = computed(() => (formValue.value.type === 'abuse' ? '举报' : '反馈'));
|
||||
|
||||
function closeForm() {
|
||||
|
||||
Reference in New Issue
Block a user