待我处理-撤回接口完成
This commit is contained in:
@@ -7,3 +7,11 @@ export function myTasksListApi() {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 撤回
|
||||||
|
export function myTasksWithdrawApi(id:number,data: {reason:string}) {
|
||||||
|
return request({
|
||||||
|
url: `/api/changes/${id}/withdraw`,
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -4,27 +4,24 @@ import { Icon } from '@iconify/vue'
|
|||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import { useRouterPush } from '@/hooks/common/router';
|
import { useRouterPush } from '@/hooks/common/router';
|
||||||
import { tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
|
import { tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
|
||||||
import { myTasksListApi } from '@/service/api/myTasks';
|
|
||||||
import { systemConfigApi } from '@/service/api/system';
|
import { systemConfigApi } from '@/service/api/system';
|
||||||
|
import { myTasksListApi, myTasksWithdrawApi } from '@/service/api/myTasks';
|
||||||
|
|
||||||
const themeStore = useThemeStore();
|
const themeStore = useThemeStore();
|
||||||
const { routerPushByKey } = useRouterPush();
|
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 loading = ref<boolean>(false);
|
||||||
|
// 当前行
|
||||||
const currentRow = ref<any>(null);
|
const currentRow = ref<any>(null);
|
||||||
|
// 进度抽屉
|
||||||
const progressDrawer = ref<boolean>(false);
|
const progressDrawer = ref<boolean>(false);
|
||||||
|
// 撤回弹框
|
||||||
const revokeModal = ref<boolean>(false);
|
const revokeModal = ref<boolean>(false);
|
||||||
const revokeSaving = ref<boolean>(false);
|
const revokeSaving = ref<boolean>(false);
|
||||||
|
// 撤回原因
|
||||||
const revokeReason = ref<string>("");
|
const revokeReason = ref<string>("");
|
||||||
|
// 处置申请弹框
|
||||||
const disposalModal = ref<boolean>(false);
|
const disposalModal = ref<boolean>(false);
|
||||||
|
|
||||||
// 变更类型
|
// 变更类型
|
||||||
const typeList = ref<any[]>([]);
|
const typeList = ref<any[]>([]);
|
||||||
// 变更等级
|
// 变更等级
|
||||||
@@ -67,25 +64,7 @@ const tabChange = (k: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const stages = ["提交申请", "审批", "实施与投用前确认", "投用", "验收", "关闭"];
|
const SUB_ORDERS: any[] = [];
|
||||||
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 subsOf = (id: string) => SUB_ORDERS.filter((s:any) => s.parentId === id);
|
const subsOf = (id: string) => SUB_ORDERS.filter((s:any) => s.parentId === id);
|
||||||
const pendingSubs = computed(() => subsOf(currentRow.value?.id).filter((s:any) => s.status === "审批中"));
|
const pendingSubs = computed(() => subsOf(currentRow.value?.id).filter((s:any) => s.status === "审批中"));
|
||||||
interface Opt { act: any; name: string; desc: string; disabled?: boolean; note?: string }
|
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() } });
|
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;
|
currentRow.value = c;
|
||||||
if(type==='reject'){
|
if(type==='reject'){
|
||||||
window.$message?.info("该任务暂无处置申请");
|
window.$message?.info("该任务暂无处置申请");
|
||||||
@@ -134,33 +102,37 @@ const openDisposal = (c: MyChange,type:string = '') => {
|
|||||||
disposalModal.value = true;
|
disposalModal.value = true;
|
||||||
};
|
};
|
||||||
// 打开资料关闭、关闭变更
|
// 打开资料关闭、关闭变更
|
||||||
const openClosure = (c: MyChange,type:string = '') => {
|
const openClosure = (c: any,type:string = '') => {
|
||||||
if(type==='reject'){
|
if(type==='reject'){
|
||||||
window.$message?.info("关闭该变更(驳回后不再推进,流程终止并归档备查)");
|
window.$message?.info("关闭该变更(驳回后不再推进,流程终止并归档备查)");
|
||||||
return;
|
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) {
|
if (!revokeReason.value) {
|
||||||
window.$message?.warning("请填写撤回理由");
|
return window.$message?.warning("请填写撤回理由");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
revokeSaving.value = true;
|
revokeSaving.value = true;
|
||||||
setTimeout(() => {
|
const {error} = await myTasksWithdrawApi(currentRow.value?.change_id,{reason:revokeReason.value});
|
||||||
revokeSaving.value = false;
|
if(!error){
|
||||||
revokeModal.value = false;
|
revokeModal.value = false;
|
||||||
const pendingGroup = list.value.find((item: any) => item.status === 'approval');
|
window.$message?.success(`撤回成功,申请退回草稿箱,审批记录保留可查,修改后可重新提交`);
|
||||||
if (pendingGroup) {
|
getList();
|
||||||
// 过滤掉匹配 targetId 的项
|
|
||||||
pendingGroup.list = pendingGroup.list.filter((item:any) => item.id !== currentRow.value?.id);
|
|
||||||
}
|
}
|
||||||
window.$message?.success(`已撤回 ${currentRow.value?.id},申请退回草稿箱,审批记录保留可查,修改后可重新提交`);
|
revokeSaving.value = false;
|
||||||
}, 1000);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 匹配变更等级
|
// 匹配变更等级
|
||||||
@@ -190,8 +162,7 @@ const getList = async () => {
|
|||||||
const {data,error} = await myTasksListApi();
|
const {data,error} = await myTasksListApi();
|
||||||
if(!error){
|
if(!error){
|
||||||
dataSource.value = data;
|
dataSource.value = data;
|
||||||
list.value = resetGrouped([...dataSource.value.my_applications,...dataSource.value.todo]);
|
tabChange(currentTab.value);
|
||||||
console.log(data)
|
|
||||||
// 统计数量
|
// 统计数量
|
||||||
// 全部
|
// 全部
|
||||||
tabCount.value["all"] = [...dataSource.value.my_applications,...dataSource.value.todo].length;
|
tabCount.value["all"] = [...dataSource.value.my_applications,...dataSource.value.todo].length;
|
||||||
@@ -416,7 +387,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
<!-- 驳回处理 -->
|
<!-- 驳回处理 -->
|
||||||
<div v-if="c.status === 'REJECTED'" class="flex gap-1.5">
|
<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="warning" @click="openProgress(c)">进度</NButton>
|
||||||
<NButton class="text-xs" text type="primary" @click="openDisposal(c,'reject')">修改重报</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>
|
<NButton class="text-xs" text type="error" @click="openClosure(c,'reject')">关闭变更</NButton>
|
||||||
@@ -493,7 +464,7 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="flex justify-end gap-[10px]">
|
<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>
|
<NButton size="small" type="primary" :loading="revokeSaving" @click="revokeSave">保存</NButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user