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.
364 lines
12 KiB
364 lines
12 KiB
<script>
|
|
import { getAreasData } from "@/api/areas/index";
|
|
import Edit from "./edit.vue";
|
|
import { STATIONTYPE, PLANLIST } from "../../const";
|
|
let that;
|
|
export default {
|
|
name: "PlanDetail",
|
|
components: {
|
|
Edit
|
|
},
|
|
data() {
|
|
return {
|
|
searchForm: {
|
|
stationType: "1",
|
|
value: ""
|
|
},
|
|
dialog: {
|
|
title: "新增配置",
|
|
dom: "",
|
|
visible: false,
|
|
},
|
|
mdl: null,
|
|
stationTypeList: [],
|
|
areasOptions: [],
|
|
areasOptionProps: {
|
|
emitPath: false,
|
|
checkStrictly: true, //选择任意一级
|
|
},
|
|
enginType: '0',
|
|
tableData: [],
|
|
pageData: {
|
|
pageNum: 1, // 当前页
|
|
pageSize: 10, // 请求数量
|
|
pageSizes: [10, 20, 50, 100],
|
|
total: 0, // 总数量
|
|
},
|
|
};
|
|
},
|
|
created() {
|
|
that = this;
|
|
this.enginType = this.$route.query.enginType
|
|
this.stationTypeList = STATIONTYPE.filter(res =>{
|
|
return res.dictType == this.enginType
|
|
})[0].dictValue
|
|
},
|
|
methods: {
|
|
handleGoManage(row) {
|
|
this.$router.push({
|
|
path: "planInfoDetail",
|
|
query: { id: row.id },
|
|
});
|
|
},
|
|
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();
|
|
},
|
|
handleAdd() {
|
|
this.dialog.dom = "Edit";
|
|
this.dialog.visible = true;
|
|
},
|
|
handleCheck(row) {
|
|
this.dialog.dom = "Edit";
|
|
this.mdl = { ...row };
|
|
this.dialog.visible = true;
|
|
},
|
|
handleEdit(row) {
|
|
this.dialog.dom = "Edit";
|
|
this.mdl = {
|
|
eventType: "edit",
|
|
...row,
|
|
};
|
|
this.dialog.visible = true;
|
|
},
|
|
handleDelete() {
|
|
this.$message.success("删除成功");
|
|
},
|
|
submitForm() {
|
|
this.$refs.component.submitForm(async (from) => {
|
|
if (this.mdl) {
|
|
this.$message.success("修改成功");
|
|
this.closeDialog();
|
|
} else {
|
|
this.$message.success("新增成功");
|
|
this.closeDialog();
|
|
}
|
|
})
|
|
},
|
|
// 关闭dialog
|
|
closeDialog() {
|
|
this.dialog.visible = false;
|
|
this.mdl = null;
|
|
},
|
|
// 获取地区树数据
|
|
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;
|
|
}
|
|
});
|
|
},
|
|
handleStation() {
|
|
this.getTableData()
|
|
},
|
|
// 获取列表数据
|
|
getTableData() {
|
|
console.log(this.searchForm);
|
|
const list = PLANLIST.filter(res => {
|
|
let filter = true
|
|
if (res.enginType !== this.enginType) {
|
|
filter = false
|
|
}
|
|
if (res.stationType !== this.searchForm.stationType) {
|
|
filter = false
|
|
}
|
|
// 过滤搜索框
|
|
if (this.searchForm.value) {
|
|
if (!res.codeNum.includes(this.searchForm.value) && !res.name.includes(this.searchForm.value)) {
|
|
filter = false
|
|
}
|
|
}
|
|
if (filter) return res
|
|
})
|
|
this.tableData = list
|
|
}
|
|
},
|
|
async mounted() {
|
|
this.getTreeData()
|
|
this.getTableData()
|
|
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div class="slider-right">
|
|
<div class="table-box">
|
|
<el-form
|
|
inline
|
|
:model="searchForm"
|
|
ref="searchForm"
|
|
class="demo-ruleForm"
|
|
>
|
|
<el-form-item label="测站/测点类型:" prop="enginType">
|
|
<el-select v-model="searchForm.stationType" @change="handleStation" placeholder="请选择">
|
|
<el-option
|
|
v-for="item in stationTypeList"
|
|
:label="item.dictLabel"
|
|
:value="item.dictValue"
|
|
:key="item.id"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item prop="value">
|
|
<el-input
|
|
v-model="searchForm.value"
|
|
class="search-input"
|
|
placeholder="请输入图层目录名称或编号"
|
|
></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button class="search-btn" type="success" @click="search"
|
|
>查询</el-button
|
|
>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-button
|
|
class="search-btn"
|
|
style="margin-right: 16px; margin-bottom: 8px; float: right"
|
|
type="success"
|
|
@click="handleAdd()"
|
|
>新增
|
|
</el-button>
|
|
<el-table :data="tableData" border>
|
|
<el-table-column key="1" type="index" align="center" label="序号" width="100">
|
|
</el-table-column>
|
|
<el-table-column key="2" v-if="searchForm.stationType === '0'" prop="name" align="center" label="水位站名">
|
|
</el-table-column>
|
|
<el-table-column key="3" v-if="searchForm.stationType === '1'" prop="name" align="center" label="雨量站名">
|
|
</el-table-column>
|
|
<el-table-column key="4" v-if="searchForm.stationType === '2'" prop="name" align="center" label="视频站名">
|
|
</el-table-column>
|
|
<el-table-column key="5" v-if="enginType === '0' && searchForm.stationType === '3'" prop="name" align="center" label="渗压计名">
|
|
</el-table-column>
|
|
<el-table-column key="6" v-if="enginType === '1' && searchForm.stationType === '3'" prop="name" align="center" label="水平变形监测组名">
|
|
</el-table-column>
|
|
<el-table-column key="7" v-if="enginType === '1' && searchForm.stationType === '4'" prop="name" align="center" label="沉降监测组名">
|
|
</el-table-column>
|
|
<el-table-column key="8" v-if="enginType === '1' && searchForm.stationType === '5'" prop="name" align="center" label="水质监测组名">
|
|
</el-table-column>
|
|
<el-table-column key="9" v-if="enginType === '1' && searchForm.stationType === '6'" prop="name" align="center" label="流量监测点名">
|
|
</el-table-column>
|
|
<el-table-column key="10" v-if="enginType === '1' && searchForm.stationType === '7'" prop="name" align="center" label="闸门开度监测组名">
|
|
</el-table-column>
|
|
<el-table-column key="11" prop="codeNum" align="center" label="编号">
|
|
</el-table-column>
|
|
<el-table-column key="12" v-if="enginType === '1' && ['3','4','5','6'].includes(searchForm.stationType)" prop="gaugingPoint" align="center" label="测点编号">
|
|
</el-table-column>
|
|
<el-table-column key="13" v-if="enginType === '1' && searchForm.stationType === '7'" prop="gateNum" align="gateNum" label="闸门编号">
|
|
</el-table-column>
|
|
<el-table-column key="14" v-if="enginType !== '0' || searchForm.stationType !== '3'" prop="coors" align="center" label="坐标">
|
|
</el-table-column>
|
|
<el-table-column key="15" v-if="enginType === '0' && searchForm.stationType === '3'" prop="pipeOpen" align="center" label="管口高程">
|
|
</el-table-column>
|
|
<el-table-column key="16" v-if="enginType === '0' && searchForm.stationType === '3'" prop="pipeBottom" align="center" label="管底高程">
|
|
</el-table-column>
|
|
<el-table-column key="18" v-if="searchForm.stationType === '0'" prop="address" align="center" label="水位值引入地址">
|
|
</el-table-column>
|
|
<el-table-column key="19" v-if="searchForm.stationType === '1'" prop="address" align="center" label="雨量值引入地址">
|
|
</el-table-column>
|
|
<el-table-column key="20" v-if="searchForm.stationType === '2'" prop="address" align="center" label="视频引入地址">
|
|
</el-table-column>
|
|
<el-table-column key="21" v-if="enginType === '0' && searchForm.stationType === '3'" prop="address" align="center" label="渗透压力值引入地址">
|
|
</el-table-column>
|
|
<el-table-column key="22" v-if="enginType === '1' && ['3','4'].includes(searchForm.stationType)" prop="address" align="center" label="位移值引入地址">
|
|
</el-table-column>
|
|
<el-table-column key="23" v-if="enginType === '1' && searchForm.stationType === '5'" prop="address" align="center" label="水质值引入地址">
|
|
</el-table-column>
|
|
<el-table-column key="24" v-if="enginType === '1' && searchForm.stationType === '6'" prop="address" align="center" label="流量值引入地址">
|
|
</el-table-column>
|
|
<el-table-column key="25" v-if="enginType === '1' && searchForm.stationType === '7'" prop="address" align="center" label="闸门开度值引入地址">
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="address"
|
|
align="center"
|
|
label="操作"
|
|
min-width="200"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
style="margin-right: 16px"
|
|
@click="handleEdit(scope.row)"
|
|
type="text"
|
|
size="small"
|
|
>
|
|
编辑
|
|
</el-button>
|
|
<el-popconfirm
|
|
confirm-button-text="确定"
|
|
cancel-button-text="取消"
|
|
icon="el-icon-info"
|
|
icon-color="red"
|
|
title="确定删除吗?"
|
|
@confirm="handleDelete(scope.row)"
|
|
>
|
|
<el-button
|
|
style="color: red"
|
|
type="text"
|
|
size="small"
|
|
slot="reference"
|
|
>删除
|
|
</el-button>
|
|
</el-popconfirm>
|
|
</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="dialog.title"
|
|
@close="closeDialog"
|
|
:visible.sync="dialog.visible"
|
|
width="50%"
|
|
>
|
|
<component
|
|
v-if="dialog.visible"
|
|
:is="dialog.dom"
|
|
ref="component"
|
|
:model="mdl"
|
|
:enginType="enginType"
|
|
></component>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button size="mini" @click="closeDialog">取 消</el-button>
|
|
<el-button size="mini" type="primary" @click="submitForm"
|
|
>保存
|
|
</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped lang="less">
|
|
|
|
.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;
|
|
}
|
|
}
|
|
}
|
|
.search-btn {
|
|
margin-left: 10px;
|
|
background-color: #37b29e;
|
|
border: none;
|
|
|
|
&:hover {
|
|
background-color: #5ac6b9;
|
|
}
|
|
|
|
&:active {
|
|
background-color: #2b8070;
|
|
}
|
|
}
|
|
</style>
|
|
|