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.

321 lines
9.1 KiB

<!-- 巡查项目管理 -->
<script>
import { getDicts } from "@/api/management";
import { getV2PatrolCheckingList, delV2PatrolChecking } from "@/api/dike";
import TopBackTitle from "@/components/TopBackTitle/index.vue";
import { calcTableHeight } from "@/mixins/calcTableHeight";
export default {
name: "patrolItemsManage",
components: {
TopBackTitle,
},
mixins: [calcTableHeight],
data() {
return {
paramsData: {
name: "",
type: "",
category: "",
},
xcTypeOptions: [], // 检查类型
xcCategoryOptions: [], // 检查类别
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) {
console.log("deleteTableItem删除 >>>>> ", row);
delV2PatrolChecking(row.id).then((res) => {
this.getTableData();
this.$message.success("删除成功");
});
},
// 表格筛选
searchTableList() {
this.getTableData();
},
// 重置搜索
resetSearch() {
this.paramsData.name = "";
this.paramsData.type = "";
this.paramsData.category = "";
this.pageData.pageNum = 1;
this.getTableData();
},
// 添加巡查项目
handleAddItem() {
this.$router.push({
path: "patrolItemsDetails",
query: {
type: "add",
},
});
},
// 编辑巡查项目
handleOperateTableItem(row, mode) {
this.$router.push({
path: "patrolItemsDetails",
query: {
id: row.id,
type: mode,
},
});
},
// 获取列表数据
getTableData() {
getV2PatrolCheckingList({
data: {
category: this.paramsData.category,
dikeCode: "",
name: this.paramsData.name,
type: this.paramsData.type,
},
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;
}
});
},
// 领单操作
handleGetInvoices(row) {
this.$router.push({
path: "inspectionRecordDetails",
query: {
checkingId: row.id,
},
});
},
},
mounted() {
// 获取列表数据
this.getTableData();
// 获取巡查类型
getDicts("patrol_maintenance_type").then((res) => {
if (res.data && Array.isArray(res.data)) {
this.xcTypeOptions = res.data;
}
});
getDicts("patrol_maintenance_category").then((res) => {
if (res.data && Array.isArray(res.data)) {
this.xcCategoryOptions = res.data;
}
});
},
};
</script>
<template>
<div class="slider-right">
<TopBackTitle :showBackBtn="false" />
<div class="table-box slider-right-body" ref="tableBoxRef">
<div class="" ref="topBoxRef">
<div class="top-search">
<span>巡查名称</span>
<el-input
class="search-input"
v-model="paramsData.name"
placeholder="请输入巡视检查名称"
/>
<span class="ml-10">巡查类型</span>
<el-select v-model="paramsData.type" placeholder="请选择">
<el-option label="全部" value=""></el-option>
<el-option
v-for="item in xcTypeOptions"
:label="item.dictLabel"
:value="item.dictValue"
:key="item.dictValue"
></el-option>
</el-select>
<span class="ml-10">巡查类别</span>
<el-select v-model="paramsData.category" placeholder="请选择">
<el-option label="全部" value=""></el-option>
<el-option
v-for="item in xcCategoryOptions"
:label="item.dictLabel"
:value="item.dictValue"
:key="item.dictValue"
></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:patrol:itemsmanage:item:add']"
@click="handleAddItem"
>添加</el-button
>
</div>
</div>
<el-table :height="tableHeight" :data="tableData" border>
<!-- <el-table-column type="index" align="center" label="序号" width="100">
</el-table-column> -->
<el-table-column prop="id" align="center" label="单号" width="100">
</el-table-column>
<el-table-column prop="name" align="center" label="巡查名称">
</el-table-column>
<el-table-column prop="dikeName" align="center" label="工程名称">
</el-table-column>
<el-table-column prop="dikeCode" align="center" label="工程代码">
</el-table-column>
<el-table-column align="center" label="巡查类型">
<template slot-scope="scope">
<span v-if="xcTypeOptions.length > 0 && scope.row.type !== null">{{
xcTypeOptions.find((item) => item.dictValue == scope.row.type)
.dictLabel || ""
}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="巡查类别">
<template slot-scope="scope">
<span
v-if="xcCategoryOptions.length > 0 && scope.row.category !== null"
>{{
xcCategoryOptions.find(
(item) => item.dictValue == scope.row.category
).dictLabel || ""
}}</span
>
</template>
</el-table-column>
<el-table-column
prop="createName"
align="center"
sortable
label="创建人"
>
</el-table-column>
<el-table-column
prop="createTime"
align="center"
sortable
label="创建时间"
>
</el-table-column>
<el-table-column
prop="address"
align="center"
label="操作"
fixed="right"
width="200"
>
<template slot-scope="scope">
<el-button
style="margin-right: 16px"
v-hasPermi="['df:run:patrol:itemsmanage:list:item:getInvoices']"
type="text"
size="small"
@click="handleGetInvoices(scope.row)"
>领单</el-button
>
<el-button
style="margin-right: 16px"
@click="handleOperateTableItem(scope.row, 'view')"
v-hasPermi="['df:run:patrol:itemsmanage:list:item:check']"
type="text"
size="small"
>查看</el-button
>
<el-button
style="margin-right: 16px"
@click="handleOperateTableItem(scope.row, 'edit')"
v-hasPermi="['df:run:patrol:itemsmanage:list: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:patrol:itemsmanage:list: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%;
margin-top: 24px;
padding: 16px;
background-color: white;
.top-search {
// display: flex;
align-items: center;
margin-bottom: 8px;
.search-input {
width: 240px;
}
}
}
</style>