feat(设备管理): 新增设备管理模块相关组件、API及数据可视化功能

- 新增设备台账、设备类型、设备检查项等基础组件
- 添加设备维修、点检、巡检等业务功能组件
- 实现设备数据可视化分析功能,包括折线图、柱状图、饼图等图表组件
- 新增设备管理相关API接口,包括设备台账、维修记录、点检计划等
- 实现设备状态看板、任务分析、人员响应分析等功能页面
- 添加设备操作弹窗及相关业务逻辑
- 完善设备管理模块的样式和交互逻辑
This commit is contained in:
2025-09-23 18:58:54 +08:00
parent 6f5cf9c333
commit c6d8d08f35
71 changed files with 14366 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<template>
<div>
<el-tree-select
style="width: 240px"
v-bind="$attrs"
highlight-current
filterable
:data="deptOptions"
:props="{ label: 'label', children: 'children' }"
node-key="value"
placeholder="请选择设备"
:render-after-expand="false"
clearable />
</div>
</template>
<script>
import * as deviceAccountApi from '@/api/deviceManagement/deviceaccount'
export default {
name: 'BaseDeviceTypeTreeSelect',
data() {
return {
deptOptions: []
}
},
mounted() {
this.getlist()
},
methods: {
getlist() {
this.deptOptions = []
deviceAccountApi.getSelectTree().then((res) => {
if (res.code == 200) {
console.log(res.data)
this.deptOptions = this.handleTree(res.data, 'id', 'parentId', 'children')
}
})
}
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,50 @@
<template>
<div>
<span>{{text}}</span>
</div>
</template>
<script>
import * as deviceAccountApi from '@/api/deviceManagement/deviceaccount'
export default {
name: 'BaseDeviceTypeTreeSelect',
props: {
deviceId: {
type: [Number, String]
}
},
data() {
return {
text: ''
}
},
watch: {
deviceId: {
handler(newValue, oldValue) {
this.getData();
},
immediate: true
}
},
methods: {
getData() {
const id = this.deviceId;
if (id === null || id === undefined || id === '' || id < 0) {
this.text = '未选择设备';
return;
}
deviceAccountApi.getDeviceAccount(id).then((res) => {
const { code, data } = res
if (code == 200 && data != null) {
this.text = data.deviceName + ' ' + data.deviceCode;
} else {
this.text = '设备编号异常';
}
})
}
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,38 @@
<template>
<div>
<el-tree :data="deptOptions" :props="{ label: 'name', children: 'children' }" :expand-on-click-node="false" ref="deptTreeRef" node-key="id" highlight-current default-expand-all @node-click="handleNodeClick" />
</div>
</template>
<script>
import * as API_devicetype from '@/api/deviceManagement/devicetype'
export default {
name: 'BaseDeviceTypeTree',
data() {
return {
deptOptions: [],
queryParams: {
status: 1
}
}
},
mounted() {
this.getlist()
},
methods: {
getlist() {
API_devicetype.getList(this.queryParams).then((res) => {
if (res.code == 200) {
this.deptOptions = this.handleTree(res.data, 'id', 'parentId', 'children')
}
})
},
handleNodeClick(data) {
this.$emit('selected', data.id)
}
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,35 @@
<template>
<div>
<el-tree-select v-bind="$attrs" style="width: 240px" :data="deptOptions" :props="{ label: 'name', children: 'children' }" node-key="id" check-strictly placeholder="请选择设备类型" :render-after-expand="false" />
</div>
</template>
<script>
import * as API_devicetype from '@/api/deviceManagement/devicetype'
export default {
name: 'BaseDeviceTypeTreeSelect',
data() {
return {
deptOptions: [],
queryParams: {
status: 1
}
}
},
mounted() {
this.getlist()
},
methods: {
getlist() {
API_devicetype.getList(this.queryParams).then((res) => {
if (res.code == 200) {
this.deptOptions = this.handleTree(res.data, 'id', 'parentId', 'children');
}
})
}
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,14 @@
<template>
<div></div>
</template>
<script>
export default {
name: 'DeviceInspect',
mounted() {
// 使用this代替proxy
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,394 @@
<template>
<div>
<!-- 工具区域 -->
<el-row :gutter="15" class="mb10">
<el-col :span="1.5">
<el-button type="primary" v-hasPermi="['deviceManagement:deviceaccount:add']" plain 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="id" label="设备台账id" align="center" v-if="columns.showColumn('id')" />
<el-table-column prop="fkDeviceType" label="设备类型" align="center" v-if="columns.showColumn('fkDeviceType')">
<template #default="scope">
<dict-tag :options="options.fkDeviceTypeOptions" :value="scope.row.fkDeviceType" />
</template>
</el-table-column>
<el-table-column prop="deviceName" label="设备名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceName')" />
<el-table-column prop="workshop" label="所属车间" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workshop')" />
<el-table-column prop="workline" label="所属产线" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workline')" />
<el-table-column prop="purchaseTime" label="购买时间" :show-overflow-tooltip="true" v-if="columns.showColumn('purchaseTime')" />
<el-table-column prop="supplier" label="设备厂商" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('supplier')" />
<el-table-column prop="status" label="设备状态" align="center" v-if="columns.showColumn('status')">
<template #default="scope">
<dict-tag :options="options.statusOptions" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="deviceImage" label="设备图片" align="center" v-if="columns.showColumn('deviceImage')">
<template #default="scope">
<ImagePreview :src="scope.row.deviceImage"></ImagePreview>
</template>
</el-table-column>
<el-table-column prop="deviceFile" label="设备文件" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceFile')" />
<el-table-column
prop="deviceSpecification"
label="设备规格"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deviceSpecification')" />
<el-table-column
prop="responsiblePerson"
label="设备负责人"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('responsiblePerson')" />
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('remark')" />
<el-table-column prop="createdBy" label="创建人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('createdBy')" />
<el-table-column prop="createdTime" label="创建时间" :show-overflow-tooltip="true" v-if="columns.showColumn('createdTime')" />
<el-table-column prop="updatedBy" label="更新人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedBy')" />
<el-table-column prop="updatedTime" label="更新时间" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedTime')" />
<el-table-column label="操作">
<template #default="scope">
<el-button type="danger" size="small" icon="delete" title="删除" @click="handleDelete(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
<!-- 选择设备台账 -->
<el-dialog title="选择设备台账" :lock-scroll="false" v-model="open" width="900">
<el-form :model="queryParams2" label-position="right" inline ref="queryRef2" v-show="showSearch2" @submit.prevent>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model.trim="queryParams2.deviceName" placeholder="请输入设备名称" clearable />
</el-form-item>
<el-form-item label="设备规格" prop="deviceSpecification">
<el-input v-model.trim="queryParams2.deviceSpecification" placeholder="请输入设备规格" clearable />
</el-form-item>
<el-form-item label="设备状态222" prop="status">
<el-radio-group v-model="queryParams2.status" @click="handleQuery2">
<el-radio-button :value="-1">全部</el-radio-button>
<el-radio-button :value="1">启用</el-radio-button>
<el-radio-button :value="0">停用</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button icon="search" type="primary" @click="handleQuery2">{{ $t('btn.search') }}</el-button>
<el-button icon="refresh" @click="resetQuery2">{{ $t('btn.reset') }}</el-button>
</el-form-item>
</el-form>
<!-- 工具区域 -->
<el-row :gutter="15" class="mb10">
<el-col :span="1.5">
<el-button type="success" plain icon="plus" @click="handleBind">
{{ $t('btn.add') }}
</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch2" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table
:data="dataList_NO_bind"
v-loading="loading"
ref="table"
border
header-cell-class-name="el-table-header-cell"
highlight-current-row
@sort-change="sortChange"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column prop="id" label="设备台账id" align="center" v-if="columns.showColumn('id')" />
<el-table-column prop="fkDeviceType" label="设备类型" align="center" v-if="columns.showColumn('fkDeviceType')">
<template #default="scope">
<dict-tag :options="options.fkDeviceTypeOptions" :value="scope.row.fkDeviceType" />
</template>
</el-table-column>
<el-table-column prop="deviceName" label="设备名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceName')" />
<el-table-column
prop="deviceCode"
label="设备编号(二维码)"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deviceCode')" />
<el-table-column prop="workshop" label="所属车间" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workshop')" />
<el-table-column prop="workline" label="所属产线" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workline')" />
<el-table-column prop="purchaseTime" label="购买时间" :show-overflow-tooltip="true" v-if="columns.showColumn('purchaseTime')" />
<el-table-column prop="supplier" label="设备厂商" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('supplier')" />
<el-table-column prop="status" label="设备状态" align="center" v-if="columns.showColumn('status')">
<template #default="scope">
<dict-tag :options="options.statusOptions" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="deviceImage" label="设备图片" align="center" v-if="columns.showColumn('deviceImage')">
<template #default="scope">
<ImagePreview :src="scope.row.deviceImage"></ImagePreview>
</template>
</el-table-column>
<el-table-column prop="deviceFile" label="设备文件" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceFile')" />
<el-table-column
prop="deviceSpecification"
label="设备规格"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deviceSpecification')" />
<el-table-column
prop="responsiblePerson"
label="设备负责人"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('responsiblePerson')" />
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('remark')" />
<el-table-column prop="createdBy" label="创建人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('createdBy')" />
<el-table-column prop="createdTime" label="创建时间" :show-overflow-tooltip="true" v-if="columns.showColumn('createdTime')" />
<el-table-column prop="updatedBy" label="更新人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedBy')" />
<el-table-column prop="updatedTime" label="更新时间" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedTime')" />
</el-table>
<pagination :total="total2" v-model:page="queryParams2.pageNum" v-model:limit="queryParams2.pageSize" @pagination="getList_nobind" />
<template #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>
</div>
</template>
<script>
import {
listDeviceAccount,
listDeviceAccount_route,
addDeviceAccount,
updateDeviceAccount,
getDeviceAccount,
AddRelation,
delDeviceAccount_relation
} from '@/api/deviceManagement/deviceaccount.js'
export default {
name: 'deivelist',
props: {
message: {
type: String
},
flag: {
type: String
}
},
data() {
return {
ids: [],
loading: false,
showSearch: true,
showSearch2: true,
queryParams: {
fkRouteInspectionPlanId: '',
pageNum: 1,
pageSize: 10,
sort: 'Id',
sortType: 'asc'
},
status: -1,
queryParams2: {
fkRouteInspectionPlanId: '',
deviceName: '',
deviceSpecification: '',
status: -1,
pageNum: 1,
pageSize: 10,
sort: 'Id',
sortType: 'asc'
},
columns: [
{ visible: true, prop: 'id', label: '设备台账id' },
{ visible: true, prop: 'fkDeviceType', label: '设备类型' },
{ visible: true, prop: 'deviceName', label: '设备名称' },
{ visible: true, prop: 'deviceCode', label: '设备编号(二维码)' },
{ visible: true, prop: 'workshop', label: '所属车间' },
{ visible: true, prop: 'workline', label: '所属产线' },
{ visible: true, prop: 'purchaseTime', label: '购买时间' },
{ visible: true, prop: 'supplier', label: '设备厂商' },
{ visible: false, prop: 'status', label: '设备状态' },
{ visible: false, prop: 'deviceImage', label: '设备图片' },
{ visible: false, prop: 'deviceFile', label: '设备文件' },
{ visible: false, prop: 'deviceSpecification', label: '设备规格' },
{ visible: false, prop: 'responsiblePerson', label: '设备负责人' },
{ visible: false, prop: 'remark', label: '备注' },
{ visible: false, prop: 'createdBy', label: '创建人' },
{ visible: false, prop: 'createdTime', label: '创建时间' },
{ visible: false, prop: 'updatedBy', label: '更新人' },
{ visible: false, prop: 'updatedTime', label: '更新时间' }
],
total: 0,
total2: 0,
dataList: [],
dataList_NO_bind: [],
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,
state: {
single: true,
multiple: true,
form: {},
rules: {},
options: {
fkDeviceTypeOptions: [],
statusOptions: [
{ dictLabel: '启用', dictValue: 1, listClass: 'success' },
{ dictLabel: '停用', dictValue: 0, listClass: 'info' }
]
}
},
multipleSelection: []
}
},
computed: {
form() {
return this.state.form
},
rules() {
return this.state.rules
},
options() {
return this.state.options
},
single() {
return this.state.single
},
multiple() {
return this.state.multiple
}
},
watch: {
message: {
handler() {
this.handleQuery()
},
immediate: true
}
},
mounted() {
this.handleQuery()
},
methods: {
getList() {
this.loading = true
this.queryParams.fkRouteInspectionPlanId = this.message
this.queryParams.flag = 1
listDeviceAccount_route(this.queryParams).then((res) => {
const { code, data } = res
if (code == 200) {
this.dataList = data.result
this.total = data.totalNum
this.loading = false
}
})
},
getList_nobind() {
this.loading = true
this.queryParams2.fkRouteInspectionPlanId = this.message
this.queryParams2.flag = 0
listDeviceAccount_route(this.queryParams2).then((res) => {
const { code, data } = res
if (code == 200) {
this.dataList_NO_bind = data.result
this.total2 = data.totalNum
this.loading = false
}
})
},
handleQuery2() {
this.queryParams2.pageNum = 1
this.getList_nobind()
},
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
resetQuery() {
this.$refs.queryRef && this.$refs.queryRef.resetFields()
this.handleQuery()
},
resetQuery2() {
this.$refs.queryRef2 && this.$refs.queryRef2.resetFields()
this.handleQuery2()
},
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()
},
cancel() {
this.open = false
},
handleAdd() {
this.open = true
this.title = '添加设备台账'
this.opertype = 1
this.loading = false
this.getList_nobind()
},
handleBind() {
let query = {}
query.FkRouteInspectionPlanId = this.message
query.FkDeviceAccountIdList = this.multipleSelection
AddRelation(query).then((res) => {
if (res.code == 200) {
this.$modal.msgSuccess('添加成功' + res.data + '条')
this.getList_nobind()
}
})
},
submitForm() {
if (this.multipleSelection.length > 0) {
this.handleBind()
}
this.open = false
},
handleDelete(row) {
const Ids = row.id || this.ids
this
.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?')
.then(() => {
const query = {
FkRouteInspectionPlanId: this.message,
FkDeviceAccountId: row.id
}
return delDeviceAccount_relation(query)
})
.then((res) => {
if (res.code == 200 && res.data > 0) {
this.getList()
this.$modal.msgSuccess('删除成功')
}
})
},
handleSelectionChange(rows) {
this.multipleSelection = rows.map((it) => it.id)
console.log('multipleSelection', this.multipleSelection)
}
}
}
</script>

View File

@@ -0,0 +1,385 @@
<template>
<div>
<!-- 工具区域 -->
<el-row :gutter="15" class="mb10">
<el-col :span="1.5">
<el-button type="primary" plain 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="id" label="设备台账id" align="center" v-if="columns.showColumn('id')" />
<el-table-column prop="fkDeviceType" label="设备类型" align="center" v-if="columns.showColumn('fkDeviceType')">
<template #default="scope">
<dict-tag :options="options.fkDeviceTypeOptions" :value="scope.row.fkDeviceType" />
</template>
</el-table-column>
<el-table-column prop="deviceName" label="设备名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceName')" />
<el-table-column prop="workshop" label="所属车间" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workshop')" />
<el-table-column prop="workline" label="所属产线" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workline')" />
<el-table-column prop="purchaseTime" label="购买时间" :show-overflow-tooltip="true" v-if="columns.showColumn('purchaseTime')" />
<el-table-column prop="supplier" label="设备厂商" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('supplier')" />
<el-table-column prop="status" label="设备状态" align="center" v-if="columns.showColumn('status')">
<template #default="scope">
<dict-tag :options="options.statusOptions" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="deviceImage" label="设备图片" align="center" v-if="columns.showColumn('deviceImage')">
<template #default="scope">
<ImagePreview :src="scope.row.deviceImage"></ImagePreview>
</template>
</el-table-column>
<el-table-column prop="deviceFile" label="设备文件" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceFile')" />
<el-table-column
prop="deviceSpecification"
label="设备规格"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deviceSpecification')" />
<el-table-column
prop="responsiblePerson"
label="设备负责人"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('responsiblePerson')" />
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('remark')" />
<el-table-column prop="createdBy" label="创建人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('createdBy')" />
<el-table-column prop="createdTime" label="创建时间" :show-overflow-tooltip="true" v-if="columns.showColumn('createdTime')" />
<el-table-column prop="updatedBy" label="更新人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedBy')" />
<el-table-column prop="updatedTime" label="更新时间" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedTime')" />
<el-table-column label="操作">
<template #default="scope">
<el-button type="danger" size="small" icon="delete" title="删除" @click="handleDelete(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
<!-- 选择设备台账 -->
<el-dialog title="选择设备台账" :lock-scroll="false" v-model="open" width="900">
<el-form :model="queryParams2" label-position="right" inline ref="queryRef2" v-show="showSearch2" @submit.prevent>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model.trim="queryParams2.deviceName" placeholder="请输入设备名称" clearable />
</el-form-item>
<el-form-item label="设备规格" prop="deviceSpecification">
<el-input v-model.trim="queryParams2.deviceSpecification" placeholder="请输入设备规格" clearable />
</el-form-item>
<el-form-item label="设备状态" prop="status">
<el-radio-group v-model="queryParams2.status" @click="handleQuery2">
<el-radio-button :value="-1">全部</el-radio-button>
<el-radio-button :value="1">启用</el-radio-button>
<el-radio-button :value="0">停用</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button icon="search" type="primary" @click="handleQuery2">{{ $t('btn.search') }}</el-button>
<el-button icon="refresh" @click="resetQuery2">{{ $t('btn.reset') }}</el-button>
</el-form-item>
</el-form>
<!-- 工具区域 -->
<el-row :gutter="15" class="mb10">
<el-col :span="1.5">
<el-button type="success" plain icon="plus" @click="handleBind">
{{ $t('btn.add') }}
</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch2" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table
:data="dataList_NO_bind"
v-loading="loading"
ref="table"
border
header-cell-class-name="el-table-header-cell"
highlight-current-row
@sort-change="sortChange"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column prop="id" label="设备台账id" align="center" v-if="columns.showColumn('id')" />
<el-table-column prop="fkDeviceType" label="设备类型" align="center" v-if="columns.showColumn('fkDeviceType')">
<template #default="scope">
<dict-tag :options="options.fkDeviceTypeOptions" :value="scope.row.fkDeviceType" />
</template>
</el-table-column>
<el-table-column prop="deviceName" label="设备名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceName')" />
<el-table-column
prop="deviceCode"
label="设备编号(二维码)"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deviceCode')" />
<el-table-column prop="workshop" label="所属车间" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workshop')" />
<el-table-column prop="workline" label="所属产线" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workline')" />
<el-table-column prop="purchaseTime" label="购买时间" :show-overflow-tooltip="true" v-if="columns.showColumn('purchaseTime')" />
<el-table-column prop="supplier" label="设备厂商" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('supplier')" />
<el-table-column prop="status" label="设备状态" align="center" v-if="columns.showColumn('status')">
<template #default="scope">
<dict-tag :options="options.statusOptions" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="deviceImage" label="设备图片" align="center" v-if="columns.showColumn('deviceImage')">
<template #default="scope">
<ImagePreview :src="scope.row.deviceImage"></ImagePreview>
</template>
</el-table-column>
<el-table-column prop="deviceFile" label="设备文件" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceFile')" />
<el-table-column
prop="deviceSpecification"
label="设备规格"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deviceSpecification')" />
<el-table-column
prop="responsiblePerson"
label="设备负责人"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('responsiblePerson')" />
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('remark')" />
<el-table-column prop="createdBy" label="创建人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('createdBy')" />
<el-table-column prop="createdTime" label="创建时间" :show-overflow-tooltip="true" v-if="columns.showColumn('createdTime')" />
<el-table-column prop="updatedBy" label="更新人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedBy')" />
<el-table-column prop="updatedTime" label="更新时间" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedTime')" />
</el-table>
<pagination :total="total2" v-model:page="queryParams2.pageNum" v-model:limit="queryParams2.pageSize" @pagination="getList_nobind" />
<template #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>
</div>
</template>
<script>
import {
listDeviceAccount_point,
AddRelation_point_account,
delDeviceAccount_relation_point_account
} from '@/api/deviceManagement/deviceaccount.js'
export default {
name: 'devicelistPoint',
props: {
message: {
type: String
}
},
data() {
return {
ids: [],
loading: false,
showSearch: true,
showSearch2: true,
queryParams: {
fkRouteInspectionPlanId: '',
pageNum: 1,
pageSize: 10,
sort: 'Id',
sortType: 'asc'
},
status: -1,
queryParams2: {
fkRouteInspectionPlanId: '',
deviceName: '',
deviceSpecification: '',
status: -1,
pageNum: 1,
pageSize: 10,
sort: 'Id',
sortType: 'asc'
},
columns: [
{ visible: true, prop: 'id', label: '设备台账id' },
{ visible: true, prop: 'fkDeviceType', label: '设备类型' },
{ visible: true, prop: 'deviceName', label: '设备名称' },
{ visible: true, prop: 'deviceCode', label: '设备编号(二维码)' },
{ visible: true, prop: 'workshop', label: '所属车间' },
{ visible: true, prop: 'workline', label: '所属产线' },
{ visible: true, prop: 'purchaseTime', label: '购买时间' },
{ visible: true, prop: 'supplier', label: '设备厂商' },
{ visible: false, prop: 'status', label: '设备状态' },
{ visible: false, prop: 'deviceImage', label: '设备图片' },
{ visible: false, prop: 'deviceFile', label: '设备文件' },
{ visible: false, prop: 'deviceSpecification', label: '设备规格' },
{ visible: false, prop: 'responsiblePerson', label: '设备负责人' },
{ visible: false, prop: 'remark', label: '备注' },
{ visible: false, prop: 'createdBy', label: '创建人' },
{ visible: false, prop: 'createdTime', label: '创建时间' },
{ visible: false, prop: 'updatedBy', label: '更新人' },
{ visible: false, prop: 'updatedTime', label: '更新时间' }
],
total: 0,
total2: 0,
dataList: [],
dataList_NO_bind: [],
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)],
dictParams: [],
title: '',
opertype: 0,
open: false,
multipleSelection: [],
// state 对象的属性展开到 data 中
single: true,
multiple: true,
form: {},
rules: {},
options: {
// 设备类型 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
fkDeviceTypeOptions: [],
// 设备状态 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
statusOptions: [
{ dictLabel: '启用', dictValue: 1, listClass: 'success' },
{ dictLabel: '停用', dictValue: 0, listClass: 'info' }
]
}
}
},
watch: {
message: {
handler() {
this.handleQuery()
},
immediate: true
}
},
methods: {
getList() {
this.loading = true
this.queryParams.FkPointInspectionPlanId = this.message
this.queryParams.flag = 1
listDeviceAccount_point(this.queryParams).then((res) => {
const { code, data } = res
if (code == 200) {
this.dataList = data.result
this.total = data.totalNum
this.loading = false
}
})
},
getList_nobind() {
this.loading = true
this.queryParams2.FkPointInspectionPlanId = this.message
this.queryParams2.flag = 0
listDeviceAccount_point(this.queryParams2).then((res) => {
const { code, data } = res
if (code == 200) {
this.dataList_NO_bind = data.result
this.total2 = data.totalNum
this.loading = false
}
})
},
// 查询2
handleQuery2() {
this.queryParams2.pageNum = 1
this.getList_nobind()
},
// 查询
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
// 重置查询操作
resetQuery() {
this.$refs.queryRef && this.$refs.queryRef.resetFields()
this.handleQuery()
},
resetQuery2() {
this.$refs.queryRef2 && this.$refs.queryRef2.resetFields()
this.handleQuery2()
},
// 自定义排序
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
},
// 添加按钮操作
handleAdd() {
this.open = true
this.title = '添加设备台账'
this.opertype = 1
this.loading = false
this.getList_nobind()
},
// 绑定
handleBind() {
let query = {}
query.FkPointInspectionPlanId = this.message
query.FkDeviceAccountIdList = this.multipleSelection
AddRelation_point_account(query).then((res) => {
if (res.code == 200) {
this.$modal.msgSuccess('添加成功' + res.data + '条')
this.getList_nobind()
}
})
},
// 表单提交
submitForm() {
if (this.multipleSelection.length > 0) {
this.handleBind()
}
// 刷新数据
this.getList()
this.open = false
},
// 删除按钮操作
handleDelete(row) {
const Ids = row.id || this.ids
this.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?')
.then(() => {
const query = {
FkPointInspectionPlanId: this.message,
FkDeviceAccountId: row.id
}
return delDeviceAccount_relation_point_account(query)
})
.then((res) => {
if (res.code == 200 && res.data > 0) {
this.getList()
this.$modal.msgSuccess('删除成功')
}
})
},
// 表格多选
handleSelectionChange(rows) {
this.multipleSelection = rows.map((it) => it.id)
}
}
}
</script>

View File

@@ -0,0 +1,392 @@
<template>
<div>
<!-- 工具区域 -->
<el-row :gutter="15" class="mb10">
<el-col :span="1.5">
<el-button type="primary" plain 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="id" label="设备台账id" align="center" v-if="columns.showColumn('id')" />
<el-table-column prop="fkDeviceType" label="设备类型" align="center" v-if="columns.showColumn('fkDeviceType')">
<template #default="scope">
<dict-tag :options="options.fkDeviceTypeOptions" :value="scope.row.fkDeviceType" />
</template>
</el-table-column>
<el-table-column prop="deviceName" label="设备名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceName')" />
<el-table-column prop="workshop" label="所属车间" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workshop')" />
<el-table-column prop="workline" label="所属产线" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workline')" />
<el-table-column prop="purchaseTime" label="购买时间" :show-overflow-tooltip="true" v-if="columns.showColumn('purchaseTime')" />
<el-table-column prop="supplier" label="设备厂商" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('supplier')" />
<el-table-column prop="status" label="设备状态" align="center" v-if="columns.showColumn('status')">
<template #default="scope">
<dict-tag :options="options.statusOptions" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="deviceImage" label="设备图片" align="center" v-if="columns.showColumn('deviceImage')">
<template #default="scope">
<ImagePreview :src="scope.row.deviceImage"></ImagePreview>
</template>
</el-table-column>
<el-table-column prop="deviceFile" label="设备文件" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceFile')" />
<el-table-column
prop="deviceSpecification"
label="设备规格"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deviceSpecification')" />
<el-table-column
prop="responsiblePerson"
label="设备负责人"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('responsiblePerson')" />
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('remark')" />
<el-table-column prop="createdBy" label="创建人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('createdBy')" />
<el-table-column prop="createdTime" label="创建时间" :show-overflow-tooltip="true" v-if="columns.showColumn('createdTime')" />
<el-table-column prop="updatedBy" label="更新人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedBy')" />
<el-table-column prop="updatedTime" label="更新时间" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedTime')" />
<el-table-column label="操作">
<template #default="scope">
<el-button type="danger" size="small" icon="delete" title="删除" @click="handleDelete(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
<!-- 选择设备台账 -->
<el-dialog title="选择设备台账" :lock-scroll="false" v-model="open" width="900">
<el-form :model="queryParams2" label-position="right" inline ref="queryRef2" v-show="showSearch2" @submit.prevent>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model.trim="queryParams2.deviceName" placeholder="请输入设备名称" clearable />
</el-form-item>
<el-form-item label="设备规格" prop="deviceSpecification">
<el-input v-model.trim="queryParams2.deviceSpecification" placeholder="请输入设备规格" clearable />
</el-form-item>
<el-form-item label="设备状态" prop="status">
<el-radio-group v-model="queryParams2.status" @click="handleQuery2">
<el-radio-button :value="-1">全部</el-radio-button>
<el-radio-button :value="1">启用</el-radio-button>
<el-radio-button :value="0">停用</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button icon="search" type="primary" @click="handleQuery2">{{ $t('btn.search') }}</el-button>
<el-button icon="refresh" @click="resetQuery2">{{ $t('btn.reset') }}</el-button>
</el-form-item>
</el-form>
<!-- 工具区域 -->
<el-row :gutter="15" class="mb10">
<el-col :span="1.5">
<el-button type="success" plain icon="plus" @click="handleBind">
{{ $t('btn.add') }}
</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch2" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table
:data="dataList_NO_bind"
v-loading="loading"
ref="table"
border
header-cell-class-name="el-table-header-cell"
highlight-current-row
@sort-change="sortChange"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column prop="id" label="设备台账id" align="center" v-if="columns.showColumn('id')" />
<el-table-column prop="deviceName" label="设备名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceName')" />
<el-table-column
prop="deviceCode"
label="设备编号(二维码)"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deviceCode')" />
<el-table-column prop="workshop" label="所属车间" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workshop')" />
<el-table-column prop="workline" label="所属产线" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workline')" />
<el-table-column prop="purchaseTime" label="购买时间" :show-overflow-tooltip="true" v-if="columns.showColumn('purchaseTime')" />
<el-table-column prop="supplier" label="设备厂商" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('supplier')" />
<el-table-column prop="status" label="设备状态" align="center" v-if="columns.showColumn('status')">
<template #default="scope">
<dict-tag :options="options.statusOptions" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="deviceImage" label="设备图片" align="center" v-if="columns.showColumn('deviceImage')">
<template #default="scope">
<ImagePreview :src="scope.row.deviceImage"></ImagePreview>
</template>
</el-table-column>
<el-table-column prop="deviceFile" label="设备文件" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deviceFile')" />
<el-table-column
prop="deviceSpecification"
label="设备规格"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deviceSpecification')" />
<el-table-column
prop="responsiblePerson"
label="设备负责人"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('responsiblePerson')" />
<el-table-column prop="fkDeviceType" label="设备类型" align="center" v-if="columns.showColumn('fkDeviceType')">
<template #default="scope">
<dict-tag :options="options.fkDeviceTypeOptions" :value="scope.row.fkDeviceType" />
</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="createdBy" label="创建人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('createdBy')" />
<el-table-column prop="createdTime" label="创建时间" :show-overflow-tooltip="true" v-if="columns.showColumn('createdTime')" />
<el-table-column prop="updatedBy" label="更新人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedBy')" />
<el-table-column prop="updatedTime" label="更新时间" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedTime')" />
</el-table>
<pagination :total="total2" v-model:page="queryParams2.pageNum" v-model:limit="queryParams2.pageSize" @pagination="getList_nobind" />
<template #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>
</div>
</template>
<script>
import {
listDeviceAccount,
listDeviceAccount_route,
addDeviceAccount,
updateDeviceAccount,
getDeviceAccount,
AddRelation,
delDeviceAccount_relation
} from '@/api/deviceManagement/deviceaccount.js'
export default {
name: 'devicelistRoute',
props: {
message: {
type: String
}
},
data() {
return {
ids: [],
loading: false,
showSearch: true,
showSearch2: true,
queryParams: {
fkRouteInspectionPlanId: '',
pageNum: 1,
pageSize: 10,
sort: 'Id',
sortType: 'asc'
},
status: -1,
queryParams2: {
fkRouteInspectionPlanId: '',
deviceName: '',
deviceSpecification: '',
status: -1,
pageNum: 1,
pageSize: 10,
sort: 'Id',
sortType: 'asc'
},
columns: [
{ visible: true, prop: 'id', label: '设备台账id' },
{ visible: true, prop: 'fkDeviceType', label: '设备类型' },
{ visible: true, prop: 'deviceName', label: '设备名称' },
{ visible: true, prop: 'deviceCode', label: '设备编号(二维码)' },
{ visible: true, prop: 'workshop', label: '所属车间' },
{ visible: true, prop: 'workline', label: '所属产线' },
{ visible: true, prop: 'purchaseTime', label: '购买时间' },
{ visible: true, prop: 'supplier', label: '设备厂商' },
{ visible: false, prop: 'status', label: '设备状态' },
{ visible: false, prop: 'deviceImage', label: '设备图片' },
{ visible: false, prop: 'deviceFile', label: '设备文件' },
{ visible: false, prop: 'deviceSpecification', label: '设备规格' },
{ visible: false, prop: 'responsiblePerson', label: '设备负责人' },
{ visible: false, prop: 'remark', label: '备注' },
{ visible: false, prop: 'createdBy', label: '创建人' },
{ visible: false, prop: 'createdTime', label: '创建时间' },
{ visible: false, prop: 'updatedBy', label: '更新人' },
{ visible: false, prop: 'updatedTime', label: '更新时间' }
],
total: 0,
total2: 0,
dataList: [],
dataList_NO_bind: [],
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)],
dictParams: [],
title: '',
opertype: 0,
open: false,
multipleSelection: [],
// state 对象的属性展开到 data 中
single: true,
multiple: true,
form: {},
rules: {},
options: {
// 设备类型 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
fkDeviceTypeOptions: [],
// 设备状态 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
statusOptions: [
{ dictLabel: '启用', dictValue: 1, listClass: 'success' },
{ dictLabel: '停用', dictValue: 0, listClass: 'info' }
]
}
}
},
watch: {
message: {
handler() {
this.handleQuery()
},
immediate: true
}
},
methods: {
getList() {
this.loading = true
this.queryParams.fkRouteInspectionPlanId = this.message
this.queryParams.flag = 1
listDeviceAccount_route(this.queryParams).then((res) => {
const { code, data } = res
if (code == 200) {
this.dataList = data.result
this.total = data.totalNum
this.loading = false
}
})
},
getList_nobind() {
this.loading = true
this.queryParams2.fkRouteInspectionPlanId = this.message
this.queryParams2.flag = 0
listDeviceAccount_route(this.queryParams2).then((res) => {
const { code, data } = res
if (code == 200) {
this.dataList_NO_bind = data.result
this.total2 = data.totalNum
this.loading = false
}
})
},
// 查询2
handleQuery2() {
this.queryParams2.pageNum = 1
this.getList_nobind()
},
// 查询
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
// 重置查询操作
resetQuery() {
this.$refs.queryRef && this.$refs.queryRef.resetFields()
this.handleQuery()
},
resetQuery2() {
this.$refs.queryRef2 && this.$refs.queryRef2.resetFields()
this.handleQuery2()
},
// 自定义排序
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
},
// 添加按钮操作
handleAdd() {
this.open = true
this.title = '添加设备台账'
this.opertype = 1
this.loading = false
this.getList_nobind()
},
// 绑定
handleBind() {
let query = {}
query.FkRouteInspectionPlanId = this.message
query.FkDeviceAccountIdList = this.multipleSelection
AddRelation(query).then((res) => {
if (res.code == 200) {
this.$modal.msgSuccess('添加成功' + res.data + '条')
this.getList_nobind()
}
})
},
// 表单提交
submitForm() {
if (this.multipleSelection.length > 0) {
this.handleBind()
}
// 刷新数据
this.getList()
this.open = false
},
// 删除按钮操作
handleDelete(row) {
const Ids = row.id || this.ids
this.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?')
.then(() => {
const query = {
FkRouteInspectionPlanId: this.message,
FkDeviceAccountId: row.id
}
return delDeviceAccount_relation(query)
})
.then((res) => {
if (res.code == 200 && res.data > 0) {
this.getList()
this.$modal.msgSuccess('删除成功')
}
})
},
// 表格多选
handleSelectionChange(rows) {
this.multipleSelection = rows.map((it) => it.id)
console.log('multipleSelection', this.multipleSelection)
}
}
}
</script>