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.
 
 
 

257 lines
7.2 KiB

<!-- 调度运用管理-水闸 -->
<script>
import {getDicts} from "@/api/management";
import { getAreasData } from "@/api/areas/index";
import { getSluiceProjectList } from "@/api/sluice/index";
let that
export default {
name: "sluice",
data() {
return {
searchForm: {
adcd: '',
wagaType: -1,
wagaName: ''
},
searchInput: "",
searchType: 3,
sluiceType: [], // 检查类型
areasOptions: [], // 检查类型
adcdOptions: [], // 检查类型
areasOptionProps: {
emitPath: false,
checkStrictly: true, //选择任意一级
},
tableData: [], // 检查列表
pageData: {
pageNum: 1, // 当前页
pageSize: 10, // 请求数量
pageSizes: [10, 20, 50, 100],
total: 0, // 总数量
},
};
},
created() {
that = this
},
filters: {
// 过滤类型
filterSluice (price) {
const data = that.sluiceType.filter((res) => res.dictValue == price)
return data[0] ? data[0].dictLabel : '/'
},
// 过滤区域
filterAdcd (price) {
let name = ''
if (that.adcdOptions.filter((res) => res.id == price)[0]) {
name = that.adcdOptions.filter((res) => res.id == price)[0].name
}
return name
}
},
methods: {
handleGoManage(row) {
this.$router.push({
path: "manage",
query: { wagaCode: row.wagaCode },
});
},
handleCurrentPageChange(page) {
this.pageData.pageNum = page;
this.getTableData();
},
handlePageSizeChange(pageSize) {
this.pageData.pageSize = pageSize;
this.getTableData();
},
search() {
this.pageData.pageNum = 1;
this.getTableData();
},
// 重置搜索
resetSearch() {
this.pageData.pageNum = 1;
if (!this.$refs['searchForm']) return
this.$refs['searchForm'].resetFields()
this.getTableData();
},
// 获取列表数据
getTableData() {
getSluiceProjectList({
data: {
timeView: {
timeField: "create_time",
},
adcd: this.searchForm.adcd,
wagaType: this.searchForm.wagaType == -1 ? "" : this.searchForm.wagaType,
wagaName: this.searchForm.wagaName
},
cv: {
name: "name",
type: "like",
},
pageSize: this.pageData.pageSize,
pageNum: this.pageData.pageNum,
}).then((res) => {
if (res) {
this.tableData = res.records;
this.pageData.total = res.total;
}
});
},
// 获取地区树数据
getTreeData() {
getAreasData().then((items) => {
this.adcdOptions = items.data
if (items?.data) {
let res = [];
let getChildren = (res, pid) => {
for (const i of items.data) {
if (i.parentid === pid) {
const newItem = {
label: i.name,
value: i.id,
};
if (i.layer != 3) newItem.children = [];
res.push(newItem);
getChildren(newItem.children, newItem.value);
}
}
};
getChildren(res, items.data[0].parentid);
this.areasOptions = res;
}
});
},
},
async mounted () {
// 获取水闸类型
getDicts("sluice_type").then((res) => {
this.sluiceType = res.data;
});
await this.getTreeData();
// 获取列表数据
await this.getTableData();
},
};
</script>
<template>
<div class="slider-right">
<div class="top-title">基础信息管理</div>
<div class="table-box">
<el-form inline :model="searchForm" ref="searchForm" class="demo-ruleForm">
<el-form-item label="区域选择:" prop="adcd">
<el-cascader
:options="areasOptions"
v-model="searchForm.adcd"
:props="areasOptionProps"
placeholder="请选择"
clearable
size="small"
>
</el-cascader>
</el-form-item>
<el-form-item label="水闸类型:" prop="wagaType">
<el-select v-model="searchForm.wagaType" placeholder="请选择">
<el-option
v-for="item in sluiceType"
:label="item.dictLabel"
:value="item.dictValue"
:key="item.id"
></el-option>
<el-option label="全部" :value="-1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="水闸名称:" prop="wagaName">
<el-input v-model="searchForm.wagaName" class="search-input" placeholder="请输入水闸名称"></el-input>
</el-form-item>
<el-form-item>
<el-button class="search-btn" type="success" @click="search()">查询</el-button>
<el-button @click="resetSearch()">重置</el-button>
</el-form-item>
</el-form>
<el-table height="625" :data="tableData" border>
<el-table-column type="index" align="center" label="序号" width="100">
</el-table-column>
<el-table-column prop="wagaCode" align="center" label="水闸编码">
</el-table-column>
<el-table-column prop="wagaName" align="center" label="水闸名称">
</el-table-column>
<el-table-column prop="waterAdministrativeDepartment" align="center" label="水闸类型">
<template slot-scope="scope">
{{ scope.row.waterAdministrativeDepartment | filterSluice }}
</template>
</el-table-column>
<el-table-column prop="name" align="center" label="区域">
<template slot-scope="scope">
{{ scope.row.adcd | filterAdcd }}
</template>
</el-table-column>
<el-table-column prop="engineeringManagementUnit" align="center" label="管理机构">
</el-table-column>
<el-table-column prop="address" align="center" label="操作">
<template slot-scope="scope">
<el-button
style="margin-right: 16px"
@click="handleGoManage(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>
</div>
</template>
<style scoped lang="less">
.top-title {
height: 50px;
background-color: white;
display: flex;
padding-left: 16px;
align-items: center;
font-weight: 600;
}
.table-box {
width: 100%;
height: calc(100% - 50px - 24px);
margin-top: 24px;
padding: 16px;
background-color: white;
.search-input {
width: 300px;
margin-right: 10px;
}
.search-btn {
margin-left: 10px;
background-color: #37b29e;
border: none;
&:hover {
background-color: #5ac6b9;
}
&:active {
background-color: #2b8070;
}
}
}
</style>