pcs开关机,设备列表上传、下载

This commit is contained in:
白菜
2025-12-11 17:59:34 +08:00
parent ac54ce999e
commit 9b14d96e24
5 changed files with 267 additions and 116 deletions

View File

@ -8,13 +8,23 @@
:key="index+'zdxeSelect'"></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备类型">
<el-select v-model="deviceCategory" placeholder="请选择设备类型" @change="onSearch" clearable>
<el-option
v-for="(item,index) in deviceCategoryList"
:key="index+'deviceCategorySelect'"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<!-- <el-button type="primary" @click="onSearch" native-type="button">搜索</el-button>-->
<!-- <el-button @click="onReset" native-type="button">重置</el-button>-->
</el-form-item>
</el-form>
<el-button type="primary" @click="addDevice" native-type="button">新增设备</el-button>
<el-dropdown @command="downloadPointDetail">
<el-dropdown @command="(val)=>downloadPointDetail(val,false)">
<el-button
style="margin-left:10px;"
type="primary"
@ -28,7 +38,7 @@
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown @command="uploadPointDetail">
<el-dropdown @command="(val)=>uploadPointDetail(val,false)">
<el-button
style="margin-left:10px;"
type="success"
@ -42,8 +52,6 @@
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-table
class="common-table"
:data="tableData"
@ -76,6 +84,9 @@
label="在线状态">
<template slot-scope="scope">
<span>{{ $store.state.ems.deviceStatusOptions[scope.row.runningStatus] }}</span>
<pcs-switch v-if="scope.row.deviceCategory === 'PCS'" style="margin-left:5px;"
:data="{runningStatus:scope.row.runningStatus,deviceId:scope.row.deviceId,deviceName:scope.row.deviceName}"
@updateSuccess="getData"/>
</template>
</el-table-column>
<el-table-column
@ -96,6 +107,23 @@
报警点位清单
</el-button>
<br>
<el-button
@click="downloadPointDetail(scope.row,true)"
style="margin-top:10px;"
type="primary"
plain
size="mini">
下载点位清单
</el-button>
<el-button
@click="uploadPointDetail(scope.row,true)"
style="margin-top:10px;"
type="success"
plain
size="mini">
上传点位清单
</el-button>
<br>
<el-button
@click="editDevice(scope.row)"
style="margin-top:10px;"
@ -151,10 +179,11 @@ import {getAllDeviceCategory} from '@/api/ems/search'
import PointTable from './PointTable.vue'
import AddDevice from "./AddDevice.vue";
import PointUpload from "./PointUpload.vue";
import PcsSwitch from "./PcsSwitch.vue";
export default {
name: "Sblb",
components: {AddDevice, PointTable, PointUpload},
components: {AddDevice, PointTable, PointUpload, PcsSwitch},
data() {
return {
loading: false,
@ -163,8 +192,9 @@ export default {
editDeviceId: '',//编辑设备id
siteId: '',
siteList: [],
tableData: [],
deviceCategory: '',//搜索栏设备类型
deviceCategoryList: [],//设备类别
tableData: [],
pageSize: 10,//分页栏当前每个数据总数
pageNum: 1,//分页栏当前页数
totalSize: 0,//table表格数据总数
@ -204,15 +234,26 @@ export default {
this.$refs.pointTable.showTable(row, dataType)
},
// 下载点位清单
downloadPointDetail(command) {
downloadPointDetail(command, isDetail = false) {
const siteId = isDetail ? command.siteId : this.siteId
const deviceCategory = isDetail ? command.deviceCategory : command.code
const categoryName = isDetail ? command.categoryName : command.name
const deviceId = isDetail ? command.deviceId : null
console.log('下载', command, isDetail)
this.download('ems/pointMatch/export', {
siteId: this.siteId,
deviceCategory: command.code
}, `点位清单_${command.name}_${new Date().getTime()}.xlsx`)
siteId,
deviceCategory,
deviceId,
}, `点位清单_${categoryName}_${new Date().getTime()}.xlsx`)
},
// 上传点位清单
uploadPointDetail(command) {
this.$refs.pointUpload.showDialog({...command, siteId: this.siteId})
uploadPointDetail(command, isDetail = false) {
const siteId = isDetail ? command.siteId : this.siteId
const deviceCategory = isDetail ? command.deviceCategory : command.code
const categoryName = isDetail ? command.categoryName : command.name
const deviceId = isDetail ? command.deviceId : ''
console.log('上传', command, isDetail)
this.$refs.pointUpload.showDialog({siteId, deviceCategory, categoryName, deviceId})
},
clearEditDeviceData() {
this.mode = '';
@ -312,8 +353,8 @@ export default {
// 获取数据
getData() {
this.loading = true
const {siteId, pageNum, pageSize} = this
getDeviceInfoList({siteId, pageNum, pageSize}).then(response => {
const {siteId, deviceCategory, pageNum, pageSize} = this
getDeviceInfoList({siteId, deviceCategory, pageNum, pageSize}).then(response => {
this.tableData = response?.rows || [];
this.totalSize = response?.total || 0
}).finally(() => {