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.
286 lines
7.3 KiB
286 lines
7.3 KiB
<!-- 巡查项目管理-堤防 -->
|
|
<script>
|
|
import {
|
|
getDicts,
|
|
postDFInspectionProjectList,
|
|
deleteDFInspectionProject,
|
|
} from "@/api/management";
|
|
|
|
import TopBackTitle from "@/components/TopBackTitle/index.vue";
|
|
|
|
export default {
|
|
name: "InspectionItems",
|
|
components: {
|
|
TopBackTitle,
|
|
},
|
|
data() {
|
|
return {
|
|
searchInput: "",
|
|
searchType: 3,
|
|
dialogVisible: false,
|
|
ContentType: "",
|
|
firstType: [], // 一级检查内容类型
|
|
secondType: [], // 二级检查内容类型
|
|
examType: [], // 检查类型
|
|
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();
|
|
},
|
|
deleteTableItem(row) {
|
|
deleteDFInspectionProject(row.id).then((res) => {
|
|
this.getTableData();
|
|
this.$message.success("删除成功");
|
|
});
|
|
},
|
|
// 表格筛选
|
|
searchTableList() {
|
|
postDFInspectionProjectList({
|
|
data: {
|
|
timeView: {
|
|
timeField: "create_time",
|
|
},
|
|
type: this.searchType == 3 ? "" : this.searchType,
|
|
},
|
|
cv: {
|
|
name: "name",
|
|
type: "like",
|
|
value: this.searchInput,
|
|
},
|
|
pageSize: this.pageData.pageSize,
|
|
pageNum: this.pageData.pageNum,
|
|
}).then((res) => {
|
|
if (res) {
|
|
this.tableData = res.records;
|
|
this.pageData.total = res.total;
|
|
}
|
|
});
|
|
},
|
|
// 重置搜索
|
|
resetSearch() {
|
|
this.searchInput = "";
|
|
this.searchType = 3;
|
|
this.searchTableList();
|
|
},
|
|
// 添加巡查项目
|
|
handleAddItem() {
|
|
this.$router.push({
|
|
path: "inspectionItemDetails",
|
|
query: {
|
|
type: "add",
|
|
},
|
|
});
|
|
},
|
|
// 编辑巡查项目
|
|
editTableItem(row) {
|
|
this.$router.push({
|
|
path: "inspectionItemDetails",
|
|
query: {
|
|
id: row.id,
|
|
type: "edit",
|
|
},
|
|
});
|
|
},
|
|
|
|
// 获取列表数据
|
|
getTableData() {
|
|
this.searchInput = "";
|
|
this.searchType = 3;
|
|
postDFInspectionProjectList({
|
|
data: {
|
|
timeView: {
|
|
timeField: "create_time",
|
|
},
|
|
},
|
|
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;
|
|
}
|
|
});
|
|
},
|
|
},
|
|
mounted() {
|
|
// 获取列表数据
|
|
this.getTableData();
|
|
// 获取巡查类型
|
|
getDicts("xs_classfy").then((res) => {
|
|
if (res.data && Array.isArray(res.data)) {
|
|
this.examType = res.data;
|
|
}
|
|
});
|
|
// 获取一级数据
|
|
getDicts("df_xs_c_classfy").then((res) => {
|
|
if (res.data && Array.isArray(res.data)) {
|
|
this.firstType = res.data;
|
|
}
|
|
});
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div class="slider-right">
|
|
<TopBackTitle :showBackBtn="false" />
|
|
<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="searchType" placeholder="请选择">
|
|
<el-option label="全部" :value="3"></el-option>
|
|
<el-option
|
|
v-for="item in examType"
|
|
:label="item.dictLabel"
|
|
:value="item.dictValue"
|
|
:key="item.id"
|
|
></el-option>
|
|
</el-select>
|
|
<el-button
|
|
class="search-btn !ml-16"
|
|
type="success"
|
|
@click="searchTableList()"
|
|
>搜索</el-button
|
|
>
|
|
<el-button @click="resetSearch()">重置</el-button>
|
|
<el-button
|
|
class="search-btn"
|
|
style="float: right"
|
|
type="success"
|
|
v-hasPermi="['df:run:checking:item:add']"
|
|
@click="handleAddItem"
|
|
>添加</el-button
|
|
>
|
|
</div>
|
|
<el-table :data="tableData" border>
|
|
<el-table-column type="index" align="center" label="序号" width="100">
|
|
</el-table-column>
|
|
<el-table-column prop="name" align="center" label="巡视检查名称">
|
|
</el-table-column>
|
|
<el-table-column align="center" label="巡查类型">
|
|
<template slot-scope="scope">
|
|
<span v-if="examType.length > 0 && scope.row.type !== null">{{
|
|
examType.find((item) => item.dictValue == scope.row.type)
|
|
.dictLabel || ""
|
|
}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="createTime"
|
|
align="center"
|
|
sortable
|
|
label="创建时间"
|
|
>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="updateTime"
|
|
align="center"
|
|
sortable
|
|
label="更新时间"
|
|
>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="address"
|
|
align="center"
|
|
label="操作"
|
|
fixed="right"
|
|
width="100"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
style="margin-right: 16px"
|
|
@click="editTableItem(scope.row)"
|
|
v-hasPermi="['df:run:checking:item:edit']"
|
|
type="text"
|
|
size="small"
|
|
>编辑</el-button
|
|
>
|
|
<el-popconfirm
|
|
confirm-button-text="确定"
|
|
cancel-button-text="取消"
|
|
icon="el-icon-info"
|
|
icon-color="red"
|
|
title="确定删除吗?"
|
|
@confirm="deleteTableItem(scope.row)"
|
|
>
|
|
<el-button
|
|
style="color: red"
|
|
type="text"
|
|
size="small"
|
|
slot="reference"
|
|
v-hasPermi="['df:run:checking:item:delete']"
|
|
>删除</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>
|
|
</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);
|
|
margin-top: 24px;
|
|
padding: 16px;
|
|
padding-bottom: 60px;
|
|
background-color: white;
|
|
|
|
.top-search {
|
|
// display: flex;
|
|
align-items: center;
|
|
margin-bottom: 8px;
|
|
|
|
.search-input {
|
|
width: 300px;
|
|
margin-right: 10px;
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
|