Files
flow-center-front/src/views/flow/admin/Instances.vue
T

106 lines
5.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
// 办件记录(管理端):全校办件查询;CONDITION 判断失败挂起的办件在此"重跑路由"恢复
import { ref } from "vue";
import { Message, Tag } from "view-ui-plus";
import { OperatorEnum } from "@/types";
import TablePageAlovaNew from "@/components/TablePageAlovaNew.vue";
import InstanceDrawer from "@/views/flow/components/InstanceDrawer.vue";
import { flowApi, INSTANCE_STATUS, INSTANCE_STATUS_COLOR } from "@/api/module/flow";
import { actionColumn } from "@/utils/tableActions";
const tableRef = ref<InstanceType<typeof TablePageAlovaNew> | null>(null);
// status 下拉含伪选项 'hung'(路由挂起):表内是 string,出站转 hung=true(不再传 status)
const dataParams = ref<{ status?: number | string; keyword?: string }>({ status: undefined, keyword: "" });
const drawerVisible = ref(false);
const drawerInstanceId = ref<string | number>("");
const columns = [
{ title: "序号", type: "index", width: 70, align: "center" },
{ title: "办件标题", key: "bizTitle", minWidth: 220 },
{ title: "业务", width: 170, render: (h: any, p: any) => h("span", `${p.row.bizType || "-"}/${p.row.bizId || "-"}`) },
{ title: "状态", width: 120, align: "center", render: (h: any, p: any) => h("span", [
h(Tag, { color: INSTANCE_STATUS_COLOR[p.row.status] || "gray" }, () => INSTANCE_STATUS[p.row.status] || p.row.status),
// F11-4 路由挂起红标:接口回传 routeHung(最新 attempt 路由判断仍无出口)
p.row.routeHung ? h(Tag, { color: "red" }, () => "路由挂起") : null,
]) },
{ title: "提交人", key: "submitterName", width: 100 },
{ title: "提交时间", width: 160, render: (h: any, p: any) => h("span", (p.row.submitTime || "").replace("T", " ")) },
actionColumn(
[
{ key: "detail", label: "详情", icon: "icon-browse", on: (r: any) => openDetail(r.id) },
// 仅审批中的办件可挂条件分支节点;其余行置灰保位(重跑入口对非挂起办件是业务错提示)
{ key: "reroute", label: "重跑路由", icon: "icon-play", on: (r: any) => onReroute(r), disabledWhen: (r: any) => r.status !== 10 },
],
{ mode: "text", width: 170, fixed: "right" },
),
];
function openDetail(instanceId: string | number) {
drawerInstanceId.value = instanceId;
drawerVisible.value = true;
}
/** 重跑路由(2026-09-24 §4.4 + F5-4 逃生门):确认框带「按当前已发布定义重跑」复选——
* 僵尸办件(挂起时的表达式已修好并发布为新版)勾选后按新版续走,否则按落库快照重跑 */
const rerouteVisible = ref(false);
const rerouteUseLatest = ref(false);
const rerouteRow = ref<any>(null);
function onReroute(row: any) {
rerouteRow.value = row;
rerouteUseLatest.value = false;
rerouteVisible.value = true;
}
async function confirmReroute() {
const row = rerouteRow.value;
if (!row) return;
await flowApi.instanceReroute(row.id, rerouteUseLatest.value).send();
rerouteVisible.value = false;
Message.success("路由已重跑,流程按判断结果继续");
tableRef.value?.reloadData(OperatorEnum.edit);
}
// dataApi 返回 Method(alova usePagination 负责发送与解包),不能调 .send()
const tableApi = (p: { pageIndex: number; pageSize: number }) => {
const params: any = { page: p.pageIndex, size: p.pageSize };
if (dataParams.value.status === "hung") {
// F11-4 路由挂起伪选项:只传 hung,不带 status(后端 hung 过滤已内含审批中)
params.hung = true;
} else if (dataParams.value.status) {
params.status = dataParams.value.status;
}
if (dataParams.value.keyword) params.keyword = dataParams.value.keyword.trim();
return flowApi.adminInstances(params);
};
function onSearch() {
tableRef.value?.refreshData();
}
</script>
<template>
<div class="page-wrapper yh-fill">
<div class="main-container">
<div class="search-wrap fix">
<Select v-model="dataParams.status" class="search-wrap_sel" clearable placeholder="状态" @on-change="onSearch">
<Option :value="10" label="审批中" />
<Option :value="20" label="已完成" />
<Option :value="30" label="已拒绝" />
<Option :value="40" label="已撤回" />
<Option value="hung" label="路由挂起" />
</Select>
<Input class="fr" v-model="dataParams.keyword" placeholder="标题关键字" search suffix="ios-search"
style="width: 200px" @on-search="onSearch" @on-clear="onSearch" />
</div>
<TablePageAlovaNew ref="tableRef" :dataApi="tableApi" :columns="columns" />
</div>
<InstanceDrawer v-model="drawerVisible" :instance-id="drawerInstanceId" />
<Modal v-model="rerouteVisible" title="重跑路由" :mask-closable="false" @on-ok="confirmReroute">
<p style="margin: 0 0 8px">确定对办件「{{ rerouteRow?.bizTitle || rerouteRow?.id }}」重跑条件路由判断吗?</p>
<p style="margin: 0 0 12px; color: #808695">仅对挂在条件分支节点的挂起办件生效(未挂起的会提示无需重跑)</p>
<Checkbox v-model="rerouteUseLatest">按当前已发布流程定义重跑(救僵尸办件)</Checkbox>
</Modal>
</div>
</template>