328 lines
9.3 KiB
Vue
328 lines
9.3 KiB
Vue
<template>
|
|
<div class="warning-page">
|
|
<LeftMenu
|
|
v-model="active"
|
|
:tabs="['项目名称', '工程名称']"
|
|
:records="records"
|
|
:activeIndex="modelActive"
|
|
@change-page="onCurChange"
|
|
@search="onSearchInput"
|
|
:pageable="pages"
|
|
class="leftMenu"
|
|
>
|
|
<template #default="{ data }">
|
|
<div class="leftProject" @click="onSearch(data)">
|
|
<span class="projectName">{{ data.projectName || data.engineeringName }}</span>
|
|
<div class="leftMenu_item">
|
|
<div class="leftMenu_item flx-justify-between">
|
|
<div style="margin-top: 5px" class="flx-justify-between">
|
|
<img
|
|
style="margin-right: 5px; width: 25px; height: 25px"
|
|
src="@/assets/images/AIwaring/dustMapWhite.png"
|
|
alt=""
|
|
/>
|
|
<span class="middleSize">{{ data.projectAddress || data.address }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</LeftMenu>
|
|
<div class="table-box">
|
|
<div class="table">
|
|
<ProTable
|
|
ref="proTable"
|
|
title="考勤设备列表"
|
|
:columns="columns"
|
|
:requestApi="getTableList"
|
|
:dataCallback="dataCallback"
|
|
:tool-button="false"
|
|
:pagination="true"
|
|
background
|
|
:isShowSearch="false"
|
|
:onReset="true"
|
|
>
|
|
<template #formButton="scope">
|
|
<el-button v-auth="'quality_inspect_add'" 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.level == 1
|
|
? "待初审"
|
|
: row.state == 4 && row.level == 1
|
|
? "待终审"
|
|
: row.state == 4 && row.level == 2
|
|
? "已闭合"
|
|
: row.state == 5 && row.level == 1
|
|
? "初审驳回"
|
|
: row.state == 5 && row.level == 2
|
|
? "终审驳回"
|
|
: ""
|
|
}}</span>
|
|
</template>
|
|
<template #slippageState="{ row }">
|
|
<span>{{
|
|
row.slippageState == 1 ? "正常" : row.slippageState == 2 ? "临期" : row.slippageState == 3 ? "超期" : ""
|
|
}}</span>
|
|
</template>
|
|
<template #slippage="{ row }">
|
|
<span :style="{ color: row.slippage ? 'red' : 'var(--el-menu-text-color)' }">{{
|
|
row.slippage ? row.slippage : ""
|
|
}}</span>
|
|
</template>
|
|
</ProTable>
|
|
</div>
|
|
<!-- 执法单信息 -->
|
|
<transformInfo v-model:detailsDialog="detailsDialog" :relativeId="relativeId" @confirm="allConfirm"></transformInfo>
|
|
<!-- 执法单新增 -->
|
|
<orderAdd v-model:orderDialog="orderDialog" @confirm="allConfirm"></orderAdd>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="tsx" name="ProjectSupervisionRecord">
|
|
import { ref, onMounted, watch } from "vue";
|
|
import { useRoute } from "vue-router";
|
|
import { ColumnProps } from "@/components/ProTable/interface";
|
|
import ProTable from "@/components/ProTable/index.vue";
|
|
import transformInfo from "./components/transformInfo.vue";
|
|
import orderAdd from "./components/orderAdd.vue";
|
|
import { statisticsTable } from "@/api/modules/goverment";
|
|
import LeftMenu from "@/components/LeftMenu/LeftMenu.vue";
|
|
import { getDustprojectPage, getDustengineeringPage } from "@/api/modules/goverment";
|
|
import { sendIframeMessage } from "@/utils/util";
|
|
import { GlobalStore } from "@/stores";
|
|
const route = useRoute();
|
|
const modelActive = ref(0);
|
|
const pages = ref({
|
|
pageNo: 1,
|
|
pageSize: 7,
|
|
total: 0
|
|
});
|
|
const store = GlobalStore();
|
|
const records = ref([]);
|
|
// 表格配置项
|
|
const columns: ColumnProps[] = [
|
|
{ type: "index", label: "序号", width: 80 },
|
|
{
|
|
prop: "engineeringName",
|
|
label: "项目名称",
|
|
search: { el: "input" },
|
|
width: 150
|
|
},
|
|
{
|
|
prop: "inspectUserName",
|
|
label: "监督员",
|
|
width: 150
|
|
},
|
|
{
|
|
prop: "createTime",
|
|
label: "检查时间",
|
|
width: 220
|
|
},
|
|
{
|
|
prop: "buildEnt",
|
|
label: "建设单位",
|
|
width: 150
|
|
},
|
|
{
|
|
prop: "supervisorEnt",
|
|
label: "监理单位",
|
|
width: 150
|
|
},
|
|
{
|
|
prop: "opEnt",
|
|
label: "施工单位",
|
|
width: 150
|
|
},
|
|
{
|
|
prop: "surveyEnt",
|
|
label: "勘察单位",
|
|
width: 150
|
|
},
|
|
{
|
|
prop: "designEnt",
|
|
label: "设计单位",
|
|
width: 150
|
|
},
|
|
{
|
|
prop: "state",
|
|
label: "状态",
|
|
search: { el: "select" },
|
|
width: 150,
|
|
enum: [
|
|
// { label: "执法中", value: 1 },
|
|
{ label: "待整改", value: "2" },
|
|
{ label: "待初审", value: "3-1" },
|
|
{ label: "待终审", value: "4-1" },
|
|
{ label: "已闭合", value: "4-2" },
|
|
{ label: "初审驳回", value: "5-1" },
|
|
{ label: "终审驳回", value: "5-2" }
|
|
]
|
|
},
|
|
{ prop: "slippageState", label: "逾期情况", width: 150 },
|
|
{ prop: "slippage", label: "逾期天数", width: 150 },
|
|
{ prop: "operation", label: "操作", fixed: "right", width: 100 }
|
|
];
|
|
const pageable = ref({
|
|
pageNo: 1,
|
|
pageSize: 12,
|
|
total: 0
|
|
});
|
|
const active = ref(1);
|
|
const detailsDialog = ref(false);
|
|
const orderDialog = ref(false);
|
|
const relativeId = ref("");
|
|
// 搜索用的项目sn或者工程sn
|
|
const searchSn = ref("");
|
|
const searchName = ref("");
|
|
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
|
const proTable = ref();
|
|
// 新增执法单
|
|
const handleAddItem = () => {
|
|
orderDialog.value = true;
|
|
};
|
|
// 页面的项目名称和工程名称的div点击事件
|
|
const onSearch = async (params: any) => {
|
|
active.value === 0 ? (searchSn.value = params.projectSn) : (searchSn.value = params.engineeringSn);
|
|
active.value === 0 ? (searchName.value = params.projectName) : (searchName.value = params.engineeringName);
|
|
proTable.value.getTableList();
|
|
};
|
|
// 全部审核完成
|
|
const allConfirm = () => {
|
|
proTable.value.getTableList();
|
|
};
|
|
const handleLookItem = row => {
|
|
console.log(row);
|
|
relativeId.value = row.id;
|
|
detailsDialog.value = true;
|
|
};
|
|
// leftMenu页面的搜索按钮
|
|
const onSearchInput = async (params: string) => {
|
|
console.log(params);
|
|
if (active.value === 0) {
|
|
const { result } = await getDustprojectPage({ projectName: params, ...pages.value });
|
|
records.value = result.records;
|
|
} else {
|
|
const { result } = await getDustengineeringPage({ engineeringName: params, ...pages.value });
|
|
records.value = result.records;
|
|
}
|
|
};
|
|
// leftMenu页面的分页
|
|
const onCurChange = async (params: number) => {
|
|
if (active.value === 0) {
|
|
const { result } = await getDustprojectPage({ ...pages.value, pageNo: params });
|
|
records.value = result.records;
|
|
} else {
|
|
const { result } = await getDustengineeringPage({ ...pages.value, pageNo: params });
|
|
records.value = result.records;
|
|
pages.value.total = +result.total;
|
|
}
|
|
pages.value.total = +res.result.total;
|
|
};
|
|
const getTableList = (params: any) => {
|
|
let newParams = JSON.parse(JSON.stringify(params));
|
|
newParams.type = 2;
|
|
newParams.level = 1;
|
|
// console.log(newParams);
|
|
if (newParams.createTime) {
|
|
newParams.createTime_begin = newParams.createTime[0];
|
|
newParams.createTime_end = newParams.createTime[1];
|
|
delete newParams.createTime;
|
|
}
|
|
if (newParams.state) {
|
|
if (newParams.state.indexOf("-")) {
|
|
newParams.level = Number(newParams.state[2]);
|
|
newParams.state = Number(newParams.state[0]);
|
|
} else {
|
|
newParams.state = newParams.state;
|
|
}
|
|
}
|
|
newParams.engineeringSn = searchSn.value;
|
|
if (!newParams.engineeringSn) {
|
|
return { result: { records: [], current: "1", pages: "1", size: "10", total: "0" } };
|
|
}
|
|
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)
|
|
};
|
|
};
|
|
// 获取项目名称分页
|
|
const getProPage = async () => {
|
|
const { result } = await getDustprojectPage(pages.value);
|
|
records.value = result.records;
|
|
records.value.map(item => {
|
|
let showGif = false;
|
|
item.showGif = showGif;
|
|
});
|
|
pages.value.total = Number(result.total);
|
|
};
|
|
// 获取工程名称分页
|
|
const getEngPage = async () => {
|
|
const { result } = await getDustengineeringPage(pages.value);
|
|
records.value = result.records;
|
|
records.value.map(item => {
|
|
let showGif = false;
|
|
item.showGif = showGif;
|
|
});
|
|
pages.value.total = +result.total;
|
|
};
|
|
watch(
|
|
() => active.value,
|
|
async (value: number) => {
|
|
pages.value.pageNo = 1;
|
|
pages.value.total = 0;
|
|
// console.log(value);
|
|
|
|
if (value === 0) {
|
|
await getProPage();
|
|
onSearch(records.value[0]);
|
|
} else {
|
|
await getEngPage();
|
|
onSearch(records.value[0]);
|
|
}
|
|
},
|
|
{
|
|
deep: true
|
|
}
|
|
);
|
|
onMounted(async () => {
|
|
await getEngPage();
|
|
searchSn.value = (records.value as any[])[0].engineeringSn;
|
|
searchName.value = (records.value as any[])[0].engineeringName;
|
|
if (route.query.projectName) {
|
|
let defaultActive = records.value.findIndex((item: any) => {
|
|
return route.query.projectName == item.engineeringName;
|
|
});
|
|
if (defaultActive != -1) {
|
|
modelActive.value = defaultActive;
|
|
onSearch(records.value[defaultActive]);
|
|
}
|
|
} else {
|
|
onSearch(records.value[0]);
|
|
}
|
|
await sendIframeMessage({ obj: { path: route.path } }, 2, undefined);
|
|
});
|
|
</script>
|
|
<style scoped lang="scss">
|
|
@import "./index.scss";
|
|
</style>
|