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.

603 lines
16 KiB

<!-- 巡查计划管理-堤防 -->
<script>
1 year ago
import {
postDFInspectionPlanlist,
postDFInspectionPlan,
putDFInspectionPlan,
postDFInspectionProjectList,
getDFInspectionPlan,
deleteDFInspectionPlan,
listUser,
} from "@/api/management";
10 months ago
import TopBackTitle from "@/components/TopBackTitle/index.vue";
1 year ago
import { uploadFileData } from "@/api/system/upload";
10 months ago
import PlanDetail from "./components/PlanDetail.vue";
export default {
1 year ago
name: "InspectionItems",
10 months ago
components: {
TopBackTitle,
PlanDetail,
},
data() {
return {
10 months ago
paramsData: {
name: "",
status: "",
10 months ago
userIds: [],
10 months ago
planDateArr: [],
},
currentRow: {},
dialogVisible: false,
patrolType: [], // 巡查周期类型
personnelList: [], // 人员列表
examType: [], // 检查类型
tableData: [], // 检查列表
patrolTableData: [], // 巡查项目列表
pageData: {
pageNum: 1, // 当前页
pageSize: 10, // 请求数量
pageSizes: [10, 20, 50, 100],
1 year ago
total: 0, // 总数量
},
ruleForm: {
1 year ago
dikeCode: this.$route.query.dikeCode || "",
name: "",
type: "",
xcId: "",
frequency: "",
cycleType: "0",
isReminder: true,
1 year ago
reminderTime: "",
operators: [],
1 year ago
files: [], //依据
otherConfig: {
1 year ago
week: "",
time: "",
selectUser: [],
},
},
rules: {
name: [
{ required: true, message: "请输入计划名称", trigger: "change" },
{ max: 50, message: "名称最长为50个字符", trigger: "change" },
],
type: [
1 year ago
{ required: true, message: "请选择巡查类型", trigger: "change" },
],
xcId: [
1 year ago
{ required: true, message: "请选择巡查项目名称", trigger: "change" },
],
cycleType: [
1 year ago
{ required: true, message: "请选择巡查周期", trigger: "change" },
],
frequency: [
{ required: true, message: "请输入巡查次数", trigger: "blur" },
],
1 year ago
isReminder: [
1 year ago
{ required: true, message: "请选择消息提醒", trigger: "change" },
],
1 year ago
"otherConfig.time": [
{ required: true, message: "请选择检查时间", trigger: "change" },
],
reminderTime: [
1 year ago
{ required: true, message: "请选择提醒时间", trigger: "change" },
],
1 year ago
"otherConfig.selectUser": [
{ required: true, message: "请选择责任人", trigger: "change" },
],
},
};
},
computed: {
1 year ago
disabledUpload() {
return this.ruleForm?.files?.length >= 9;
},
},
methods: {
1 year ago
handleCurrentPageChange(page) {
this.pageData.pageNum = page;
this.getTableData();
},
handlePageSizeChange(pageSize) {
this.pageData.pageSize = pageSize;
this.getTableData();
},
10 months ago
handleAdd() {
this.$router.push({
path: "createInspectionPlan",
});
},
// 查看巡查项目
handleCheck(row) {
this.currentRow = row;
this.dialogVisible = true;
},
// 编辑巡查项目
10 months ago
handleEdit(row) {
this.$router.push({
path: "createInspectionPlan",
query: {
id: row.id,
},
1 year ago
});
},
// 删除对应巡查项目
deleteTableItem(row) {
deleteDFInspectionPlan(row.id).then((res) => {
1 year ago
this.getTableData();
this.$message.success("删除成功");
});
},
10 months ago
// 查看详情
submitForm(formName) {
1 year ago
console.log("保存 >>> ", this.ruleForm);
this.$refs[formName].validate((valid) => {
if (valid) {
1 year ago
let user = [];
this.ruleForm.otherConfig.selectUser.forEach((element) => {
let a = {
name: element.nickName,
1 year ago
uid: element.id,
};
user.push(a);
});
1 year ago
this.ruleForm.operators = user;
if (this.ruleForm.id) {
putDFInspectionPlan(this.ruleForm).then((res) => {
1 year ago
this.getTableData();
this.dialogVisible = false;
this.$message.success("更新成功");
});
} else {
postDFInspectionPlan(this.ruleForm).then((res) => {
1 year ago
this.getTableData();
this.dialogVisible = false;
this.$message.success("添加成功");
});
}
} else {
1 year ago
console.log("校验不通过");
return false;
}
});
},
// 更改巡查类型
changePatrolType(ruleForm, reset) {
if (reset) {
1 year ago
this.$set(ruleForm, "xcId", "");
}
setTimeout(() => {
this.$refs.ruleForm.validateField("frequency");
this.$refs.ruleForm.validateField("otherConfig.time");
}, 30);
postDFInspectionProjectList({
data: {
timeView: {
1 year ago
timeField: "create_time",
},
1 year ago
type: ruleForm.type,
},
cv: {
name: "name",
1 year ago
type: "like",
},
pageSize: 999,
1 year ago
pageNum: 1,
}).then((res) => {
1 year ago
this.patrolTableData = res.records;
});
},
// 搜索用户
searchUser(e) {
listUser({
data: {
timeView: {
1 year ago
timeField: "create_time",
},
},
cv: {
name: "nickName",
type: "like",
1 year ago
value: e,
},
pageSize: 100,
1 year ago
pageNum: 1,
}).then((res) => {
10 months ago
this.personnelList = res.records.map((item) => {
return {
id: item.id,
name: item.nickName,
uid: item.uuid,
};
});
1 year ago
});
},
10 months ago
// 获取数据
10 months ago
getTableData() {
postDFInspectionPlanlist({
data: {
timeView: {
1 year ago
timeField: "create_time",
},
10 months ago
name: this.paramsData.name,
10 months ago
startTime: this.paramsData.planDateArr[0],
endTime: this.paramsData.planDateArr[1],
10 months ago
status: this.paramsData.status,
10 months ago
userIds: this.paramsData.userIds,
},
pageSize: this.pageData.pageSize,
1 year ago
pageNum: this.pageData.pageNum,
}).then((res) => {
if (res) {
1 year ago
this.tableData = res.records;
this.pageData.total = res.total;
}
1 year ago
});
},
// 上传前
1 year ago
beforeUpload(e) {
console.log("beforeUpload >>>>> ", e);
if (this.ruleForm.files?.length >= 9) {
return false;
}
1 year ago
return true;
},
1 year ago
handleUpload(e) {
const { file } = e;
let formData = new FormData();
formData.append("file", file);
uploadFileData(formData)
.then((res) => {
console.log("上传结果 >>>>> ", res);
this.ruleForm.files.push(res.url);
})
.catch((err) => {
console.log("err >>>>> ", err);
});
},
1 year ago
handleDelFile(_url, index) {
this.ruleForm.files.splice(index, 1);
},
10 months ago
handleChangeQuery() {
this.pageData.pageNum = 1;
this.getTableData();
},
handleResetQuery() {
10 months ago
this.paramsData.name = "";
this.paramsData.status = "";
this.paramsData.userIds = [];
this.paramsData.planDateArr = [];
10 months ago
this.pageData.pageNum = 1;
1 year ago
this.getTableData();
},
10 months ago
getDikeTypeName(type) {
let name = "";
this.embankmentTypeOptions.forEach((element) => {
if (element.dictValue === type) {
name = element.dictLabel;
}
});
return name;
},
},
1 year ago
created() {
this.getDicts("embankment_type").then((response) => {
this.embankmentTypeOptions = response.data;
});
1 year ago
this.getDicts("xs_classfy").then((res) => {
if (res.data && Array.isArray(res.data)) {
1 year ago
res.data.forEach((element) => {
element.dictValue = element.dictValue;
});
1 year ago
this.examType = res.data;
}
1 year ago
});
this.getDicts("xs_cycle_type").then((res) => {
this.patrolType = res.data;
});
},
mounted() {
// 获取列表数据
1 year ago
this.getTableData();
},
1 year ago
};
</script>
<template>
<div class="slider-right">
10 months ago
<TopBackTitle :showBackBtn="false"></TopBackTitle>
<div class="table-box slider-right-body">
<div class="search-form flex flex-wrap">
<div class="search-item flex items-center">
<span class="search-label">巡查计划名称</span>
1 year ago
<el-input
10 months ago
size="small"
class="w-202 ml-10"
10 months ago
:maxlength="50"
10 months ago
v-model="paramsData.name"
@change="handleChangeQuery"
placeholder="请输入名称"
1 year ago
/>
10 months ago
</div>
<div class="search-item flex items-center">
<span class="search-label">巡查计划启用状态</span>
<el-select
size="small"
class="w-202 ml-10"
@change="handleChangeQuery"
v-model="paramsData.status"
10 months ago
:popper-append-to-body="false"
10 months ago
filterable
placeholder="请选择"
>
<el-option label="全部" value=""> </el-option>
<el-option label="启用" value="1"> </el-option>
<el-option label="停用" value="0"> </el-option>
</el-select>
</div>
<div class="search-item flex items-center">
<span class="search-label">巡查计划责任人</span>
<el-select
size="small"
class="w-202 ml-10"
@change="handleChangeQuery"
10 months ago
v-model="paramsData.userIds"
10 months ago
:popper-append-to-body="false"
10 months ago
multiple
10 months ago
filterable
10 months ago
remote
:remote-method="searchUser"
value-key="id"
placeholder="请输入关键词搜索用户"
10 months ago
>
<el-option
10 months ago
v-for="item in personnelList"
10 months ago
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</div>
<div class="search-item flex items-center">
<span class="search-label">巡查计划日期</span>
<el-date-picker
size="small"
class="ml-10"
v-model="paramsData.planDateArr"
type="daterange"
placeholder="开始日期"
value-format="yyyy-MM-dd"
@change="handleChangeQuery"
></el-date-picker>
</div>
<div class="flex-1 flex justify-end search-item">
1 year ago
<el-button
10 months ago
size="small"
class="flex-shrink-0 myml-12"
1 year ago
type="success"
10 months ago
@click="handleChangeQuery"
>查询</el-button
>
<el-button
class="flex-shrink-0"
size="small"
@click="handleResetQuery"
>重置</el-button
1 year ago
>
</div>
</div>
10 months ago
<div class="line"></div>
<div class="flex justify-end mb-16">
<div>
<el-button type="primary" size="small" @click="handleAdd"
>新增</el-button
>
<!-- <el-button size="small">编辑</el-button> -->
<el-button type="danger" size="small">删除</el-button>
</div>
</div>
11 months ago
<el-table :data="tableData" border>
10 months ago
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="status" align="center" label="状态">
<template slot-scope="scope">
10 months ago
<el-tag
v-if="scope.row.status === '1'"
type="success"
class="normal"
>启用</el-tag
>
<el-tag v-else type="danger" class="abnormal">停用</el-tag>
</template>
</el-table-column>
<el-table-column prop="dikeName" align="center" label="堤防名称" />
10 months ago
<el-table-column prop="dikeType" align="center" label="堤防类型">
<template slot-scope="scope">
<span>{{ getDikeTypeName(scope.row.dikeType) }}</span>
</template>
</el-table-column>
10 months ago
<el-table-column prop="name" align="center" label="巡查计划名称" />
<el-table-column align="center" label="巡查计划类型">
<template slot-scope="scope">
<span>{{
scope.row.planType === "0"
? "日常检查"
: scope.row.planType === "1"
? "年度检查"
: scope.row.planType === "2"
? "特别检查"
: "-"
}}</span>
</template>
</el-table-column>
10 months ago
<el-table-column prop="frequency" align="center" label="巡查频次" />
<el-table-column prop="itemCount" align="center" label="子项计划数量" />
1 year ago
<el-table-column
10 months ago
prop="createName"
1 year ago
align="center"
10 months ago
label="创建计划人员"
1 year ago
/>
<el-table-column
prop="createTime"
align="center"
sortable
label="创建时间"
/>
10 months ago
<el-table-column prop="operate" align="center" label="操作">
<template slot-scope="scope">
1 year ago
<el-button
style="margin-right: 16px"
10 months ago
type="text"
size="small"
@click="handleCheck(scope.row)"
>查看</el-button
>
<el-button
style="margin-right: 16px"
@click="handleEdit(scope.row)"
1 year ago
type="text"
size="small"
v-hasPermi="['df:run:checking:plan:edit']"
1 year ago
>编辑</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; margin-right: 16px"
type="text"
size="small"
slot="reference"
v-hasPermi="['df:run:checking:plan:delete']"
1 year ago
>删除</el-button
>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
1 year ago
<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"
1 year ago
@size-change="(e) => handlePageSizeChange(e)"
@current-change="(e) => handleCurrentPageChange(e)"
1 year ago
>
</el-pagination>
</div>
10 months ago
<el-drawer
title="计划详情"
1 year ago
:visible.sync="dialogVisible"
10 months ago
direction="rtl"
size="80%"
1 year ago
>
10 months ago
<div class="drawer-body">
<PlanDetail
ref="formRef"
:id="currentRow.id"
:canEdit="false"
></PlanDetail>
</div>
<div class="drawer-footer p-16">
<el-button size="mini" type="primary" @click="handleEdit(currentRow)"
>编辑</el-button
1 year ago
>
<el-button size="mini" @click="dialogVisible = false">取消</el-button>
</div>
10 months ago
</el-drawer>
</div>
</template>
<style scoped lang="less">
10 months ago
.search-form {
.search-item {
margin-bottom: 16px;
.search-label {
width: 120px;
text-align: right;
flex-shrink: 0;
}
}
}
.line {
background: #e5e5e5;
width: 100%;
height: 1px;
margin-top: 8px;
margin-bottom: 24px;
}
.top-title {
height: 50px;
background-color: white;
display: flex;
padding-left: 16px;
align-items: center;
font-weight: 600;
}
.table-box {
11 months ago
// height: calc(100% - 50px - 24px);
margin-top: 24px;
padding: 16px;
11 months ago
padding-bottom: 60px;
background-color: white;
.top-search {
display: flex;
align-items: center;
margin-bottom: 8px;
.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;
}
}
}
10 months ago
.drawer-footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
z-index: 2;
border-top: 1px solid #ebeef5;
background: #fff;
}
.drawer-body {
height: 100%;
padding: 0 16px;
padding-bottom: 72px;
overflow: auto;
}
1 year ago
</style>