139 lines
3.6 KiB
Vue
Raw Normal View History

2023-07-19 18:09:20 +08:00
<template>
<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>
<!-- </div> -->
<ProjectSupervision
v-model:detailsDialog="detailsDialog"
:relativeId="relativeId"
:title="approvalTitle"
@confirm="confirmReform"
></ProjectSupervision>
</div>
</template>
<script setup lang="tsx" name="ProjectSupervisionRecord">
import { ref, reactive, nextTick, onMounted, watch } from "vue";
import { ColumnProps } from "@/components/ProTable/interface";
import ProTable from "@/components/ProTable/index.vue";
import ProjectSupervision from "./components/ProjectSupervision/index.vue";
import { statisticsInfo, statisticsTable } from "@/api/modules/project";
// 表格配置项
const columns: ColumnProps[] = [
{ type: "index", label: "序号", width: 80 },
{
prop: "engineeringName",
label: "项目名称",
search: { el: "input" }
},
{
prop: "inspectUserName",
label: "项目编号"
},
{
prop: "createTime",
label: "项目类型"
},
{
prop: "buildEnt",
label: "负责人"
},
{
prop: "supervisorEnt",
label: "手机号"
},
{
prop: "opEnt",
label: "审批状态"
},
{ prop: "operation", label: "操作", fixed: "right", width: 130 }
];
const detailsDialog = ref(false);
const approvalTitle = ref("新增");
const relativeId = ref("");
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const proTable = ref();
// 新增项目
const handleAddItem = () => {
approvalTitle.value = "新增";
detailsDialog.value = true;
};
// 整改完成,全部已提交审核
const confirmReform = () => {
proTable.value.getTableList();
};
const handleLookItem = row => {
console.log(row);
approvalTitle.value = "再次申请";
relativeId.value = row.id;
detailsDialog.value = true;
};
const getTableList = (params: any) => {
let newParams = JSON.parse(JSON.stringify(params));
if (newParams.createTime) {
newParams.createTime_begin = newParams.createTime[0];
newParams.createTime_end = newParams.createTime[1];
delete newParams.createTime;
}
newParams.type = 1;
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">
.table-box {
height: 100%;
// .table {
// position: relative;
// z-index: 500;
// }
}
</style>