108 lines
3.4 KiB
Vue
Raw Normal View History

<template>
<div class="table-box">
<ProTable
ref="proTable"
title="用户列表"
:columns="columns"
:requestApi="getTableList"
:dataCallback="dataCallback"
:tool-button="false"
:pagination="true"
background
:isShowSearch="false"
:onReset="true"
>
<template #operation="{ row }">
<el-button type="primary" v-if="row.examineState === 2" link @click="handleEditItem(row)">
<img src="@/assets/images/tableIcon/updateIcon.png" alt="" class="configureIcon" />
<span>再次申请</span>
</el-button>
</template>
<template #examineState="{ row }">
{{ row.examineState === 1 ? "待审核" : row.examineState === 2 ? "审核驳回" : "审核通过" }}
</template>
</ProTable>
</div>
</template>
<script setup lang="tsx" name="ProjectSupervisionRecord">
import { ref, reactive } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router";
import { User } from "@/api/interface";
import { ColumnProps } from "@/components/ProTable/interface";
import { useHandleData } from "@/hooks/useHandleData";
import ProTable from "@/components/ProTable/index.vue";
import { getIdEngApproveList } from "@/api/modules/goverment";
import { getProjectRecordPage } from "@/api/modules/project";
import { GlobalStore } from "@/stores";
const router = useRouter();
const store = GlobalStore();
const visible = ref(false);
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const proTable = ref();
const useSelector = (path: string) => {
const store = GlobalStore();
const paths = path.split(".");
let i = 0,
curr = store;
while (i < paths.length) {
curr = curr[paths[i]];
}
return curr;
};
// 修改数据按钮
const handleEditItem = async (row: any) => {
const res = await getIdEngApproveList({ id: row.id });
store.Message = res.result;
router.push({ path: "/project/supervision/ProjectSupervision/index" });
};
// 表格配置项
const columns: ColumnProps[] = [
{ type: "index", label: "序号", width: 80 },
{
prop: "engineeringCode",
label: "工程编号"
// search: { el: "input" }
},
// 多级 prop
{ prop: "engineeringName", label: "工程名称" },
{ prop: "engineeringType", label: "所在区域" },
{ prop: "engineeringTypeName", label: "工程类型" },
{ prop: "stateName", label: "工程状态" },
{
prop: "examineState",
label: "审核状态"
},
{ prop: "rejectReason", label: "驳回原因" },
{ prop: "operation", label: "操作", fixed: "right" }
];
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total && pageNum && pageSize 这些字段,那么你可以在这里进行处理成这些字段
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
const dataCallback = (data: any) => {
// console.log(data);
return {
list: data.records,
total: Number(data.total),
pageNo: Number(data.current),
pageSize: Number(data.size)
};
};
// 如果你想在请求之前对当前请求参数做一些操作可以自定义如下函数params 为当前所有的请求参数(包括分页),最后返回请求列表接口
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
const getTableList = (params: any) => {
let newParams = JSON.parse(JSON.stringify(params));
return getProjectRecordPage(newParams);
};
</script>