feat(设备管理): 新增设备管理模块相关组件、API及数据可视化功能
- 新增设备台账、设备类型、设备检查项等基础组件 - 添加设备维修、点检、巡检等业务功能组件 - 实现设备数据可视化分析功能,包括折线图、柱状图、饼图等图表组件 - 新增设备管理相关API接口,包括设备台账、维修记录、点检计划等 - 实现设备状态看板、任务分析、人员响应分析等功能页面 - 添加设备操作弹窗及相关业务逻辑 - 完善设备管理模块的样式和交互逻辑
This commit is contained in:
383
src/views/deviceManagement/deviceinspect/index.vue
Normal file
383
src/views/deviceManagement/deviceinspect/index.vue
Normal file
@@ -0,0 +1,383 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch" @submit.prevent>
|
||||
<el-form-item label="检查项名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入设备类型名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="status">
|
||||
<el-select style="width: 200px" v-model="queryParams.status" placeholder="选择" clearable>
|
||||
<el-option v-for="status in statusList" :key="status.value" :label="status.label" :value="status.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="检查类型" prop="status">
|
||||
<el-select style="width: 200px" v-model="queryParams.type" placeholder="选择" clearable>
|
||||
<el-option v-for="status in checkType" :key="status.value" :label="status.label" :value="status.value" />
|
||||
</el-select>
|
||||
</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:deviceinspect: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 type="index" width="50" label="#" />
|
||||
<el-table-column prop="name" label="名称" width="480" v-if="columns_showColumn('id')" />
|
||||
<el-table-column prop="image" label="图片" align="center" v-if="columns_showColumn('image')">
|
||||
<template slot-scope="scope">
|
||||
<ImagePreview :src="scope.row.image"></ImagePreview>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="类别" align="center" :show-overflow-tooltip="true" v-if="columns_showColumn('type')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.type == 1">检查</el-tag>
|
||||
<el-tag type="primary" v-else-if="scope.row.type == 2">保养</el-tag>
|
||||
<el-tag type="danger" v-else>异常</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" v-if="columns_showColumn('remark')" />
|
||||
<el-table-column prop="status" label="检查项状态" align="center" v-if="columns_showColumn('status')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.status == 1">启用</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.status == 0">停用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="descride" label="描述" align="center" :show-overflow-tooltip="true" v-if="columns_showColumn('descride')" />
|
||||
<el-table-column prop="name" label="检查项名称" align="center" :show-overflow-tooltip="true" v-if="columns_showColumn('name')" />
|
||||
|
||||
<el-table-column label="操作" width="160">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
icon="el-icon-edit"
|
||||
title="编辑"
|
||||
v-hasPermi="['deviceManagement:deviceinspect:edit']"
|
||||
@click="handleUpdate(scope.row)"></el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
title="删除"
|
||||
v-hasPermi="['deviceManagement:deviceinspect: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="24">
|
||||
<el-form-item label="描述" prop="descride">
|
||||
<el-input v-model="form.descride" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="24">
|
||||
<el-form-item label="图片" prop="image">
|
||||
<UploadImage v-model="form.image" :data="{ uploadType: 1, filePath: 'device/inspect' }" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="类型" prop="status">
|
||||
<el-select v-model="form.type" placeholder="选择" clearable>
|
||||
<el-option v-for="status in checkType" :key="status.value" :label="status.label" :value="status.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="检查项状态" prop="status">
|
||||
<el-select v-model="form.status" placeholder="选择" clearable>
|
||||
<el-option v-for="status in statusList" :key="status.value" :label="status.label" :value="status.value" />
|
||||
</el-select>
|
||||
</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-col :lg="12">
|
||||
<el-form-item label="检查表单" prop="type" v-show="opertype == 2">
|
||||
<el-button type="primary" @click="open_form_dialog">配置表单</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template slot="footer" v-if="opertype != 3">
|
||||
<el-button text @click="cancel">取消</el-button>
|
||||
<el-button type="success" @click="submitForm">完成</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog title="检查项表单配置" :lock-scroll="false" v-model="open_form">
|
||||
<formconfig v-bind:message="parentMessage"></formconfig>
|
||||
<template slot="footer">
|
||||
<el-button type="success" @click="open_form = false">完成</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDeviceInspect, addDeviceInspect, delDeviceInspect, updateDeviceInspect, getDeviceInspect } from '@/api/deviceManagement/deviceinspect'
|
||||
import formconfig from '@/views/deviceManagement/deviceformconfig/index'
|
||||
|
||||
export default {
|
||||
name: 'deviceinspect',
|
||||
components: {
|
||||
formconfig
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ids: [],
|
||||
loading: false,
|
||||
showSearch: true,
|
||||
queryParams: {
|
||||
name: '',
|
||||
status: 1,
|
||||
type: 1,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
sort: '',
|
||||
sortType: 'asc'
|
||||
},
|
||||
columns: [
|
||||
{ visible: true, prop: 'id', label: 'id' },
|
||||
{ visible: true, prop: 'fkDeviceId', label: '设备id' },
|
||||
{ visible: true, prop: 'image', label: '图片' },
|
||||
{ visible: true, prop: 'sort', label: '检查顺序' },
|
||||
{ visible: true, prop: 'type', label: '检查项类型(重点)' },
|
||||
{ visible: true, prop: 'remark', label: '备注' },
|
||||
{ visible: true, prop: 'status', label: '检查项状态' },
|
||||
{ visible: true, prop: 'descride', label: '描述' },
|
||||
{ visible: false, prop: 'name', label: '检查项名称' },
|
||||
{ visible: false, prop: 'createdBy', label: '创建人' },
|
||||
{ visible: false, prop: 'createdTime', label: '创建时间' },
|
||||
{ visible: false, prop: 'updatedBy', label: '更新人' },
|
||||
{ visible: false, prop: 'updatedTime', label: '更新时间' }
|
||||
],
|
||||
total: 0,
|
||||
dataList: [],
|
||||
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)],
|
||||
open_form: false,
|
||||
parentMessage: 0,
|
||||
statusList: [
|
||||
{
|
||||
label: '启用',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '停用',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: ' ',
|
||||
value: -1
|
||||
}
|
||||
],
|
||||
checkType: [
|
||||
{
|
||||
label: '检查',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '保养',
|
||||
value: 2
|
||||
}
|
||||
],
|
||||
title: '',
|
||||
opertype: 0,
|
||||
open: false,
|
||||
form: {
|
||||
id: null,
|
||||
fkDeviceId: null,
|
||||
image: null,
|
||||
sort: null,
|
||||
type: 1,
|
||||
remark: null,
|
||||
status: 1,
|
||||
descride: null,
|
||||
name: null,
|
||||
createdBy: null,
|
||||
createdTime: null,
|
||||
updatedBy: null,
|
||||
updatedTime: null
|
||||
},
|
||||
rules: {},
|
||||
options: {
|
||||
typeOptions: [],
|
||||
statusOptions: []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.handleQuery()
|
||||
// 使用字典
|
||||
var dictParams = [{ dictType: 'mes_device_inspect_form_config', columnName: 'typeOptions' }]
|
||||
this.getDicts(dictParams).then((response) => {
|
||||
response.data.forEach((element) => {
|
||||
this.options[element.columnName] = element.list
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
columns_showColumn(prop) {
|
||||
return this.columns.some(column => column.prop === prop && column.visible)
|
||||
},
|
||||
getList() {
|
||||
this.loading = true
|
||||
listDeviceInspect(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.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,
|
||||
fkDeviceId: null,
|
||||
image: null,
|
||||
sort: null,
|
||||
type: 1,
|
||||
remark: null,
|
||||
status: 1,
|
||||
descride: null,
|
||||
name: 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
|
||||
getDeviceInspect(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) {
|
||||
updateDeviceInspect(this.form).then((res) => {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addDeviceInspect(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 delDeviceInspect(Ids)
|
||||
})
|
||||
.then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
},
|
||||
// 打开表单
|
||||
open_form_dialog() {
|
||||
if (this.form.id != undefined && this.opertype === 2) {
|
||||
this.open_form = true
|
||||
// 父组件向子组件传值
|
||||
this.parentMessage = this.form.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user