2023-07-09 21:54:32 +08:00

145 lines
4.0 KiB
Vue

<template>
<div class="warning-page">
<div class="table-box">
<div class="table">
<ProTable
ref="proTable"
title="项目审批"
:columns="columns"
:requestApi="getTableList"
:dataCallback="dataCallback"
:tool-button="false"
:pagination="true"
background
:isShowSearch="true"
:onReset="true"
>
<template #formButton="scope">
<el-button class="btnStyle" @click="handleAddItem">新增</el-button>
</template>
<template #operation="{ row }">
<el-button type="primary" link @click="handleLookItem(row)">
<img src="@/assets/images/tableIcon/look.png" alt="" class="configureIcon" />
<span>审核</span>
</el-button>
</template>
<template #state="{ row }">
<span>{{
row.state == 1
? "执法中"
: row.state == 2
? "待整改"
: row.state == 3
? "待审核"
: row.state == 4
? "已闭合"
: row.state == 5
? "已驳回"
: ""
}}</span>
</template>
</ProTable>
<ProjectSupervision
v-model:detailsDialog="detailsDialog"
:relativeId="relativeId"
:title="approvalTitle"
@confirm="confirmReform"
></ProjectSupervision>
</div>
</div>
<!-- 审核弹框 -->
<auditDialog v-model:auditDialogVisible="auditDialogVisible" :relativeId="relativeId" @confirm="allConfirm"></auditDialog>
</div>
</template>
<script setup lang="tsx" name="ProjectSupervisionRecord">
import { ref, onMounted } from "vue";
import { ElMessage, ElMessageBox, ElTree, FormInstance } from "element-plus";
import { ColumnProps } from "@/components/ProTable/interface";
import ProTable from "@/components/ProTable/index.vue";
import { statisticsTable } from "@/api/modules/goverment";
import auditDialog from "./components/auditDialog.vue";
import ProjectSupervision from "./components/ProjectSupervision/index.vue";
const auditDialogVisible = ref(false);
// 表格配置项
const columns: ColumnProps[] = [
{ type: "index", label: "序号", width: 80 },
{
prop: "engineeringName",
label: "项目名称",
search: { el: "input" }
},
{
prop: "inspectUserName",
label: "项目编号"
},
{
prop: "buildEnt",
label: "项目类型"
},
{
prop: "supervisorEnt",
label: "负责人"
},
{
prop: "surveyEnt",
label: "手机号"
},
{
prop: "designEnt",
label: "审批状态"
},
{ prop: "operation", label: "操作", fixed: "right", width: 100 }
];
const relativeId = ref("");
const detailsDialog = ref(false);
const approvalTitle = ref("");
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const proTable = ref();
// 整改完成,全部已提交审核
const confirmReform = () => {
proTable.value.getTableList();
};
// 新增项目
const handleAddItem = () => {
approvalTitle.value = "新增";
detailsDialog.value = true;
};
// 子组件弹框确认回调
const allConfirm = val => {
console.log(val);
};
const handleLookItem = row => {
console.log(row);
relativeId.value = row.id;
auditDialogVisible.value = true;
};
const getTableList = (params: any) => {
let newParams = JSON.parse(JSON.stringify(params));
console.log(newParams);
if (newParams.createTime) {
newParams.createTime_begin = newParams.createTime[0];
newParams.createTime_end = newParams.createTime[1];
delete newParams.createTime;
}
newParams.type = 2;
return statisticsTable(newParams);
};
// 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)
};
};
onMounted(() => {});
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>