Commit 2496dddd authored by lei's avatar lei

add:日常巡检

parent e7341cf1
import request from '@/utils/request'
// 查询【请填写功能名称】列表
export function listAllocation(query) {
return request({
url: '/pc/inspection/allocation/query',
method: 'get',
params: query
})
}
// 查询【请填写功能名称】所有列表
export function listAllAllocation(query) {
return request({
url: '/business/allocation/listAll',
method: 'get',
params: query
})
}
// 查询【请填写功能名称】详细
export function getAllocation(id) {
return request({
url: '/pc/inspection/allocation/getInfo/' + id,
method: 'get'
})
}
// 新增【请填写功能名称】
export function addAllocation(data) {
return request({
url: '/pc/inspection/allocation/add',
method: 'post',
data: data
})
}
// 修改【请填写功能名称】
export function updateAllocation(data) {
return request({
url: '/pc/inspection/allocation/add',
method: 'post',
data: data
})
}
// 删除【请填写功能名称】
export function delAllocation(id) {
return request({
url: '/pc/inspection/allocation/remove/' + id,
method: 'get'
})
}
//获取设备信息
export function getDeviceInfo() {
return request({
url: '/gemho/device/list',
method: 'get'
})
}
//查询所有人员
export function getAllPerson() {
return request({
url: '/system/user/list',
method: 'get'
})
}
......@@ -117,14 +117,14 @@ export default {
this.viewer.cesiumWidget.creditContainer.style.display = "none";
// 加载3D Tileset
// Cesium.Cesium3DTileset.fromUrl("/terra_b3dms_yd/tileset.json", {
Cesium.Cesium3DTileset.fromUrl(
"http://localhost/terra_b3dms_yd/tileset.json",
{
maximumScreenSpaceError: 1,
pickable: true,
}
)
Cesium.Cesium3DTileset.fromUrl("/terra_b3dms_yd/tileset.json", {
// Cesium.Cesium3DTileset.fromUrl(
// "http://localhost/terra_b3dms_yd/tileset.json",
// {
maximumScreenSpaceError: 1,
pickable: true,
})
.then((tileset) => {
this.tileset = tileset; // 存储tileset供后续使用
this.viewer.scene.primitives.add(tileset);
......
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="巡检时间" prop="inspectionTime">
<el-input
v-model="queryParams.inspectionTime"
placeholder="请输入巡检时间"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="巡检对象" prop="inspectionObject">
<el-input
v-model="queryParams.inspectionObject"
placeholder="地点/设备编号/Id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="巡检人" prop="responsiblePerson">
<el-input
v-model="queryParams.responsiblePerson"
placeholder="请输入巡检人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button
>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business:allocation:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business:allocation:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['business:allocation:export']"
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar> -->
</el-row>
<el-table
v-loading="loading"
:data="allocationList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="id" />
<el-table-column label="巡检时间" align="center" prop="inspectionTime">
<template slot-scope="scope">
{{ scope.row.inspectionTimeInterval }}/{{
scope.row.inspectionTimeUnit == "time" ? "分钟" : ""
}}进行巡检
</template>
</el-table-column>
<el-table-column
label="巡检对象"
align="center"
prop="inspectionObjectName"
/>
<el-table-column
label="类型区分地点和设备(0地点1设备)"
align="center"
prop="inspectionType"
>
<template slot-scope="scope">
{{ scope.row.inspectionType === 0 ? "地点" : "设备" }}
</template>
</el-table-column>
<el-table-column
label="巡检人"
align="center"
prop="responsiblePersonName"
/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
:type="scope.row.status === 0 ? '开启' : '关闭'"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
>
</el-switch>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['business:allocation:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business:allocation:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改【请填写功能名称】对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="巡检时间" prop="inspectionTimeInterval">
<div class="yihang" style="display: flex; align-items: center">
<el-input
type="number"
v-model="form.inspectionTimeInterval"
size="mini"
style="width: 80px"
/>
/
<el-select
v-model="form.inspectionTimeUnit"
placeholder="选择天/小时"
size="mini"
>
<el-option label="小时" value="time"></el-option>
<el-option label="天" value="day"></el-option> </el-select
>进行巡检
</div>
</el-form-item>
<el-form-item label="巡检类型" prop="inspectionType">
<el-radio-group
v-model="form.inspectionType"
@change="handleChange"
size="mini"
>
<el-radio label="0">地点</el-radio>
<el-radio label="1">设备</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="巡检对象" prop="inspectionObjectName">
<el-select v-model="form.inspectionObject" placeholder="" size="mini">
<el-option
v-for="item in optionList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="巡检人" prop="responsiblePerson">
<el-select
v-model="form.responsiblePerson"
filterable
multiple
placeholder=""
>
<el-option
v-for="item in perpOptionList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getAllocation,
listAllocation,
addAllocation,
updateAllocation,
deleteAllocation,
getDeviceInfo,
getAllPerson,
} from "@/api/patrol/dailyinspection.js";
import { listLog } from "@/api/patrol/patrolLocation";
export default {
name: "Allocation",
data() {
return {
// 根路径
baseURL: process.env.VUE_APP_BASE_API,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 【请填写功能名称】表格数据
allocationList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
inspectionTime: null,
inspectionObject: null,
inspectionType: null,
responsiblePerson: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
id: [{ required: true, message: "主键Id不能为空", trigger: "blur" }],
inspectionTime: [
{ required: true, message: "巡检时间不能为空", trigger: "blur" },
],
inspectionObject: [
{
required: true,
message: "巡检对象包括地点和设备编号或Id不能为空",
trigger: "blur",
},
],
inspectionType: [
{
required: true,
message: "类型区分地点和设备(0地点1设备)不能为空",
trigger: "change",
},
],
responsiblePerson: [
{ required: true, message: "巡检人不能为空", trigger: "blur" },
],
status: [
{
required: true,
message: "状态(开启0关闭1)不能为空",
trigger: "blur",
},
],
},
//巡检地点list
locationList: [],
deviceList: [],
optionList: [],
perpOptionList: [],
};
},
created() {
this.getList();
listLog().then((response) => {
this.locationList = response.rows.map((item) => {
return {
label: item.placeName,
value: item.id,
};
});
});
getDeviceInfo().then((response) => {
this.deviceList = response.rows.map((item) => {
return {
label: item.deviceName,
value: item.id,
};
});
});
getAllPerson().then((response) => {
this.perpOptionList = response.rows.map((item) => {
return {
label: item.nickName,
value: item.userId,
};
});
});
},
methods: {
//日常巡检任务开关
handleStatusChange(row) {
row.status = row.status == 0 ? 1 : 0;
updateAllocation(row).then((response) => {
this.$modal.msgSuccess("修改成功");
this.getList();
});
},
// 切换巡检类型
handleChange() {
if (this.form.inspectionType == 0) {
this.form.inspectionObject = null;
this.optionList = this.locationList;
} else {
this.form.inspectionObject = null;
this.optionList = this.deviceList;
}
},
/** 查询【请填写功能名称】列表 */
getList() {
this.loading = true;
listAllocation(this.queryParams).then((response) => {
this.allocationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
inspectionTime: null,
inspectionObject: null,
inspectionType: null,
responsiblePerson: null,
status: "0",
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加日常巡检";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getAllocation(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改日常巡检";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateAllocation(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addAllocation(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?')
.then(function () {
return delAllocation(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"business/allocation/export",
{
...this.queryParams,
},
`allocation_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<style scoped>
.yihang {
display: flex;
align-items: center;
justify-content: center;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment