feat: 设备运动轨迹

This commit is contained in:
李沐阳 2023-12-04 16:17:26 +08:00
parent dd8271bd24
commit c568a3d68d

View File

@ -0,0 +1,483 @@
<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="deviceCode">
<el-input
v-model="queryParams.deviceCode"
placeholder="请输入设备编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="queryParams.deviceType" placeholder="请选择设备类型" clearable>
<el-option
v-for="dict in dict.type.gcjx_device_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!--<el-form-item label="故障类型" prop="faultType">
<el-select v-model="queryParams.faultType" placeholder="请选择故障类型" clearable>
<el-option
v-for="dict in dict.type.gcjx_fault_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>-->
<!--<el-form-item label="设备品牌" prop="deviceBrand">
<el-input
v-model="queryParams.deviceBrand"
placeholder="请输入设备品牌"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="故障描述" prop="faultDetail">
<el-input
v-model="queryParams.faultDetail"
placeholder="请输入故障描述"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="维保人员" prop="maintenancePerson">
<el-input
v-model="queryParams.maintenancePerson"
placeholder="请输入维保人员"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="维保时间" prop="maintenanceTime">
<el-input
v-model="queryParams.maintenanceTime"
placeholder="请输入维保时间"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="维保任务" prop="maintenanceTask">
<el-input
v-model="queryParams.maintenanceTask"
placeholder="请输入维保任务"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="经度" prop="longitude">
<el-input
v-model="queryParams.longitude"
placeholder="请输入经度"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="纬度" prop="latitude">
<el-input
v-model="queryParams.latitude"
placeholder="请输入纬度"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工作时间" prop="workTime">
<el-input
v-model="queryParams.workTime"
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"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="deviceManageList" @selection-change="handleSelectionChange" height="calc(100vh - 270px)" :default-sort="defaultSort">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="设备编码" align="center" prop="deviceCode" width="140"/>
<el-table-column label="设备名称" align="center" prop="deviceName" width="200"/>
<el-table-column label="设备类型" align="center" prop="deviceType" width="140">
<template slot-scope="scope">
<dict-tag :options="dict.type.gcjx_device_type" :value="scope.row.deviceType"/>
</template>
</el-table-column>
<el-table-column label="设备品牌" align="center" prop="deviceBrand" width="200"/>
<el-table-column label="设备状态" align="center" prop="deviceStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.gcjx_device_status" :value="scope.row.deviceStatus"/>
</template>
</el-table-column>
<!--<el-table-column label="故障类型" align="center" prop="faultType" width="130">
<template slot-scope="scope">
<dict-tag :options="dict.type.gcjx_fault_type" :value="scope.row.faultType"/>
</template>
</el-table-column>
<el-table-column label="故障描述" align="center" prop="faultDetail" width="300"/>
<el-table-column label="维保人员" align="center" prop="maintenancePerson"/>
<el-table-column label="维保时间" align="center" prop="maintenanceTime" width="150"/>
<el-table-column label="维保任务" align="center" prop="maintenanceTask" width="300"/>-->
<el-table-column label="经度" align="center" prop="longitude"/>
<el-table-column label="纬度" align="center" prop="latitude"/>
<el-table-column label="工作时间" align="center" prop="workTime"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="170">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row)"
>查看
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除
</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="70%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="设备编码" prop="deviceCode">
<el-input :disabled="disabled" v-model="form.deviceCode" maxlength="14" placeholder="请输入设备编码"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称" prop="deviceName">
<el-input :disabled="disabled" v-model="form.deviceName" placeholder="请输入设备名称"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="设备类型" prop="deviceType">
<el-select :disabled="disabled" v-model="form.deviceType" placeholder="请选择设备类型" style="width: 100%">
<el-option
v-for="dict in dict.type.gcjx_device_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备品牌" prop="deviceBrand">
<el-input :disabled="disabled" v-model="form.deviceBrand" placeholder="请输入设备品牌"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="经度" prop="longitude">
<el-input v-model="form.longitude" placeholder="请输入经度"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="纬度" prop="latitude">
<el-input v-model="form.latitude" placeholder="请输入纬度"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="工作时间" prop="workTime">
<el-date-picker
clearable
:disabled="disabled"
style="width: 100%"
v-model="form.workTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择工作时间">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer" v-show="!disabled">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listDeviceManage,
getDeviceManage,
delDeviceManage,
addDeviceManage,
updateDeviceManage
} from "@/api/deviceInfo/deviceManage";
const interfaceType = 'gcjxDeviceTrack'
export default {
name: "DeviceManage",
dicts: ['gcjx_device_type', 'gcjx_device_status', 'gcjx_fault_type'],
data() {
return {
disabled: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
deviceManageList: [],
//
title: "",
defaultSort: { prop: "workTime", order: "descending" },
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
deviceCode: null,
deviceName: null,
deviceType: null,
deviceStatus: null,
deviceBrand: null,
isFault: null,
faultType: null,
faultDetail: null,
maintenancePerson: null,
maintenanceTime: null,
maintenanceTask: null,
longitude: null,
latitude: null,
workTime: null,
interfaceType: interfaceType,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询设备管理列表 */
getList() {
this.loading = true;
listDeviceManage(this.queryParams).then(response => {
this.deviceManageList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
deviceCode: null,
deviceName: null,
deviceType: null,
deviceStatus: null,
deviceBrand: null,
isFault: null,
faultType: null,
faultDetail: null,
maintenancePerson: null,
maintenanceTime: null,
maintenanceTask: null,
longitude: null,
latitude: null,
workTime: null,
interfaceType: interfaceType
};
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 = "添加设备运动轨迹";
},
/** 查看按钮操作 */
handleView(row) {
this.reset();
const id = row.id || this.ids
getDeviceManage(id).then(response => {
this.form = response.data;
this.open = true;
this.disabled = true;
this.title = "查看设备运动轨迹";
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.disabled = false;
const id = row.id || this.ids
getDeviceManage(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改设备运动轨迹";
});
},
/** 设备退场按钮操作 */
handleBack(row) {
this.reset();
const id = row.id || this.ids
getDeviceManage(id).then(response => {
this.form = response.data;
this.form.deviceStatus = '40';
updateDeviceManage(this.form).then(response => {
this.$modal.msgSuccess("设备确认退场");
this.getList();
});
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDeviceManage(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDeviceManage(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除所选中的设备运动轨迹?').then(function () {
return delDeviceManage(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('deviceInfo/deviceManage/export', {
...this.queryParams
}, `deviceManage_${new Date().getTime()}.xlsx`)
}
}
};
</script>