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

69 lines
2.8 KiB
Vue

<script setup lang="ts">
// 办件记录(管理端):全校办件查询
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { flowApi, INSTANCE_STATUS } from "@/api/module/flow";
import Utils from "@/utils";
const router = useRouter();
const loading = ref(false);
const page = ref(1);
const total = ref(0);
const filter = ref<any>({ status: null, keyword: "" });
const rows = ref<any[]>([]);
const columns = [
{ title: "办件标题", key: "bizTitle", minWidth: 220 },
{ title: "业务", width: 170, render: (h: any, p: any) => h("span", `${p.row.bizType || "-"}/${p.row.bizId || "-"}`) },
{ title: "状态", width: 100, render: (h: any, p: any) => {
const c = p.row.status === 10 ? "blue" : p.row.status === 20 ? "green" : p.row.status === 30 ? "red" : "gray";
return h("Tag", { color: c }, () => INSTANCE_STATUS[p.row.status] || p.row.status);
} },
{ title: "提交人", key: "submitterName", width: 100 },
{ title: "提交时间", width: 160, render: (h: any, p: any) => h("span", (p.row.submitTime || "").replace("T", " ")) },
{ title: "操作", width: 90, render: (h: any, p: any) =>
Utils.operatingTextHandle(h, "详情", "", () => router.push(`/instance/${p.row.id}?pid=102`)) },
];
async function load() {
loading.value = true;
try {
const params: any = { page: page.value, size: 10 };
if (filter.value.status !== null && filter.value.status !== undefined) params.status = filter.value.status;
if (filter.value.keyword) params.keyword = filter.value.keyword;
const data: any = await flowApi.adminInstances(params).send();
rows.value = data?.content || [];
total.value = data?.total || 0;
} finally {
loading.value = false;
}
}
onMounted(load);
</script>
<template>
<div class="page">
<div class="filter">
<Select v-model="filter.status" clearable placeholder="状态" style="width: 130px">
<Option :value="10" label="审批中" />
<Option :value="20" label="已完成" />
<Option :value="30" label="已拒绝" />
<Option :value="40" label="已撤回" />
</Select>
<Input v-model="filter.keyword" placeholder="标题关键字" style="width: 200px" clearable @on-enter="load" />
<Button @click="page = 1; load()">查询</Button>
</div>
<Table :columns="columns" :data="rows" :loading="loading" stripe />
<div class="pager">
<Page :total="total" :current="page" :page-size="10" show-total @on-change="(p: number) => { page = p; load(); }" />
</div>
</div>
</template>
<style scoped>
.page { padding: 12px 16px; }
.filter { margin-bottom: 10px; display: flex; gap: 8px; }
.pager { margin-top: 12px; text-align: right; }
</style>