You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

263 lines
6.6 KiB

<!-- 监督检查工程管理 -->
<script>
import dayjs from "dayjs";
import {
delSuperviseWayItemData,
getSuperviseWayTaskListData,
} from "@/api/sluice";
export default {
name: "projectManage",
data() {
return {
searchTaskName: "",
searchManageName: "",
searchProjectName: "",
paramsData: {
name: "",
type: null,
dikeName: "",
selectLevel: "",
selectType: "",
},
tableData: [], // 检查列表
pageData: {
pageNum: 1, // 当前页
pageSize: 10, // 请求数量
pageSizes: [10, 20, 50, 100],
total: 0, // 总数量
},
};
},
methods: {
handleCurrentPageChange(page) {
this.pageData.pageNum = page;
this.getTableData();
},
handlePageSizeChange(pageSize) {
this.pageData.pageSize = pageSize;
this.getTableData();
},
// 查看
handleCheck(row) {
this.$router.push({
path: "supervisionProjectReport",
query: {
type: "preview",
wayId: row.wayId,
id: row.id,
},
});
},
// 跳转编辑页面
handleEdit(row) {
this.$router.push({
path: "supervisionProjectReport",
query: {
type: "edit",
wayId: row.wayId,
id: row.id,
},
});
},
// 跳转报告页面
handleCheckReport(row) {
this.$router.push({
path: "supervisionProjectReportPage",
query: {
wayId: row.wayId,
id: row.id,
},
});
},
// 计算doneTime距离此刻剩余多少天
calcDeadLine(time) {
if (!time) return "-";
let days = dayjs(time).diff(dayjs(), "day");
let seconds = 0;
if (days <= 0) {
seconds = dayjs(time).diff(dayjs(), "second");
}
return days > 0
? days
: seconds > 0
? 1
: dayjs(time).diff(dayjs(), "day") - 1;
},
// 获取列表数据
getTableData() {
getSuperviseWayTaskListData({
data: {
timeView: {
timeField: "create_time",
},
name: this.searchTaskName || null,
engineeringManagementUnit: this.searchManageName || null,
},
params: {
orderBy: "create_time",
sort: "desc",
},
pageSize: this.pageData.pageSize,
pageNum: this.pageData.pageNum,
}).then((res) => {
if (res) {
this.tableData = res.records.map((item) => {
if (item.state != "1") {
item.deadTime = this.calcDeadLine(item.doneTime);
}
return item;
});
this.pageData.total = res.total;
}
});
},
// 重置搜索
resetSearch() {
this.searchTaskName = null;
this.searchManageName = null;
this.getTableData();
},
},
created() {
this.getDicts("embankment_type").then((response) => {
this.dikeTypeList = response.data;
});
},
mounted() {
// 获取列表数据
this.getTableData();
},
};
</script>
<template>
<div class="body slider-right">
<div class="top-title">基础信息管理</div>
<div class="table-box">
<span>任务名称</span>
<el-input
class="search-input ml-10"
v-model="searchTaskName"
placeholder="请输入名称"
/>
<span class="ml-10">管理单位:</span>
<el-input
class="search-input ml-10"
v-model="searchManageName"
placeholder="请输入"
/>
<span class="ml-10">工程对象:</span>
<el-input
class="search-input ml-10"
v-model="searchProjectName"
placeholder="请输入"
/>
<el-button class="search-btn" type="success" @click="getTableData()"
>搜索</el-button
>
<el-button class="search-btn" @click="resetSearch">重置</el-button>
<el-table class="table mt-16" height="640" :data="tableData" border>
<el-table-column type="index" align="center" label="序号" width="60" />
<el-table-column prop="name" align="center" label="检查任务" />
<el-table-column
prop="engineeringManagementUnit"
align="center"
label="管理单位"
/>
<el-table-column prop="wagaName" align="center" label="工程对象">
</el-table-column>
<el-table-column prop="doneTime" align="center" label="完成时间">
<template slot-scope="scope">
<span v-if="scope.row.state == '1'">完成</span>
<span
v-else
:class="{
'warning-time':
scope.row.deadTime != '-' && scope.row.deadTime <= 1,
}"
>{{ scope.row.deadTime }}天</span
>
</template>
</el-table-column>
<el-table-column prop="operate" align="center" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handleCheck(scope.row)"
>查看</el-button
>
<el-button
type="text"
size="small"
v-if="scope.row.state != '1'"
@click="handleEdit(scope.row)"
>巡查</el-button
>
<el-button
v-else
type="text"
size="small"
@click="handleCheckReport(scope.row)"
>报告</el-button
>
</template>
</el-table-column>
</el-table>
<el-pagination
background
class="pagination"
style="margin-top: 16px; margin-right: 16px; float: right"
:current-page="pageData.pageNum"
:page-sizes="pageData.pageSizes"
layout="total, prev, pager, next, sizes, jumper"
:total="pageData.total"
@size-change="(e) => handlePageSizeChange(e)"
@current-change="(e) => handleCurrentPageChange(e)"
>
</el-pagination>
</div>
</div>
</template>
<style scoped lang="less">
.body {
width: 100%;
min-height: calc(100vh - 56px);
padding-left: 24px;
.top-title {
height: 40px;
background-color: white;
display: flex;
padding-left: 16px;
align-items: center;
font-weight: 600;
}
.table-box {
width: 100%;
min-height: calc(100vh - 56px - 64px);
margin-top: 24px;
padding: 16px;
background-color: white;
.top-search {
margin-bottom: 8px;
}
.table {
height: calc(680px - 34px);
}
}
.search-input {
width: 202px;
margin-right: 10px;
}
.search-btn {
margin-left: 10px;
}
.warning-time {
color: red;
}
}
</style>