feat(设备管理): 新增设备管理模块相关组件、API及数据可视化功能
- 新增设备台账、设备类型、设备检查项等基础组件 - 添加设备维修、点检、巡检等业务功能组件 - 实现设备数据可视化分析功能,包括折线图、柱状图、饼图等图表组件 - 新增设备管理相关API接口,包括设备台账、维修记录、点检计划等 - 实现设备状态看板、任务分析、人员响应分析等功能页面 - 添加设备操作弹窗及相关业务逻辑 - 完善设备管理模块的样式和交互逻辑
This commit is contained in:
370
src/views/deviceManagement/devicePointInspectionPlan/index.vue
Normal file
370
src/views/deviceManagement/devicePointInspectionPlan/index.vue
Normal file
@@ -0,0 +1,370 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch" @submit.prevent>
|
||||
<el-form-item label="点检名称" prop="deviceName">
|
||||
<el-input v-model.trim="queryParams.name" placeholder="请输入点检名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="点检状态" prop="status">
|
||||
<el-radio-group v-model="queryParams.status" @change="handleQuery">
|
||||
<el-radio-button label="全部" :value="-1" />
|
||||
<el-radio-button label="停用" :value="0" />
|
||||
<el-radio-button label="启用" :value="1" />
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="类别" prop="innerType">
|
||||
<el-radio-group v-model="queryParams.innerType" @change="handleQuery">
|
||||
<el-radio-button label="全部" :value="-1" />
|
||||
<el-radio-button label="检查" :value="1" />
|
||||
<el-radio-button label="保养" :value="2" />
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="开始时间" prop="starttime">
|
||||
<el-date-picker v-model="queryParams.starttime" type="datetime" placeholder="请输入开始时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="结束时间" prop="endtime">
|
||||
<el-date-picker v-model="queryParams.endtime" type="datetime" placeholder="请输入开始时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button icon="el-icon-search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 工具区域 -->
|
||||
<el-row :gutter="15" class="mb10">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" v-hasPermi="['deviceManagement:devicepointinspectionplan:add']" plain icon="el-icon-plus" @click="handleAdd">
|
||||
{{ $t('btn.add') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="dataList" v-loading="loading" ref="table" border header-cell-class-name="el-table-header-cell" highlight-current-row @sort-change="sortChange">
|
||||
<el-table-column prop="name" label="点检检名称" align="center" :show-overflow-tooltip="true" v-if="columns_showColumn('name')" />
|
||||
<el-table-column prop="innerType" label="类别" align="center" v-if="columns_showColumn('innerType')">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="options.innerTypeOptions" :value="scope.row.innerType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="添加设备" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="small" icon="el-icon-message-box" title="添加设备" @click="AddDevice(scope.row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="立刻派发" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="success" size="small" icon="el-icon-promotion" @click="dispatch(scope.row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="fkPersonId" label="执行人" align="center" :show-overflow-tooltip="true" v-if="columns_showColumn('fkPersonId')" />
|
||||
|
||||
<el-table-column prop="status" label="点检状态" align="center" v-if="columns_showColumn('status')">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="options.statusOptions" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" v-if="columns_showColumn('remark')" />
|
||||
|
||||
<el-table-column label="操作" width="160">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="success" size="small" icon="el-icon-edit" title="编辑" v-hasPermi="['deviceManagement:devicepointinspectionplan:edit']" @click="handleUpdate(scope.row)"></el-button>
|
||||
<el-button type="danger" size="small" icon="el-icon-delete" title="删除" v-hasPermi="['deviceManagement:devicepointinspectionplan:delete']" @click="handleDelete(scope.row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改点检任务对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" v-model="open">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="点检检名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入点检检名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="执行人" prop="fkPersonId">
|
||||
<el-input v-model="form.fkPersonId" placeholder="请输入执行人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="类别" prop="innerType">
|
||||
<el-radio-group v-model="form.innerType">
|
||||
<el-radio v-for="item in options.innerTypeOptions" :key="item.dictValue" :value="parseInt(item.dictValue)" :label="item.dictLabel">
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="点检状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="item in options.statusOptions" :key="item.dictValue" :value="parseInt(item.dictValue)" :label="item.dictLabel">
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template slot="footer" v-if="opertype != 3">
|
||||
<el-button text @click="cancel">{{ $t('btn.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="submitForm">{{ $t('btn.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="添加设备" :lock-scroll="false" v-model="open_device">
|
||||
<Devicelist :message="messageFromParent" :flag="point"></Devicelist>
|
||||
<template slot="footer">
|
||||
<el-button text @click="open_device = false">{{ $t('btn.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="open_device = false">{{ $t('btn.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listDevicePointInspectionPlan,
|
||||
addDevicePointInspectionPlan,
|
||||
delDevicePointInspectionPlan,
|
||||
updateDevicePointInspectionPlan,
|
||||
getDevicePointInspectionPlan
|
||||
} from '@/api/deviceManagement/devicepointinspectionplan.js'
|
||||
import { taskdispatch } from '@/api/deviceManagement/devicetaskexecute.js'
|
||||
import Devicelist from '@/views/deviceManagement/components/devicelist_point/index.vue'
|
||||
|
||||
export default {
|
||||
name: 'devicepointinspectionplan',
|
||||
components: {
|
||||
Devicelist
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ids: [],
|
||||
loading: false,
|
||||
showSearch: true,
|
||||
open_device: false,
|
||||
queryParams: {
|
||||
name: '',
|
||||
status: -1,
|
||||
innerType: -1,
|
||||
starttime: null,
|
||||
endtime: null,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
sort: 'createdTime',
|
||||
sortType: 'desc'
|
||||
},
|
||||
columns: [
|
||||
{ visible: false, prop: 'id', label: 'id(雪花)' },
|
||||
{ visible: true, prop: 'name', label: '点检检名称' },
|
||||
{ visible: true, prop: 'fkPersonId', label: '执行人' },
|
||||
{ visible: true, prop: 'innerType', label: '类别' },
|
||||
{ visible: true, prop: 'status', label: '点检状态' },
|
||||
{ visible: true, prop: 'type', label: '类型(内部)' },
|
||||
{ visible: true, prop: 'remark', label: '备注' },
|
||||
{ visible: true, prop: 'createdBy', label: '创建人' },
|
||||
{ visible: true, prop: 'createdTime', label: '创建时间' },
|
||||
{ visible: false, prop: 'updatedBy', label: '更新人' },
|
||||
{ visible: false, prop: 'updatedTime', label: '更新时间' }
|
||||
],
|
||||
total: 0,
|
||||
dataList: [],
|
||||
queryRef: null,
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)],
|
||||
dictParams: [],
|
||||
formRef: null,
|
||||
title: '',
|
||||
opertype: 0,
|
||||
open: false,
|
||||
form: {
|
||||
id: null,
|
||||
name: null,
|
||||
fkPersonId: null,
|
||||
status: 1,
|
||||
innerType: 1,
|
||||
type: null,
|
||||
remark: null,
|
||||
createdBy: null,
|
||||
createdTime: null,
|
||||
updatedBy: null,
|
||||
updatedTime: null
|
||||
},
|
||||
rules: {
|
||||
// id: [{ required: true, message: "id(雪花)不能为空", trigger: "blur" }],
|
||||
},
|
||||
options: {
|
||||
// 点检状态 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
|
||||
statusOptions: [
|
||||
{ dictLabel: '启用', dictValue: 1, listClass: 'success' },
|
||||
{ dictLabel: '停用', dictValue: 0, listClass: 'danger' }
|
||||
],
|
||||
// 类型(内部) 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
|
||||
typeOptions: [],
|
||||
innerTypeOptions: [
|
||||
{ dictLabel: '检查', dictValue: 1, listClass: 'primary' },
|
||||
{ dictLabel: '保养', dictValue: 2, listClass: 'warning' }
|
||||
]
|
||||
},
|
||||
point: '',
|
||||
messageFromParent: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.handleQuery()
|
||||
},
|
||||
methods: {
|
||||
columns_showColumn(prop) {
|
||||
return this.columns.some(column => column.prop === prop && column.visible)
|
||||
},
|
||||
getList() {
|
||||
this.loading = true
|
||||
listDevicePointInspectionPlan(this.queryParams).then((res) => {
|
||||
const { code, data } = res
|
||||
if (code == 200) {
|
||||
this.dataList = data.result
|
||||
this.total = data.totalNum
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 查询
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 重置查询操作
|
||||
resetQuery() {
|
||||
this.queryParams.name = ''
|
||||
this.queryParams.status = -1
|
||||
this.queryParams.starttime = null
|
||||
this.queryParams.endtime = null
|
||||
|
||||
this.resetForm('queryRef')
|
||||
|
||||
this.handleQuery()
|
||||
},
|
||||
// 自定义排序
|
||||
sortChange(column) {
|
||||
var sort = undefined
|
||||
var sortType = undefined
|
||||
|
||||
if (column.prop != null && column.order != null) {
|
||||
sort = column.prop
|
||||
sortType = column.order
|
||||
}
|
||||
this.queryParams.sort = sort
|
||||
this.queryParams.sortType = sortType
|
||||
this.handleQuery()
|
||||
},
|
||||
// 关闭dialog
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 重置表单
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
fkPersonId: null,
|
||||
status: 1,
|
||||
innerType: 1,
|
||||
type: null,
|
||||
remark: null,
|
||||
createdBy: null,
|
||||
createdTime: null,
|
||||
updatedBy: null,
|
||||
updatedTime: null
|
||||
}
|
||||
this.resetForm('formRef')
|
||||
},
|
||||
// 添加按钮操作
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加点检任务'
|
||||
this.opertype = 1
|
||||
},
|
||||
// 修改按钮操作
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids
|
||||
getDevicePointInspectionPlan(id).then((res) => {
|
||||
const { code, data } = res
|
||||
if (code == 200) {
|
||||
this.open = true
|
||||
this.title = '修改点检任务'
|
||||
this.opertype = 2
|
||||
|
||||
this.form = {
|
||||
...data
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 添加&修改 表单提交
|
||||
submitForm() {
|
||||
this.$refs['formRef'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != undefined && this.opertype === 2) {
|
||||
updateDevicePointInspectionPlan(this.form).then((res) => {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addDevicePointInspectionPlan(this.form).then((res) => {
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除按钮操作
|
||||
handleDelete(row) {
|
||||
const Ids = row.id || this.ids
|
||||
|
||||
this
|
||||
.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?')
|
||||
.then(function () {
|
||||
return delDevicePointInspectionPlan(Ids)
|
||||
})
|
||||
.then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
},
|
||||
AddDevice(row) {
|
||||
this.open_device = true
|
||||
this.messageFromParent = row.id
|
||||
this.point = 'point'
|
||||
},
|
||||
// 任务派发
|
||||
dispatch(row) {
|
||||
this
|
||||
.$confirm('是否派发任务' + row.name)
|
||||
.then(function () {
|
||||
return taskdispatch(row.id)
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code == 200 && res.data > 0) {
|
||||
this.$modal.msgSuccess('任务派发成功')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user