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.
399 lines
11 KiB
399 lines
11 KiB
<!-- 巡查管理页 -->
|
|
<template>
|
|
<div class="patrol-manage-page">
|
|
<div class="top-title">水闸巡查管理</div>
|
|
<div class="table-box">
|
|
<div class="top-search">
|
|
<span>水闸名称:</span>
|
|
<el-input
|
|
class="search-input"
|
|
v-model="searchInput"
|
|
placeholder="请输入水闸名称"
|
|
/>
|
|
<!-- <span>水闸类型:</span>
|
|
<el-select v-model="wagaType" placeholder="请选择">
|
|
<el-option
|
|
v-for="item in wagaTypeList"
|
|
:key="item.dictValue"
|
|
:label="item.dictLabel"
|
|
:value="item.dictValue"
|
|
>
|
|
</el-option>
|
|
</el-select> -->
|
|
<el-button
|
|
class="!ml-10"
|
|
type="success"
|
|
@click="getTableData(searchInput)"
|
|
>搜索</el-button
|
|
>
|
|
<el-button @click="resetSearch()">重置</el-button>
|
|
</div>
|
|
<el-table class="mt-16" height="625" :data="tableData" border>
|
|
<el-table-column type="index" align="center" label="序号" width="80" />
|
|
<el-table-column prop="wagaName" align="center" label="水闸名称" />
|
|
<el-table-column prop="wagaCode" align="center" label="水闸代码" />
|
|
<el-table-column
|
|
prop="engineeringManagementUnit"
|
|
align="center"
|
|
label="管理单位"
|
|
/>
|
|
<el-table-column
|
|
prop="waterAdministrativeDepartment"
|
|
align="center"
|
|
label="行政主管部门"
|
|
>
|
|
<template #default="{ row }">
|
|
{{ getDictLabel(row.waterAdministrativeDepartment) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="lastTime" align="center" label="最近巡查时间" />
|
|
<el-table-column prop="operate" align="center" label="操作">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
style="margin-right: 16px"
|
|
@click="handleSet(scope.row)"
|
|
type="text"
|
|
size="small"
|
|
>巡查配置</el-button
|
|
>
|
|
<el-button @click="handleGoPlan(scope.row)" type="text" size="small"
|
|
>计划管理</el-button
|
|
>
|
|
<el-button
|
|
@click="handleGoRecord(scope.row)"
|
|
type="text"
|
|
size="small"
|
|
>巡查记录</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"
|
|
@current-change="(e) => handleCurrentPageChange(e)"
|
|
@size-change="(e) => handlePageSizeChange(e)"
|
|
>
|
|
</el-pagination>
|
|
</div>
|
|
|
|
<!-- 弹窗 -->
|
|
<el-dialog
|
|
title="巡查项目配置"
|
|
@close="dialogVisible = false"
|
|
:visible.sync="dialogVisible"
|
|
width="520px"
|
|
>
|
|
<el-form
|
|
:model="ruleForm"
|
|
:rules="rules"
|
|
ref="ruleForm"
|
|
label-width="100px"
|
|
>
|
|
<el-form-item
|
|
label-width="120px"
|
|
label="日常巡查项目"
|
|
prop="checkings[0].xcId"
|
|
>
|
|
<el-select
|
|
filterable
|
|
remote
|
|
:remote-method="(query) => handleGetRemoteProjectListData(0, query)"
|
|
@focus="handleGetRemoteProjectListData(0, '')"
|
|
v-model="ruleForm.checkings[0].xcId"
|
|
placeholder="请选择"
|
|
>
|
|
<el-option
|
|
v-for="item in projectList0"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
:key="item.id"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item
|
|
label-width="120px"
|
|
label="定期巡查项目"
|
|
prop="checkings[1].xcId"
|
|
>
|
|
<el-select
|
|
filterable
|
|
remote
|
|
:remote-method="(query) => handleGetRemoteProjectListData(1, query)"
|
|
@focus="handleGetRemoteProjectListData(1, '')"
|
|
v-model="ruleForm.checkings[1].xcId"
|
|
placeholder="请选择"
|
|
>
|
|
<el-option
|
|
v-for="item in projectList1"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
:key="item.id"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item
|
|
label-width="120px"
|
|
label="特别巡查项目"
|
|
prop="checkings[2].xcId"
|
|
>
|
|
<el-select
|
|
filterable
|
|
remote
|
|
:remote-method="(query) => handleGetRemoteProjectListData(2, query)"
|
|
@focus="handleGetRemoteProjectListData(2, '')"
|
|
v-model="ruleForm.checkings[2].xcId"
|
|
placeholder="请选择"
|
|
>
|
|
<el-option
|
|
v-for="item in projectList2"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
:key="item.id"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button size="mini" @click="resetForm">取 消</el-button>
|
|
<el-button size="mini" type="primary" @click="submitForm"
|
|
>保存</el-button
|
|
>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import {
|
|
getRunProjectList,
|
|
postProjectChecking,
|
|
postSZInspectionProjectList,
|
|
getProjectCheckingRel,
|
|
} from "@/api/sluice";
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
dialogVisible: false,
|
|
pageData: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
total: 0,
|
|
},
|
|
searchInput: "",
|
|
waterAdministrativeDepartmentOptions: [],
|
|
wagaTypeList: [
|
|
{
|
|
label: "全部",
|
|
value: "",
|
|
},
|
|
], // 水闸类型列表
|
|
wagaType: "",
|
|
tableData: [],
|
|
ruleForm: {
|
|
wagaCode: "",
|
|
checkings: [
|
|
{
|
|
type: "0",
|
|
label: "日常检查",
|
|
xcId: "",
|
|
},
|
|
{
|
|
type: "1",
|
|
label: "定期检查",
|
|
xcId: "",
|
|
},
|
|
{
|
|
type: "2",
|
|
label: "特别检查",
|
|
xcId: "",
|
|
},
|
|
],
|
|
},
|
|
projectList0: [], // 对应type===0的日常巡查项目
|
|
projectList1: [], // 对应type===1的日常巡查项目
|
|
projectList2: [], // 对应type===2的日常巡查项目
|
|
rules: {
|
|
["checkings[0].xcId"]: [
|
|
{ required: true, message: "请选择", trigger: "change" },
|
|
],
|
|
["checkings[1].xcId"]: [
|
|
{ required: true, message: "请选择", trigger: "change" },
|
|
],
|
|
["checkings[2].xcId"]: [
|
|
{ required: true, message: "请选择", trigger: "change" },
|
|
],
|
|
},
|
|
};
|
|
},
|
|
created() {
|
|
this.getDicts("sluice_type").then((response) => {
|
|
this.wagaTypeList = response.data;
|
|
});
|
|
this.getDicts("water_administrative_department").then((response) => {
|
|
this.waterAdministrativeDepartmentOptions = response.data;
|
|
});
|
|
},
|
|
mounted() {
|
|
this.getTableData();
|
|
},
|
|
methods: {
|
|
handleCurrentPageChange(page) {
|
|
this.pageData.pageNum = page;
|
|
this.getTableData();
|
|
},
|
|
handlePageSizeChange(pageSize) {
|
|
this.pageData.pageSize = pageSize;
|
|
this.getTableData();
|
|
},
|
|
// 获取列表信息
|
|
getTableData() {
|
|
getRunProjectList({
|
|
pageNum: this.pageData.pageNum,
|
|
pageSize: this.pageData.pageSize,
|
|
data: {
|
|
wagaType: this.wagaType || "",
|
|
wagaName: this.searchInput || "",
|
|
},
|
|
}).then((res) => {
|
|
if (res) {
|
|
this.tableData = res.records;
|
|
this.pageData.total = res.total;
|
|
}
|
|
});
|
|
},
|
|
// 重置搜索条件
|
|
resetSearch() {
|
|
this.searchInput = "";
|
|
this.wagaType = "";
|
|
this.getTableData();
|
|
},
|
|
handleGoPlan(row) {
|
|
this.$router.push({
|
|
path: "inspectionPlan",
|
|
query: {
|
|
wagaCode: row.wagaCode,
|
|
wagaName: row.wagaName,
|
|
},
|
|
});
|
|
},
|
|
handleGoRecord(row) {
|
|
this.$router.push({
|
|
path: "inspectionRecords",
|
|
query: {
|
|
wagaCode: row.wagaCode,
|
|
wagaName: row.wagaName,
|
|
},
|
|
});
|
|
},
|
|
// 请求项目列表
|
|
initProjectList(type, query) {
|
|
postSZInspectionProjectList({
|
|
data: {
|
|
timeView: {
|
|
timeField: "create_time",
|
|
},
|
|
type,
|
|
},
|
|
cv: {
|
|
name: "name",
|
|
type: "like",
|
|
value: query,
|
|
},
|
|
pageSize: 20,
|
|
pageNum: 1,
|
|
}).then((res) => {
|
|
if (res) {
|
|
this[`projectList${type}`] = res.records;
|
|
}
|
|
});
|
|
},
|
|
// 请求项目列表数据
|
|
handleGetRemoteProjectListData(type, query) {
|
|
this.initProjectList(type, query);
|
|
},
|
|
// 配置项目
|
|
handleSet(row) {
|
|
this.handleGetRemoteProjectListData(0);
|
|
this.handleGetRemoteProjectListData(1);
|
|
this.handleGetRemoteProjectListData(2);
|
|
this.dialogVisible = true;
|
|
getProjectCheckingRel(row.wagaCode).then((res) => {
|
|
this.ruleForm.wagaCode = row.wagaCode;
|
|
if (res.data?.checkings?.length) {
|
|
this.ruleForm.checkings.forEach((item) => {
|
|
item.xcId = res.data.checkings?.find(
|
|
(v) => v.type == item.type
|
|
)?.xcId;
|
|
});
|
|
}
|
|
});
|
|
},
|
|
resetForm() {
|
|
this.$refs.ruleForm.resetFields();
|
|
this.dialogVisible = false;
|
|
},
|
|
submitForm() {
|
|
console.log("表单 >>> ", this.ruleForm);
|
|
this.$refs.ruleForm.validate((valid) => {
|
|
if (valid) {
|
|
postProjectChecking(this.ruleForm).then((res) => {
|
|
if (res?.success) {
|
|
this.$message.success("配置成功");
|
|
this.dialogVisible = false;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
},
|
|
getDictLabel(key) {
|
|
return (
|
|
this.waterAdministrativeDepartmentOptions.filter(
|
|
(v) => v.dictValue === key
|
|
)?.[0]?.dictLabel || key
|
|
);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style scoped lang="scss">
|
|
.patrol-manage-page {
|
|
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;
|
|
|
|
.search-input {
|
|
width: 202px;
|
|
margin-right: 10px;
|
|
}
|
|
}
|
|
|
|
.table {
|
|
height: calc(680px - 34px);
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
|