待我处理-撤回接口完成

This commit is contained in:
2026-09-15 17:02:53 +08:00
parent 46b50e052e
commit 098e92026e
2 changed files with 40 additions and 61 deletions
+32 -61
View File
@@ -4,27 +4,24 @@ import { Icon } from '@iconify/vue'
import { useThemeStore } from '@/store/modules/theme';
import { useRouterPush } from '@/hooks/common/router';
import { tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
import { myTasksListApi } from '@/service/api/myTasks';
import { systemConfigApi } from '@/service/api/system';
import { myTasksListApi, myTasksWithdrawApi } from '@/service/api/myTasks';
const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush();
const emit = defineEmits<{ go: [v: string, preset?: string];}>();
interface MyChange {
id: string;title: string;status: string;detail: string;applyTime: string;updateTime: string;
level: "重要" | "一般"; dur: "永久" | "临时"; urgent?: boolean;deadline?: string;
stage: string; meta: string; left?: number; extended?: boolean;
node?: string; members?: { name: string; done: boolean }[];
}
const loading = ref<boolean>(false);
// 当前行
const currentRow = ref<any>(null);
// 进度抽屉
const progressDrawer = ref<boolean>(false);
// 撤回弹框
const revokeModal = ref<boolean>(false);
const revokeSaving = ref<boolean>(false);
// 撤回原因
const revokeReason = ref<string>("");
// 处置申请弹框
const disposalModal = ref<boolean>(false);
// 变更类型
const typeList = ref<any[]>([]);
// 变更等级
@@ -67,25 +64,7 @@ const tabChange = (k: string) => {
}
};
const stages = ["提交申请", "审批", "实施与投用前确认", "投用", "验收", "关闭"];
const curIdx = computed(() => ({ 审批中: 1, 已批准: 2, 实施中: 2, 待PSSR: 2, 待验收: 4, 待关闭: 5, 已关闭: 6 } as Record<string, number>)[currentRow.value?.status ?? ""] ?? 1);
const closed = computed(() => currentRow.value?.status === "已关闭");
const timeOf = (i: number) => (i === 0 ? currentRow.value?.applyTime : i === 3 ? currentRow.value?.actualUse : i === 5 ? currentRow.value?.closeTime : undefined);
interface SubOrder {
id: string; // 子单号:原单号-Y1(延期)/ -Z1(转永久)
parentId: string; // 原变更单号
parentTitle: string;
kind: "extend" | "permanent";
applicant: string;
reason: string;
newDeadline?: string; // 延期子单:申请延期至
status: "审批中" | "已通过" | "已驳回";
submitTime: string;
steps: { role: string; name: string; done: boolean }[]; // 会签:全员同意即通过
rejectNote?: string;
}
const SUB_ORDERS: SubOrder[] = [];
const SUB_ORDERS: any[] = [];
const subsOf = (id: string) => SUB_ORDERS.filter((s:any) => s.parentId === id);
const pendingSubs = computed(() => subsOf(currentRow.value?.id).filter((s:any) => s.status === "审批中"));
interface Opt { act: any; name: string; desc: string; disabled?: boolean; note?: string }
@@ -110,22 +89,11 @@ const opts = computed<Opt[]>(() => {
});
// 打开详情
const openDetail = (c: MyChange,type:string = '') => {
const openDetail = (c: any) => {
routerPushByKey("my_highriskdetail",{ query: { id: c.id.toString() } });
};
// 打开进度
const openProgress = (c: any) => {
currentRow.value = c;
progressDrawer.value = true;
};
// 打开撤回
const openWithdraw = (c: MyChange) => {
revokeReason.value = "";
currentRow.value = c;
revokeModal.value = true;
};
// 打开处置申请、修改重报
const openDisposal = (c: MyChange,type:string = '') => {
const openDisposal = (c: any,type:string = '') => {
currentRow.value = c;
if(type==='reject'){
window.$message?.info("该任务暂无处置申请");
@@ -134,33 +102,37 @@ const openDisposal = (c: MyChange,type:string = '') => {
disposalModal.value = true;
};
// 打开资料关闭、关闭变更
const openClosure = (c: MyChange,type:string = '') => {
const openClosure = (c: any,type:string = '') => {
if(type==='reject'){
window.$message?.info("关闭该变更(驳回后不再推进,流程终止并归档备查)");
return;
}
};
// 撤回取消
const revokeCancel = () => {
revokeModal.value = false;
// 打开进度
const openProgress = (c: any) => {
currentRow.value = c;
progressDrawer.value = true;
};
// 打开撤回
const openWithdraw = (c: any) => {
revokeReason.value = "";
currentRow.value = c;
revokeModal.value = true;
};
// 撤回确认
const revokeSave = () => {
const revokeSave = async () => {
if (!revokeReason.value) {
window.$message?.warning("请填写撤回理由");
return;
return window.$message?.warning("请填写撤回理由");
}
revokeSaving.value = true;
setTimeout(() => {
revokeSaving.value = false;
const {error} = await myTasksWithdrawApi(currentRow.value?.change_id,{reason:revokeReason.value});
if(!error){
revokeModal.value = false;
const pendingGroup = list.value.find((item: any) => item.status === 'approval');
if (pendingGroup) {
// 过滤掉匹配 targetId 的项
pendingGroup.list = pendingGroup.list.filter((item:any) => item.id !== currentRow.value?.id);
}
window.$message?.success(`已撤回 ${currentRow.value?.id},申请退回草稿箱,审批记录保留可查,修改后可重新提交`);
}, 1000);
window.$message?.success(`撤回成功,申请退回草稿箱,审批记录保留可查,修改后可重新提交`);
getList();
}
revokeSaving.value = false;
};
// 匹配变更等级
@@ -190,8 +162,7 @@ const getList = async () => {
const {data,error} = await myTasksListApi();
if(!error){
dataSource.value = data;
list.value = resetGrouped([...dataSource.value.my_applications,...dataSource.value.todo]);
console.log(data)
tabChange(currentTab.value);
// 统计数量
// 全部
tabCount.value["all"] = [...dataSource.value.my_applications,...dataSource.value.todo].length;
@@ -416,7 +387,7 @@ onMounted(() => {
</div>
<!-- 驳回处理 -->
<div v-if="c.status === 'REJECTED'" class="flex gap-1.5">
<NButton class="text-xs" text type="primary" @click="openDetail(c,'reject')">详情</NButton>
<NButton class="text-xs" text type="primary" @click="openDetail(c)">详情</NButton>
<NButton class="text-xs" text type="warning" @click="openProgress(c)">进度</NButton>
<NButton class="text-xs" text type="primary" @click="openDisposal(c,'reject')">修改重报</NButton>
<NButton class="text-xs" text type="error" @click="openClosure(c,'reject')">关闭变更</NButton>
@@ -493,7 +464,7 @@ onMounted(() => {
</template>
<template #footer>
<div class="flex justify-end gap-[10px]">
<NButton size="small" @click="revokeCancel">取消</NButton>
<NButton size="small" @click="revokeModal = false">取消</NButton>
<NButton size="small" type="primary" :loading="revokeSaving" @click="revokeSave">保存</NButton>
</div>
</template>