feat: 完成分享、单会话与发布审批改造
- 增加工作流协作分享与知识库卡片分享入口,统一低版本浏览器复制反馈 - Web 新登录替换旧会话,并保持 API Key 会话隔离 - 发布审批增加必填说明并在审批详情展示 - 账号重置与导入改用可配置默认强密码
This commit is contained in:
@@ -27,6 +27,7 @@ import WorkflowApprovalSnapshotPreview from '#/views/system/approval/components/
|
||||
const route = useRoute();
|
||||
const loading = ref(false);
|
||||
const detail = ref<any>(null);
|
||||
const approvalActionLoading = ref<'approve' | 'reject' | 'revoke' | null>(null);
|
||||
|
||||
const resourceLabelMap: Record<string, string> = {
|
||||
BOT: $t('approval.resource.bot'),
|
||||
@@ -96,28 +97,45 @@ async function loadDetail() {
|
||||
}
|
||||
|
||||
async function submitApprovalAction(action: 'approve' | 'reject' | 'revoke') {
|
||||
if (approvalActionLoading.value) {
|
||||
return;
|
||||
}
|
||||
approvalActionLoading.value = action;
|
||||
const titleMap = {
|
||||
approve: $t('approval.action.approve'),
|
||||
reject: $t('approval.action.reject'),
|
||||
revoke: $t('approval.action.revoke'),
|
||||
};
|
||||
const { value } = await ElMessageBox.prompt(
|
||||
$t('approval.placeholder.actionComment'),
|
||||
titleMap[action],
|
||||
{
|
||||
inputValue: '',
|
||||
inputType: 'textarea',
|
||||
},
|
||||
);
|
||||
const res = await api.post(`/api/v1/approvalInstance/${action}`, {
|
||||
comment: value || '',
|
||||
instanceId: detail.value?.id,
|
||||
});
|
||||
if (res.errorCode !== 0) {
|
||||
return;
|
||||
try {
|
||||
let value = '';
|
||||
try {
|
||||
const promptResult = await ElMessageBox.prompt(
|
||||
$t('approval.placeholder.actionComment'),
|
||||
titleMap[action],
|
||||
{
|
||||
inputValue: '',
|
||||
inputType: 'textarea',
|
||||
},
|
||||
);
|
||||
value = promptResult.value || '';
|
||||
} catch (error) {
|
||||
if (error === 'cancel' || error === 'close') {
|
||||
return;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
const res = await api.post(`/api/v1/approvalInstance/${action}`, {
|
||||
comment: value,
|
||||
instanceId: detail.value?.id,
|
||||
});
|
||||
if (res.errorCode !== 0) {
|
||||
return;
|
||||
}
|
||||
ElMessage.success($t('approval.message.actionSuccess'));
|
||||
await loadDetail();
|
||||
} finally {
|
||||
approvalActionLoading.value = null;
|
||||
}
|
||||
ElMessage.success($t('approval.message.actionSuccess'));
|
||||
await loadDetail();
|
||||
}
|
||||
|
||||
function getStatusType(status: string) {
|
||||
@@ -167,6 +185,10 @@ function formatOperatorName(name?: null | string) {
|
||||
return name || '-';
|
||||
}
|
||||
|
||||
function formatApplicationReason(value?: null | string) {
|
||||
return String(value || '').trim() || '-';
|
||||
}
|
||||
|
||||
function formatAssigneeDisplay(row: Record<string, any>) {
|
||||
if (!row?.assigneeType || !row?.assigneeTargetName) {
|
||||
return '-';
|
||||
@@ -238,6 +260,8 @@ function formatEventInfo(row: Record<string, any>) {
|
||||
<ElButton
|
||||
v-if="detail?.canApprove"
|
||||
type="success"
|
||||
:disabled="Boolean(approvalActionLoading)"
|
||||
:loading="approvalActionLoading === 'approve'"
|
||||
@click="submitApprovalAction('approve')"
|
||||
>
|
||||
{{ $t('approval.action.approve') }}
|
||||
@@ -245,12 +269,17 @@ function formatEventInfo(row: Record<string, any>) {
|
||||
<ElButton
|
||||
v-if="detail?.canReject"
|
||||
type="danger"
|
||||
:disabled="Boolean(approvalActionLoading)"
|
||||
:loading="approvalActionLoading === 'reject'"
|
||||
@click="submitApprovalAction('reject')"
|
||||
>
|
||||
{{ $t('approval.action.reject') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="detail?.canRevoke"
|
||||
type="warning"
|
||||
:disabled="Boolean(approvalActionLoading)"
|
||||
:loading="approvalActionLoading === 'revoke'"
|
||||
@click="submitApprovalAction('revoke')"
|
||||
>
|
||||
{{ $t('approval.action.revoke') }}
|
||||
@@ -270,6 +299,9 @@ function formatEventInfo(row: Record<string, any>) {
|
||||
<ElDescriptionsItem :label="$t('approval.fields.summary')">
|
||||
{{ detail.summary || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="$t('approval.fields.applicationReason')">
|
||||
{{ detail.applicationReason || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="$t('approval.fields.currentStep')">
|
||||
{{ detail.currentStepNo || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
@@ -319,6 +351,14 @@ function formatEventInfo(row: Record<string, any>) {
|
||||
:label="$t('approval.fields.stepName')"
|
||||
min-width="180"
|
||||
/>
|
||||
<ElTableColumn
|
||||
:label="$t('approval.fields.applicationReason')"
|
||||
min-width="220"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatApplicationReason(row.applicationReason) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('approval.fields.status')" width="120">
|
||||
<template #default="{ row }">
|
||||
<ElTag :type="getStatusType(row.status)">
|
||||
@@ -390,6 +430,14 @@ function formatEventInfo(row: Record<string, any>) {
|
||||
</div>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
:label="$t('approval.fields.applicationReason')"
|
||||
min-width="220"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatApplicationReason(row.applicationReason) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user