Files
flow-center-front/src/views/flow/MyInstances.vue
T
chenxing 90db00cf16
build / build (push) Successful in 3m21s
feat: 提交流程中心前端代码
Vue3 + Vite + view-ui-plus 前端源码,含流程工作台、实例详情、
任务处理、管理端(定义/实例/映射/回调)等页面。
保留远程 .gitea/workflows/build.yml CI 配置。
2026-09-15 10:42:45 +08:00

96 lines
3.4 KiB
Vue

<script setup lang="ts">
// 我的办件(提交人视角):列表 + 撤回/催办/详情
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { Message } from "view-ui-plus";
import { flowApi, INSTANCE_STATUS } from "@/api/module/flow";
const router = useRouter();
const loading = ref(false);
const page = ref(1);
const size = ref(10);
const total = ref(0);
const status = ref<number | undefined>(undefined);
const rows = ref<any[]>([]);
const columns = [
{ title: "办件标题", key: "bizTitle", minWidth: 220 },
{ title: "业务类型", key: "bizType", width: 110 },
{ title: "状态", width: 100, render: (h: any, p: any) => {
const color = p.row.status === 10 ? "blue" : p.row.status === 20 ? "green" : p.row.status === 30 ? "red" : "gray";
return h("Tag", { color }, () => INSTANCE_STATUS[p.row.status] || p.row.status);
} },
{ title: "当前节点", key: "currentNodes", width: 150 },
{ title: "提交时间", width: 170, render: (h: any, p: any) => h("span", (p.row.submitTime || "").replace("T", " ")) },
{ title: "办结时间", width: 170, render: (h: any, p: any) => h("span", (p.row.finishTime || "").replace("T", " ") || "-") },
{ title: "操作", width: 180, render: (h: any, p: any) => {
const btns = [h("Button", { size: "small", onClick: () => router.push(`/instance/${p.row.instanceId}`) }, () => "详情")];
if (p.row.status === 10) {
btns.push(h("Button", { size: "small", onClick: () => onWithdraw(p.row) }, () => "撤回"));
btns.push(h("Button", { size: "small", onClick: () => onUrge(p.row) }, () => "催办"));
}
return h("div", { style: "display:flex;gap:4px" }, btns);
} },
];
async function load() {
loading.value = true;
try {
const data: any = await flowApi.my({ status: status.value, page: page.value, size: size.value }).send();
rows.value = data?.content || [];
total.value = data?.total || 0;
} finally {
loading.value = false;
}
}
async function onWithdraw(row: any) {
try {
await flowApi.withdraw(row.instanceId).send();
Message.success("已撤回");
load();
} catch (e: any) {
Message.error(e?.message || "撤回失败(可能已有任务被办理)");
}
}
async function onUrge(row: any) {
try {
await flowApi.urge(row.instanceId).send();
Message.success("已催办");
} catch (e: any) {
Message.error(e?.message || "催办失败");
}
}
function onPage(p: number) {
page.value = p;
load();
}
onMounted(load);
</script>
<template>
<div class="page">
<div class="filter">
<Select v-model="status" clearable placeholder="状态" style="width: 140px" @on-change="load">
<Option :value="10" label="审批中" />
<Option :value="20" label="已完成" />
<Option :value="30" label="已拒绝" />
<Option :value="40" label="已撤回" />
</Select>
</div>
<Table :columns="columns" :data="rows" :loading="loading" stripe />
<div class="pager">
<Page :total="total" :current="page" :page-size="size" show-total @on-change="onPage" />
</div>
</div>
</template>
<style scoped>
.page { padding: 12px 16px; }
.filter { margin-bottom: 10px; }
.pager { margin-top: 12px; text-align: right; }
</style>